Support reseting arbitrary params of ext disks
[ganeti-local] / lib / objects.py
index 8d809c4..358f108 100644 (file)
@@ -828,9 +828,18 @@ class Disk(ConfigObject):
         child.UpgradeConfig()
 
     # FIXME: Make this configurable in Ganeti 2.7
-    self.params = {}
+    # Params should be an empty dict that gets filled any time needed
+    # In case of ext template we allow arbitrary params that should not
+    # be overrided during a config reload/upgrade.
+    if not self.params or not isinstance(self.params, dict):
+      self.params = {}
+
     # add here config upgrade for this disk
 
+    # If the file driver is empty, fill it up with the default value
+    if self.dev_type == constants.LD_FILE and self.physical_id[0] is None:
+      self.physical_id[0] = constants.FD_DEFAULT
+
   @staticmethod
   def ComputeLDParams(disk_template, disk_params):
     """Computes Logical Disk parameters from Disk Template parameters.
@@ -1057,6 +1066,7 @@ class Instance(TaggableObject):
     "nics",
     "disks",
     "disk_template",
+    "disks_active",
     "network_port",
     "serial_no",
     ] + _TIMESTAMPS + _UUID
@@ -1222,6 +1232,8 @@ class Instance(TaggableObject):
     if self.osparams is None:
       self.osparams = {}
     UpgradeBeParams(self.beparams)
+    if self.disks_active is None:
+      self.disks_active = self.admin_state == constants.ADMINST_UP
 
 
 class OS(ConfigObject):
@@ -1516,6 +1528,7 @@ class Cluster(TaggableObject):
   __slots__ = [
     "serial_no",
     "rsahostkeypub",
+    "dsahostkeypub",
     "highest_used_port",
     "tcpudp_port_pool",
     "mac_prefix",