[PATCHv1 0/2] fix create vm on logical pool

From: Royce Lv <lvroyce@linux.vnet.ibm.com> VG path is create under 'dev' and logical volume's format should be raw, to avoid qcow2 write exceed problem. Royce Lv (2): Fix storage volume format on logical pool for vm logical pool: Fix logical pool target path src/kimchi/model/libvirtstoragepool.py | 2 +- src/kimchi/vmtemplate.py | 8 +++++--- tests/test_storagepool.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) -- 1.8.1.2

From: Royce Lv <lvroyce@linux.vnet.ibm.com> VM with LV as its disk will fail to start. Root cause is volume format is set to be qcow2, space of which is not allocated at creation time, just with metadata. Data of files can be allocated through writes. But LV cannot extend accordingly as file unless manually call 'lvextend'. So create logical volume formated as 'raw' to allocate enough space, This will prevent vm write access exceeds range. Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com> --- src/kimchi/vmtemplate.py | 8 +++++--- tests/test_storagepool.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py index f380170..d3bd52e 100644 --- a/src/kimchi/vmtemplate.py +++ b/src/kimchi/vmtemplate.py @@ -149,10 +149,11 @@ class VMTemplate(object): src = os.path.join(storage_path, volume) dev = "%s%s" % (self._bus_to_dev[self.info['disk_bus']], string.lowercase[index]) - params = {'src': src, 'dev': dev, 'bus': self.info['disk_bus']} + fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2' + params = {'src': src, 'dev': dev, 'bus': self.info['disk_bus'], 'type': fmt} ret += """ <disk type='file' device='disk'> - <driver name='qemu' type='qcow2' cache='none'/> + <driver name='qemu' type='%(type)s' cache='none'/> <source file='%(src)s' /> <target dev='%(dev)s' bus='%(bus)s' /> </disk> @@ -198,6 +199,7 @@ class VMTemplate(object): def to_volume_list(self, vm_uuid): storage_path = self._get_storage_path() + fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2' ret = [] for i, d in enumerate(self.info['disks']): index = d.get('index', i) @@ -206,7 +208,7 @@ class VMTemplate(object): info = {'name': volume, 'capacity': d['size'], 'type': 'disk', - 'format': 'qcow2', + 'format': fmt, 'path': '%s/%s' % (storage_path, volume)} info['xml'] = """ diff --git a/tests/test_storagepool.py b/tests/test_storagepool.py index fcf24f8..22b4943 100644 --- a/tests/test_storagepool.py +++ b/tests/test_storagepool.py @@ -72,7 +72,7 @@ class storagepoolTests(unittest.TestCase): <device path="/dev/hdb" /> </source> <target> - <path>/var/lib/kimchi/logical_mount/unitTestLogicalPool</path> + <path>/dev/unitTestLogicalPool</path> </target> </pool> """}, -- 1.8.1.2

From: Royce Lv <lvroyce@linux.vnet.ibm.com> Logical pool target path, which refers to the VG path, is always under /dev. Specify a random file system path will not take effective. LV link is always created under /dev/VG-name/. REF: libvirt/src/storage/storage_backend_logical.c virStorageBackendLogicalBuildPool() Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com> --- src/kimchi/model/libvirtstoragepool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kimchi/model/libvirtstoragepool.py b/src/kimchi/model/libvirtstoragepool.py index 1fbd8c0..b8f3d42 100644 --- a/src/kimchi/model/libvirtstoragepool.py +++ b/src/kimchi/model/libvirtstoragepool.py @@ -143,7 +143,7 @@ class LogicalPoolDef(StoragePoolDef): def __init__(self, poolArgs): super(LogicalPoolDef, self).__init__(poolArgs) - self.path = '/var/lib/kimchi/logical_mount/' + self.poolArgs['name'] + self.path = '/dev/' + self.poolArgs['name'] @property def xml(self): -- 1.8.1.2

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 03/07/2014 10:56 AM, lvroyce@linux.vnet.ibm.com wrote:
From: Royce Lv <lvroyce@linux.vnet.ibm.com>
VG path is create under 'dev' and logical volume's format should be raw, to avoid qcow2 write exceed problem.
Royce Lv (2): Fix storage volume format on logical pool for vm logical pool: Fix logical pool target path
src/kimchi/model/libvirtstoragepool.py | 2 +- src/kimchi/vmtemplate.py | 8 +++++--- tests/test_storagepool.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
participants (2)
-
Aline Manera
-
lvroyce@linux.vnet.ibm.com