Change in vdsm[master]: vdsm-toolize dummybr and nwfilter

zhshzhou at linux.vnet.ibm.com zhshzhou at linux.vnet.ibm.com
Wed Jun 5 08:19:43 UTC 2013


Zhou Zheng Sheng has uploaded a new change for review.

Change subject: vdsm-toolize dummybr and nwfilter
......................................................................

vdsm-toolize dummybr and nwfilter

Move dummybr and nwfilter to vdsm-tool, so that all the init wrappers in
the supported or to-be-supported systems can call them uniformly.

Change-Id: Id32554824cc231f428523dbd34a3fa189b361ae5
Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
---
M lib/vdsm/tool/Makefile.am
R lib/vdsm/tool/dummybr.py
R lib/vdsm/tool/nwfilter.py
M vdsm.spec.in
M vdsm/Makefile.am
M vdsm/vdsmd.init.in
M vdsm/vm.py
7 files changed, 19 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/15370/1

diff --git a/lib/vdsm/tool/Makefile.am b/lib/vdsm/tool/Makefile.am
index 0515be6..efb8f4c 100644
--- a/lib/vdsm/tool/Makefile.am
+++ b/lib/vdsm/tool/Makefile.am
@@ -31,6 +31,8 @@
 
 dist_vdsmtool_DATA = \
 	__init__.py \
+	dummybr.py \
+	nwfilter.py \
 	passwd.py \
 	seboolsetup.py \
 	service.py \
diff --git a/vdsm/dummybr.py b/lib/vdsm/tool/dummybr.py
similarity index 92%
rename from vdsm/dummybr.py
rename to lib/vdsm/tool/dummybr.py
index 0e24cf8..50fc755 100644
--- a/vdsm/dummybr.py
+++ b/lib/vdsm/tool/dummybr.py
@@ -23,6 +23,7 @@
 
 from vdsm.netinfo import DUMMY_BRIDGE
 from vdsm import libvirtconnection, utils, constants
+from vdsm.tool import expose
 
 
 def createEphemeralBridge(bridgeName):
@@ -39,7 +40,15 @@
             '''<network><name>%s</name><forward mode='bridge'/><bridge '''
             '''name='%s'/></network>''' % (bridgeName, bridgeName))
 
-if __name__ == '__main__':
+ at expose('dummybr')
+def main():
+    '''
+    Defines dummy bridge on libvirt network.
+    '''
     if not os.path.exists('/sys/class/net/%s' % DUMMY_BRIDGE):
         createEphemeralBridge(DUMMY_BRIDGE)
     addBridgeToLibvirt(DUMMY_BRIDGE)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/vdsm/nwfilter.py b/lib/vdsm/tool/nwfilter.py
similarity index 97%
rename from vdsm/nwfilter.py
rename to lib/vdsm/tool/nwfilter.py
index 7fcff29..85d9dff 100755
--- a/vdsm/nwfilter.py
+++ b/lib/vdsm/tool/nwfilter.py
@@ -24,8 +24,10 @@
 import libvirt
 
 from vdsm import libvirtconnection
+from vdsm.tool import expose
 
 
+ at expose('nwfilter')
 def main():
     """
     Defines network filters on libvirt
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 7f79e23..c365900 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -786,8 +786,6 @@
 %{_datadir}/%{vdsm_name}/vdsm-store-net-config
 %{_datadir}/%{vdsm_name}/vm.py*
 %{_datadir}/%{vdsm_name}/zombieReaper.py*
-%attr (755,vdsm,kvm) %{_datadir}/%{vdsm_name}/dummybr.py*
-%attr (755,vdsm,kvm) %{_datadir}/%{vdsm_name}/nwfilter.py*
 %config(noreplace) %{_sysconfdir}/%{vdsm_name}/logger.conf
 %config(noreplace) %{_sysconfdir}/%{vdsm_name}/svdsm.logger.conf
 %config(noreplace) %{_sysconfdir}/%{vdsm_name}/mom.conf
@@ -975,6 +973,8 @@
 %else
 %{python_sitearch}/%{vdsm_name}/tool/load_needed_modules.py*
 %endif
+%{python_sitearch}/%{vdsm_name}/tool/dummybr.py*
+%{python_sitearch}/%{vdsm_name}/tool/nwfilter.py*
 %{python_sitearch}/%{vdsm_name}/tool/passwd.py*
 %{python_sitearch}/%{vdsm_name}/tool/seboolsetup.py*
 %{python_sitearch}/%{vdsm_name}/tool/service.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index c101335..c528b41 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -32,7 +32,6 @@
 	configNetwork.py \
 	debugPluginClient.py \
 	dmidecodeUtil.py \
-	dummybr.py \
 	guestIF.py \
 	hooking.py \
 	hooks.py \
@@ -45,7 +44,6 @@
 	momIF.py \
 	neterrors.py \
 	netmodels.py \
-	nwfilter.py \
 	parted_utils.py \
 	sampling.py \
 	supervdsm.py \
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index 72a48c3..7a6d2db 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -477,7 +477,7 @@
        return $ret_val
     fi
 
-    python @VDSMDIR@/nwfilter.pyc
+    vdsm-tool nwfilter
     ret_val=$?
     if [ $ret_val -ne 0 ]
     then
@@ -485,7 +485,7 @@
         return $ret_val
     fi
 
-    python @VDSMDIR@/dummybr.pyc
+    vdsm-tool dummybr
     ret_val=$?
     if [ $ret_val -ne 0 ]
     then
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 76e3383..67328d2 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -43,9 +43,9 @@
 from vdsm import vdscli
 from vdsm.config import config
 from vdsm.define import ERROR, NORMAL, doneCode, errCode
+from vdsm.netinfo import DUMMY_BRIDGE
 
 # local imports
-from dummybr import DUMMY_BRIDGE
 from logUtils import SimpleLogAdapter
 import caps
 import guestIF


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id32554824cc231f428523dbd34a3fa189b361ae5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list