summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/virt/baremetal/proxy.py56
1 files changed, 34 insertions, 22 deletions
diff --git a/nova/virt/baremetal/proxy.py b/nova/virt/baremetal/proxy.py
index 383976ec0..4272ef9f1 100644
--- a/nova/virt/baremetal/proxy.py
+++ b/nova/virt/baremetal/proxy.py
@@ -136,10 +136,10 @@ class ProxyConnection(driver.ComputeDriver):
self._conn.destroy_domain(instance['name'])
break
except Exception as ex:
- msg = (_("Error encountered when destroying instance "
- "'%(name)s': %(ex)s") %
- {"name": instance["name"], "ex": ex})
- LOG.debug(msg)
+ LOG.debug(_("Error encountered when destroying instance "
+ "'%(name)s': %(ex)s") %
+ {"name": instance["name"], "ex": ex},
+ instance=instance)
break
if cleanup:
@@ -151,7 +151,7 @@ class ProxyConnection(driver.ComputeDriver):
target = os.path.join(FLAGS.instances_path, instance['name'])
instance_name = instance['name']
LOG.info(_('instance %(instance_name)s: deleting instance files'
- ' %(target)s') % locals())
+ ' %(target)s') % locals(), instance=instance)
if FLAGS.baremetal_type == 'lxc':
disk.destroy_container(self.container)
if os.path.exists(target):
@@ -177,10 +177,11 @@ class ProxyConnection(driver.ComputeDriver):
try:
state = self._conn.reboot_domain(instance['name'])
if state == power_state.RUNNING:
- LOG.debug(_('instance %s: rebooted'), instance['name'])
+ LOG.debug(_('instance %s: rebooted'), instance['name'],
+ instance=instance)
timer.stop()
except Exception:
- LOG.exception(_('_wait_for_reboot failed'))
+ LOG.exception(_('_wait_for_reboot failed'), instance=instance)
timer.stop()
timer.f = _wait_for_reboot
return timer.start(interval=0.5)
@@ -210,10 +211,11 @@ class ProxyConnection(driver.ComputeDriver):
try:
state = self._conn.reboot_domain(instance['name'])
if state == power_state.RUNNING:
- LOG.debug(_('instance %s: rescued'), instance['name'])
+ LOG.debug(_('instance %s: rescued'), instance['name'],
+ instance=instance)
timer.stop()
except Exception:
- LOG.exception(_('_wait_for_rescue failed'))
+ LOG.exception(_('_wait_for_rescue failed'), instance=instance)
timer.stop()
timer.f = _wait_for_reboot
return timer.start(interval=0.5)
@@ -243,26 +245,32 @@ class ProxyConnection(driver.ComputeDriver):
self._create_image(context, instance, xml_dict,
network_info=network_info,
block_device_info=block_device_info)
- LOG.debug(_("instance %s: is building"), instance['name'])
- LOG.debug(xml_dict)
+ LOG.debug(_("instance %s: is building"), instance['name'],
+ instance=instance)
+ LOG.debug(xml_dict, instance=instance)
def _wait_for_boot():
try:
- LOG.debug(_("Key is injected but instance is not running yet"))
+ LOG.debug(_("Key is injected but instance is not running yet"),
+ instance=instance)
db.instance_update(context, instance['id'],
{'vm_state': vm_states.BUILDING})
state = self._conn.create_domain(xml_dict, bpath)
if state == power_state.RUNNING:
- LOG.debug(_('instance %s: booted'), instance['name'])
+ LOG.debug(_('instance %s: booted'), instance['name'],
+ instance=instance)
db.instance_update(context, instance['id'],
{'vm_state': vm_states.ACTIVE})
- LOG.debug(_('~~~~~~ current state = %s ~~~~~~'), state)
+ LOG.debug(_('~~~~~~ current state = %s ~~~~~~'), state,
+ instance=instance)
LOG.debug(_("instance %s spawned successfully"),
- instance['name'])
+ instance['name'], instance=instance)
else:
- LOG.debug(_('instance %s:not booted'), instance['name'])
+ LOG.debug(_('instance %s:not booted'), instance['name'],
+ instance=instance)
except Exception as Exn:
- LOG.debug(_("Bremetal assignment is overcommitted."))
+ LOG.debug(_("Bremetal assignment is overcommitted."),
+ instance=instance)
db.instance_update(context, instance['id'],
{'vm_state': vm_states.OVERCOMMIT,
'power_state': power_state.SUSPENDED})
@@ -342,7 +350,8 @@ class ProxyConnection(driver.ComputeDriver):
libvirt_utils.ensure_tree(basepath(suffix=''))
utils.execute('chmod', '0777', basepath(suffix=''))
- LOG.info(_('instance %s: Creating image'), inst['name'])
+ LOG.info(_('instance %s: Creating image'), inst['name'],
+ instance=inst)
if FLAGS.baremetal_type == 'lxc':
container_dir = '%s/rootfs' % basepath(suffix='')
@@ -463,7 +472,7 @@ class ProxyConnection(driver.ComputeDriver):
if locals()[injection]:
LOG.info(_('instance %(inst_name)s: injecting '
'%(injection)s into image %(img_id)s'),
- locals())
+ locals(), instance=inst)
try:
disk.inject_data(injection_path, key, net, metadata,
partition=target_partition,
@@ -473,7 +482,8 @@ class ProxyConnection(driver.ComputeDriver):
except Exception as e:
# This could be a windows image, or a vmdk format disk
LOG.warn(_('instance %(inst_name)s: ignoring error injecting'
- ' data into image %(img_id)s (%(e)s)') % locals())
+ ' data into image %(img_id)s (%(e)s)') % locals(),
+ instance=inst)
def _prepare_xml_info(self, instance, network_info, rescue,
block_device_info=None):
@@ -517,9 +527,11 @@ class ProxyConnection(driver.ComputeDriver):
return xml_info
def to_xml_dict(self, instance, rescue=False, network_info=None):
- LOG.debug(_('instance %s: starting toXML method'), instance['name'])
+ LOG.debug(_('instance %s: starting toXML method'), instance['name'],
+ instance=instance)
xml_info = self._prepare_xml_info(instance, rescue, network_info)
- LOG.debug(_('instance %s: finished toXML method'), instance['name'])
+ LOG.debug(_('instance %s: finished toXML method'), instance['name'],
+ instance=instance)
return xml_info
def get_info(self, instance):