Add Disks and NICs to _AllUUIDObjects
authorChristos Stavrakakis <cstavr@grnet.gr>
Thu, 4 Apr 2013 08:51:13 +0000 (11:51 +0300)
committerHelga Velroyen <helgav@google.com>
Wed, 17 Apr 2013 16:04:53 +0000 (18:04 +0200)
Since disks and NICs have UUIDs, they must be considered
to _AllUUIDObjects.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/config.py

index 050cdac..6c82991 100644 (file)
@@ -445,6 +445,24 @@ class ConfigWriter:
         lvnames.update(lv_list)
     return lvnames
 
+  def _AllDisks(self):
+    """Compute the list of all Disks.
+
+    """
+    disks = []
+    for instance in self._config_data.instances.values():
+      disks.extend(instance.disks)
+    return disks
+
+  def _AllNICs(self):
+    """Compute the list of all NICs.
+
+    """
+    nics = []
+    for instance in self._config_data.instances.values():
+      nics.extend(instance.nics)
+    return nics
+
   def _AllIDs(self, include_temporary):
     """Compute the list of all UUIDs and names we have.
 
@@ -2038,6 +2056,8 @@ class ConfigWriter:
             self._config_data.nodes.values() +
             self._config_data.nodegroups.values() +
             self._config_data.networks.values() +
+            self._AllDisks() +
+            self._AllNICs() +
             [self._config_data.cluster])
 
   def _OpenConfig(self, accept_foreign):