-
Notifications
You must be signed in to change notification settings - Fork 283
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
CA-396743: Don't allow NBD on boot from SAN devices, and fix Network.managed to reflect PIF.managed #5917
Merged
Merged
CA-396743: Don't allow NBD on boot from SAN devices, and fix Network.managed to reflect PIF.managed #5917
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5446171
CA-396743: log non managed devices in PIF.scan
edwintorok 5acf001
CA-396743: make Network.managed reflect PIF.managed
edwintorok 2c7bc39
CA-396743: forbid setting NBD purpose on unmanaged networks
edwintorok 1adffbd
CA-396743: fix bridge name for unmanaged devices
edwintorok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)) | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -457,13 +458,13 @@ let db_forget ~__context ~self = Db.PIF.destroy ~__context ~self | |
let introduce_internal ?network ?(physical = true) ~t:_ ~__context ~host ~mAC | ||
~mTU ~device ~vLAN ~vLAN_master_of ?metrics ~managed | ||
?(disallow_unplug = false) () = | ||
let bridge = bridge_naming_convention device in | ||
let bridge = if managed then bridge_naming_convention device else "" in | ||
(* If we are not told which network to use, | ||
* apply the default convention *) | ||
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 | ||
|
@@ -667,6 +668,8 @@ let scan ~__context ~host = | |
([], []) | ||
) | ||
in | ||
debug "non-managed devices=%s" (String.concat "," non_managed_devices) ; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should new log lines contain |
||
debug "disallow-unplug devices=%s" (String.concat "," disallow_unplug_devices) ; | ||
Xapi_stdext_threads.Threadext.Mutex.execute scan_m (fun () -> | ||
let t = make_tables ~__context ~host in | ||
let devices_not_yet_represented_by_pifs = | ||
|
@@ -681,6 +684,8 @@ let scan ~__context ~host = | |
let mTU = Int64.of_int (Net.Interface.get_mtu dbg device) in | ||
let managed = not (List.mem device non_managed_devices) in | ||
let disallow_unplug = List.mem device disallow_unplug_devices in | ||
debug "About to introduce %s, managed=%b, disallow-unplug=%b" device | ||
managed disallow_unplug ; | ||
let (_ : API.ref_PIF) = | ||
introduce_internal ~t ~__context ~host ~mAC ~mTU ~vLAN:(-1L) | ||
~vLAN_master_of:Ref.null ~device ~managed ~disallow_unplug () | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
managed
field innetwork
object a duplication of the fieldmanaged
ofPIF
objects?In other words, if a PIF is managed, its connected network must be managed?
There was a problem hiding this comment.
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