Revision d43a4dd9

b/lib/cmdlib/instance.py
207 207

  
208 208
      nic_ip = ip
209 209

  
210
    # TODO: check the ip address for uniqueness
211
    if nic_mode == constants.NIC_MODE_ROUTED and not nic_ip:
212
      raise errors.OpPrereqError("Routed nic mode requires an ip address",
213
                                 errors.ECODE_INVAL)
214

  
215 210
    # MAC address verification
216 211
    mac = nic.get(constants.INIC_MAC, constants.VALUE_AUTO)
217 212
    if mac not in (constants.VALUE_AUTO, constants.VALUE_GENERATE):
......
2630 2625
    elif new_mode == constants.NIC_MODE_ROUTED:
2631 2626
      ip = params.get(constants.INIC_IP, old_ip)
2632 2627
      if ip is None:
2633
        raise errors.OpPrereqError("Cannot set the NIC IP address to None"
2634
                                   " on a routed NIC", errors.ECODE_INVAL)
2628
        self.LogInfo("Allowing mode=routed, ip=None (can have an ip6)")
2635 2629

  
2636 2630
    elif new_mode == constants.NIC_MODE_OVS:
2637 2631
      # TODO: check OVS link
b/test/py/cmdlib/instance_unittest.py
218 218
                         nics=[{
219 219
                           constants.INIC_MODE: constants.NIC_MODE_ROUTED
220 220
                         }])
221
    self.ExecOpCodeExpectOpPrereqError(
222
      op, "Routed nic mode requires an ip address")
221
    self.ExecOpCode(op)
223 222

  
224 223
  def testValicMac(self):
225 224
    op = self.CopyOpCode(self.diskless_op,
......
2009 2008
                                {
2010 2009
                                  constants.INIC_MODE: constants.NIC_MODE_ROUTED
2011 2010
                                })])
2012
    self.ExecOpCodeExpectOpPrereqError(
2013
      op, "Cannot set the NIC IP address to None on a routed NIC")
2011
    self.ExecOpCode(op)
2014 2012

  
2015 2013
  def testModifyNicSetMac(self):
2016 2014
    op = self.CopyOpCode(self.op,

Also available in: Unified diff