From 89fefa4f37adc27dcfc2dfdf9cd171b5937799c1 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Mon, 17 Dec 2012 14:56:19 +1100 Subject: [PATCH] libvirt: Skip intermediate base files with qcow2. Instead of having two files in _base (the original and a resized copy), let's just keep the originals and resize with the qcow2 image in the instance's directory. This will reduce the size of _base and simplify cleanup. This also simplifies resizing of instance disk images later. Resolves bug 1087031. Change-Id: Id91426e3cb9f75f31339b5156785e3782a4cb98f --- nova/tests/test_imagebackend.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/nova/tests/test_imagebackend.py b/nova/tests/test_imagebackend.py index c1525906..c077fce7 100644 --- a/nova/tests/test_imagebackend.py +++ b/nova/tests/test_imagebackend.py @@ -196,26 +196,9 @@ class Qcow2TestCase(_ImageTestCase, test.TestCase): fn = self.prepare_mocks() fn(target=self.TEMPLATE_PATH) self.mox.StubOutWithMock(os.path, 'exists') - os.path.exists(self.QCOW2_BASE).AndReturn(False) - imagebackend.libvirt_utils.copy_image(self.TEMPLATE_PATH, - self.QCOW2_BASE) - imagebackend.disk.extend(self.QCOW2_BASE, self.SIZE) - imagebackend.libvirt_utils.create_cow_image(self.QCOW2_BASE, - self.PATH) - self.mox.ReplayAll() - - image = self.image_class(self.INSTANCE, self.NAME) - image.create_image(fn, self.TEMPLATE_PATH, self.SIZE) - - self.mox.VerifyAll() - - def test_create_image_with_size_template_exists(self): - fn = self.prepare_mocks() - fn(target=self.TEMPLATE_PATH) - self.mox.StubOutWithMock(os.path, 'exists') - os.path.exists(self.QCOW2_BASE).AndReturn(True) - imagebackend.libvirt_utils.create_cow_image(self.QCOW2_BASE, + imagebackend.libvirt_utils.create_cow_image(self.TEMPLATE_PATH, self.PATH) + imagebackend.disk.extend(self.PATH, self.SIZE) self.mox.ReplayAll() image = self.image_class(self.INSTANCE, self.NAME)