Merge "Make sure domain exists before referencing it" into stable/icehouse

This commit is contained in:
Jenkins 2014-07-14 19:15:09 +00:00 committed by Gerrit Code Review
commit 678b00e028
1 changed files with 5 additions and 2 deletions

View File

@ -3647,6 +3647,7 @@ class LibvirtDriver(driver.ComputeDriver):
events = []
launch_flags = events and libvirt.VIR_DOMAIN_START_PAUSED or 0
domain = None
try:
with self.virtapi.wait_for_instance_event(
instance, events, deadline=timeout,
@ -3666,7 +3667,8 @@ class LibvirtDriver(driver.ComputeDriver):
except exception.NovaException:
# Neutron reported failure and we didn't swallow it, so
# bail here
domain.destroy()
if domain:
domain.destroy()
self.cleanup(context, instance, network_info=network_info,
block_device_info=block_device_info)
raise exception.VirtualInterfaceCreateException()
@ -3675,7 +3677,8 @@ class LibvirtDriver(driver.ComputeDriver):
LOG.warn(_('Timeout waiting for vif plugging callback for '
'instance %(uuid)s'), {'uuid': instance['uuid']})
if CONF.vif_plugging_is_fatal:
domain.destroy()
if domain:
domain.destroy()
self.cleanup(context, instance, network_info=network_info,
block_device_info=block_device_info)
raise exception.VirtualInterfaceCreateException()