Server Upgrade: wait until DS is ready

During server upgrade we should wait until DS is ready after restart, otherwise
connection error is raised.

Instead of 389 port, the DS socket is checked.

https://fedorahosted.org/freeipa/ticket/4904

Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Martin Basti
2015-05-21 13:25:10 +02:00
committed by Petr Vobornik
parent 98e4c6d6de
commit 3d17bf8e63
2 changed files with 17 additions and 5 deletions

View File

@@ -153,6 +153,20 @@ class RedHatDirectoryService(RedHatService):
super(RedHatDirectoryService, self).restart(instance_name,
capture_output=capture_output, wait=wait)
def wait_for_open_ports(self, instance_name=""):
if instance_name.endswith('.service'):
instance_name = instance_name[:-8]
if instance_name.startswith('dirsrv@'):
instance_name = instance_name[7:]
if instance_name:
ipautil.wait_for_open_socket(
paths.SLAPD_INSTANCE_SOCKET_TEMPLATE % instance_name,
self.api.env.startup_timeout)
else:
super(RedHatDirectoryService, self).wait_for_open_ports()
class RedHatIPAService(RedHatService):
# Enforce restart of IPA services when we do enable it

View File

@@ -171,10 +171,8 @@ class IPAUpgrade(service.Service):
self.schema_files = schema_files
self.realm = realm_name
def __start_nowait(self):
# Don't wait here because we've turned off port 389. The connection
# we make will wait for the socket.
super(IPAUpgrade, self).start(wait=False)
def __start(self):
super(IPAUpgrade, self).start()
def __stop_instance(self):
"""Stop only the main DS instance"""
@@ -187,7 +185,7 @@ class IPAUpgrade(service.Service):
self.step("saving configuration", self.__save_config)
self.step("disabling listeners", self.__disable_listeners)
self.step("enabling DS global lock", self.__enable_ds_global_write_lock)
self.step("starting directory server", self.__start_nowait)
self.step("starting directory server", self.__start)
if self.schema_files:
self.step("updating schema", self.__update_schema)
self.step("upgrading server", self.__upgrade)