mirror of https://github.com/apache/cloudstack.git
vrouter: reload keepalived instead of restart and fix password… (#3898)
This commit is contained in:
parent
faccec4142
commit
3f8b2c369d
|
|
@ -61,7 +61,7 @@ class CsPassword(CsDataBag):
|
|||
server_ip = None
|
||||
guest_ip = None
|
||||
for interface in self.config.address().get_interfaces():
|
||||
if interface.ip_in_subnet(vm_ip):
|
||||
if interface.ip_in_subnet(vm_ip) and interface.is_added():
|
||||
if self.config.cl.is_redundant():
|
||||
server_ip = interface.get_gateway()
|
||||
guest_ip = interface.get_ip()
|
||||
|
|
|
|||
|
|
@ -581,6 +581,11 @@ class CsIP:
|
|||
CsPasswdSvc(self.address['public_ip']).start()
|
||||
elif method == "delete":
|
||||
CsPasswdSvc(self.address['public_ip']).stop()
|
||||
elif cmdline.is_master():
|
||||
if method == "add":
|
||||
CsPasswdSvc(self.address['gateway'] + "," + self.address['public_ip']).start()
|
||||
elif method == "delete":
|
||||
CsPasswdSvc(self.address['gateway'] + "," + self.address['public_ip']).stop()
|
||||
|
||||
if self.get_type() == "public" and self.config.is_vpc() and method == "add":
|
||||
if self.address["source_nat"]:
|
||||
|
|
|
|||
|
|
@ -194,10 +194,15 @@ class CsRedundant(object):
|
|||
heartbeat_cron.commit()
|
||||
|
||||
proc = CsProcess(['/usr/sbin/keepalived'])
|
||||
if not proc.find() or keepalived_conf.is_changed() or force_keepalived_restart:
|
||||
if not proc.find():
|
||||
force_keepalived_restart = True
|
||||
if keepalived_conf.is_changed() or force_keepalived_restart:
|
||||
keepalived_conf.commit()
|
||||
os.chmod(self.KEEPALIVED_CONF, 0o644)
|
||||
CsHelper.service("keepalived", "restart")
|
||||
if force_keepalived_restart or not self.cl.is_master():
|
||||
CsHelper.service("keepalived", "restart")
|
||||
else:
|
||||
CsHelper.service("keepalived", "reload")
|
||||
|
||||
def release_lock(self):
|
||||
try:
|
||||
|
|
@ -339,7 +344,8 @@ class CsRedundant(object):
|
|||
|
||||
interfaces = [interface for interface in self.address.get_interfaces() if interface.needs_vrrp()]
|
||||
for interface in interfaces:
|
||||
CsPasswdSvc(interface.get_gateway() + "," + interface.get_ip()).restart()
|
||||
if interface.is_added():
|
||||
CsPasswdSvc(interface.get_gateway() + "," + interface.get_ip()).restart()
|
||||
|
||||
CsHelper.service("dnsmasq", "restart")
|
||||
self.cl.set_master_state(True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue