Skip to content
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

Yangtze Backports #5177

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
19 changes: 19 additions & 0 deletions ocaml/xapi/xapi_vlan.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ open D
let vlan_mac = "fe:ff:ff:ff:ff:ff"

let pool_introduce ~__context ~tagged_PIF ~untagged_PIF ~tag ~other_config =
let __FUNCTION__ = "pool_introduce" in
let vlan = Ref.make () in
let vlan_uuid = Uuid.to_string (Uuid.make_uuid ()) in
let () =
Expand All @@ -27,6 +28,24 @@ let pool_introduce ~__context ~tagged_PIF ~untagged_PIF ~tag ~other_config =
in
(* Untagged PIF going to be VLAN_master_of above VLAN *)
Db.PIF.set_VLAN_master_of ~__context ~self:untagged_PIF ~value:vlan ;
(* Ensure that the untagged PIF shares PIF_metrics of tagged PIF.
* This is useful for the VLANs created in pool.join for management network.
*)
let untagged_pif_metrics = Db.PIF.get_metrics ~__context ~self:untagged_PIF in
let tagged_pif_metrics = Db.PIF.get_metrics ~__context ~self:tagged_PIF in
if untagged_pif_metrics <> tagged_pif_metrics then (
debug
"%s: Set PIF_metrics (%s) of VLAN untagged PIF (%s) to the one (%s) of \
VLAN tagged PIF (%s)"
__FUNCTION__
(Ref.string_of untagged_pif_metrics)
(Ref.string_of untagged_PIF)
(Ref.string_of tagged_pif_metrics)
(Ref.string_of tagged_PIF) ;
Db.PIF.set_metrics ~__context ~self:untagged_PIF ~value:tagged_pif_metrics ;
if untagged_pif_metrics <> Ref.null then
Db.PIF_metrics.destroy ~__context ~self:untagged_pif_metrics
) ;
vlan

let create_internal ~__context ~host ~tagged_PIF ~tag ~network ~device =
Expand Down
31 changes: 20 additions & 11 deletions ocaml/xapi/xapi_vm_migrate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,27 @@ let infer_vgpu_map ~__context ?remote vm =
try Db.VM.get_VGPUs ~__context ~self:vm |> List.map f |> List.concat
with e -> raise (VGPU_mapping (Printexc.to_string e))
)
| Some {rpc; session} -> (
| Some {rpc; session; _} -> (
let session_id = session in
let f vgpu =
let vgpu = XenAPI.VGPU.get_record rpc session vgpu in
(* avoid using get_record, allows to cross-pool migration to versions
that may have removed fields in the vgpu record *)
let pci = XenAPI.VGPU.get_PCI ~rpc ~session_id ~self:vgpu in
let pf () =
vgpu.API.vGPU_scheduled_to_be_resident_on |> fun self ->
XenAPI.VGPU.get_scheduled_to_be_resident_on ~rpc ~session_id
~self:vgpu
|> fun self ->
XenAPI.PGPU.get_PCI rpc session self |> fun self ->
XenAPI.PCI.get_pci_id rpc session self
|> Xenops_interface.Pci.address_of_string
in
let vf () =
vgpu.API.vGPU_PCI |> fun self ->
XenAPI.PCI.get_pci_id rpc session self
XenAPI.PCI.get_pci_id ~rpc ~session_id ~self:pci
|> Xenops_interface.Pci.address_of_string
in
let pf_device = vgpu.API.vGPU_device in
let pf_device = XenAPI.VGPU.get_device ~rpc ~session_id ~self:vgpu in
let vf_device = vf_device_of pf_device in
if vgpu.API.vGPU_PCI <> API.Ref.null then
if pci <> API.Ref.null then
[(pf_device, pf ()); (vf_device, vf ())]
else
[(pf_device, pf ())]
Expand Down Expand Up @@ -1377,17 +1381,22 @@ let migrate_send' ~__context ~vm ~dest ~live ~vdi_map ~vif_map ~vgpu_map
in
List.map
(fun vif ->
let vifr =
XenAPI.VIF.get_record ~rpc:remote.rpc ~session_id:remote.session
(* Avoid using get_record to allow judicious field removals in the future *)
let network =
XenAPI.VIF.get_network ~rpc:remote.rpc ~session_id:remote.session
~self:vif
in
let device =
XenAPI.VIF.get_device ~rpc:remote.rpc ~session_id:remote.session
~self:vif
in
let bridge =
Xenops_interface.Network.Local
(XenAPI.Network.get_bridge ~rpc:remote.rpc
~session_id:remote.session ~self:vifr.API.vIF_network
~session_id:remote.session ~self:network
)
in
(vifr.API.vIF_device, bridge)
(device, bridge)
)
vifs
in
Expand Down