Change in vdsm[master]: superVdsm: create dir '/var/run/vdsm' before creating pid fi...
wudxw at linux.vnet.ibm.com
wudxw at linux.vnet.ibm.com
Mon Jul 15 09:49:57 UTC 2013
Mark Wu has uploaded a new change for review.
Change subject: superVdsm: create dir '/var/run/vdsm' before creating pid file
......................................................................
superVdsm: create dir '/var/run/vdsm' before creating pid file
On new fedora system, the directory '/var/run' is a symbolic of '/run'
which is mounted on tmpfs. The vdsm running state directory '/var/run/vdsm'
can't be persisted across reboot. So we can't rely on the dir created
on installation and we need create that directory dynamically. Supervdsmd
need ensure the direcotry '/var/run/vdsm' exist by itself, otherwise it will
fail to start because it can't create pid file.
Change-Id: I0e1c228d87dafbd88e41d110a5bbf7dd984d8c32
Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
---
M vdsm/supervdsmServer.py
1 file changed, 12 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/16843/1
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index b952063..fa634e5 100644
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -26,6 +26,7 @@
import errno
import threading
import re
+import selinux
from storage import fuser
import signal
from multiprocessing import Pipe, Process
@@ -43,9 +44,9 @@
from supervdsm import _SuperVdsmManager
from storage.fileUtils import chown, resolveGid, resolveUid
from storage.fileUtils import validateAccess as _validateAccess
-from vdsm.constants import METADATA_GROUP, EXT_UDEVADM, \
- DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS, VDSM_USER, \
- P_VDSM_RUN
+from storage.fileUtils import createdir
+from vdsm.constants import METADATA_GROUP, EXT_UDEVADM, DISKIMAGE_USER, \
+ DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS, VDSM_USER, VDSM_GROUP, P_VDSM_RUN
from storage.devicemapper import _removeMapping, _getPathsStatus
import configNetwork
from vdsm.config import config
@@ -336,6 +337,13 @@
return self.__udevVersion() > self.UDEV_WITH_RELOAD_VERSION
+def ensureRunDir():
+ run_dir = P_VDSM_RUN
+ createdir(run_dir)
+ chown(run_dir, VDSM_USER, VDSM_GROUP)
+ selinux.restorecon(run_dir)
+
+
def main():
def bind(func):
def wrapper(_SuperVdsm, *args, **kwargs):
@@ -360,6 +368,7 @@
if os.geteuid() != 0:
sys.exit(errno.EPERM)
+ ensureRunDir()
pidfile = P_VDSM_RUN + 'supervdsmd.pid'
pid = str(os.getpid())
with open(pidfile, 'w') as f:
--
To view, visit http://gerrit.ovirt.org/16843
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e1c228d87dafbd88e41d110a5bbf7dd984d8c32
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw at linux.vnet.ibm.com>
More information about the vdsm-patches
mailing list