Dan Kenigsberg has uploaded a new change for review.

Change subject: lvm.env: move to /usr/share/vdsm/storage
......................................................................

lvm.env: move to /usr/share/vdsm/storage

lvm.env is a tiny helper script, intended to make it a bit easier to
debug Vdsm-controlled lvm state. It is being created whenever the lvm
module is loaded, which generates an annoying warning message in unit
test.

This patch makes lvm.env ship statically with vdsm. It can be used by

    . /usr/share/vdsm/storage/lvm.env

Change-Id: I6ae6bc789efa22321eb06422e910bf272c575007
Signed-off-by: Dan Kenigsberg <dan...@redhat.com>
---
M .gitignore
M vdsm.spec.in
M vdsm/storage/Makefile.am
A vdsm/storage/lvm.env.in
M vdsm/storage/lvm.py
5 files changed, 16 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/21872/1

diff --git a/.gitignore b/.gitignore
index 7ec1993..3042c43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,6 +53,7 @@
 vdsm/mom.conf
 vdsm/sos/vdsm.py
 vdsm/storage/protect/safelease
+vdsm/storage/lvm.env
 vdsm/storage/vdsm-lvm.rules
 vdsm/sudoers.vdsm
 vdsm/svdsm.logger.conf
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f248b74..a059ad6 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -912,6 +912,7 @@
 %{_datadir}/%{vdsm_name}/storage/iscsi.py*
 %{_datadir}/%{vdsm_name}/storage/localFsSD.py*
 %{_datadir}/%{vdsm_name}/storage/lvm.py*
+%{_datadir}/%{vdsm_name}/storage/lvm.env
 %{_datadir}/%{vdsm_name}/storage/misc.py*
 %{_datadir}/%{vdsm_name}/storage/mount.py*
 %{_datadir}/%{vdsm_name}/storage/multipath.py*
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index 2d3e9a6..6d0d769 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -20,6 +20,8 @@
 
 SUBDIRS = protect imageRepository
 
+include $(top_srcdir)/build-aux/Makefile.subs
+
 vdsmstoragedir = $(vdsmdir)/storage
 dist_vdsmstorage_PYTHON = \
        __init__.py \
@@ -71,5 +73,13 @@
 dist_vdsmexec_SCRIPTS = \
        curl-img-wrap
 
+nodist_vdsmstorage_DATA = \
+       lvm.env \
+       $(NULL)
+
+EXTRA_DIST = \
+       lvm.env.in \
+       $(NULL)
+
 check-local:
        PYTHONPATH="$(top_srcdir)/lib:$$PYTHONPATH" PYTHONDONTWRITEBYTECODE=1 
$(PYTHON) $(srcdir)/storage_exception.py
diff --git a/vdsm/storage/lvm.env.in b/vdsm/storage/lvm.env.in
new file mode 100644
index 0000000..25f73cb
--- /dev/null
+++ b/vdsm/storage/lvm.env.in
@@ -0,0 +1,4 @@
+#
+# source this into your shell to gain vdsm's view of lvm.
+#
+export LVM_SYSTEM_DIR=@VDSMRUNDIR@/lvm
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 559f169..2b892d7 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -161,19 +161,6 @@
         log.warning("Cannot create %s file %s", VDSM_LVM_CONF, str(e))
 
 
-def _setupLVMEnv():
-    lvmenvfname = os.path.join(VAR_RUN_VDSM, "lvm.env")
-    with file(lvmenvfname, "w") as lvmenv:
-        lvmenv.write("export LVM_SYSTEM_DIR=%s\n" % VDSM_LVM_SYSTEM_DIR)
-
-
-def _setupLVM():
-    try:
-        _setupLVMEnv()
-    except IOError as e:
-        log.warning("Cannot create env file %s", e)
-
-
 #
 # Make sure that "args" is suitable for consumption in interfaces
 # that expect an iterabale argument. The string is treated a single
@@ -294,7 +281,6 @@
     def __init__(self):
         self._filterStale = True
         self._extraCfg = None
-        _setupLVM()
         self._filterLock = threading.Lock()
         self._oplock = misc.OperationMutex()
         self._stalepv = True


-- 
To view, visit http://gerrit.ovirt.org/21872
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ae6bc789efa22321eb06422e910bf272c575007
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <dan...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to