nic_ip = ip
- # TODO: check the ip address for uniqueness
- if nic_mode == constants.NIC_MODE_ROUTED and not nic_ip:
- raise errors.OpPrereqError("Routed nic mode requires an ip address",
- errors.ECODE_INVAL)
-
# MAC address verification
mac = nic.get(constants.INIC_MAC, constants.VALUE_AUTO)
if mac not in (constants.VALUE_AUTO, constants.VALUE_GENERATE):
elif new_mode == constants.NIC_MODE_ROUTED:
ip = params.get(constants.INIC_IP, old_ip)
if ip is None:
- raise errors.OpPrereqError("Cannot set the NIC IP address to None"
- " on a routed NIC", errors.ECODE_INVAL)
+ self.LogInfo("Allowing mode=routed, ip=None (can have an ip6)")
elif new_mode == constants.NIC_MODE_OVS:
# TODO: check OVS link
nics=[{
constants.INIC_MODE: constants.NIC_MODE_ROUTED
}])
- self.ExecOpCodeExpectOpPrereqError(
- op, "Routed nic mode requires an ip address")
+ self.ExecOpCode(op)
def testValicMac(self):
op = self.CopyOpCode(self.diskless_op,
{
constants.INIC_MODE: constants.NIC_MODE_ROUTED
})])
- self.ExecOpCodeExpectOpPrereqError(
- op, "Cannot set the NIC IP address to None on a routed NIC")
+ self.ExecOpCode(op)
def testModifyNicSetMac(self):
op = self.CopyOpCode(self.op,