Skip to content

Commit

Permalink
CA-396743: make Network.managed reflect PIF.managed
Browse files Browse the repository at this point in the history
This will make it easier to filter out these networks in test code.
A PIF is unmanaged when it is a boot from SAN interface for example,
as returned by the 'bfs-interfaces' script.

Certain operations are not valid on such interfaces, e.g. you cannot use them to export NBD devices.

Fixes: 1a9cc76 ("CP-20482: Create network with the specified bridge name")

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Aug 6, 2024
1 parent 5446171 commit 3bbf558
Showing 1 changed file with 4 additions and 3 deletions.
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
~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

0 comments on commit 3bbf558

Please sign in to comment.