live migration failed when using shared instance path with QCOW2
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
In Progress
|
Undecided
|
Guangya Liu (Jay Lau) |
Bug Description
Currently, live migration will be failed when using shared instance path with QCOW2 because of 'instance_dir' was not defined.
File "/usr/lib/
result = getattr(endpoint, method)(ctxt, **new_args)
File "/usr/lib/
return function(self, context, *args, **kwargs)
File "/usr/lib/
payload)
File "/usr/lib/
six.
File "/usr/lib/
return f(self, context, *args, **kw)
File "/usr/lib/
kwargs[
File "/usr/lib/
six.
File "/usr/lib/
return function(self, context, *args, **kwargs)
File "/usr/lib/
migrate_data)
File "/usr/lib/
instance_dir, disk_info)
UnboundLocalError: local variable 'instance_dir' referenced before assignment
to caller
def pre_live_ migration( self, context, instance, block_device_info,
network_ info, disk_info, migrate_data=None):
"""Preparation live migration."""
is_shared_ block_storage = True
is_shared_ instance_ path = True
is_block_ migration = True
instance_ relative_ path = None
is_ shared_ block_storage = migrate_data.get(
' is_shared_ block_storage' , True)
is_ shared_ instance_ path = migrate_data.get(
' is_shared_ instance_ path', True)
is_ block_migration = migrate_ data.get( 'block_ migration' , True)
instance_ relative_ path = migrate_ data.get( 'instance_ relative_ path')
# Steps for volume backed instance live migration w/o shared storage.
if migrate_data:
if not (is_shared_ instance_ path and is_shared_ block_storage) : required_ by(instance) :
raise exception. NoLiveMigration ForConfigDriveI nLibVirt( )
# NOTE(mikal): live migration of instances using config drive is
# not supported because of a bug in libvirt (read only devices
# are not copied by libvirt). See bug/1246201
if configdrive.
if not is_shared_ instance_ path: utils.get_ instance_ path relative_ path:
instance_ dir = os.path. join(CONF. instances_ path,
instance_ relative_ path) <<<<<<<<<<<<<<< instance_dir define here
instance_ dir = libvirt_ utils.get_ instance_ path(instance) <<<<<<<<<<<<<<< instance_dir define here
# NOTE(mikal): this doesn't use libvirt_
# because we are ensuring that the same instance directory name
# is used as was at the source
if instance_
else:
if os.path. exists( instance_ dir):
raise exception. DestinationDisk Exists( path=instance_ dir)
os. mkdir(instance_ dir)
if not is_shared_ block_storage:
self. _create_ images_ and_backing( context, instance,
instance_ dir, disk_info) <<<<<<<<<<<<<<< using instance_dir here, but if I was using shared instance path, then instance_dir will be a undefined variable
# Ensure images and backing files are present.