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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user