[PATCH] Set allocation=capacity when creating images in logical pools

If allocation is set to 0 for images in logical storage, they cannot be used. You may see an error similar to: /dev/VMs_Storage_R5/ed229d7b-5248-4499-8758-43069dd79fe7-0.img: \ read failed after 0 of 65536 at 21474770944: Input/output error When attempting to access the image. When using the image, the guest may report that it is unable to write to the disk (I/O error). Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com> --- src/kimchi/vmtemplate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py index d4fbe8b..ef41d0a 100644 --- a/src/kimchi/vmtemplate.py +++ b/src/kimchi/vmtemplate.py @@ -202,8 +202,12 @@ def to_volume_list(self, vm_uuid): 'capacity': d['size'], 'format': fmt, 'path': '%s/%s' % (storage_path, volume)} - info['allocation'] = 0 if fmt in ['qcow2', 'raw'] \ - else info['capacity'] + + if 'logical' == self._get_storage_type() or \ + fmt not in ['qcow2', 'raw']: + info['allocation'] = info['capacity'] + else: + info['allocation'] = 0 if 'base' in d: info['base'] = dict() -- 2.1.0

Reviewed-by: Crístian Viana <vianac@linux.vnet.ibm.com> Tested-by: Crístian Viana <vianac@linux.vnet.ibm.com> On 17-02-2015 18:09, Christy Perez wrote:
If allocation is set to 0 for images in logical storage, they cannot be used. You may see an error similar to:
/dev/VMs_Storage_R5/ed229d7b-5248-4499-8758-43069dd79fe7-0.img: \ read failed after 0 of 65536 at 21474770944: Input/output error
When attempting to access the image.
When using the image, the guest may report that it is unable to write to the disk (I/O error).
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
participants (3)
-
Aline Manera
-
Christy Perez
-
Crístian Viana