Fix logical volume tests

After commit 590c8dbebf, 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 <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2013-04-08 10:39:58 +02:00 committed by Cole Robinson
parent d0a76f3905
commit 212b77cc1f
4 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<volume>
<name>pool-logical-vol</name>
<capacity>10737418240</capacity>
<allocation>5368709120</allocation>
<allocation>10737418240</allocation>
<target>
<permissions>
<mode>0700</mode>

View File

@ -5,7 +5,7 @@
<source>
</source>
<capacity unit="bytes">10737418240</capacity>
<allocation unit="bytes">5368709120</allocation>
<allocation unit="bytes">10737418240</allocation>
<target>
<path>/some/target/path/pool-logical-vol</path>
<permissions>

View File

@ -1,7 +1,7 @@
<volume>
<name>pool-logical-volinput</name>
<capacity>10737418240</capacity>
<allocation>5368709120</allocation>
<allocation>10737418240</allocation>
<target>
<permissions>
<mode>0700</mode>

View File

@ -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)