Revision 255e19d4 lib/objects.py

b/lib/objects.py
312 312
  """Config object representing a network card."""
313 313
  __slots__ = ["mac", "ip", "bridge"]
314 314

  
315
  @classmethod
316
  def CheckParameterSyntax(cls, nicparams):
317
    """Check the given parameters for validity.
318

  
319
    @type nicparams:  dict
320
    @param nicparams: dictionary with parameter names/value
321
    @raise errors.ConfigurationError: when a parameter is not valid
322

  
323
    """
324
    if nicparams[constants.NIC_MODE] not in constants.NIC_VALID_MODES:
325
      err = "Invalid nic mode: %s" % nicparams[constants.NIC_MODE]
326
      raise errors.ConfigurationError(err)
327

  
328
    if (nicparams[constants.NIC_MODE] is constants.NIC_MODE_BRIDGED and
329
        not nicparams[constants.NIC_LINK]):
330
      err = "Missing bridged nic link"
331
      raise errors.ConfigurationError(err)
332

  
315 333

  
316 334
class Disk(ConfigObject):
317 335
  """Config object representing a block device."""

Also available in: Unified diff