[PATCH 4/5] Update action_test.py to specify sizes using blivet.size.Size.
Anne Mulhern
amulhern at redhat.com
Thu Mar 20 20:36:46 UTC 2014
----- Original Message -----
> From: "David Lehman" <dlehman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Thursday, March 20, 2014 1:06:39 PM
> Subject: [PATCH 4/5] Update action_test.py to specify sizes using blivet.size.Size.
>
> ---
> tests/action_test.py | 188
> ++++++++++++++++++++++++++++++---------------------
> 1 file changed, 110 insertions(+), 78 deletions(-)
>
> diff --git a/tests/action_test.py b/tests/action_test.py
> index bc906c9..c28157a 100644
> --- a/tests/action_test.py
> +++ b/tests/action_test.py
> @@ -6,6 +6,7 @@ from mock import Mock
> from storagetestcase import StorageTestCase
> import blivet
> from blivet.formats import getFormat
> +from blivet.size import Size
>
> # device classes for brevity's sake -- later on, that is
> from blivet.devices import StorageDevice
> @@ -38,7 +39,7 @@ class DeviceActionTestCase(StorageTestCase):
>
> for name in ["sda", "sdb", "sdc", "sdd"]:
> disk = self.newDevice(device_class=DiskDevice,
> - name=name, size=100000)
> + name=name, size=Size(spec="100 GiB"))
> disk.format = self.newFormat("disklabel", path=disk.path,
> exists=True)
> self.storage.devicetree._addDevice(disk)
> @@ -48,19 +49,22 @@ class DeviceActionTestCase(StorageTestCase):
> sdb = self.storage.devicetree.getDeviceByName("sdb")
>
> sda1 = self.newDevice(device_class=PartitionDevice,
> - exists=True, name="sda1", parents=[sda],
> size=500)
> + exists=True, name="sda1", parents=[sda],
> + size=Size(spec="500 MiB"))
> sda1.format = self.newFormat("ext4", mountpoint="/boot",
> device_instance=sda1,
> device=sda1.path, exists=True)
> self.storage.devicetree._addDevice(sda1)
>
> sda2 = self.newDevice(device_class=PartitionDevice,
> - size=99500, name="sda2", parents=[sda],
> exists=True)
> + size=Size(spec="99.5 GiB"), name="sda2",
> + parents=[sda], exists=True)
> sda2.format = self.newFormat("lvmpv", device=sda2.path, exists=True)
> self.storage.devicetree._addDevice(sda2)
>
> sdb1 = self.newDevice(device_class=PartitionDevice,
> - size=99999, name="sdb1", parents=[sdb],
> exists=True)
> + size=Size(spec="99.999 GiB"), name="sdb1",
> + parents=[sdb], exists=True)
> sdb1.format = self.newFormat("lvmpv", device=sdb1.path, exists=True)
> self.storage.devicetree._addDevice(sdb1)
>
> @@ -70,16 +74,16 @@ class DeviceActionTestCase(StorageTestCase):
> self.storage.devicetree._addDevice(vg)
>
> lv_root = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_root", parents=[vg], size=160000,
> - exists=True)
> + name="lv_root", parents=[vg],
> + size=Size(spec="160 GiB"), exists=True)
> lv_root.format = self.newFormat("ext4", mountpoint="/",
> device_instance=lv_root,
> device=lv_root.path, exists=True)
> self.storage.devicetree._addDevice(lv_root)
>
> lv_swap = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_swap", parents=[vg], size=4000,
> - exists=True)
> + name="lv_swap", parents=[vg],
> + size=Size(spec="4000 MiB"), exists=True)
> lv_swap.format = self.newFormat("swap", device=lv_swap.path,
> device_instance=lv_swap,
> exists=True)
> @@ -125,11 +129,13 @@ class DeviceActionTestCase(StorageTestCase):
> self.assertNotEqual(sda, None, "failed to find disk 'sda'")
>
> sda1 = self.newDevice(device_class=PartitionDevice,
> - name="sda1", size=500, parents=[sda])
> + name="sda1", size=Size(spec="500 MiB"),
> + parents=[sda])
> self.scheduleCreateDevice(device=sda1)
>
> sda2 = self.newDevice(device_class=PartitionDevice,
> - name="sda2", size=100000, parents=[sda])
> + name="sda2", size=Size(spec="100 GiB"),
> + parents=[sda])
> self.scheduleCreateDevice(device=sda2)
> format = self.newFormat("lvmpv", device=sda2.path)
> self.scheduleCreateFormat(device=sda2, format=format)
> @@ -139,19 +145,22 @@ class DeviceActionTestCase(StorageTestCase):
> self.scheduleCreateDevice(device=vg)
>
> lv_root = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_root", parents=[vg], size=60000)
> + name="lv_root", parents=[vg],
> + size=Size(spec="60 GiB"))
> self.scheduleCreateDevice(device=lv_root)
> format = self.newFormat("ext4", device=lv_root.path, mountpoint="/")
> self.scheduleCreateFormat(device=lv_root, format=format)
>
> lv_swap = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_swap", parents=[vg], size=4000)
> + name="lv_swap", parents=[vg],
> + size=Size(spec="4000 MiB"))
> self.scheduleCreateDevice(device=lv_swap)
> format = self.newFormat("swap", device=lv_swap.path)
> self.scheduleCreateFormat(device=lv_swap, format=format)
>
> sda3 = self.newDevice(device_class=PartitionDevice,
> - name="sda3", parents=[sda], size=40000)
> + name="sda3", parents=[sda],
> + size=Size(spec="40 GiB"))
> self.scheduleCreateDevice(device=sda3)
> format = self.newFormat("mdmember", device=sda3.path)
> self.scheduleCreateFormat(device=sda3, format=format)
> @@ -160,13 +169,14 @@ class DeviceActionTestCase(StorageTestCase):
> self.assertNotEqual(sdb, None, "failed to find disk 'sdb'")
>
> sdb1 = self.newDevice(device_class=PartitionDevice,
> - name="sdb1", parents=[sdb], size=40000)
> + name="sdb1", parents=[sdb],
> + size=Size(spec="40 GiB"))
> self.scheduleCreateDevice(device=sdb1)
> format = self.newFormat("mdmember", device=sdb1.path,)
> self.scheduleCreateFormat(device=sdb1, format=format)
>
> md0 = self.newDevice(device_class=MDRaidArrayDevice,
> - name="md0", level="raid0", minor=0, size=80000,
> + name="md0", level="raid0", minor=0,
> memberDevices=2, totalDevices=2,
> parents=[sdb1, sda3])
> self.scheduleCreateDevice(device=md0)
> @@ -184,11 +194,11 @@ class DeviceActionTestCase(StorageTestCase):
> # XXX resizable depends on existence, so this is covered implicitly
> sdd = self.storage.devicetree.getDeviceByName("sdd")
> p = self.newDevice(device_class=PartitionDevice,
> - name="sdd1", size=32768, parents=[sdd])
> + name="sdd1", size=Size(spec="32 GiB"),
> parents=[sdd])
> self.failUnlessRaises(ValueError,
> blivet.deviceaction.ActionResizeDevice,
> p,
> - p.size + 7232)
> + p.size + Size(spec="7232 MiB"))
>
> # instantiation of device resize action for non-resizable device
> # should fail
> @@ -197,7 +207,7 @@ class DeviceActionTestCase(StorageTestCase):
> self.failUnlessRaises(ValueError,
> blivet.deviceaction.ActionResizeDevice,
> vg,
> - vg.size + 32)
> + vg.size + Size(spec="32 MiB"))
>
> # instantiation of format resize action for non-resizable format
> type
> # should fail
> @@ -206,7 +216,7 @@ class DeviceActionTestCase(StorageTestCase):
> self.failUnlessRaises(ValueError,
> blivet.deviceaction.ActionResizeFormat,
> lv_swap,
> - lv_swap.size + 32)
> + lv_swap.size + Size(spec="32 MiB"))
>
> # instantiation of format resize action for non-existent format
> # should fail
> @@ -216,7 +226,7 @@ class DeviceActionTestCase(StorageTestCase):
> self.failUnlessRaises(ValueError,
> blivet.deviceaction.ActionResizeFormat,
> lv_root,
> - lv_root.size - 1000)
> + lv_root.size - Size(spec="1000 MiB"))
> lv_root.format.exists = True
>
> # instantiation of device create action for existing device should
> @@ -263,8 +273,8 @@ class DeviceActionTestCase(StorageTestCase):
> sdc = self.storage.devicetree.getDeviceByName("sdc")
> self.assertNotEqual(sdc, None)
> sdc1 = self.newDevice(device_class=PartitionDevice,
> - name="sdc1", size=100000, parents=[sdc],
> - exists=True)
> + name="sdc1", size=Size(spec="100 GiB"),
> + parents=[sdc], exists=True)
>
> sdc1_format = self.newFormat("ext2", device=sdc1.path,
> mountpoint="/")
> create_sdc1_format = ActionCreateFormat(sdc1, sdc1_format)
> @@ -274,12 +284,13 @@ class DeviceActionTestCase(StorageTestCase):
>
> sdc1_format.exists = True
>
> - resize_sdc1_format = ActionResizeFormat(sdc1, sdc1.size - 10000)
> + resize_sdc1_format = ActionResizeFormat(sdc1,
> + sdc1.size - Size(spec="10
> GiB"))
> self.failUnlessRaises(blivet.errors.DeviceTreeError,
> self.storage.devicetree.registerAction,
> resize_sdc1_format)
>
> - resize_sdc1 = ActionResizeDevice(sdc1, sdc1.size - 10000)
> + resize_sdc1 = ActionResizeDevice(sdc1, sdc1.size - Size(spec="10
> GiB"))
> self.failUnlessRaises(blivet.errors.DeviceTreeError,
> self.storage.devicetree.registerAction,
> resize_sdc1)
> @@ -315,7 +326,8 @@ class DeviceActionTestCase(StorageTestCase):
> sdd1 = self.storage.devicetree.getDeviceByName("sdd1")
> self.assertEqual(sdd1, None)
> sdd1 = self.newDevice(device_class=PartitionDevice,
> - name="sdd1", size=100000, parents=[sdd])
> + name="sdd1", size=Size(spec="100 GiB"),
> + parents=[sdd])
> a = ActionCreateDevice(sdd1)
> self.storage.devicetree.registerAction(a)
> sdd1 = self.storage.devicetree.getDeviceByName("sdd1")
> @@ -328,7 +340,7 @@ class DeviceActionTestCase(StorageTestCase):
> self.assertNotEqual(sdc, None)
>
> sdc1 = self.newDevice(device_class=PartitionDevice,
> - name="sdc1", parents=[sdc], size=40000)
> + name="sdc1", parents=[sdc], size=Size(spec="40
> GiB"))
>
> # ActionCreateDevice
> #
> @@ -356,8 +368,8 @@ class DeviceActionTestCase(StorageTestCase):
> # device
> sdc1.exists = True
> sdc1.format.exists = True
> - resize_format_1 = ActionResizeFormat(sdc1, sdc1.size - 1000)
> - resize_format_2 = ActionResizeFormat(sdc1, sdc1.size - 5000)
> + resize_format_1 = ActionResizeFormat(sdc1, sdc1.size -
> Size(spec="1000 MiB"))
> + resize_format_2 = ActionResizeFormat(sdc1, sdc1.size -
> Size(spec="5000 MiB"))
> self.assertEqual(resize_format_2.obsoletes(resize_format_1), True)
> self.assertEqual(resize_format_1.obsoletes(resize_format_2), False)
> sdc1.exists = False
> @@ -377,8 +389,10 @@ class DeviceActionTestCase(StorageTestCase):
> # device
> sdc1.exists = True
> sdc1.format.exists = True
> - resize_device_1 = ActionResizeDevice(sdc1, sdc1.size + 10000)
> - resize_device_2 = ActionResizeDevice(sdc1, sdc1.size - 10000)
> + resize_device_1 = ActionResizeDevice(sdc1,
> + sdc1.size + Size(spec="10
> GiB"))
> + resize_device_2 = ActionResizeDevice(sdc1,
> + sdc1.size - Size(spec="10
> GiB"))
> self.assertEqual(resize_device_2.obsoletes(resize_device_1), True)
> self.assertEqual(resize_device_1.obsoletes(resize_device_2), False)
> sdc1.exists = False
> @@ -412,8 +426,9 @@ class DeviceActionTestCase(StorageTestCase):
> # sda1 exists
> sda1 = self.storage.devicetree.getDeviceByName("sda1")
> self.assertNotEqual(sda1, None)
> - resize_sda1_format = ActionResizeFormat(sda1, sda1.size - 50)
> - resize_sda1 = ActionResizeDevice(sda1, sda1.size - 50)
> + resize_sda1_format = ActionResizeFormat(sda1,
> + sda1.size - Size(spec="50
> MiB"))
> + resize_sda1 = ActionResizeDevice(sda1, sda1.size - Size(spec="50
> MiB"))
> destroy_sda1_format = ActionDestroyFormat(sda1)
> destroy_sda1 = ActionDestroyDevice(sda1)
> self.assertEqual(destroy_sda1.obsoletes(resize_sda1_format), True)
> @@ -429,11 +444,13 @@ class DeviceActionTestCase(StorageTestCase):
> self.assertNotEqual(sda, None, "failed to find disk 'sda'")
>
> sda1 = self.newDevice(device_class=PartitionDevice,
> - name="sda1", size=500, parents=[sda])
> + name="sda1", size=Size(spec="500 MiB"),
> + parents=[sda])
> self.scheduleCreateDevice(device=sda1)
>
> sda2 = self.newDevice(device_class=PartitionDevice,
> - name="sda2", size=100000, parents=[sda])
> + name="sda2", size=Size(spec="100 GiB"),
> + parents=[sda])
> self.scheduleCreateDevice(device=sda2)
> format = self.newFormat("lvmpv", device=sda2.path)
> self.scheduleCreateFormat(device=sda2, format=format)
> @@ -443,13 +460,15 @@ class DeviceActionTestCase(StorageTestCase):
> self.scheduleCreateDevice(device=vg)
>
> lv_root = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_root", parents=[vg], size=60000)
> + name="lv_root", parents=[vg],
> + size=Size(spec="60 GiB"))
> self.scheduleCreateDevice(device=lv_root)
> format = self.newFormat("ext4", device=lv_root.path, mountpoint="/")
> self.scheduleCreateFormat(device=lv_root, format=format)
>
> lv_swap = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_swap", parents=[vg], size=4000)
> + name="lv_swap", parents=[vg],
> + size=Size(spec="4 GiB"))
> self.scheduleCreateDevice(device=lv_swap)
> format = self.newFormat("swap", device=lv_swap.path)
> self.scheduleCreateFormat(device=lv_swap, format=format)
> @@ -457,7 +476,8 @@ class DeviceActionTestCase(StorageTestCase):
> # we'll soon schedule destroy actions for these members and the
> array,
> # which will test pruning. the whole mess should reduce to nothing
> sda3 = self.newDevice(device_class=PartitionDevice,
> - name="sda3", parents=[sda], size=40000)
> + name="sda3", parents=[sda],
> + size=Size(spec="40 GiB"))
> self.scheduleCreateDevice(device=sda3)
> format = self.newFormat("mdmember", device=sda3.path)
> self.scheduleCreateFormat(device=sda3, format=format)
> @@ -466,13 +486,14 @@ class DeviceActionTestCase(StorageTestCase):
> self.assertNotEqual(sdb, None, "failed to find disk 'sdb'")
>
> sdb1 = self.newDevice(device_class=PartitionDevice,
> - name="sdb1", parents=[sdb], size=40000)
> + name="sdb1", parents=[sdb],
> + size=Size(spec="40 GiB"))
> self.scheduleCreateDevice(device=sdb1)
> format = self.newFormat("mdmember", device=sdb1.path,)
> self.scheduleCreateFormat(device=sdb1, format=format)
>
> md0 = self.newDevice(device_class=MDRaidArrayDevice,
> - name="md0", level="raid0", minor=0, size=80000,
> + name="md0", level="raid0", minor=0,
> memberDevices=2, totalDevices=2,
> parents=[sdb1, sda3])
> self.scheduleCreateDevice(device=md0)
> @@ -518,8 +539,10 @@ class DeviceActionTestCase(StorageTestCase):
> # shrinks the device's format
> lv_root =
> self.storage.devicetree.getDeviceByName("VolGroup-lv_root")
> self.assertNotEqual(lv_root, None)
> - shrink_format = ActionResizeFormat(lv_root, lv_root.size - 5000)
> - shrink_device = ActionResizeDevice(lv_root, lv_root.size - 5000)
> + shrink_format = ActionResizeFormat(lv_root,
> + lv_root.size - Size(spec="5
> GiB"))
> + shrink_device = ActionResizeDevice(lv_root,
> + lv_root.size - Size(spec="5
> GiB"))
> self.assertEqual(shrink_device.requires(shrink_format), True)
> self.assertEqual(shrink_format.requires(shrink_device), False)
> shrink_format.cancel()
> @@ -529,8 +552,10 @@ class DeviceActionTestCase(StorageTestCase):
> # an action that grows a format should require the action that
> # grows the device
> orig_size = lv_root.currentSize
> - grow_device = ActionResizeDevice(lv_root, orig_size + 100)
> - grow_format = ActionResizeFormat(lv_root, orig_size + 100)
> + grow_device = ActionResizeDevice(lv_root,
> + orig_size + Size(spec="100 MiB"))
> + grow_format = ActionResizeFormat(lv_root,
> + orig_size + Size(spec="100 MiB"))
> self.assertEqual(grow_format.requires(grow_device), True)
> self.assertEqual(grow_device.requires(grow_format), False)
>
> @@ -538,21 +563,21 @@ class DeviceActionTestCase(StorageTestCase):
> self.destroyAllDevices()
> sda = self.storage.devicetree.getDeviceByName("sda")
> sdb = self.storage.devicetree.getDeviceByName("sdb")
> - sda1 = self.newDevice(device_class=PartitionDevice,
> - name="sda1", size=500, parents=[sda])
> + sda1 = self.newDevice(device_class=PartitionDevice, name="sda1",
> + size=Size(spec="500 MiB"), parents=[sda])
> sda1_format = self.newFormat("ext4", mountpoint="/boot",
> device=sda1.path)
> self.scheduleCreateDevice(device=sda1)
> self.scheduleCreateFormat(device=sda1, format=sda1_format)
>
> - sda2 = self.newDevice(device_class=PartitionDevice,
> - name="sda2", size=99500, parents=[sda])
> + sda2 = self.newDevice(device_class=PartitionDevice, name="sda2",
> + size=Size(spec="99.5 GiB"), parents=[sda])
> sda2_format = self.newFormat("lvmpv", device=sda1.path)
> self.scheduleCreateDevice(device=sda2)
> self.scheduleCreateFormat(device=sda2, format=sda2_format)
>
> - sdb1 = self.newDevice(device_class=PartitionDevice,
> - name="sdb1", size=100000, parents=[sdb])
> + sdb1 = self.newDevice(device_class=PartitionDevice, name="sdb1",
> + size=Size(spec="100 GiB"), parents=[sdb])
> sdb1_format = self.newFormat("lvmpv", device=sdb1.path)
> self.scheduleCreateDevice(device=sdb1)
> self.scheduleCreateFormat(device=sdb1, format=sdb1_format)
> @@ -562,13 +587,15 @@ class DeviceActionTestCase(StorageTestCase):
> self.scheduleCreateDevice(device=vg)
>
> lv_root = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_root", parents=[vg], size=160000)
> + name="lv_root", parents=[vg],
> + size=Size(spec="160 GiB"))
> self.scheduleCreateDevice(device=lv_root)
> format = self.newFormat("ext4", device=lv_root.path, mountpoint="/")
> self.scheduleCreateFormat(device=lv_root, format=format)
>
> lv_swap = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="lv_swap", parents=[vg], size=4000)
> + name="lv_swap", parents=[vg],
> + size=Size(spec="4 GiB"))
> self.scheduleCreateDevice(device=lv_swap)
> format = self.newFormat("swap", device=lv_swap.path)
> self.scheduleCreateFormat(device=lv_swap, format=format)
> @@ -622,13 +649,13 @@ class DeviceActionTestCase(StorageTestCase):
> sdc = self.storage.devicetree.getDeviceByName("sdc")
> self.assertNotEqual(sdc, None)
>
> - sdc1 = self.newDevice(device_class=PartitionDevice,
> - name="sdc1", parents=[sdc], size=50000)
> + sdc1 = self.newDevice(device_class=PartitionDevice, name="sdc1",
> + parents=[sdc], size=Size(spec="50 GiB"))
> create_sdc1 = self.scheduleCreateDevice(device=sdc1)
> self.assertEqual(isinstance(create_sdc1, ActionCreateDevice), True)
>
> - sdc2 = self.newDevice(device_class=PartitionDevice,
> - name="sdc2", parents=[sdc], size=50000)
> + sdc2 = self.newDevice(device_class=PartitionDevice, name="sdc2",
> + parents=[sdc], size=Size(spec="50 GiB"))
> create_sdc2 = self.scheduleCreateDevice(device=sdc2)
> self.assertEqual(isinstance(create_sdc2, ActionCreateDevice), True)
>
> @@ -659,20 +686,20 @@ class DeviceActionTestCase(StorageTestCase):
> sdd = self.storage.devicetree.getDeviceByName("sdd")
> self.assertNotEqual(sdd, None)
>
> - sdc1 = self.newDevice(device_class=PartitionDevice,
> - name="sdc1", parents=[sdc], size=40000)
> + sdc1 = self.newDevice(device_class=PartitionDevice, name="sdc1",
> + parents=[sdc], size=Size(spec="40 GiB"))
> self.scheduleCreateDevice(device=sdc1)
> format = self.newFormat("mdmember", device=sdc1.path)
> self.scheduleCreateFormat(device=sdc1, format=format)
>
> - sdd1 = self.newDevice(device_class=PartitionDevice,
> - name="sdd1", parents=[sdd], size=40000)
> + sdd1 = self.newDevice(device_class=PartitionDevice, name="sdd1",
> + parents=[sdd], size=Size(spec="40 GiB"))
> self.scheduleCreateDevice(device=sdd1)
> format = self.newFormat("mdmember", device=sdd1.path,)
> self.scheduleCreateFormat(device=sdd1, format=format)
>
> md0 = self.newDevice(device_class=MDRaidArrayDevice,
> - name="md0", level="raid0", minor=0, size=80000,
> + name="md0", level="raid0", minor=0,
> memberDevices=2, totalDevices=2,
> parents=[sdc1, sdd1])
> self.scheduleCreateDevice(device=md0)
> @@ -696,12 +723,12 @@ class DeviceActionTestCase(StorageTestCase):
> # partition should require the action that will destroy the higher-
> # numbered partition, eg: destroy sda2 before destroying sda1
> self.destroyAllDevices(disks=["sdc", "sdd"])
> - sdc1 = self.newDevice(device_class=PartitionDevice,
> - name="sdc1", parents=[sdc], size=50000)
> + sdc1 = self.newDevice(device_class=PartitionDevice, name="sdc1",
> + parents=[sdc], size=Size(spec="50 GiB"))
> self.scheduleCreateDevice(device=sdc1)
>
> - sdc2 = self.newDevice(device_class=PartitionDevice,
> - name="sdc2", parents=[sdc], size=40000)
> + sdc2 = self.newDevice(device_class=PartitionDevice, name="sdc2",
> + parents=[sdc], size=Size(spec="40 GiB"))
> self.scheduleCreateDevice(device=sdc2)
>
> destroy_sdc1 = self.scheduleDestroyDevice(device=sdc1)
> @@ -715,17 +742,18 @@ class DeviceActionTestCase(StorageTestCase):
> sdd = self.storage.devicetree.getDeviceByName("sdd")
> self.assertNotEqual(sdd, None)
>
> - sdc1 = self.newDevice(device_class=PartitionDevice,
> - name="sdc1", parents=[sdc], size=50000)
> + sdc1 = self.newDevice(device_class=PartitionDevice, name="sdc1",
> + parents=[sdc], size=Size(spec="50 GiB"))
> create_pv = self.scheduleCreateDevice(device=sdc1)
> format = self.newFormat("lvmpv", device=sdc1.path)
> create_pv_format = self.scheduleCreateFormat(device=sdc1,
> format=format)
>
> testvg = self.newDevice(device_class=LVMVolumeGroupDevice,
> - name="testvg", parents=[sdc1], size=50000)
> + name="testvg", parents=[sdc1])
> create_vg = self.scheduleCreateDevice(device=testvg)
> testlv = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - name="testlv", parents=[testvg], size=30000)
> + name="testlv", parents=[testvg],
> + size=Size(spec="30 GiB"))
> create_lv = self.scheduleCreateDevice(device=testlv)
> format = self.newFormat("ext4", device=testlv.path)
> create_lv_format = self.scheduleCreateFormat(device=testlv,
> format=format)
> @@ -750,14 +778,16 @@ class DeviceActionTestCase(StorageTestCase):
> # we instantiate and use actions directly
> self.destroyAllDevices(disks=["sdc", "sdd"])
> sdc1 = self.newDevice(device_class=PartitionDevice, exists=True,
> - name="sdc1", parents=[sdc], size=50000)
> + name="sdc1", parents=[sdc],
> + size=Size(spec="50 GiB"))
> sdc1.format = self.newFormat("lvmpv", device=sdc1.path, exists=True,
> device_instance=sdc1)
> testvg = self.newDevice(device_class=LVMVolumeGroupDevice,
> exists=True,
> - name="testvg", parents=[sdc1], size=50000)
> + name="testvg", parents=[sdc1],
> + size=Size(spec="50 GiB"))
> testlv = self.newDevice(device_class=LVMLogicalVolumeDevice,
> - exists=True,
> - name="testlv", parents=[testvg], size=30000)
> + exists=True, size=Size(spec="30 GiB"),
> + name="testlv", parents=[testvg])
> testlv.format = self.newFormat("ext4", device=testlv.path,
> exists=True, device_instance=testlv)
>
> @@ -769,9 +799,10 @@ class DeviceActionTestCase(StorageTestCase):
> sdc1.format = None # since lvmpv format is not resizable
> sdc1.exists = True
> sdc1.format.exists = True
> - grow_pv = ActionResizeDevice(sdc1, sdc1.size + 10000)
> - grow_lv = ActionResizeDevice(testlv, testlv.size + 5000)
> - grow_lv_format = ActionResizeFormat(testlv, testlv.size + 5000)
> + grow_pv = ActionResizeDevice(sdc1, sdc1.size + Size(spec="10 GiB"))
> + grow_lv = ActionResizeDevice(testlv, testlv.size + Size(spec="5
> GiB"))
> + grow_lv_format = ActionResizeFormat(testlv,
> + testlv.size + Size(spec="5
> GiB"))
> sdc1.exists = False
> sdc1.format.exists = False
>
> @@ -811,10 +842,11 @@ class DeviceActionTestCase(StorageTestCase):
> # an action that resizes a device should require an action that
> # shrinks a device that depends on the first action's device, eg:
> # shrink LV before resizing VG or PV devices
> - shrink_lv = ActionResizeDevice(testlv, testlv.size - 10000)
> + shrink_lv = ActionResizeDevice(testlv,
> + testlv.size - Size(spec="10 GiB"))
> sdc1.exists = True
> sdc1.format.exists = True
> - shrink_pv = ActionResizeDevice(sdc1, sdc1.size - 5000)
> + shrink_pv = ActionResizeDevice(sdc1, sdc1.size - Size(spec="5 GiB"))
> sdc1.exists = False
> sdc1.format.exists = False
>
> @@ -859,7 +891,7 @@ class DeviceActionTestCase(StorageTestCase):
> # ActionCreateFormat
> # an action that creates a format on a device should require an
> action
> # that resizes the device that will contain the format
> - grow_lv = ActionResizeDevice(testlv, testlv.size + 1000)
> + grow_lv = ActionResizeDevice(testlv, testlv.size + Size(spec="1
> GiB"))
> format = self.newFormat("msdos", device=testlv.path)
> format_lv = ActionCreateFormat(testlv, format)
> self.assertEqual(format_lv.requires(grow_lv), True)
> --
> 1.8.5.3
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>
Ack.
- mulhern
More information about the anaconda-patches
mailing list