The only patch that was changed (other than according to suggestions), was "Add a few small tests...".
mulhern (7): Remove unnecessary fanciness about importing devices. Do not use udev info to get the name of the device. Add a few small tests for mdexamine Add a method to get the uuid of an md array member (#1070095) Canonicalize mdadm generated UUIDS (#1070095) Reset the uuid of the mdraid member device from mdexamine info (#1070095) Remove always succeeding check from udev_device_get_uuid() (#1070095)
blivet/devicelibs/mdraid.py | 9 +++++++++ blivet/devicetree.py | 11 +++++++--- blivet/udev.py | 31 +++++++++++++++++++--------- tests/devicelibs_test/mdraid_test.py | 39 ++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 12 deletions(-)
Signed-off-by: mulhern amulhern@redhat.com --- tests/devicelibs_test/mdraid_test.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/tests/devicelibs_test/mdraid_test.py b/tests/devicelibs_test/mdraid_test.py index cba8487..b9943d4 100755 --- a/tests/devicelibs_test/mdraid_test.py +++ b/tests/devicelibs_test/mdraid_test.py @@ -66,6 +66,11 @@ class MDRaidAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
super(MDRaidAsRootTestCase, self).tearDown()
+ def testNonMDRaid(self): + # invoking mdexamine on a device that is not an array member yields {} + info = mdraid.mdexamine(self.loopDevices[0]) + self.assertEqual(info, {}) + def testMDRaidAsRoot(self): ## ## mdcreate @@ -75,6 +80,35 @@ class MDRaidAsRootTestCase(loopbackedtestcase.LoopBackedTestCase): # wait for raid to settle time.sleep(2)
+ info = mdraid.mdexamine(self._dev_name) + self.assertEqual(info, {}) + + info = mdraid.mdexamine(self.loopDevices[0]) + + names = [ + 'DEVICE', + 'MD_ARRAY_SIZE', + 'MD_DEV_UUID', + 'MD_DEVICES', + 'MD_EVENTS', + 'MD_LEVEL', + 'MD_METADATA', + 'MD_NAME', + 'MD_UPDATE_TIME', + 'MD_UUID' + ] + + # info contains values for exactly names + for n in names: + self.assertIn(n, info, msg="name '%s' not in info" % n) + + for n in info.keys(): + self.assertIn(n, names, msg="unexpected name '%s' in info" % n) + + # check names with predictable values + self.assertEqual(info['MD_DEVICES'], '2') + self.assertEqual(info['MD_LEVEL'], 'raid1') + # fail self.assertRaises(MDRaidError, mdraid.mdcreate, "/dev/md1", "raid1", ["/not/existing/dev0", "/not/existing/dev1"])
On 06/25/2014 08:01 AM, mulhern wrote:
Signed-off-by: mulhern amulhern@redhat.com
tests/devicelibs_test/mdraid_test.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/tests/devicelibs_test/mdraid_test.py b/tests/devicelibs_test/mdraid_test.py index cba8487..b9943d4 100755 --- a/tests/devicelibs_test/mdraid_test.py +++ b/tests/devicelibs_test/mdraid_test.py @@ -66,6 +66,11 @@ class MDRaidAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
super(MDRaidAsRootTestCase, self).tearDown()
- def testNonMDRaid(self):
# invoking mdexamine on a device that is not an array member yields {}
info = mdraid.mdexamine(self.loopDevices[0])
self.assertEqual(info, {})
def testMDRaidAsRoot(self): ## ## mdcreate
@@ -75,6 +80,35 @@ class MDRaidAsRootTestCase(loopbackedtestcase.LoopBackedTestCase): # wait for raid to settle time.sleep(2)
info = mdraid.mdexamine(self._dev_name)
self.assertEqual(info, {})
info = mdraid.mdexamine(self.loopDevices[0])
names = [
'DEVICE',
'MD_ARRAY_SIZE',
'MD_DEV_UUID',
'MD_DEVICES',
'MD_EVENTS',
'MD_LEVEL',
'MD_METADATA',
'MD_NAME',
'MD_UPDATE_TIME',
'MD_UUID'
]
# info contains values for exactly names
for n in names:
self.assertIn(n, info, msg="name '%s' not in info" % n)
for n in info.keys():
self.assertIn(n, names, msg="unexpected name '%s' in info" % n)
# check names with predictable values
self.assertEqual(info['MD_DEVICES'], '2')
self.assertEqual(info['MD_LEVEL'], 'raid1')
# fail self.assertRaises(MDRaidError, mdraid.mdcreate, "/dev/md1", "raid1", ["/not/existing/dev0", "/not/existing/dev1"])
IIRC the set of output fields ("names" above) varies depending on the metadata version used on the member device. That doesn't have to mean changes to this patch, but you should be aware of it.
David
anaconda-patches@lists.fedorahosted.org