diff --git a/XenModel/Actions/VM/VMSnapshotRevertAction.cs b/XenModel/Actions/VM/VMSnapshotRevertAction.cs index 51c54ac9c..52b20e4fb 100644 --- a/XenModel/Actions/VM/VMSnapshotRevertAction.cs +++ b/XenModel/Actions/VM/VMSnapshotRevertAction.cs @@ -94,7 +94,7 @@ namespace XenAdmin.Actions { if (vm.power_state == vm_power_state.Halted) { - if (previousHost != null && vm.CanBootOnHost(previousHost)) + if (previousHost != null && VMCanBootOnHost(vm, previousHost)) { RelatedTask = XenAPI.VM.async_start_on(Session, vm.opaque_ref, previousHost.opaque_ref, false, false); @@ -108,7 +108,7 @@ namespace XenAdmin.Actions } else if (vm.power_state == vm_power_state.Suspended) { - if (previousHost != null && vm.CanBootOnHost(previousHost)) + if (previousHost != null && VMCanBootOnHost(vm, previousHost)) { RelatedTask = XenAPI.VM.async_resume_on(Session, vm.opaque_ref, previousHost.opaque_ref, false, false); @@ -123,5 +123,19 @@ namespace XenAdmin.Actions } } } + + private bool VMCanBootOnHost(VM vm, Host host) + { + try + { + VM.assert_can_boot_here(Session, vm.opaque_ref, host.opaque_ref); + } + catch + { + return false; + } + + return true; + } } } \ No newline at end of file diff --git a/XenModel/XenAPI-Extensions/VM.cs b/XenModel/XenAPI-Extensions/VM.cs index 23cf7a4eb..dbe22319a 100644 --- a/XenModel/XenAPI-Extensions/VM.cs +++ b/XenModel/XenAPI-Extensions/VM.cs @@ -2073,20 +2073,6 @@ namespace XenAPI return other_config != null && other_config.ContainsKey("hci-warn-before-shutdown"); } } - - public bool CanBootOnHost(Host host) - { - try - { - assert_can_boot_here(Connection.Session, this.opaque_ref, host.opaque_ref); - } - catch - { - return false; - } - - return true; - } } public struct VMStartupOptions