summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <pbrady@redhat.com>2012-02-15 15:44:29 +0000
committerPádraig Brady <pbrady@redhat.com>2012-02-17 22:55:42 +0000
commit4289b6459707b656e61ff06669a3ed4baf2433e0 (patch)
tree4b82e4c09886edd408c4dc035f857897e3799f8c
parent55bc3d927739f98a002c4590b196aa6780fa8fbf (diff)
fix pre_block_migration() interaction with libvirt cache
Fixes bug 932179 * nova/virt/libvirt/connection (pre_block_migration): Don't pass the 'ephemeral_gb' attribute as the size, since this has the wrong units and is the wrong quantity to pass anyway. Also don't check for file existence, or create the cow image as this is done within _cache_image() Change-Id: Id723ec8d119dacd4660e88e546e05af417c736fc
-rw-r--r--nova/virt/libvirt/connection.py29
1 files changed, 12 insertions, 17 deletions
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
index b89b67372..60527a5ee 100644
--- a/nova/virt/libvirt/connection.py
+++ b/nova/virt/libvirt/connection.py
@@ -1909,24 +1909,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.