Change in vdsm[master]: build: Introduce --enable-gluster configuration
nsoffer at redhat.com
nsoffer at redhat.com
Thu Sep 24 19:08:33 UTC 2015
Nir Soffer has uploaded a new change for review.
Change subject: build: Introduce --enable-gluster configuration
......................................................................
build: Introduce --enable-gluster configuration
Previously building gluster package and building for RHEV were coupled
together in an ugly way. We disabled gluster package when building for
RHEV, and enabled some gluster apis only when building for RHEV.
We want to get rid of these downstream related options, but we also want
to allow downstream maintainers easy way to configure the package as
needed.
This patch decouples rhev_build and with_gluster options; To build the
vdsm-gluster package, use:
./configure --enable-gluster
To build without vdsm-gluster package, use:
./configure --disable-gluster
When gluster is enabled, supervdsm exposes all gluster apis marked
with @glusterapi decorator. Most of these apis are used when vdsm is
used to control gluster server.
When gluster is disabled, supervdsm exposes only the gluster vdsm apis
marked as with @ovirtapi. These apis are required for consuming gluster
storage.
Change-Id: I84608625e3b004c64b4928e5325d9375fb952878
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M Makefile.am
M configure.ac
M lib/vdsm/constants.py.in
M vdsm.spec.in
M vdsm/gluster/__init__.py
M vdsm/gluster/cli.py
M vdsm/supervdsmServer
7 files changed, 81 insertions(+), 67 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/46708/1
diff --git a/Makefile.am b/Makefile.am
index 5508094..13d49d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,6 +58,10 @@
WITH_HOOKS = --define="with_hooks 1"
endif
+if GLUSTER
+WITH_GLUSTER = --define="with_gluster 1"
+endif
+
if RHEV
RHEV_BUILD = --define="rhev_build 1"
endif
@@ -158,7 +162,7 @@
rpm: dist
rpmbuild -ta $(if $(BUILDID),--define="extra_release .$(BUILDID)") \
- $(WITH_HOOKS) $(RHEV_BUILD) $(KOJI_BUILD) $(DIST_ARCHIVES)
+ $(WITH_HOOKS) $(WITH_GLUSTER) $(RHEV_BUILD) $(KOJI_BUILD) $(DIST_ARCHIVES)
dist-hook: gen-VERSION gen-ChangeLog
.PHONY: gen-VERSION gen-ChangeLog
diff --git a/configure.ac b/configure.ac
index feb7e52..da361ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,17 @@
AM_CONDITIONAL([HOOKS], [test "${enable_hooks}" = "yes"])
AC_ARG_ENABLE(
+ [gluster],
+ [AS_HELP_STRING(
+ [--enable-gluster],
+ [build gluster package @<:@default=no@:>@]
+ )],
+ ,
+ [enable_gluster="no"]
+)
+AM_CONDITIONAL([GLUSTER], [test "${enable_gluster}" = "yes"])
+
+AC_ARG_ENABLE(
[rhev],
[AS_HELP_STRING(
[--enable-rhev],
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index e5cff54..542ad3e 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -23,7 +23,7 @@
from __future__ import absolute_import
import os
-RHEV_ENABLED = False if '@RHEV_TRUE@' else True
+GLUSTER_ENABLED = False if '@GLUSTER_TRUE@' else True
# VDSM management networks
LEGACY_MANAGEMENT_NETWORKS = ('ovirtmgmt', 'rhevm')
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f93bcd6..9cc3597 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -13,6 +13,9 @@
# Glusterfs package version
%global gluster_version 3.7.1
+# Glusterfs - overridable using rpmbuild --define "with_gluster 1"
+%{!?with_gluster: %global with_gluster 0}
+
# koji build - overridable using rpmbuild --define "fedora_koji_build 1"
%{!?fedora_koji_build: %global fedora_koji_build 0}
@@ -40,11 +43,6 @@
%global _polkitdir %{_datadir}/polkit-1/rules.d
%else
%global _polkitdir %{_localstatedir}/lib/polkit-1/localauthority/10-vendor.d
-%endif
-
-# Gluster should not be shipped with RHEV
-%if ! 0%{?rhev_build}
-%global with_gluster 1
%endif
%if ! 0%{?rhel} || ! 0%{fedora_koji_build}
@@ -594,6 +592,7 @@
autoreconf -if
%endif
%configure %{?with_hooks:--enable-hooks} \
+ %{?with_gluster:--enable-gluster} \
%if 0%{?rhev_build}
--enable-rhev \
--with-smbios-manufacturer='Red Hat' \
diff --git a/vdsm/gluster/__init__.py b/vdsm/gluster/__init__.py
index fa953a1..23599fa 100644
--- a/vdsm/gluster/__init__.py
+++ b/vdsm/gluster/__init__.py
@@ -25,24 +25,24 @@
'gfapi', 'storagedev', 'api')
-def makePublic(func):
- func.superVdsm = True
+def glusterapi(func):
+ func.glusterapi = True
return func
-def makePublicRHEV(func):
- func.superVdsmRHEV = True
+def ovirtapi(func):
+ func.ovirtapi = True
return func
-def listPublicFunctions(rhev=False):
+def listPublicFunctions(gluster_enabled=True):
methods = []
for modName in MODULE_LIST:
try:
module = __import__('gluster.' + modName, fromlist=['gluster'])
for name in dir(module):
func = getattr(module, name)
- if _shouldPublish(func, rhev):
+ if _shouldPublish(func, gluster_enabled):
funcName = 'gluster%s%s' % (name[0].upper(), name[1:])
methods.append((funcName, func))
except ImportError:
@@ -50,11 +50,11 @@
return methods
-def _shouldPublish(func, rhev):
- if rhev:
- return getattr(func, 'superVdsmRHEV', False)
+def _shouldPublish(func, gluster_enabled):
+ if gluster_enabled:
+ return getattr(func, 'glusterapi', False)
else:
- return getattr(func, 'superVdsm', False)
+ return getattr(func, 'ovirtapi', False)
def safeWrite(fileName, content):
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index 8d399f0..0724b22 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -27,7 +27,7 @@
from vdsm import utils
from vdsm import netinfo
import exception as ge
-from . import makePublic, makePublicRHEV
+from . import glusterapi, ovirtapi
_glusterCommandPath = utils.CommandPath("gluster",
"/usr/sbin/gluster",
@@ -135,7 +135,7 @@
return ''
- at makePublic
+ at glusterapi
def hostUUIDGet():
command = _getGlusterSystemCmd() + ["uuid", "get"]
rc, out, err = _execGluster(command)
@@ -265,7 +265,7 @@
return status
- at makePublic
+ at glusterapi
def volumeStatus(volumeName, brick=None, option=None):
"""
Get volume status
@@ -472,8 +472,8 @@
return status
- at makePublic
- at makePublicRHEV
+ at glusterapi
+ at ovirtapi
def volumeInfo(volumeName=None, remoteServer=None):
"""
Returns:
@@ -501,7 +501,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeCreate(volumeName, brickList, replicaCount=0, stripeCount=0,
transportList=[], force=False):
command = _getGlusterVolCmd() + ["create", volumeName]
@@ -526,7 +526,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeStart(volumeName, force=False):
command = _getGlusterVolCmd() + ["start", volumeName]
if force:
@@ -538,7 +538,7 @@
return True
- at makePublic
+ at glusterapi
def volumeStop(volumeName, force=False):
command = _getGlusterVolCmd() + ["stop", volumeName]
if force:
@@ -550,7 +550,7 @@
raise ge.GlusterVolumeStopFailedException(rc=e.rc, err=e.err)
- at makePublic
+ at glusterapi
def volumeDelete(volumeName):
command = _getGlusterVolCmd() + ["delete", volumeName]
try:
@@ -560,7 +560,7 @@
raise ge.GlusterVolumeDeleteFailedException(rc=e.rc, err=e.err)
- at makePublic
+ at glusterapi
def volumeSet(volumeName, option, value):
command = _getGlusterVolCmd() + ["set", volumeName, option, value]
try:
@@ -581,7 +581,7 @@
return optionList
- at makePublic
+ at glusterapi
def volumeSetHelpXml():
rc, out, err = _execGluster(_getGlusterVolCmd() + ["set", 'help-xml'])
if rc:
@@ -590,7 +590,7 @@
return _parseVolumeSetHelpXml(out)
- at makePublic
+ at glusterapi
def volumeReset(volumeName, option='', force=False):
command = _getGlusterVolCmd() + ['reset', volumeName]
if option:
@@ -604,7 +604,7 @@
raise ge.GlusterVolumeResetFailedException(rc=e.rc, err=e.err)
- at makePublic
+ at glusterapi
def volumeAddBrick(volumeName, brickList,
replicaCount=0, stripeCount=0, force=False):
command = _getGlusterVolCmd() + ["add-brick", volumeName]
@@ -622,7 +622,7 @@
raise ge.GlusterVolumeBrickAddFailedException(rc=e.rc, err=e.err)
- at makePublic
+ at glusterapi
def volumeRebalanceStart(volumeName, rebalanceType="", force=False):
command = _getGlusterVolCmd() + ["rebalance", volumeName]
if rebalanceType:
@@ -641,7 +641,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeRebalanceStop(volumeName, force=False):
command = _getGlusterVolCmd() + ["rebalance", volumeName, "stop"]
if force:
@@ -658,7 +658,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def _parseVolumeRebalanceRemoveBrickStatus(xmltree, mode):
"""
returns {'hosts': [{'name': NAME,
@@ -714,7 +714,7 @@
return status
- at makePublic
+ at glusterapi
def volumeRebalanceStatus(volumeName):
command = _getGlusterVolCmd() + ["rebalance", volumeName, "status"]
try:
@@ -728,7 +728,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeReplaceBrickCommitForce(volumeName, existingBrick, newBrick):
command = _getGlusterVolCmd() + ["replace-brick", volumeName,
existingBrick, newBrick, "commit",
@@ -741,7 +741,7 @@
err=e.err)
- at makePublic
+ at glusterapi
def volumeRemoveBrickStart(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -758,7 +758,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeRemoveBrickStop(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -776,7 +776,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeRemoveBrickStatus(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -793,7 +793,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeRemoveBrickCommit(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -807,7 +807,7 @@
err=e.err)
- at makePublic
+ at glusterapi
def volumeRemoveBrickForce(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -821,7 +821,7 @@
err=e.err)
- at makePublic
+ at glusterapi
def peerProbe(hostName):
command = _getGlusterPeerCmd() + ["probe", hostName]
try:
@@ -831,7 +831,7 @@
raise ge.GlusterHostAddFailedException(rc=e.rc, err=e.err)
- at makePublic
+ at glusterapi
def peerDetach(hostName, force=False):
command = _getGlusterPeerCmd() + ["detach", hostName]
if force:
@@ -865,7 +865,7 @@
return hostList
- at makePublic
+ at glusterapi
def peerStatus():
"""
Returns:
@@ -884,7 +884,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeProfileStart(volumeName):
command = _getGlusterVolCmd() + ["profile", volumeName, "start"]
try:
@@ -894,7 +894,7 @@
return True
- at makePublic
+ at glusterapi
def volumeProfileStop(volumeName):
command = _getGlusterVolCmd() + ["profile", volumeName, "stop"]
try:
@@ -904,7 +904,7 @@
return True
- at makePublic
+ at glusterapi
def volumeProfileInfo(volumeName, nfs=False):
"""
Returns:
@@ -1010,7 +1010,7 @@
return tasks
- at makePublic
+ at glusterapi
def volumeTasks(volumeName="all"):
command = _getGlusterVolCmd() + ["status", volumeName, "tasks"]
try:
@@ -1023,7 +1023,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeGeoRepSessionStart(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1042,7 +1042,7 @@
err=e.err)
- at makePublic
+ at glusterapi
def volumeGeoRepSessionStop(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1141,7 +1141,7 @@
return status
- at makePublic
+ at glusterapi
def volumeGeoRepStatus(volumeName=None, remoteHost=None,
remoteVolumeName=None, remoteUserName=None):
if remoteUserName:
@@ -1165,7 +1165,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def volumeGeoRepSessionPause(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1184,7 +1184,7 @@
err=e.err)
- at makePublic
+ at glusterapi
def volumeGeoRepSessionResume(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1216,7 +1216,7 @@
return {'geoRepConfig': config}
- at makePublic
+ at glusterapi
def volumeGeoRepConfig(volumeName, remoteHost,
remoteVolumeName, optionName=None,
optionValue=None,
@@ -1244,7 +1244,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def snapshotCreate(volumeName, snapName,
snapDescription=None,
force=False):
@@ -1266,7 +1266,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def snapshotDelete(volumeName=None, snapName=None):
command = _getGlusterSnapshotCmd() + ["delete"]
if snapName:
@@ -1282,7 +1282,7 @@
return True
- at makePublic
+ at glusterapi
def snapshotActivate(snapName, force=False):
command = _getGlusterSnapshotCmd() + ["activate", snapName]
@@ -1296,7 +1296,7 @@
raise ge.GlusterSnapshotActivateFailedException(rc=e.rc, err=e.err)
- at makePublic
+ at glusterapi
def snapshotDeactivate(snapName):
command = _getGlusterSnapshotCmd() + ["deactivate", snapName]
@@ -1326,7 +1326,7 @@
return snapshotRestore
- at makePublic
+ at glusterapi
def snapshotRestore(snapName):
command = _getGlusterSnapshotCmd() + ["restore", snapName]
@@ -1371,7 +1371,7 @@
return {'system': systemConfig, 'volume': volumeConfig}
- at makePublic
+ at glusterapi
def snapshotConfig(volumeName=None, optionName=None, optionValue=None):
command = _getGlusterSnapshotCmd() + ["config"]
if volumeName:
@@ -1491,7 +1491,7 @@
return volumes
- at makePublic
+ at glusterapi
def snapshotInfo(volumeName=None):
command = _getGlusterSnapshotCmd() + ["info"]
if volumeName:
@@ -1509,7 +1509,7 @@
raise ge.GlusterXmlErrorInfoException(err=[etree.tostring(xmltree)])
- at makePublic
+ at glusterapi
def executeGsecCreate():
command = _getGlusterSystemCmd() + ["execute", "gsec_create"]
rc, out, err = _execGluster(command)
@@ -1519,7 +1519,7 @@
return True
- at makePublic
+ at glusterapi
def executeMountBrokerUserAdd(remoteUserName, remoteVolumeName):
command = _getGlusterSystemCmd() + ["execute", "mountbroker",
"user", remoteUserName,
@@ -1532,7 +1532,7 @@
return True
- at makePublic
+ at glusterapi
def executeMountBrokerOpt(optionName, optionValue):
command = _getGlusterSystemCmd() + ["execute", "mountbroker",
"opt", optionName,
@@ -1544,7 +1544,7 @@
return True
- at makePublic
+ at glusterapi
def volumeGeoRepSessionCreate(volumeName, remoteHost,
remoteVolumeName,
remoteUserName=None, force=False):
@@ -1564,7 +1564,7 @@
raise ge.GlusterGeoRepSessionCreateFailedException(rc=e.rc, err=e.err)
- at makePublic
+ at glusterapi
def volumeGeoRepSessionDelete(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None):
if remoteUserName:
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index 9a679ee..62aa7bb 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -77,7 +77,7 @@
from vdsm.constants import METADATA_GROUP, EXT_CHOWN, \
DISKIMAGE_USER, DISKIMAGE_GROUP, \
P_LIBVIRT_VMCHANNELS, P_OVIRT_VMCONSOLES, \
- VDSM_USER, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP, RHEV_ENABLED
+ VDSM_USER, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP, GLUSTER_ENABLED
from storage.devicemapper import _removeMapping, _getPathsStatus
from vdsm.config import config
import mkimage
@@ -532,7 +532,7 @@
return wrapper
if _glusterEnabled:
- for name, func in listPublicFunctions(RHEV_ENABLED):
+ for name, func in listPublicFunctions(GLUSTER_ENABLED):
setattr(_SuperVdsm, name, logDecorator(bind(func)))
try:
--
To view, visit https://gerrit.ovirt.org/46708
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I84608625e3b004c64b4928e5325d9375fb952878
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
More information about the vdsm-patches
mailing list