[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [virt-manager PATCH 1/3] 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 <mkletzan redhat com>
---
 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 8f48373..aaca040 100644
--- a/tests/storage-xml/pool-logical-vol.xml
+++ b/tests/storage-xml/pool-logical-vol.xml
@@ -1,7 +1,7 @@
 <volume>
   <name>pool-logical-vol</name>
   <capacity>10737418240</capacity>
-  <allocation>5368709120</allocation>
+  <allocation>10737418240</allocation>
   <target>
     <permissions>
       <mode>0700</mode>
diff --git a/tests/storage-xml/pool-logical-volclone.xml b/tests/storage-xml/pool-logical-volclone.xml
index 4200585..ef53c6c 100644
--- a/tests/storage-xml/pool-logical-volclone.xml
+++ b/tests/storage-xml/pool-logical-volclone.xml
@@ -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>
diff --git a/tests/storage-xml/pool-logical-volinput.xml b/tests/storage-xml/pool-logical-volinput.xml
index 5abaf37..d51a9b0 100644
--- a/tests/storage-xml/pool-logical-volinput.xml
+++ b/tests/storage-xml/pool-logical-volinput.xml
@@ -1,7 +1,7 @@
 <volume>
   <name>pool-logical-volinput</name>
   <capacity>10737418240</capacity>
-  <allocation>5368709120</allocation>
+  <allocation>10737418240</allocation>
   <target>
     <permissions>
       <mode>0700</mode>
diff --git a/virtinst/Storage.py b/virtinst/Storage.py
index 1a39641..a80875a 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)


-- 
1.8.1.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]