[blivet:master 01/13] Change uuid parameter to array_uuid

mulhern amulhern at redhat.com
Wed Jul 9 17:16:17 UTC 2014


Motivation is to avoid name conflict with uuid import, but new name
is a bit more descriptive.
Improve method docstring a bit as well.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/devicelibs/mdraid.py          | 21 +++++++++++++--------
 blivet/devices.py                    |  2 +-
 tests/devicelibs_test/mdraid_test.py |  2 +-
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/blivet/devicelibs/mdraid.py b/blivet/devicelibs/mdraid.py
index 7893cc1..67edb0c 100644
--- a/blivet/devicelibs/mdraid.py
+++ b/blivet/devicelibs/mdraid.py
@@ -182,22 +182,27 @@ def mdremove(array, device, fail=False):
     except MDRaidError as msg:
         raise MDRaidError("mdremove failed for %s: %s" % (device, msg))
 
-def mdactivate(device, members=None, uuid=None):
+def mdactivate(device, members=None, array_uuid=None):
     """Assemble devices given by members into a single device.
 
-       Use uuid value to identify devices in members to include in device.
+       Use array_uuid to identify the devices in members to include in
+       the assembled array.
 
-       :param device: the device to be assembled
-       :param type: str
-       :param members: the component devices
-       :param type: list of str or NoneType
+       :param str device: the device to be assembled
+       :param members: the component devices to be considered for inclusion
+       :type members: list of str or NoneType
+       :param array_uuid: the UUID of the array
+       :type array_uuid: str or NoneType
+
+       :raises: :class:`~.errors.MDRaidError` if no array_uuid specified
+       or assembly failed
     """
     members = members or []
 
-    if not uuid:
+    if not array_uuid:
         raise MDRaidError("mdactivate requires a uuid")
 
-    identifier = "--uuid=%s" % uuid
+    identifier = "--uuid=%s" % array_uuid
 
     args = ["--assemble", device, identifier, "--run"]
     args += members
diff --git a/blivet/devices.py b/blivet/devices.py
index 664406f..c3da7f6 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -3952,7 +3952,7 @@ class MDRaidArrayDevice(ContainerDevice):
 
         mdraid.mdactivate(self.path,
                           members=disks,
-                          uuid=self.uuid)
+                          array_uuid=self.uuid)
 
     def _postTeardown(self, recursive=False):
         super(MDRaidArrayDevice, self)._postTeardown(recursive=recursive)
diff --git a/tests/devicelibs_test/mdraid_test.py b/tests/devicelibs_test/mdraid_test.py
index cba8487..d2ad45d 100755
--- a/tests/devicelibs_test/mdraid_test.py
+++ b/tests/devicelibs_test/mdraid_test.py
@@ -99,7 +99,7 @@ class MDRaidAsRootTestCase(loopbackedtestcase.LoopBackedTestCase):
         ##
         ## mdactivate
         ##
-        self.assertRaises(MDRaidError, mdraid.mdactivate, "/not/existing/md", uuid=32)
+        self.assertRaises(MDRaidError, mdraid.mdactivate, "/not/existing/md", array_uuid=32)
         # requires uuid
         self.assertRaises(MDRaidError, mdraid.mdactivate, "/dev/md1")
 
-- 
1.9.3



More information about the anaconda-patches mailing list