Skip to content

Commit

Permalink
Fix error message in pre_live_migration.
Browse files Browse the repository at this point in the history
We are using locals() to reference a variable which doesn't exist
in this error message. Also rename the instance variable while I
am here to be more consistent with other uses.

Resolves bug 1164072.

Change-Id: I96f5e2a81ac2e97181c3e87df83e19b381f4bcd2
(cherry picked from commit 676b16b)
  • Loading branch information
mikalstill authored and vishvananda committed Apr 12, 2013
1 parent 8a14299 commit a3cc7bc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions nova/virt/libvirt/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3139,7 +3139,7 @@ def _fetch_instance_kernel_ramdisk(self, context, instance):
instance['user_id'],
instance['project_id'])

def pre_live_migration(self, context, instance_ref, block_device_info,
def pre_live_migration(self, context, instance, block_device_info,
network_info, migrate_data=None):
"""Preparation live migration."""
# Steps for volume backed instance live migration w/o shared storage.
Expand All @@ -3154,18 +3154,18 @@ def pre_live_migration(self, context, instance_ref, block_device_info,
if is_volume_backed and not (is_block_migration or is_shared_storage):

# Create the instance directory on destination compute node.
instance_dir = libvirt_utils.get_instance_path(instance_ref)
instance_dir = libvirt_utils.get_instance_path(instance)
if os.path.exists(instance_dir):
raise exception.DestinationDiskExists(path=instance_dir)
os.mkdir(instance_dir)

# Touch the console.log file, required by libvirt.
console_file = self._get_console_log_path(instance_ref)
console_file = self._get_console_log_path(instance)
libvirt_utils.file_open(console_file, 'a').close()

# if image has kernel and ramdisk, just download
# following normal way.
self._fetch_instance_kernel_ramdisk(context, instance_ref)
self._fetch_instance_kernel_ramdisk(context, instance)

# Establishing connection to volume server.
block_device_mapping = driver.block_device_info_get_mapping(
Expand All @@ -3190,15 +3190,17 @@ def pre_live_migration(self, context, instance_ref, block_device_info,
max_retry = CONF.live_migration_retry_count
for cnt in range(max_retry):
try:
self.plug_vifs(instance_ref, network_info)
self.plug_vifs(instance, network_info)
break
except exception.ProcessExecutionError:
if cnt == max_retry - 1:
raise
else:
LOG.warn(_("plug_vifs() failed %(cnt)d."
"Retry up to %(max_retry)d for %(hostname)s.")
% locals())
LOG.warn(_('plug_vifs() failed %(cnt)d. Retry up to '
'%(max_retry)d.'),
{'cnt': cnt,
'max_retry': max_retry},
instance=instance)
greenthread.sleep(1)

def pre_block_migration(self, ctxt, instance, disk_info_json):
Expand Down

0 comments on commit a3cc7bc

Please sign in to comment.