Change in vdsm[master]: gluster: Publish gluster get volume info

ahino at redhat.com ahino at redhat.com
Wed Aug 19 15:05:10 UTC 2015


Ala Hino has uploaded a new change for review.

Change subject: gluster: Publish gluster get volume info
......................................................................

gluster: Publish gluster get volume info

Publish glusterGetVolumeInfo when RHEV enabled.

Change-Id: Ib9c70e9afa2fd776dfd9c2767c2e83e7f179b5c2
Bug-Url: https://bugzilla.redhat.com/1254499
Signed-off-by: Ala Hino <ahino at redhat.com>
---
M lib/vdsm/constants.py.in
M vdsm.spec.in
M vdsm/gluster/__init__.py
M vdsm/gluster/cli.py
M vdsm/supervdsmServer
5 files changed, 24 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/45098/1

diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index 0c85b9f..541786b 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -23,6 +23,8 @@
 from __future__ import absolute_import
 import os
 
+RHEV_ENABLED = False if '@RHEV_TRUE@' else True
+
 # SMBIOS manufacturer
 SMBIOS_MANUFACTURER = '@SMBIOS_MANUFACTURER@'
 SMBIOS_OSNAME = '@SMBIOS_OSNAME@'
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 72e7df6..bafd953 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -982,14 +982,10 @@
 %{_datadir}/%{vdsm_name}/kaxmlrpclib.py*
 %{_datadir}/%{vdsm_name}/momIF.py*
 %{_datadir}/%{vdsm_name}/set-conf-item
-%if 0%{?with_gluster}
 %dir %{_datadir}/%{vdsm_name}/gluster
 %{_datadir}/%{vdsm_name}/gluster/__init__.py*
 %{_datadir}/%{vdsm_name}/gluster/cli.py*
 %{_datadir}/%{vdsm_name}/gluster/exception.py*
-%else
-%exclude %{_datadir}/%{vdsm_name}/gluster/*
-%endif
 %{python_sitelib}/sos/plugins/vdsm.py*
 %{_udevrulesdir}/12-vdsm-lvm.rules
 /etc/security/limits.d/99-vdsm.conf
diff --git a/vdsm/gluster/__init__.py b/vdsm/gluster/__init__.py
index ee033a2..8932bb2 100644
--- a/vdsm/gluster/__init__.py
+++ b/vdsm/gluster/__init__.py
@@ -31,14 +31,19 @@
     return func
 
 
-def listPublicFunctions():
+def makePublicRHEV(func):
+    func.superVdsmRHEV = True
+    return func
+
+
+def listPublicFunctions(rhev=False):
     methods = []
     for modName in MODULE_LIST:
         try:
             module = __import__('gluster.' + modName, fromlist=['gluster'])
             for name in dir(module):
                 func = getattr(module, name)
-                if getattr(func, 'superVdsm', False):
+                if _shouldPublish(func, rhev):
                     funcName = 'gluster%s%s' % (name[0].upper(), name[1:])
                     methods.append((funcName, func))
         except ImportError:
@@ -46,6 +51,13 @@
     return methods
 
 
+def _shouldPublish(func, rehv):
+    if rhev:
+        return getattr(func, 'superVdsmRHEV', False)
+    else:
+        return getattr(func, 'superVdsm', False)
+
+
 def safeWrite(fileName, content):
     with tempfile.NamedTemporaryFile(dir=os.path.dirname(fileName),
                                      delete=False) as tmp:
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index b35f09f..8ff050f 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -473,6 +473,7 @@
 
 
 @makePublic
+ at makePublicRHEV
 def volumeInfo(volumeName=None, remoteServer=None):
     """
     Returns:
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index e836368..a8a8c2a 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -65,6 +65,7 @@
 from network.api import editNetwork, setupNetworks, setSafeNetworkConfig,\
     change_numvfs
 
+from gluster import cliutils
 from network.tc import setPortMirroring, unsetPortMirroring
 from storage.multipath import getScsiSerial as _getScsiSerial
 from storage.iscsi import getDevIscsiInfo as _getdeviSCSIinfo
@@ -76,7 +77,7 @@
 from vdsm.constants import METADATA_GROUP, EXT_CHOWN, EXT_UDEVADM, \
     DISKIMAGE_USER, DISKIMAGE_GROUP, \
     P_LIBVIRT_VMCHANNELS, P_OVIRT_VMCONSOLES, \
-    VDSM_USER, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP
+    VDSM_USER, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP, RHEV_ENABLED
 from storage.devicemapper import _removeMapping, _getPathsStatus
 from vdsm.config import config
 import mkimage
@@ -220,6 +221,10 @@
     @logDecorator
     def changeNumvfs(self, device_name, numvfs):
         return change_numvfs(device_name, numvfs)
+
+    @logDecorator
+    def getGlusterVolumeInfo(volumeName=None, remoteServer=None):
+        return cliutils.volumeInfo(volumeName, remoteServer)
 
     def _runAs(self, user, groups, func, args=(), kwargs={}):
         def child(pipe):
@@ -493,7 +498,7 @@
         return wrapper
 
     if _glusterEnabled:
-        for name, func in listPublicFunctions():
+        for name, func in listPublicFunctions(RHEV_ENABLED):
             setattr(_SuperVdsm, name, logDecorator(bind(func)))
 
     try:


-- 
To view, visit https://gerrit.ovirt.org/45098
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9c70e9afa2fd776dfd9c2767c2e83e7f179b5c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ala Hino <ahino at redhat.com>


More information about the vdsm-patches mailing list