(ipfix) Allow NICs with mode=routed and ip=none
authorDimitris Aragiorgis <dimara@grnet.gr>
Mon, 16 Dec 2013 01:13:48 +0000 (03:13 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Thu, 29 May 2014 11:08:02 +0000 (14:08 +0300)
This allows us to define an IPv6 only network (currently with a
dummy IPv4 network) with connectivity mode 'routed' and let
the NICs inside this network have only IPv6 address (auto-generated
from their MAC and the network's prefix).

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

lib/cmdlib/instance.py
test/py/cmdlib/instance_unittest.py

index de2b4d8..d77288a 100644 (file)
@@ -207,11 +207,6 @@ def _ComputeNics(op, cluster, default_ip, cfg, ec_id):
 
       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):
@@ -2630,8 +2625,7 @@ class LUInstanceSetParams(LogicalUnit):
     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
index 325f1da..62038c8 100644 (file)
@@ -218,8 +218,7 @@ class TestLUInstanceCreate(CmdlibTestCase):
                          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,
@@ -2009,8 +2008,7 @@ class TestLUInstanceSetParams(CmdlibTestCase):
                                 {
                                   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,