Dan Kenigsberg has uploaded a new change for review. Change subject: virt: keep on sampling before /var/run/vdsm/client.log exists ......................................................................
virt: keep on sampling before /var/run/vdsm/client.log exists My commit 24c8e24 has introduced a serious bug: if vdsm is started before /var/run/vdsm/client.log is created (which is the common case for new installations), the host-sampling thread would stop when it fails to find it. This patch explicitly handles the case of a missing /var/run/vdsm/client.log on the two locations that attempted to read its time. Change-Id: Ibb7d380882f5a93e5c75eda80598f382744b178c Bug-Url: https://bugzilla.redhat.com/1111234 Signed-off-by: Dan Kenigsberg <[email protected]> --- M vdsm/network/api.py M vdsm/virt/sampling.py 2 files changed, 18 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/31619/1 diff --git a/vdsm/network/api.py b/vdsm/network/api.py index b2cfa41..c059b51 100755 --- a/vdsm/network/api.py +++ b/vdsm/network/api.py @@ -18,6 +18,7 @@ # from functools import wraps +import errno import inspect import sys import os @@ -472,8 +473,14 @@ def clientSeen(timeout): start = time.time() while timeout >= 0: - if os.stat(constants.P_VDSM_CLIENT_LOG).st_mtime > start: - return True + try: + if os.stat(constants.P_VDSM_CLIENT_LOG).st_mtime > start: + return True + except OSError as e: + if e.errno == errno.ENOENT: + pass # P_VDSM_CLIENT_LOG is not yet there + else: + raise time.sleep(1) timeout -= 1 return False diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py index 99d2585..d6bef32 100644 --- a/vdsm/virt/sampling.py +++ b/vdsm/virt/sampling.py @@ -280,9 +280,15 @@ self.cpuCores = CpuCoreSample() self.numaNodeMem = NumaNodeMemorySample() ENGINE_DEFAULT_POLL_INTERVAL = 15 - self.recentClient = ( - self.timestamp - os.stat(P_VDSM_CLIENT_LOG).st_mtime < - 2 * ENGINE_DEFAULT_POLL_INTERVAL) + try: + self.recentClient = ( + self.timestamp - os.stat(P_VDSM_CLIENT_LOG).st_mtime < + 2 * ENGINE_DEFAULT_POLL_INTERVAL) + except OSError as e: + if e.errno == errno.ENOENT: + self.recentClient = False + else: + raise def to_connlog(self): text = ', '.join( -- To view, visit http://gerrit.ovirt.org/31619 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibb7d380882f5a93e5c75eda80598f382744b178c Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
