Skip to content

Commit

Permalink
Check appliance field using is_valid_ref
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
johnelse committed Mar 23, 2011
1 parent ba4c424 commit 63c0ef4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ocaml/xapi/message_forwarding.ml
Expand Up @@ -1806,7 +1806,7 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
(* If a VM is part of an appliance, the appliance *)
(* should be recovered using VM_appliance.recover *)
let appliance = Db.VM.get_appliance ~__context ~self in
if appliance <> Ref.null then
if Db.is_valid_ref __context appliance then
raise (Api_errors.Server_error(Api_errors.vm_is_part_of_an_appliance,
[Ref.string_of self; Ref.string_of appliance]));
Local.VM.recover ~__context ~self ~session_to ~force
Expand Down

0 comments on commit 63c0ef4

Please sign in to comment.