Change in vdsm[master]: configs: introduce static dir
by Martin Polednik
Martin Polednik has posted comments on this change.
Change subject: configs: introduce static dir
......................................................................
Patch Set 2: Verified+1
Doesn't break build, doesn't do anything fancy either (as the dir itself isn't really "built").
--
To view, visit https://gerrit.ovirt.org/61599
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I654f6ef224a1add496cdcc576f075d1748e1901e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
7 years, 9 months
Change in vdsm[master]: makefile: remove unused all-local section
by Martin Polednik
Martin Polednik has posted comments on this change.
Change subject: makefile: remove unused all-local section
......................................................................
Patch Set 3: Verified+1
Builds as expected (dead automake code).
--
To view, visit https://gerrit.ovirt.org/61545
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I10865cf3b48b5572708fd34bdeb6e5a178f38398
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
7 years, 9 months
Change in vdsm[master]: gluster:enforce gluster fencing policies
by Ramesh Nachimuthu
Ramesh N has uploaded a new change for review.
Change subject: gluster:enforce gluster fencing policies
......................................................................
gluster:enforce gluster fencing policies
Enforce gluster related fencing policies before fencing
the host.
1. skipFecingIfGlusterBricksUp
Fencing should be skipped any brick is ONLINE in
the host being fenced.
2. skipFecingIfGlusterQuorumNotMet
Fencing should be skipped if any brick is ONLINE
in the host being fenced and quorum will be lost if the
brick is brought down.
Gluster volume info command will be used to get the
volume details and 'volume status' command will be used
to get the brick status from fence proxy host.
Change-Id: I2c18571209a3a7682a43bd2814b9ee3f0a69c55f
Signed-off-by: Ramesh Nachimuthu <rnachimu(a)redhat.com>
---
M vdsm/API.py
1 file changed, 66 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/59600/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 698ac29..fba19ac 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -22,6 +22,7 @@
import os
import logging
+import math
from vdsm.network.errors import ConfigNetworkError
@@ -54,6 +55,7 @@
import caps
from vdsm.config import config
from vdsm.virt import sampling
+from gluster import cli as glustercli
haClient = None # Define here to work around pyflakes issue #13
@@ -1255,8 +1257,72 @@
return False
self.log.debug("Host doesn't have any live lease")
+ return can_fence_gluster_hosts(policy)
+
+ def can_fence_gluster_hosts(policy):
+ skipFecingIfGlusterBricksUp = \
+ policy.get('skipFencingIfGlusterBricksUp') == 'true'
+ skipFecingIfGlusterQuorumNotMet = \
+ policy.get('skipFencingIfGlusterQuorumNotMet') == 'true'
+ hostUuid = policy.get('glusterServerUuid')
+ if skipFecingIfGlusterBricksUp or skipFecingIfGlusterQuorumNotMet:
+ volumesList = glustercli.volumeInfo()
+ for volumeName in volumesList:
+ if 'REPLICATE' in volumesList.get(volumeName).\
+ get('volumeType'):
+ volumeStatus = glustercli.volumeStatus(volumeName)
+ if skipFecingIfGlusterBricksUp:
+ for brick in volumeStatus.get('bricks'):
+ if hostUuid == brick.get('hostuuid') \
+ and brick.get('status') == 'ONLINE':
+ self.log.error("Gluster brick '%s' "
+ "is ONLINE.",
+ brick.get("name"))
+ return False
+ if skipFecingIfGlusterQuorumNotMet:
+ if not is_gluster_quorum_met(
+ volumesList.get(volumeName),
+ volumeStatus, hostUuid):
+ self.log.error("Gluster Quorum not met "
+ "for volume %s", volumeName)
+ return False
return True
+ def is_gluster_quorum_met(volumeInfo, volumeStatus, hostUuid):
+ replicaCount = volumeInfo.get("replicaCount")
+ subVolumes = volumeInfo.get('brickCount')
+ quorumType = volumeInfo.get("options").get("cluster.quorum-type")
+ if quorumType == "fixed":
+ quorumCount = volumeInfo.get("cluster.quorum-count")
+ elif quorumType == "auto":
+ quorumCount = math.ceil(replicaCount/2)
+ else:
+ return True
+ for index in range(0, subVolumes):
+ subVolume = \
+ volumeInfo.get("bricksInfo")[index:index+replicaCount]
+
+ bricksRemainingUp = 0
+ bricksGoingDown = 0
+
+ for brick in subVolume:
+ brick_status = get_brick_status(brick.get('hostUuid'),
+ brick.get("name"),
+ volumeStatus)
+ if brick_status.get('status') == 'ONLINE':
+ if brick.get('hostUuid') == hostUuid:
+ bricksGoingDown += bricksGoingDown
+ else:
+ bricksRemainingUp += bricksRemainingUp
+ if bricksGoingDown > 0 and bricksRemainingUp < quorumCount:
+ return False
+ return True
+
+ def get_brick_status(hostUuid, brickName, volumeStatus):
+ return [brick for brick in volumeStatus.get("bircks")
+ if brick.get("hostuuid") == hostUuid
+ and brick.get("brick") == brickName][0]
+
self.log.debug('fenceNode(addr=%s,port=%s,agent=%s,user=%s,passwd=%s,'
'action=%s,secure=%s,options=%s,policy=%s)',
addr, port, agent, username, password, action, secure,
--
To view, visit https://gerrit.ovirt.org/59600
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c18571209a3a7682a43bd2814b9ee3f0a69c55f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ramesh N <rnachimu(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: Move gluster.exception to lib/vdsm/gluster
by Ramesh Nachimuthu
Ramesh N has uploaded a new change for review.
Change subject: Move gluster.exception to lib/vdsm/gluster
......................................................................
Move gluster.exception to lib/vdsm/gluster
Change-Id: Ib97d2728c97d295b83ed452e116e9422184de10f
Signed-off-by: Ramesh Nachimuthu <rnachimu(a)redhat.com>
---
M configure.ac
M lib/vdsm/Makefile.am
A lib/vdsm/gluster/Makefile.am
A lib/vdsm/gluster/__init__.py
R lib/vdsm/gluster/exception.py
M lib/vdsm/rpc/Bridge.py
M tests/gluster_exception_test.py
M tests/storageServerTests.py
M vdsm.spec.in
M vdsm/gluster/Makefile.am
M vdsm/gluster/api.py
M vdsm/gluster/cli.py
M vdsm/gluster/fstab.py
M vdsm/gluster/gfapi.py
M vdsm/gluster/hooks.py
M vdsm/gluster/services.py
M vdsm/gluster/storagedev.py
M vdsm/gluster/tasks.py
M vdsm/storage/glusterVolume.py
M vdsm/storage/storageServer.py
20 files changed, 59 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/61019/1
diff --git a/configure.ac b/configure.ac
index a953b3e..55d8b70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -409,6 +409,7 @@
lib/vdsm/tool/configurators/Makefile
lib/api/Makefile
lib/yajsonrpc/Makefile
+ lib/vdsm/gluster/Makefile
lib/vdsm/host/Makefile
lib/vdsm/network/Makefile
lib/vdsm/network/configurators/Makefile
diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am
index a9680c0..3e3fa68 100644
--- a/lib/vdsm/Makefile.am
+++ b/lib/vdsm/Makefile.am
@@ -19,7 +19,7 @@
#
include $(top_srcdir)/build-aux/Makefile.subs
-SUBDIRS=common tool profiling rpc network virt storage host metrics
+SUBDIRS=common tool profiling rpc network virt storage host metrics gluster
dist_vdsmpylib_PYTHON = \
__init__.py \
diff --git a/lib/vdsm/gluster/Makefile.am b/lib/vdsm/gluster/Makefile.am
new file mode 100644
index 0000000..cd1e427
--- /dev/null
+++ b/lib/vdsm/gluster/Makefile.am
@@ -0,0 +1,18 @@
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+include $(top_srcdir)/build-aux/Makefile.subs
+
+vdsmglusterdir = $(vdsmpylibdir)/gluster
+
+common = \
+ __init__.py \
+ exception.py \
+ $(NULL)
+
+dist_vdsmgluster_PYTHON = $(common)
diff --git a/lib/vdsm/gluster/__init__.py b/lib/vdsm/gluster/__init__.py
new file mode 100644
index 0000000..4a67f47
--- /dev/null
+++ b/lib/vdsm/gluster/__init__.py
@@ -0,0 +1,19 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+from __future__ import absolute_import
diff --git a/vdsm/gluster/exception.py b/lib/vdsm/gluster/exception.py
similarity index 99%
rename from vdsm/gluster/exception.py
rename to lib/vdsm/gluster/exception.py
index 1e1b961..43ad1da 100644
--- a/vdsm/gluster/exception.py
+++ b/lib/vdsm/gluster/exception.py
@@ -29,6 +29,8 @@
# IMPORTANT NOTE: USE CODES BETWEEN 4100 AND 4800
#
########################################################
+#
+from __future__ import absolute_import
from vdsm.exception import VdsmException
diff --git a/lib/vdsm/rpc/Bridge.py b/lib/vdsm/rpc/Bridge.py
index d2880cd..70da6b7 100644
--- a/lib/vdsm/rpc/Bridge.py
+++ b/lib/vdsm/rpc/Bridge.py
@@ -32,7 +32,7 @@
try:
import gluster.apiwrapper as gapi
- import gluster.exception as ge
+ from vdsm.gluster import exception as ge
_glusterEnabled = True
except ImportError:
_glusterEnabled = False
diff --git a/tests/gluster_exception_test.py b/tests/gluster_exception_test.py
index d742f36..eb652ae 100644
--- a/tests/gluster_exception_test.py
+++ b/tests/gluster_exception_test.py
@@ -19,8 +19,8 @@
#
from testlib import VdsmTestCase
-from gluster import exception as gluster_exception
-from gluster.exception import GlusterException
+from vdsm.gluster import exception as gluster_exception
+from vdsm.gluster.exception import GlusterException
class TestGlusterException(VdsmTestCase):
diff --git a/tests/storageServerTests.py b/tests/storageServerTests.py
index bd1534a..056a359 100644
--- a/tests/storageServerTests.py
+++ b/tests/storageServerTests.py
@@ -20,7 +20,7 @@
from monkeypatch import MonkeyPatch
import gluster.cli
-import gluster.exception as ge
+from vdsm.gluster import exception as ge
from testlib import permutations, expandPermutations
from testlib import VdsmTestCase
from storage.storageServer import GlusterFSConnection
diff --git a/vdsm.spec.in b/vdsm.spec.in
index e402cde..ac18c41 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1091,9 +1091,11 @@
%{_datadir}/%{vdsm_name}/get-conf-item
%{_datadir}/%{vdsm_name}/set-conf-item
%dir %{_datadir}/%{vdsm_name}/gluster
+%dir %{python_sitelib}/%{vdsm_name}/gluster
%{_datadir}/%{vdsm_name}/gluster/__init__.py*
%{_datadir}/%{vdsm_name}/gluster/cli.py*
-%{_datadir}/%{vdsm_name}/gluster/exception.py*
+%{python_sitelib}/%{vdsm_name}/gluster/exception.py*
+%{python_sitelib}/%{vdsm_name}/gluster/__init__.py*
%{python_sitelib}/sos/plugins/vdsm.py*
%{_udevrulesdir}/12-vdsm-lvm.rules
/etc/security/limits.d/99-vdsm.conf
@@ -1643,6 +1645,7 @@
%defattr(-, root, root, -)
%dir %{_datadir}/%{vdsm_name}
%dir %{_datadir}/%{vdsm_name}/gluster
+%dir %{python_sitelib}/%{vdsm_name}/gluster
%dir %{python_sitelib}/%{vdsm_name}
%dir %{python_sitelib}/%{vdsm_name}/rpc
%license COPYING
diff --git a/vdsm/gluster/Makefile.am b/vdsm/gluster/Makefile.am
index a811ad0..fdb0020 100644
--- a/vdsm/gluster/Makefile.am
+++ b/vdsm/gluster/Makefile.am
@@ -25,7 +25,6 @@
common = \
__init__.py \
cli.py \
- exception.py
$(NULL)
if GLUSTER_MGMT
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index b6f11c3..b0b1689 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -31,7 +31,7 @@
from vdsm import supervdsm as svdsm
from pwd import getpwnam
-import exception as ge
+from vdsm.gluster import exception as ge
from . import gluster_mgmt_api
from . import safeWrite
import fstab
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index 87ee752..e8d0828 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -28,7 +28,7 @@
from vdsm import commands
from vdsm import utils
from vdsm.network.netinfo import addresses
-import exception as ge
+from vdsm.gluster import exception as ge
from . import gluster_mgmt_api, gluster_api
_glusterCommandPath = utils.CommandPath("gluster",
diff --git a/vdsm/gluster/fstab.py b/vdsm/gluster/fstab.py
index 5a2b4c8..ac5ca4f 100644
--- a/vdsm/gluster/fstab.py
+++ b/vdsm/gluster/fstab.py
@@ -22,7 +22,7 @@
import os
from collections import namedtuple
-import exception as ge
+from vdsm.gluster import exception as ge
from . import safeWrite
diff --git a/vdsm/gluster/gfapi.py b/vdsm/gluster/gfapi.py
index 83a5c57..059e76b 100644
--- a/vdsm/gluster/gfapi.py
+++ b/vdsm/gluster/gfapi.py
@@ -21,7 +21,7 @@
from ctypes.util import find_library
import os
-import exception as ge
+from vdsm.gluster import exception as ge
from . import gluster_mgmt_api
diff --git a/vdsm/gluster/hooks.py b/vdsm/gluster/hooks.py
index 7f8013e..9619fa2 100644
--- a/vdsm/gluster/hooks.py
+++ b/vdsm/gluster/hooks.py
@@ -26,7 +26,7 @@
import magic
import logging
import selinux
-import exception as ge
+from vdsm.gluster import exception as ge
from functools import wraps
from . import gluster_mgmt_api
from . import safeWrite
diff --git a/vdsm/gluster/services.py b/vdsm/gluster/services.py
index 782afb6..2352c78 100644
--- a/vdsm/gluster/services.py
+++ b/vdsm/gluster/services.py
@@ -18,7 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
-import exception as ge
+from vdsm.gluster import exception as ge
from vdsm.tool import service
from . import gluster_mgmt_api
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index ca1ee01..32ab65d 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -34,7 +34,7 @@
from vdsm import utils
import fstab
-import exception as ge
+from vdsm.gluster import exception as ge
from . import gluster_mgmt_api
diff --git a/vdsm/gluster/tasks.py b/vdsm/gluster/tasks.py
index c531785..a952154 100644
--- a/vdsm/gluster/tasks.py
+++ b/vdsm/gluster/tasks.py
@@ -19,7 +19,7 @@
#
import logging
-import exception as ge
+from vdsm.gluster import exception as ge
from . import gluster_mgmt_api
from . import cli
from cli import TaskType
diff --git a/vdsm/storage/glusterVolume.py b/vdsm/storage/glusterVolume.py
index b508097..ed4a40d 100644
--- a/vdsm/storage/glusterVolume.py
+++ b/vdsm/storage/glusterVolume.py
@@ -23,7 +23,7 @@
from sdc import sdCache
import vdsm.supervdsm as svdsm
try:
- from gluster.exception import GlusterException
+ from vdsm.gluster.exception import GlusterException
_glusterEnabled = True
except ImportError:
_glusterEnabled = False
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 05f69e7..53dcb68 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -45,7 +45,7 @@
import fileSD
import iscsi
import gluster.cli
-import gluster.exception as ge
+from vdsm.gluster import exception as ge
class AliasAlreadyRegisteredError(RuntimeError):
--
To view, visit https://gerrit.ovirt.org/61019
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib97d2728c97d295b83ed452e116e9422184de10f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ramesh N <rnachimu(a)redhat.com>
7 years, 9 months