Whamcloud - gitweb
- landing b_fid.
[fs/lustre-release.git] / lustre / utils / Lustre / lustredb.py
index eda5779..12656b5 100644 (file)
@@ -27,6 +27,13 @@ class LustreDB:
             return default
         return None
 
+    def get_hostaddr(self):
+       ret = []
+       list = self.dom_node.getElementsByTagName('hostaddr')
+       for node in list:
+           ret.append(node.firstChild.data)
+       return ret
+                
     def get_class(self):
         return self._get_class()
 
@@ -57,6 +64,11 @@ class LustreDB:
         uuids = self._get_all_refs()
         return uuids
 
+    def get_lov_tgts(self, tag):
+        """ Returns list of lovtgts. """
+        tgts = self._get_lov_tgts(tag)
+        return tgts
+
     def nid2server(self, nid, net_type, cluster_id):
         netlist = self.lookup_class('network')
         for net_db in netlist:
@@ -183,6 +195,18 @@ class LustreDB_XML(LustreDB):
             uuids.append(self.xml_get_ref(r))
         return uuids
 
+    def _get_lov_tgts(self, tag):
+        """ Get all the refs of type TAG.  Returns list of lov_tgts. """
+        tgts = []
+        tgtlist = self.dom_node.getElementsByTagName(tag)
+        for tgt in tgtlist:
+            uuidref = tgt.getAttribute('uuidref')
+            index = tgt.getAttribute('index')
+            generation = tgt.getAttribute('generation')
+            active = int(tgt.getAttribute('active'))
+            tgts.append((uuidref, index, generation, active))
+        return tgts
+
     def xmllookup_by_uuid(self, dom_node, uuid):
         for n in dom_node.childNodes:
             if n.nodeType == n.ELEMENT_NODE: