Commit 13f1af63 authored by Guido Trotter's avatar Guido Trotter
Browse files

Add nicparams to the NIC object



Also populate nicparams with a sensible default for imported instances.
Unfortunately we don't know if the bridge set up in old nics is the
default one or not, and we don't have access to the config cluster
object here to verify, so we'll just copy it without questions.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b6e243ab
......@@ -310,7 +310,7 @@ class ConfigData(ConfigObject):
class NIC(ConfigObject):
"""Config object representing a network card."""
__slots__ = ["mac", "ip", "bridge"]
__slots__ = ["mac", "ip", "bridge", "nicparams"]
@classmethod
def CheckParameterSyntax(cls, nicparams):
......@@ -330,6 +330,16 @@ class NIC(ConfigObject):
err = "Missing bridged nic link"
raise errors.ConfigurationError(err)
def UpgradeConfig(self):
"""Fill defaults for missing configuration values.
"""
if self.nicparams is None:
self.nicparams = {}
if self.bridge is not None:
self.nicparams[constants.NIC_MODE] = constants.NIC_MODE_BRIDGED
self.nicparams[constants.NIC_LINK] = self.bridge
class Disk(ConfigObject):
"""Config object representing a block device."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment