Change in vdsm[ovirt-3.4]: virt: keep on sampling before /var/run/vdsm/client.log exists
danken at redhat.com
danken at redhat.com
Tue Aug 19 09:48:39 UTC 2014
Hello Antoni Segura Puimedon, Francesco Romani,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/31656
to review the following change.
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/1122010
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/31619
Reviewed-by: Antoni Segura Puimedon <asegurap at redhat.com>
Reviewed-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/configNetwork.py
M vdsm/sampling.py
2 files changed, 18 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/31656/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 98f6c10..a339da9 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -18,6 +18,7 @@
#
from functools import wraps
+import errno
import inspect
import sys
import os
@@ -428,8 +429,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/sampling.py b/vdsm/sampling.py
index 51adcb5..fe4e3be 100644
--- a/vdsm/sampling.py
+++ b/vdsm/sampling.py
@@ -205,9 +205,15 @@
self.thpState = 'never'
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/31656
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb7d380882f5a93e5c75eda80598f382744b178c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
More information about the vdsm-patches
mailing list