Skip to content

Commit 2d0b039

Browse files
committed
Check appliance field using is_valid_ref
A VM should not be allowed to be recovered using VM.recover if it is part of an appliance. Previously, this was checked by looking for Ref.null in the VM.appliance field, however the appliance field is now checked using Db.is_valid_ref. Signed-off-by: John Else <john.else@citrix.com>
1 parent 0ccfb5c commit 2d0b039

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ocaml/xapi/message_forwarding.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
17781778
(* If a VM is part of an appliance, the appliance *)
17791779
(* should be recovered using VM_appliance.recover *)
17801780
let appliance = Db.VM.get_appliance ~__context ~self in
1781-
if appliance <> Ref.null then
1781+
if Db.is_valid_ref __context appliance then
17821782
raise (Api_errors.Server_error(Api_errors.vm_is_part_of_an_appliance,
17831783
[Ref.string_of self; Ref.string_of appliance]));
17841784
Local.VM.recover ~__context ~self ~session_to ~force

0 commit comments

Comments
 (0)