From 212b77cc1f56e9ca3a5c1b174f551cc57ac1815f Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Mon, 8 Apr 2013 10:39:58 +0200 Subject: [PATCH] Fix logical volume tests After commit 590c8dbebfddb71874de7a98e579264ebae6859f, the tests got broken due to the fact that the commit broke something that was working. I'm changing the error to warning and fixing the tests. Signed-off-by: Martin Kletzander --- tests/storage-xml/pool-logical-vol.xml | 2 +- tests/storage-xml/pool-logical-volclone.xml | 2 +- tests/storage-xml/pool-logical-volinput.xml | 2 +- virtinst/Storage.py | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/storage-xml/pool-logical-vol.xml b/tests/storage-xml/pool-logical-vol.xml index 8f483731d..aaca040f5 100644 --- a/tests/storage-xml/pool-logical-vol.xml +++ b/tests/storage-xml/pool-logical-vol.xml @@ -1,7 +1,7 @@ pool-logical-vol 10737418240 - 5368709120 + 10737418240 0700 diff --git a/tests/storage-xml/pool-logical-volclone.xml b/tests/storage-xml/pool-logical-volclone.xml index 420058571..ef53c6ccd 100644 --- a/tests/storage-xml/pool-logical-volclone.xml +++ b/tests/storage-xml/pool-logical-volclone.xml @@ -5,7 +5,7 @@ 10737418240 - 5368709120 + 10737418240 /some/target/path/pool-logical-vol diff --git a/tests/storage-xml/pool-logical-volinput.xml b/tests/storage-xml/pool-logical-volinput.xml index 5abaf374b..d51a9b06f 100644 --- a/tests/storage-xml/pool-logical-volinput.xml +++ b/tests/storage-xml/pool-logical-volinput.xml @@ -1,7 +1,7 @@ pool-logical-volinput 10737418240 - 5368709120 + 10737418240 0700 diff --git a/virtinst/Storage.py b/virtinst/Storage.py index 1a39641c5..a80875aab 100644 --- a/virtinst/Storage.py +++ b/virtinst/Storage.py @@ -1350,8 +1350,8 @@ class LogicalVolume(StorageVolume): def __init__(self, name, capacity, pool=None, pool_name=None, conn=None, allocation=None, perms=None): if allocation and allocation != capacity: - raise ValueError(_("Sparse logical volumes are not supported, " - "allocation must be equal to capacity")) + logging.warn(_("Sparse logical volumes are not supported, " + "setting allocation equal to capacity")) StorageVolume.__init__(self, name=name, pool=pool, pool_name=pool_name, allocation=capacity, capacity=capacity, conn=conn) @@ -1365,9 +1365,9 @@ class LogicalVolume(StorageVolume): def set_allocation(self, allocation): if allocation != self.capacity: - raise ValueError(_("Sparse logical volumes are not supported, " - "allocation must be equal to capacity")) - super(LogicalVolume, self).set_allocation(allocation) + logging.warn(_("Sparse logical volumes are not supported, " + "setting allocation equal to capacity")) + super(LogicalVolume, self).set_allocation(self.capacity) capacity = property(StorageVolume.get_allocation, set_allocation)