Skip to content

Commit 1403a1f

Browse files
committed
SCTX-1473: Unable to start VM by VM_REQUIRES_GPU. Multiple PCI consumed
by a single VM. The GPU code in the start_paused function selects a GPU to be passed through during a VM start. This does not take into account the fact that xapi has already taken care of the PCI devices attached to the VM before reboot. Hence during a VM reboot the VM will get assigned a different PCI device other than the one it was holding prior to the reboot. Signed-off-by: Akshay <[email protected]>
1 parent 3ab10fc commit 1403a1f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ocaml/xapi/vmops.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ let resume ~__context ~xc ~xs ~vm =
949949
Domain.unpause ~xc domid)
950950
951951
(** Starts up a VM, leaving it in the paused state *)
952-
let start_paused ?(progress_cb = fun _ -> ()) ~pcidevs ~__context ~vm ~snapshot =
952+
let start_paused ?(progress_cb = fun _ -> ()) ?(is_reboot = false) ~pcidevs ~__context ~vm ~snapshot =
953953
(* Ensure no old consoles survive *)
954954
destroy_consoles ~__context ~vM:vm;
955955
@@ -1059,7 +1059,7 @@ let start_paused ?(progress_cb = fun _ -> ()) ~pcidevs ~__context ~vm ~snapshot
10591059
let vifs = Vm_config.vifs_of_vm ~__context ~vm domid in
10601060
create_vifs ~__context ~xs vifs;
10611061
progress_cb 0.70;
1062-
let pcis = Vgpuops.create_vgpus ~__context ~vm domid hvm in
1062+
let pcis = if is_reboot then [] else Vgpuops.create_vgpus ~__context ~vm domid hvm in
10631063
(* WORKAROUND FOR CA-55754: temporarily disable msitranslate when GPU is passed through. *)
10641064
(* other-config:msitranslate can be used the override the default *)
10651065
let msitranslate =

ocaml/xapi/xapi_vm.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ let start ~__context ~vm ~start_paused:paused ~force =
231231

232232
debug "start: bringing up domain in the paused state";
233233
Vmops.start_paused
234-
~progress_cb:(TaskHelper.set_progress ~__context) ~pcidevs:None ~__context ~vm ~snapshot;
234+
~progress_cb:(TaskHelper.set_progress ~__context) ~is_reboot:false ~pcidevs:None ~__context ~vm ~snapshot;
235235
delete_guest_metrics ~__context ~self:vm;
236236

237237
let localhost = Helpers.get_localhost ~__context in
@@ -427,7 +427,7 @@ module Reboot = struct
427427
begin
428428
try
429429
Vmops.start_paused
430-
~progress_cb:(fun x -> TaskHelper.set_progress ~__context (0.50 +. x /. 2.))
430+
~progress_cb:(fun x -> TaskHelper.set_progress ~__context (0.50 +. x /. 2.)) ~is_reboot:true
431431
~pcidevs:(Some pcidevs)
432432
~__context ~vm ~snapshot:new_snapshot;
433433
with e ->

0 commit comments

Comments
 (0)