[PATCH] Create a getDeps and getTarget function for the block module.

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

 



---
 __init__.py |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/__init__.py b/__init__.py
index 943e127..bb60be6 100644
--- a/__init__.py
+++ b/__init__.py
@@ -60,7 +60,6 @@ def load(name):
     _bd.load(name)
     global _probesLoaded
     _probesLoaded = True
-    
 
 def getDevice(name):
     name = name.split('/')[-1]
@@ -165,11 +164,11 @@ def getRaidSets(*disks):
             disks += list(disk)
         else:
             disks.append(disk)
-        
+
     c = dmraid.context()
     rsList = []
     prefix = "/dev/mapper/"
-    
+
     newdisks = []
     import os as _os
     for x in range(len(disks)):
@@ -190,6 +189,25 @@ def getRaidSets(*disks):
             rsList.append(set)
     return rsList
 
+def getDeps(uuid = None, major = None, minor = None, name = None):
+    # If has dpes, return a set of maps, else return an empty set.
+    for map in dm.maps():
+        if map.name == name or \
+                map.uuid == uuid or \
+                (map.dev.minor == minor and map.dev.major == major):
+            return map.deps
+    return ()
+
+def getTarget(uuid = None, major = None, minor = None, name = None):
+    # Return None if we don't find the map.
+    for map in dm.maps():
+        if map.name == name or \
+                map.uuid == uuid or \
+                (map.dev.minor == minor and map.dev.major == major):
+            return map.table.type
+    return None
+
+
 __all__ = [ "dm", "dmraid", "BlockDev" ]
 
 #
-- 
1.5.6.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux