diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-02-18 01:12:43 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-02-18 01:12:43 +0000 |
| commit | 834dfcfeb484b8fcf0af906db57253f4f5d46915 (patch) | |
| tree | ade03a46f7f737af5c3bb7fcadcc585c61aba002 | |
| parent | 8807e17f379a9fc529c78651c72a8dcf1d074c66 (diff) | |
| parent | 4289b6459707b656e61ff06669a3ed4baf2433e0 (diff) | |
| download | nova-834dfcfeb484b8fcf0af906db57253f4f5d46915.tar.gz nova-834dfcfeb484b8fcf0af906db57253f4f5d46915.tar.xz nova-834dfcfeb484b8fcf0af906db57253f4f5d46915.zip | |
Merge "fix pre_block_migration() interaction with libvirt cache"
| -rw-r--r-- | nova/virt/libvirt/connection.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index b272b343c..b6aef1545 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -1929,24 +1929,19 @@ class LibvirtConnection(driver.ComputeDriver): info['disk_size']) else: # Creating backing file follows same way as spawning instances. - backing_file = os.path.join(FLAGS.instances_path, - '_base', info['backing_file']) - + cache_name = os.path.basename(info['backing_file']) # Remove any size tags which the cache manages - cached_file = info['backing_file'].split('_')[0] - - if not os.path.exists(backing_file): - self._cache_image(fn=libvirt_utils.fetch_image, - context=ctxt, - target=info['path'], - fname=cached_file, - cow=FLAGS.use_cow_images, - image_id=instance_ref['image_ref'], - user_id=instance_ref['user_id'], - project_id=instance_ref['project_id'], - size=instance_ref['ephemeral_gb']) - - libvirt_utils.create_cow_image(backing_file, instance_disk) + cache_name = cache_name.split('_')[0] + + self._cache_image(fn=libvirt_utils.fetch_image, + context=ctxt, + target=instance_disk, + fname=cache_name, + cow=FLAGS.use_cow_images, + image_id=instance_ref['image_ref'], + user_id=instance_ref['user_id'], + project_id=instance_ref['project_id'], + size=info['disk_size']) # if image has kernel and ramdisk, just download # following normal way. |
