Use default qemu-img cluster size in libvirt connection driver

The recommended cluster size [1] for qcow2 is 64k, which is the default
when invoking 'qemu-img create ...'.  Remove the cluster_size option
from qemu-img invocation.

[1] http://www.mail-archive.com/openstack@lists.launchpad.net/msg11371.html

V2: Fix test.

Note: This patch is needed in the stable/essex branch too, otherwise it
is not possible to start Xen instances that use qcow2 images.  The old
qemu 0.10 in Xen cannot cope with cluster size > 64k.

Change-Id: Iafc290720a820cb5f57ded10a2f584fdc5cd5b49
(cherry picked from commit de5cb27e64)
This commit is contained in:
Jim Fehlig 2012-05-10 13:20:20 -07:00
parent 54f984a540
commit 7b215ed439
3 changed files with 3 additions and 2 deletions

View File

@ -84,6 +84,7 @@ Jason Koelker <jason@koelker.net>
Jay Pipes <jaypipes@gmail.com>
JC Martin <jcmartin@ebaysf.com>
Jesse Andrews <anotherjesse@gmail.com>
Jim Fehlig <jfehlig@suse.com>
Jimmy Bergman <jimmy@sigint.se>
Joe Gordon <jogo@cloudscaling.com>
Joe Heck <heckj@mac.com>

View File

@ -2135,7 +2135,7 @@ class LibvirtUtilsTestCase(test.TestCase):
def test_create_cow_image(self):
self.mox.StubOutWithMock(utils, 'execute')
utils.execute('qemu-img', 'create', '-f', 'qcow2',
'-o', 'cluster_size=2M,backing_file=/some/path',
'-o', 'backing_file=/some/path',
'/the/new/cow')
# Start test
self.mox.ReplayAll()

View File

@ -69,7 +69,7 @@ def create_cow_image(backing_file, path):
:param path: Desired location of the COW image
"""
execute('qemu-img', 'create', '-f', 'qcow2', '-o',
'cluster_size=2M,backing_file=%s' % backing_file, path)
'backing_file=%s' % backing_file, path)
def get_disk_size(path):