diff --git a/node-daemon/pvcnoded/VMInstance.py b/node-daemon/pvcnoded/VMInstance.py index 2d93442f..e00f967e 100644 --- a/node-daemon/pvcnoded/VMInstance.py +++ b/node-daemon/pvcnoded/VMInstance.py @@ -531,8 +531,20 @@ class VMInstance(object): self.zkhandler.write([ (('domain.state', self.domuuid), 'shutdown') ]) + + ticks = 0 while self.zkhandler.read(('domain.state', self.domuuid)) != 'stop': + ticks += 1 + if ticks > self.config['vm_shutdown_timeout'] * 2: + # We've hit the timeout, forcibly stop the VM and continue + self.zkhandler.write([ + (('domain.state', self.domuuid), 'stop') + ]) + # Wait 1/2 of a second for the state propagation + time.sleep(0.5) + break time.sleep(0.5) + return True do_migrate_shutdown = False