Revision 13f1af63
b/lib/objects.py | ||
---|---|---|
310 | 310 |
|
311 | 311 |
class NIC(ConfigObject): |
312 | 312 |
"""Config object representing a network card.""" |
313 |
__slots__ = ["mac", "ip", "bridge"] |
|
313 |
__slots__ = ["mac", "ip", "bridge", "nicparams"]
|
|
314 | 314 |
|
315 | 315 |
@classmethod |
316 | 316 |
def CheckParameterSyntax(cls, nicparams): |
... | ... | |
330 | 330 |
err = "Missing bridged nic link" |
331 | 331 |
raise errors.ConfigurationError(err) |
332 | 332 |
|
333 |
def UpgradeConfig(self): |
|
334 |
"""Fill defaults for missing configuration values. |
|
335 |
|
|
336 |
""" |
|
337 |
if self.nicparams is None: |
|
338 |
self.nicparams = {} |
|
339 |
if self.bridge is not None: |
|
340 |
self.nicparams[constants.NIC_MODE] = constants.NIC_MODE_BRIDGED |
|
341 |
self.nicparams[constants.NIC_LINK] = self.bridge |
|
342 |
|
|
333 | 343 |
|
334 | 344 |
class Disk(ConfigObject): |
335 | 345 |
"""Config object representing a block device.""" |
Also available in: Unified diff