Comment 1 for bug 1251590

One possible solution that seems to work:

diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index bb3c312..68f68e6 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -4290,13 +4290,22 @@ class LibvirtDriver(driver.ComputeDriver):
                 image = self.image_backend.image(instance,
                                                  instance_disk,
                                                  CONF.libvirt_images_type)
- image.cache(fetch_func=libvirt_utils.fetch_image,
- context=context,
- filename=cache_name,
- image_id=instance['image_ref'],
- user_id=instance['user_id'],
- project_id=instance['project_id'],
- size=info['virt_disk_size'])
+
+ if cache_name.startswith('ephemeral'):
+ image.cache(fetch_func=self._create_ephemeral,
+ fs_label='ephemeral0',
+ os_type=instance["os_type"],
+ filename=cache_name,
+ size=info['virt_disk_size'],
+ ephemeral_size=instance['ephemeral_gb'])
+ else:
+ image.cache(fetch_func=libvirt_utils.fetch_image,
+ context=context,
+ filename=cache_name,
+ image_id=instance['image_ref'],
+ user_id=instance['user_id'],
+ project_id=instance['project_id'],
+ size=info['virt_disk_size'])