Skip to content

CA-396743: Don't allow NBD on boot from SAN devices, and fix Network.managed to reflect PIF.managed #5917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ocaml/xapi/xapi_pif.ml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ let assert_fcoe_not_in_use ~__context ~self =
()
)

let find_or_create_network (bridge : string) (device : string) ~__context =
let find_or_create_network (bridge : string) (device : string) ~managed
~__context =
let nets =
Db.Network.get_refs_where ~__context
~expr:(Eq (Field "bridge", Literal bridge))
Expand All @@ -362,7 +363,7 @@ let find_or_create_network (bridge : string) (device : string) ~__context =
Db.Network.create ~__context ~ref:net_ref ~uuid:net_uuid
~current_operations:[] ~allowed_operations:[]
~name_label:(Helpers.choose_network_name_for_pif device)
~name_description:"" ~mTU:1500L ~purpose:[] ~bridge ~managed:true
~name_description:"" ~mTU:1500L ~purpose:[] ~bridge ~managed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the managed field in network object a duplication of the field managed of PIF objects?
In other words, if a PIF is managed, its connected network must be managed?

Copy link
Contributor

@Vincent-lau Vincent-lau Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe they are separate, one is for the network bridge which connects things together, while the other one is for configuring the interface (bring the interface up/down, etc). Although it seems that in this case the created pif has the same managed field as the network

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we only ever introduce a managed network, even if we create an unmanaged PIF, is this ok?

~other_config:[] ~blobs:[] ~tags:[] ~default_locking_mode:`unlocked
~assigned_ips:[]
in
Expand Down Expand Up @@ -463,7 +464,7 @@ let introduce_internal ?network ?(physical = true) ~t:_ ~__context ~host ~mAC
let net_ref =
match network with
| None ->
find_or_create_network bridge device ~__context
find_or_create_network bridge device ~managed ~__context
| Some x ->
x
in
Expand Down
6 changes: 0 additions & 6 deletions ocaml/xapi/xapi_pif.mli
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ val assert_usable_for_management :
-> unit
(** Ensure the PIF can be used for management. *)

val find_or_create_network :
string -> string -> __context:Context.t -> [`network] Ref.t
(** If a network for the given bridge already exists, then return a reference to this network,
* otherwise create a new network and return its reference.
*)

(** Convenient lookup tables for scanning etc *)
type tables

Expand Down