From a522e2bcbd09c5ab443e0a0ee93767b451075b79 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Thu, 6 Feb 2014 16:39:26 +0100 Subject: [PATCH] Fix force for VM stop/restart. --- src/api/vm.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/vm.coffee b/src/api/vm.coffee index cb70dcb10..252203462 100644 --- a/src/api/vm.coffee +++ b/src/api/vm.coffee @@ -383,7 +383,9 @@ exports.restart = -> # Attempts a clean reboot. xapi.call 'VM.clean_reboot', VM.ref catch error - throw error unless error[0] is 'VM_MISSING_PV_DRIVERS' + return unless error[0] is 'VM_MISSING_PV_DRIVERS' + + @throw 'INVALID_PARAMS' unless force xapi.call 'VM.hard_reboot', VM.ref @@ -430,7 +432,9 @@ exports.stop = -> # Attempts a clean shutdown. xapi.call 'VM.clean_shutdown', VM.ref catch error - throw error unless error[0] is 'VM_MISSING_PV_DRIVERS' + return unless error[0] is 'VM_MISSING_PV_DRIVERS' + + @throw 'INVALID_PARAMS' unless force xapi.call 'VM.hard_shutdown', VM.ref