if old_netmask == netmask:
return
+ if not netutils.IPAddress.Own(master_ip):
+ _Fail("The master IP address is not up, not attempting to change its"
+ " netmask")
+
result = utils.RunCmd([constants.IP_COMMAND_PATH, "address", "add",
"%s/%s" % (master_ip, netmask),
"dev", master_netdev, "label",
"%s:0" % master_netdev])
if result.failed:
- _Fail("Could not change the master IP netmask")
+ _Fail("Could not set the new netmask on the master IP address")
result = utils.RunCmd([constants.IP_COMMAND_PATH, "address", "del",
"%s/%s" % (master_ip, old_netmask),
"dev", master_netdev, "label",
"%s:0" % master_netdev])
if result.failed:
- _Fail("Could not change the master IP netmask")
+ _Fail("Could not bring down the master IP address with the old netmask")
def EtcHostsModify(mode, host, ip):
master_params.netdev)
if result.fail_msg:
msg = "Could not change the master IP netmask: %s" % result.fail_msg
- self.LogWarning(msg)
feedback_fn(msg)
- else:
- self.cluster.master_netmask = self.op.master_netmask
+
+ self.cluster.master_netmask = self.op.master_netmask
self.cfg.Update(self.cluster, feedback_fn)