Nir Soffer has uploaded a new change for review.
Change subject: mount: Log info message when mounting or unmounting
......................................................................
mount: Log info message when mounting or unmounting
Mounting and unmounting are important modifications to the machine state
and must be logged. Since actual mount command run now in supervdsm, we
have no clue about mounting and unmounting operations in vdsm log.
To help debugging issues with unresponsive mounts, we log the time it
took to mount or unmount.
Change-Id: Idc89d6a1bfa0e9d117344d8870d81fed140d03c6
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/mount.py
1 file changed, 21 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/43974/1
diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index 1da15c6..b4e069d 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -19,6 +19,7 @@
#
from collections import namedtuple
import errno
+import logging
from os.path import normpath
import re
import os
@@ -27,6 +28,7 @@
from vdsm import cmdutils
from vdsm import constants
+from vdsm import utils
import supervdsm
import misc
@@ -195,6 +197,9 @@
class Mount(object):
+
+ log = logging.getLogger("storage.Mount")
+
def __init__(self, fs_spec, fs_file):
self.fs_spec = normpath(fs_spec)
self.fs_file = normpath(fs_file)
@@ -216,14 +221,24 @@
return hsh
def mount(self, mntOpts=None, vfstype=None, timeout=None, cgroup=None):
- mount = supervdsm.getProxy().mount if os.geteuid() != 0 else _mount
- mount(self.fs_spec, self.fs_file, mntOpts=mntOpts, vfstype=vfstype,
- timeout=timeout, cgroup=cgroup)
+ self.log.info("mounting %s at %s", self.fs_spec, self.fs_file)
+ with utils.stopwatch("%s mounted" % self.fs_file, log=self.log):
+ if os.geteuid() != 0:
+ mount = supervdsm.getProxy().mount
+ else:
+ mount = _mount
+ mount(self.fs_spec, self.fs_file, mntOpts=mntOpts, vfstype=vfstype,
+ timeout=timeout, cgroup=cgroup)
def umount(self, force=False, lazy=False, freeloop=False, timeout=None):
- umount = supervdsm.getProxy().umount if os.geteuid() != 0 else _umount
- umount(self.fs_file, force=force, lazy=lazy, freeloop=freeloop,
- timeout=timeout)
+ self.log.info("unmounting %s", self.fs_file)
+ with utils.stopwatch("%s unmounted" % self.fs_file, log=self.log):
+ if os.geteuid() != 0:
+ umount = supervdsm.getProxy().umount
+ else:
+ umount = _umount
+ umount(self.fs_file, force=force, lazy=lazy, freeloop=freeloop,
+ timeout=timeout)
def isMounted(self):
try:
--
To view, visit
https://gerrit.ovirt.org/43974
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc89d6a1bfa0e9d117344d8870d81fed140d03c6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>