Skip to content

Commit be8f4c0

Browse files
sharadyrobhoes
authored andcommitted
CA-236351: Update assert_can_see_SRs for null ref suspend VDI.
Skip the call for get_SR for null ref suspend_VDI. For resuming VM with missing suspend VDI will be handled in `xapi_xenops.resume`, performing VM force shutdown. Signed-off-by: Sharad Yadav <[email protected]>
1 parent c715804 commit be8f4c0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ocaml/xapi/xapi_vm_helpers.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,12 @@ let assert_can_see_SRs ~__context ~self ~host =
298298
let vdis = List.map (fun self -> Db.VBD.get_VDI ~__context ~self) vbds in
299299
(* If VM is currently suspended then consider the suspend_VDI. Note both power_state and the suspend VDI
300300
are stored in R/O fields, not the last_boot_record *)
301-
let suspend_vdi = if Db.VM.get_power_state ~__context ~self =`Suspended then [ Db.VM.get_suspend_VDI ~__context ~self ] else [] in
301+
let suspend_vdi =
302+
if Db.VM.get_power_state ~__context ~self = `Suspended then
303+
let vdi = Db.VM.get_suspend_VDI ~__context ~self in
304+
if vdi = Ref.null then [] else [vdi]
305+
else []
306+
in
302307
let reqd_srs = List.map (fun self -> Db.VDI.get_SR ~__context ~self) (vdis @ suspend_vdi) in
303308
let not_available = which_specified_SRs_not_available_on_host ~__context ~reqd_srs ~host in
304309
if not_available <> []

0 commit comments

Comments
 (0)