From 0cecdf4b8632d3a4eea816869796b03e8b928256 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Tue, 18 Dec 2012 16:32:14 +1100 Subject: Reliably include OS type in ephemeral filenames. Either include the OS type, or "default" if this isn't specified. Also, I don't see why we care what ephemeral disk number this disk was created as (they're all empty images in base, right?) so I've removed that. Resolves bug 1087030. Change-Id: Iee7f8e9033a2e6a829421763090ed0e67c6b2da8 --- nova/virt/libvirt/driver.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'nova') diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 263fd5ca4..a6d12d4f4 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -1362,6 +1362,11 @@ class LibvirtDriver(driver.ComputeDriver): user_id=instance['user_id'], project_id=instance['project_id']) + # Lookup the filesystem type if required + os_type_with_default = instance['os_type'] + if not os_type_with_default: + os_type_with_default = 'default' + ephemeral_gb = instance['ephemeral_gb'] if ephemeral_gb and not self._volume_in_mapping( self.default_second_device, block_device_info): @@ -1369,9 +1374,7 @@ class LibvirtDriver(driver.ComputeDriver): fn = functools.partial(self._create_ephemeral, fs_label='ephemeral0', os_type=instance["os_type"]) - fname = "ephemeral_%s_%s_%s" % ("0", - ephemeral_gb, - instance["os_type"]) + fname = "ephemeral_%s_%s" % (ephemeral_gb, os_type_with_default) size = ephemeral_gb * 1024 * 1024 * 1024 image('disk.local').cache(fetch_func=fn, filename=fname, @@ -1385,9 +1388,7 @@ class LibvirtDriver(driver.ComputeDriver): fs_label='ephemeral%d' % eph['num'], os_type=instance["os_type"]) size = eph['size'] * 1024 * 1024 * 1024 - fname = "ephemeral_%s_%s_%s" % (eph['num'], - eph['size'], - instance["os_type"]) + fname = "ephemeral_%s_%s" % (eph['size'], os_type_with_default) image(_get_eph_disk(eph)).cache(fetch_func=fn, filename=fname, size=size, -- cgit