+ def UpgradeConfig(self):
+ """Fill defaults for missing configuration values.
+
+ """
+ if self.hvparams is None:
+ self.hvparams = constants.HVC_DEFAULTS
+ else:
+ for hypervisor in self.hvparams:
+ self.hvparams[hypervisor] = FillDict(
+ constants.HVC_DEFAULTS[hypervisor], self.hvparams[hypervisor])
+
+ self.beparams = UpgradeGroupedParams(self.beparams,
+ constants.BEC_DEFAULTS)
+ migrate_default_bridge = not self.nicparams
+ self.nicparams = UpgradeGroupedParams(self.nicparams,
+ constants.NICC_DEFAULTS)
+ if migrate_default_bridge:
+ self.nicparams[constants.PP_DEFAULT][constants.NIC_LINK] = \
+ self.default_bridge
+
+ if self.modify_etc_hosts is None:
+ self.modify_etc_hosts = True
+
+ # default_bridge is no longer used it 2.1. The slot is left there to
+ # support auto-upgrading, but will be removed in 2.2
+ if self.default_bridge is not None:
+ self.default_bridge = None
+
+ # default_hypervisor is just the first enabled one in 2.1
+ if self.default_hypervisor is not None:
+ self.enabled_hypervisors = [self.default_hypervisor] + \
+ [hvname for hvname in self.enabled_hypervisors
+ if hvname != self.default_hypervisor]
+ self.default_hypervisor = None
+
+