From 3851069b7a3d5111e832642003946e470a8e4eca Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 10 Jun 2018 21:04:00 -0400 Subject: [PATCH] Fix handling of failed-start --- VMInstance.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/VMInstance.py b/VMInstance.py index cb366545..e43239a9 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -82,17 +82,17 @@ class VMInstance: try: dom = conn.createXML(xmlconfig, 0) + if not self.domuuid in self.thishypervisor.domain_list: + self.thishypervisor.domain_list.append(self.domuuid) + + ansiiprint.echo('Successfully started VM', '{}:'.format(self.domuuid), 'o') + self.dom = dom except libvirt.libvirtError as e: ansiiprint.echo('Failed to create VM', '{}:'.format(self.domuuid), 'e') self.zk.set('/domains/{}/state'.format(self.domuuid), 'stop'.encode('ascii')) - return - - if not self.domuuid in self.thishypervisor.domain_list: - self.thishypervisor.domain_list.append(self.domuuid) + self.dom = None conn.close() - ansiiprint.echo('Successfully started VM', '{}:'.format(self.domuuid), 'o') - self.dom = dom self.instart = False # Stop the VM forcibly without updating state