Change in vdsm[master]: signals: Better handle signals to non-main threads
by dkuznets@redhat.com
Dima Kuznetsov has uploaded a new change for review.
Change subject: signals: Better handle signals to non-main threads
......................................................................
signals: Better handle signals to non-main threads
There is an issue with using signal.pause() and threads in python. The signal
might arrive to a non-main thread, and not get processed (because only the
main thread handles signals) until the main thread receives its own signal.
The issue is documented and tracked here:
https://bugzilla.redhat.com/show_bug.cgi?id=1114434
Change-Id: I5dbcd00cec22ef12f2b6253b016dcbd0aa889583
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
M lib/vdsm/utils.py
M vdsm/supervdsmServer
M vdsm/vdsm
3 files changed, 54 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/29392/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 2ba5762..35c8387 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -1141,3 +1141,55 @@
def prependDefer(self, func, *args, **kwargs):
self._finally.insert(0, (func, args, kwargs))
+
+
+_signalPoller = None
+
+
+def _getSignalPoller():
+ '''
+ This function creates a select.poll object that can be used in the same
+ manner as signal.pause(). The poll object returns each time a signal was
+ received by the process.
+
+ This function has to be called from the main thread.
+ '''
+ if _signalPoller is None:
+ (fd_r, fd_w) = os.pipe()
+
+ # The write end is going to be written to from a c-level signal
+ # handler, so it is a good idea to make sure it does not block.
+ flags = fcntl.fcntl(fd_w, fcntl.F_GETFL, 0)
+ flags |= os.O_NONBLOCK
+ fcntl.fcntl(fd_w, fcntl.F_SETFL, flags)
+
+ # This call must be done from the main thread.
+ signal.set_wakeup_fd(fd_w)
+
+ poller = select.poll()
+ poller.register(fd_r, select.POLLIN)
+
+ global _signalPoller
+ _signalPoller = poller
+
+ return _signalPoller
+
+
+def waitForSignal():
+ '''
+ This function acts like signal.pause(), it returns after a signal was
+ received and handled. Unlike signal.pause(), it will wake up even if other
+ thread caught the signal while this function was called.
+ '''
+ poller = _getSignalPoller()
+ try:
+ events = poller.poll()
+ for (fd, flags) in events:
+ if flags & select.POLLIN:
+ os.read(fd, 1)
+ except select.error as e:
+ # Signal was received in this thread while poll() was active
+ if (e.args[0] == errno.EINTR):
+ return
+ logging.error('Received error while waiting for signal',
+ exc_info=True)
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index a63caa2..0b0a13f 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -446,7 +446,7 @@
sourceroutethread.start()
while _running:
- signal.pause()
+ utils.waitForSignal()
log.debug("Terminated normally")
finally:
diff --git a/vdsm/vdsm b/vdsm/vdsm
index cbc16ff..9752320 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -83,7 +83,7 @@
cif.start()
try:
while running[0]:
- signal.pause()
+ utils.waitForSignal()
profile.stop()
finally:
--
To view, visit http://gerrit.ovirt.org/29392
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5dbcd00cec22ef12f2b6253b016dcbd0aa889583
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Revert 'Create default multipath.conf during install'
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: Revert 'Create default multipath.conf during install'
......................................................................
Revert 'Create default multipath.conf during install'
Revert http://gerrit.ovirt.org/#/c/30704
as the original problem of nonexistent multipath
configuration on vdsm start is resolved by:
http://gerrit.ovirt.org/#/c/30909
which configurates multipath before vdsm starts
using the vdsm configuration tool.
Change-Id: If2da0442bbcc5e33123c47d0a9f1e825fe47d1cf
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 0 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/30978/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index d3c8a9f..05f9485 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -745,14 +745,6 @@
/sbin/chkconfig --add supervdsmd
fi
%else
-# multipath.conf does not exists after multipath install, causing multipathd to
-# exit silently when started as vdsmd required service. This creates default
-# configuration blacklisting all devices, simulating the behavior of multipathd
-# on EL6 when configuration file is missing.
-# See https://bugzilla.redhat.com/1120209
-if [ ! -f "/etc/multipath.conf" ]; then
- /usr/sbin/mpathconf --disable
-fi
/bin/systemctl restart systemd-modules-load.service >/dev/null 2>&1 || :
if [ "$1" -eq 1 ] ; then
/bin/systemctl enable vdsmd.service >/dev/null 2>&1 || :
--
To view, visit http://gerrit.ovirt.org/30978
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If2da0442bbcc5e33123c47d0a9f1e825fe47d1cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: tool: use natural numbers for configuration versioning.
by mtayer@redhat.com
mooli tayer has uploaded a new change for review.
Change subject: tool: use natural numbers for configuration versioning.
......................................................................
tool: use natural numbers for configuration versioning.
Currently we use a vdsm version but only bump it when the
configuration actually changed.(so in 4.15 this was 4.13)
This can be misleading, and several bugs where opened
due to this issue[1].
I'm suggesting to use natural numbers and counting on the fact
that configuration should be bumped for next version[2].
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1133955
There was another bug on this that I cannot locate.
[2] Ifa8f02f0e6e1793007a8b3be49fe8a2f74076b19
Change-Id: I8f50e30fe03acb101aed4b1a7aece196a77b4c6b
Signed-off-by: Mooli Tayer <mtayer(a)redhat.com>
---
M lib/vdsm/tool/configurators/libvirt.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/32708/1
diff --git a/lib/vdsm/tool/configurators/libvirt.py b/lib/vdsm/tool/configurators/libvirt.py
index dde199c..24726bb 100644
--- a/lib/vdsm/tool/configurators/libvirt.py
+++ b/lib/vdsm/tool/configurators/libvirt.py
@@ -302,7 +302,7 @@
# version != PACKAGE_VERSION since we do not want to update configuration
# on every update. see 'configuration versioning:' at Configfile.py for
# details.
- CONF_VERSION = '4.17.0'
+ CONF_VERSION = '1'
PKI_DIR = os.path.join(constants.SYSCONF_PATH, 'pki/vdsm')
LS_CERT_DIR = os.path.join(PKI_DIR, 'libvirt-spice')
--
To view, visit http://gerrit.ovirt.org/32708
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f50e30fe03acb101aed4b1a7aece196a77b4c6b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mtayer(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: vdsm: add hostdev rules for vfio
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: add hostdev rules for vfio
......................................................................
vdsm: add hostdev rules for vfio
qemu requires readable /dev/vfio/[0-9][0-9]* in order to
allow attaching of host devices without root permissions.
As it's not feasible to run qemu under root, these udev rules
modify the ownership and mode to root:qemu 660 allowing to
function without changing qemu user.
Change-Id: Iba7dc8b786e1dd7399411639fa3fe35372708333
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M debian/rules
M debian/vdsm.install
M vdsm.spec.in
A vdsm/vdsm-vfio.rules.in
4 files changed, 34 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/32218/1
diff --git a/debian/rules b/debian/rules
index b32b160..40598cd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -40,6 +40,8 @@
# Install the lvm rules
install -Dm 0644 vdsm/storage/vdsm-lvm.rules \
$(destdir)/lib/udev/rules.d/61-vdsm-lvm.rules
+ install -Dm 0644 vdsm/vdsm-vfio.rules \
+ $(destdir)/lib/udev/rules.d/62-vdsm-vfio.rules
install -Dm 0644 vdsm/limits.conf \
$(destdir)/etc/security/limits.d/99-vdsm.conf
install -Dm 0644 init/upstart/vdsmd.upstart \
diff --git a/debian/vdsm.install b/debian/vdsm.install
index b1840ec..7eef434 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -21,6 +21,7 @@
./etc/vdsm/svdsm.logger.conf
./etc/vdsm/vdsm-tmpfiles.conf
./lib/udev/rules.d/61-vdsm-lvm.rules
+./lib/udev/rules.d/62-vdsm-vfio.rules
./usr/lib/python2.7/dist-packages/sos/plugins/vdsm.py
./usr/lib/python2.7/dist-packages/vdsmapi.py
./usr/libexec/vdsm/curl-img-wrap
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 323b586..9209302 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -657,6 +657,10 @@
install -Dm 0644 vdsm/storage/vdsm-lvm.rules \
%{buildroot}%{_udevrulesdir}/12-vdsm-lvm.rules
+# Install the vfio rules
+install -Dm 0644 vdsm/vdsm-vfio.rules \
+ %{buildroot}%{_udevrulesdir}/13-vdsm-vfio.rules
+
install -Dm 0644 vdsm/limits.conf \
%{buildroot}/etc/security/limits.d/99-vdsm.conf
@@ -1133,6 +1137,7 @@
%endif
%{python_sitelib}/sos/plugins/vdsm.py*
%{_udevrulesdir}/12-vdsm-lvm.rules
+%{_udevrulesdir}/13-vdsm-vfio.rules
/etc/security/limits.d/99-vdsm.conf
%{_mandir}/man8/vdsmd.8*
%if 0%{?rhel}
diff --git a/vdsm/vdsm-vfio.rules.in b/vdsm/vdsm-vfio.rules.in
new file mode 100644
index 0000000..b367235
--- /dev/null
+++ b/vdsm/vdsm-vfio.rules.in
@@ -0,0 +1,26 @@
+#
+# Copyright 2014 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
+#
+
+# Udev rules for vfio devices.
+#
+# These rules change ownership and permissions
+# of vfio devices spawned in /dev/vfio.
+
+KERNEL=="[0-9][0-9]*", SUBSYSTEM=="vfio" GROUP:="@QEMUGROUP@" MODE="0660"
--
To view, visit http://gerrit.ovirt.org/32218
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba7dc8b786e1dd7399411639fa3fe35372708333
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: getExternalVmList
by shavivi@redhat.com
Shahar Havivi has uploaded a new change for review.
Change subject: getExternalVmList
......................................................................
getExternalVmList
Change-Id: I7dcfb860626a844d1d08590274b508519a33f4a3
Signed-off-by: Shahar Havivi <shaharh(a)redhat.com>
---
M client/vdsClient.py
M lib/vdsm/define.py
M vdsm.spec.in
M vdsm/API.py
M vdsm/Makefile.am
M vdsm/rpc/BindingXMLRPC.py
M vdsm/rpc/Bridge.py
M vdsm/rpc/vdsmapi-schema.json
A vdsm/v2v.py
9 files changed, 182 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/33309/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index dafca9e..de0055b 100644
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -1889,6 +1889,20 @@
return status['status']['code'], status['status']['message']
+ def getExternalVMList(self, args):
+ if len(args) != 3:
+ raise ValueError('Wrong number of arguments')
+ uri, username, password = args
+ status = self.s.getExternalVMList(uri, username, password)
+ if status['status']['code'] == 0:
+ vmList = status['vmList']
+ for vm in vmList:
+ for key in vm.keys():
+ print key + ': ' + str(vm[key])
+
+ return status['status']['code'], status['status']['message']
+
+
if __name__ == '__main__':
if _glusterEnabled:
serv = ge.GlusterService()
@@ -2727,6 +2741,11 @@
'<vmId> <vcpuLimit>',
'set SLA parameter for a VM'
)),
+ 'externalVMList': (
+ serv.getExternalVMList, (
+ '<uri> <username> <password>',
+ 'get VMs from external hypervisor'
+ )),
}
if _glusterEnabled:
commands.update(ge.getGlusterCmdDict(serv))
diff --git a/lib/vdsm/define.py b/lib/vdsm/define.py
index 34f423a..0b4c77f 100644
--- a/lib/vdsm/define.py
+++ b/lib/vdsm/define.py
@@ -147,6 +147,9 @@
'updateIoTuneErr': {'status': {
'code': 64,
'message': 'Failed to update ioTune values'}},
+ 'externalErr': {'status': {
+ 'code': 65,
+ 'message': 'Failed to connect to external hypervisor'}},
'recovery': {'status': {
'code': 99,
'message': 'Recovering from crash or Initializing'}},
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 8438df7..cbab18d 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -956,6 +956,7 @@
%{_datadir}/%{vdsm_name}/protocoldetector.py*
%{_datadir}/%{vdsm_name}/supervdsm.py*
%{_datadir}/%{vdsm_name}/supervdsmServer
+%{_datadir}/%{vdsm_name}/v2v.py*
%{_datadir}/%{vdsm_name}/vdsm
%{_datadir}/%{vdsm_name}/vdsm-restore-net-config
%{_datadir}/%{vdsm_name}/vdsm-store-net-config
diff --git a/vdsm/API.py b/vdsm/API.py
index 9c47b5f..6d13b19 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -52,6 +52,7 @@
from vdsm.config import config
import hooks
from caps import PAGE_SIZE_BYTES
+import v2v
import supervdsm
@@ -1377,6 +1378,17 @@
for v in self._cif.vmContainer.values()
if not vmSet or v.id in vmSet]}
+ def getExternalVMList(self, uri, username, password):
+ "return information about the not-KVM virtual machines"
+ vms = v2v.getExternalVMList(uri, username, password)
+ if vms is None:
+ return errCode['externalErr']
+ return {'status': doneCode, 'vmList': vms}
+
+ def convertVmFromExternalSystem(self, uri, username, password,
+ vmProperties, jobId):
+ return {'status': doneCode}
+
# Networking-related functions
def setupNetworks(self, networks, bondings, options):
"""Add a new network to this vds, replacing an old one."""
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 1c42fdf..a2d1111 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -41,6 +41,7 @@
ppc64HardwareInfo.py \
protocoldetector.py \
supervdsm.py \
+ v2v.py \
vdsmDebugPlugin.py \
$(NULL)
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index f2dcbdf..2f886cf 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -361,6 +361,16 @@
api = API.Global()
return api.getVMList(fullStatus, vmList)
+ def getExternalVMList(self, uri, username, password):
+ api = API.Global()
+ return api.getExternalVMList(uri, username, password)
+
+ def convertVmFromExternalSystem(self, uri, username, password,
+ vmProperties, jobId):
+ api = API.Global()
+ return api.getExternalVMList(uri, username, password,
+ vmProperties, jobId)
+
def vmPause(self, vmId):
vm = API.VM(vmId)
return vm.pause()
@@ -1035,7 +1045,8 @@
(self.merge, 'merge'),
(self.vmUpdateVmPolicy, 'updateVmPolicy'),
(self.vmSetIoTune, 'setIoTune'),
- (self.vmGetIoTunePolicy, 'getIoTunePolicy'))
+ (self.vmGetIoTunePolicy, 'getIoTunePolicy'),
+ (self.getExternalVMList, 'getExternalVMList'))
def getIrsMethods(self):
return ((self.domainActivate, 'activateStorageDomain'),
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index 608e95d..b355dc8 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -314,6 +314,28 @@
return API.Global().getVMList(False, vmList)
+def Host_getExternalVMList_Call(api, args):
+ """
+ Return map of names to status of vm from non-KVM source
+ """
+ uri = args.get('uri', None)
+ username = args.get('username', None)
+ password = args.get('password', None)
+ return API.Global().getExternalVMList(uri, username, password)
+
+
+def Host_convertVmFromExternalSystem(api, args):
+ """
+ """
+ uri = args.get('uri', None)
+ username = args.get('username', None)
+ password = args.get('password', None)
+ vmProperties = args.get('vmProperties', None)
+ jobId = args.get('jobId', None)
+ return API.Global().convertVmFromExternalSystem(uri, username, password,
+ vmProperties, jobId)
+
+
def Host_getVMFullList_Call(api, args):
"""
This call is interested in returning full status.
@@ -329,6 +351,13 @@
return [v['vmId'] for v in ret['vmList']]
+def Host_getExternalVMList_Ret(ret):
+ """
+ Just return a map of names to status
+ """
+ return ret['vmList']
+
+
def StoragePool_getInfo_Ret(ret):
"""
The result contains two data structures which must be merged
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 426d28e..0dc733a 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -3548,6 +3548,70 @@
'returns': ['UUID']}
##
+# @ExternalVmInfo:
+#
+# map of VM names to status
+#
+# @name: The name of the VM
+# @status: The VM status
+#
+# Since: 4.17.0
+##
+{'type': 'ExternalVmInfo',
+ 'data': {'name': 'str', 'status': 'str'}}
+
+
+##
+# @Host.getExternalVMList:
+#
+# Get information about the not-KVM virtual machines.
+#
+# @uri: libvirt connection uri
+#
+# @username: libvirt connection user name
+#
+# @password: libvirt connection password
+#
+# Returns:
+# A map of VM names to status
+#
+# Since: 4.17.0
+##
+{'command': {'class': 'Host', 'name': 'getExternalVMList'},
+ 'data': {'uri': 'str', 'username': 'str', 'password': 'str'},
+ 'returns': ['ExternalVmInfo']}
+
+##
+# @VmProperties:
+#
+# A mapping of Vm properties
+#
+# Since: 4.17.0
+##
+{'map': 'VmProperties',
+ 'key': 'str', 'value': 'str'}
+
+##
+# @Host.convertVmFromExternalSystem:
+#
+# Import non-KVM virtual machine to data domain
+#
+# @uri: libvirt connection uri
+#
+# @username: libvirt connection user name
+#
+# @password: libvirt connection password
+#
+# @vmProperties: vm custom properties
+#
+# @jobId: uuid of the job
+#
+# Since: 4.17.0
+##
+{'command': {'class': 'Host', 'name': 'convertVmFromExternalSystem'},
+ 'data': {'uri': 'str', 'username': 'str', 'password': 'str', 'vmProperties': 'VmProperties', 'jobId': 'UUID'}}
+
+##
# @VMFullInfo:
#
# Full information about VM.
diff --git a/vdsm/v2v.py b/vdsm/v2v.py
new file mode 100644
index 0000000..5ef9362
--- /dev/null
+++ b/vdsm/v2v.py
@@ -0,0 +1,41 @@
+import libvirt
+import logging
+
+from virt import vmstatus
+
+vmStatus = {libvirt.VIR_DOMAIN_NOSTATE: 'Unknown',
+ libvirt.VIR_DOMAIN_RUNNING: vmstatus.UP,
+ libvirt.VIR_DOMAIN_BLOCKED: 'Blocked',
+ libvirt.VIR_DOMAIN_PAUSED: vmstatus.PAUSED,
+ libvirt.VIR_DOMAIN_SHUTDOWN: vmstatus.POWERING_DOWN,
+ libvirt.VIR_DOMAIN_SHUTOFF: vmstatus.DOWN,
+ libvirt.VIR_DOMAIN_CRASHED: 'Crushed',
+ libvirt.VIR_DOMAIN_PMSUSPENDED: 'PMSuspend'}
+
+
+def getExternalVMList(uri, username, password):
+ """ return external VMs with its state (up/down...) given uri """
+ def req(credentials, user_data):
+ for cred in credentials:
+ if cred[0] == libvirt.VIR_CRED_AUTHNAME:
+ cred[4] = username
+ elif cred[0] == libvirt.VIR_CRED_PASSPHRASE:
+ cred[4] = password
+ return 0
+
+ auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE],
+ req, None]
+ try:
+ conn = libvirt.openAuth(uri, auth, 0)
+ except libvirt.libvirtError as e:
+ logging.error(
+ 'v2v.getExternalVMList: error connection to remove server: %s'
+ % e.message)
+ return None
+
+ ret = []
+ for vm in conn.listAllDomains():
+ params = {'vmName': vm.name(),
+ 'status': vmStatus[vm.state()[0]]}
+ ret.append(params)
+ return ret
--
To view, visit http://gerrit.ovirt.org/33309
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7dcfb860626a844d1d08590274b508519a33f4a3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: fileSD: Move private constant near the only call site
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: fileSD: Move private constant near the only call site
......................................................................
fileSD: Move private constant near the only call site
Keeping a private constant used by only one function at the top of the
module does not help anyone. The best place for it is just above the
code using it.
Change-Id: If8430a05dd454c34217bb051345633aec4351738
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/fileSD.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/32724/1
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 8c2c550..9a22b66 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -57,8 +57,6 @@
# Specific stat(2) block size as defined in the man page
ST_BYTES_PER_BLOCK = 512
-_MOUNTLIST_IGNORE = ('/' + sd.BLOCKSD_DIR, '/' + sd.GLUSTERSD_DIR)
-
getProcPool = oop.getGlobalProcPool
@@ -641,6 +639,9 @@
self.oop.utils.forceLink(tVol, tLink)
+_MOUNTLIST_IGNORE = ('/' + sd.BLOCKSD_DIR, '/' + sd.GLUSTERSD_DIR)
+
+
def _getMountsList(pattern="*"):
fileDomPattern = os.path.join(
sd.StorageDomain.storage_repository, sd.DOMAIN_MNT_POINT,
--
To view, visit http://gerrit.ovirt.org/32724
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If8430a05dd454c34217bb051345633aec4351738
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
9 years, 5 months
Change in vdsm[ovirt-3.5]: Conflict with firewalld and NetworkManager and use iptables
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Conflict with firewalld and NetworkManager and use iptables
......................................................................
Conflict with firewalld and NetworkManager and use iptables
As shown in the bug, we do have a few issues with firewalld and we
do not really integrate with it. If we configure firewalling we do
it with iptables (hence why I put it as Wants).
As for NetworkManager, it is so that if the users use other
configurators other than ifcfg (i.e. iproute2) that NM will not
take control of the device.
Change-Id: Id4bc190f4b80a5c8600de4760f69886824622670
Bug-Url: https://bugzilla.redhat.com/1144084
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M init/systemd/vdsmd.service.in
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/33171/1
diff --git a/init/systemd/vdsmd.service.in b/init/systemd/vdsmd.service.in
index 67f0dad..a786682 100644
--- a/init/systemd/vdsmd.service.in
+++ b/init/systemd/vdsmd.service.in
@@ -1,8 +1,10 @@
[Unit]
Description=Virtual Desktop Server Manager
+Wants=iptables.service
Requires=multipathd.service libvirtd.service time-sync.target \
iscsid.service rpcbind.service supervdsmd.service sanlock.service
-Conflicts=libvirt-guests.service ksmtuned.service
+Conflicts=libvirt-guests.service ksmtuned.service NetworkManager.service \
+ firewalld.service
[Service]
Type=simple
--
To view, visit http://gerrit.ovirt.org/33171
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4bc190f4b80a5c8600de4760f69886824622670
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Move multipath configuration to vdsm-tool configurator
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: Move multipath configuration to vdsm-tool configurator
......................................................................
Move multipath configuration to vdsm-tool configurator
Previously multipath is reconfigured on each vdsm
service restart.
Now it will be reconfigured only on user demand.
Change-Id: Ife045908dc6e2aea9829b51482b909af1faf79da
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/tool/configurator.py
M vdsm/storage/hsm.py
M vdsm/storage/multipath.py
M vdsm/supervdsmServer
4 files changed, 147 insertions(+), 121 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/30909/1
diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py
index 1e446a6..57923e8 100644
--- a/lib/vdsm/tool/configurator.py
+++ b/lib/vdsm/tool/configurator.py
@@ -26,6 +26,7 @@
import rpm
import shutil
import sys
+import tempfile
import traceback
import uuid
@@ -665,9 +666,155 @@
return configured
+class MultipathModuleConfigure(_ModuleConfigure):
+
+ _MPATH_CONF = "/etc/multipath.conf"
+
+ _STRG_MPATH_CONF = (
+ "\n\n"
+ "defaults {\n"
+ " polling_interval 5\n"
+ " getuid_callout \"%(scsi_id_path)s --whitelisted "
+ "--replace-whitespace --device=/dev/%%n\"\n"
+ " no_path_retry fail\n"
+ " user_friendly_names no\n"
+ " flush_on_last_del yes\n"
+ " fast_io_fail_tmo 5\n"
+ " dev_loss_tmo 30\n"
+ " max_fds 4096\n"
+ "}\n"
+ "\n"
+ "devices {\n"
+ "device {\n"
+ " vendor \"HITACHI\"\n"
+ " product \"DF.*\"\n"
+ " getuid_callout \"%(scsi_id_path)s --whitelisted "
+ "--replace-whitespace --device=/dev/%%n\"\n"
+ "}\n"
+ "device {\n"
+ " vendor \"COMPELNT\"\n"
+ " product \"Compellent Vol\"\n"
+ " no_path_retry fail\n"
+ "}\n"
+ "}"
+ )
+
+ _MAX_CONF_COPIES = 5
+
+ _OLD_TAGS = ["# RHAT REVISION 0.2", "# RHEV REVISION 0.3",
+ "# RHEV REVISION 0.4", "# RHEV REVISION 0.5",
+ "# RHEV REVISION 0.6", "# RHEV REVISION 0.7",
+ "# RHEV REVISION 0.8", "# RHEV REVISION 0.9"]
+
+ _MPATH_CONF_TAG = "# RHEV REVISION 1.0"
+ _MPATH_CONF_PRIVATE_TAG = "# RHEV PRIVATE"
+
+ _MPATH_CONF_TEMPLATE = _MPATH_CONF_TAG + _STRG_MPATH_CONF
+
+ _scsi_id = utils.CommandPath("scsi_id",
+ "/sbin/scsi_id", # EL6
+ "/usr/lib/udev/scsi_id", # Fedora
+ "/lib/udev/scsi_id", # Ubuntu
+ )
+
+ def getName(self):
+ return 'multipath'
+
+ def getServices(self):
+ return ["multipathd"]
+
+ def configure(self):
+ """
+ Set up the multipath daemon configuration to the known and
+ supported state. The original configuration, if any, is saved
+ """
+ if os.getuid() != 0:
+ raise UserWarning("Must run as root")
+
+ if self.isconfigured():
+ return
+
+ if os.path.exists(self._MPATH_CONF):
+ utils.rotateFiles(
+ os.path.dirname(self._MPATH_CONF),
+ os.path.basename(self._MPATH_CONF),
+ self._MAX_CONF_COPIES,
+ cp=True, persist=True)
+ with tempfile.NamedTemporaryFile() as f:
+ f.write(self._MPATH_CONF_TEMPLATE %
+ {'scsi_id_path': self._scsi_id.cmd})
+ f.flush()
+ cmd = [constants.EXT_CP, f.name,
+ self._MPATH_CONF]
+ rc, out, err = utils.execCmd(cmd)
+
+ if rc != 0:
+ raise RuntimeError("Failed to perform Multipath config.")
+ utils.persistFile(self._MPATH_CONF)
+
+ # Flush all unused multipath device maps
+ utils.execCmd([constants.EXT_MULTIPATH, "-F"])
+
+ cmd = [constants.EXT_VDSM_TOOL, "service-reload", "multipathd"]
+ rc, out, err = utils.execCmd(cmd)
+ if rc != 0:
+ sys.stdout.write("Failed to reload Multipath.")
+
+ def isconfigured(self, *args):
+ """
+ Check the multipath daemon configuration. The configuration file
+ /etc/multipath.conf should contain private tag in form
+ "RHEV REVISION X.Y" for this check to succeed.
+ If the tag above is followed by tag "RHEV PRIVATE" the configuration
+ should be preserved at all cost.
+ """
+ if os.getuid() != 0:
+ raise UserWarning("Must run as root")
+
+ if os.path.exists(self._MPATH_CONF):
+ first = second = ''
+ with open(self._MPATH_CONF) as f:
+ mpathconf = [x.strip("\n") for x in f.readlines()]
+ try:
+ first = mpathconf[0]
+ second = mpathconf[1]
+ except IndexError:
+ pass
+ if self._MPATH_CONF_PRIVATE_TAG in second:
+ sys.stdout.write("Manual override for multipath.conf detected"
+ " - preserving current configuration")
+ if self._MPATH_CONF_TAG not in first:
+ sys.stdout.write("This manual override for multipath.conf "
+ "was based on downrevved template. "
+ "You are strongly advised to "
+ "contact your support representatives")
+ return True
+
+ if self._MPATH_CONF_TAG in first:
+ sys.stdout.write("Current revision of multipath.conf detected,"
+ " preserving")
+ return True
+
+ for tag in self._OLD_TAGS:
+ if tag in first:
+ sys.stdout.write("Downrev multipath.conf detected, "
+ "upgrade required")
+ return False
+
+ sys.stdout.write("multipath Defaulting to False")
+ return False
+
+ def validate(self):
+ return self.isconfigured()
+
+ def reconfigureOnForce(self):
+ return self.isconfigured()
+
+
__configurers = (
LibvirtModuleConfigure(),
SanlockModuleConfigure(),
+ MultipathModuleConfigure(),
)
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 320a50a..49f3680 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -355,9 +355,6 @@
self._preparedVolumes = defaultdict(list)
- if not multipath.isEnabled():
- multipath.setupMultipath()
-
self.__validateLvmLockingType()
oop.setDefaultImpl(config.get('irs', 'oop_impl'))
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index d626305..0c05409 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -25,7 +25,6 @@
import os
import errno
from glob import glob
-import tempfile
import logging
import re
from collections import namedtuple
@@ -37,53 +36,11 @@
import supervdsm
import devicemapper
-import storage_exception as se
-
DEV_ISCSI = "iSCSI"
DEV_FCP = "FCP"
DEV_MIXED = "MIXED"
-MAX_CONF_COPIES = 5
-
TOXIC_CHARS = '()*+?|^$.\\'
-
-MPATH_CONF = "/etc/multipath.conf"
-
-OLD_TAGS = ["# RHAT REVISION 0.2", "# RHEV REVISION 0.3",
- "# RHEV REVISION 0.4", "# RHEV REVISION 0.5",
- "# RHEV REVISION 0.6", "# RHEV REVISION 0.7",
- "# RHEV REVISION 0.8", "# RHEV REVISION 0.9"]
-MPATH_CONF_TAG = "# RHEV REVISION 1.0"
-MPATH_CONF_PRIVATE_TAG = "# RHEV PRIVATE"
-STRG_MPATH_CONF = (
- "\n\n"
- "defaults {\n"
- " polling_interval 5\n"
- " getuid_callout \"%(scsi_id_path)s --whitelisted "
- "--replace-whitespace --device=/dev/%%n\"\n"
- " no_path_retry fail\n"
- " user_friendly_names no\n"
- " flush_on_last_del yes\n"
- " fast_io_fail_tmo 5\n"
- " dev_loss_tmo 30\n"
- " max_fds 4096\n"
- "}\n"
- "\n"
- "devices {\n"
- "device {\n"
- " vendor \"HITACHI\"\n"
- " product \"DF.*\"\n"
- " getuid_callout \"%(scsi_id_path)s --whitelisted "
- "--replace-whitespace --device=/dev/%%n\"\n"
- "}\n"
- "device {\n"
- " vendor \"COMPELNT\"\n"
- " product \"Compellent Vol\"\n"
- " no_path_retry fail\n"
- "}\n"
- "}"
-)
-MPATH_CONF_TEMPLATE = MPATH_CONF_TAG + STRG_MPATH_CONF
log = logging.getLogger("Storage.Multipath")
@@ -108,76 +65,6 @@
# Now let multipath daemon pick up new devices
misc.execCmd([constants.EXT_MULTIPATH], sudo=True)
-
-
-def isEnabled():
- """
- Check the multipath daemon configuration. The configuration file
- /etc/multipath.conf should contain private tag in form
- "RHEV REVISION X.Y" for this check to succeed.
- If the tag above is followed by tag "RHEV PRIVATE" the configuration
- should be preserved at all cost.
-
- """
- if os.path.exists(MPATH_CONF):
- first = second = ''
- svdsm = supervdsm.getProxy()
- mpathconf = svdsm.readMultipathConf()
- try:
- first = mpathconf[0]
- second = mpathconf[1]
- except IndexError:
- pass
- if MPATH_CONF_PRIVATE_TAG in second:
- log.info("Manual override for multipath.conf detected - "
- "preserving current configuration")
- if MPATH_CONF_TAG not in first:
- log.warning("This manual override for multipath.conf "
- "was based on downrevved template. "
- "You are strongly advised to "
- "contact your support representatives")
- return True
-
- if MPATH_CONF_TAG in first:
- log.debug("Current revision of multipath.conf detected, "
- "preserving")
- return True
-
- for tag in OLD_TAGS:
- if tag in first:
- log.info("Downrev multipath.conf detected, upgrade required")
- return False
-
- log.debug("multipath Defaulting to False")
- return False
-
-
-def setupMultipath():
- """
- Set up the multipath daemon configuration to the known and
- supported state. The original configuration, if any, is saved
- """
- if os.path.exists(MPATH_CONF):
- utils.rotateFiles(
- os.path.dirname(MPATH_CONF),
- os.path.basename(MPATH_CONF), MAX_CONF_COPIES,
- cp=True, persist=True)
- with tempfile.NamedTemporaryFile() as f:
- f.write(MPATH_CONF_TEMPLATE % {'scsi_id_path': _scsi_id.cmd})
- f.flush()
- cmd = [constants.EXT_CP, f.name, MPATH_CONF]
- rc = misc.execCmd(cmd, sudo=True)[0]
- if rc != 0:
- raise se.MultipathSetupError()
- utils.persistFile(MPATH_CONF)
-
- # Flush all unused multipath device maps
- misc.execCmd([constants.EXT_MULTIPATH, "-F"], sudo=True)
-
- cmd = [constants.EXT_VDSM_TOOL, "service-reload", "multipathd"]
- rc = misc.execCmd(cmd, sudo=True)[0]
- if rc != 0:
- raise se.MultipathReloadError()
def deduceType(a, b):
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index aa58a13..4ab65f6 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -139,11 +139,6 @@
return _getDevicePartedInfo(*args, **kwargs)
@logDecorator
- def readMultipathConf(self):
- with open(MPATH_CONF) as f:
- return [x.strip("\n") for x in f.readlines()]
-
- @logDecorator
def getScsiSerial(self, *args, **kwargs):
return _getScsiSerial(*args, **kwargs)
--
To view, visit http://gerrit.ovirt.org/30909
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife045908dc6e2aea9829b51482b909af1faf79da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: configurator: move usermod to spec
by Douglas Schilling Landgraf
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: configurator: move usermod to spec
......................................................................
configurator: move usermod to spec
vdsm-tool configure --force adds to /etc/group (qemu/kvm) sanlock
but doesn't persist the file in ovirt node distro which will
affect vdsm start on next reboot. This patch moves the usermod to
spec file.
Change-Id: I668552fa037414e9a6aee5b049d61749268f85d0
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M lib/vdsm/tool/configurator.py
M vdsm.spec.in
2 files changed, 5 insertions(+), 25 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/26055/1
diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py
index d1c876c..516a7bc 100644
--- a/lib/vdsm/tool/configurator.py
+++ b/lib/vdsm/tool/configurator.py
@@ -24,7 +24,7 @@
from .. import utils
from . import service, expose
-from ..constants import P_VDSM_EXEC, QEMU_PROCESS_GROUP, VDSM_GROUP
+from ..constants import P_VDSM_EXEC
class _ModuleConfigure(object):
@@ -108,8 +108,6 @@
class SanlockModuleConfigure(_ModuleConfigure):
- SANLOCK_GROUPS = (QEMU_PROCESS_GROUP, VDSM_GROUP)
-
def __init__(self):
super(SanlockModuleConfigure, self).__init__()
@@ -118,28 +116,6 @@
def getServices(self):
return ['sanlock']
-
- def configure(self):
- """
- Configure sanlock process groups
- """
- if os.getuid() != 0:
- raise UserWarning("Must run as root")
-
- rc, out, err = utils.execCmd(
- (
- '/usr/sbin/usermod',
- '-a',
- '-G',
- ','.join(self.SANLOCK_GROUPS),
- 'sanlock'
- ),
- raw=True,
- )
- sys.stdout.write(out)
- sys.stderr.write(err)
- if rc != 0:
- raise RuntimeError("Failed to perform sanlock config.")
def isconfigured(self):
"""
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 361a9c1..b149568 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -690,6 +690,7 @@
/usr/sbin/useradd -r -u 36 -g %{vdsm_group} -d /var/lib/vdsm \
-s /sbin/nologin -c "Node Virtualization Manager" %{vdsm_user}
/usr/sbin/usermod -a -G %{qemu_group},%{snlk_group} %{vdsm_user}
+/usr/sbin/usermod -a -G %{qemu_group},%{vdsm_group} %{snlk_user}
%post
%{_bindir}/vdsm-tool sebool-config || :
@@ -734,6 +735,9 @@
%endif
%preun
+/usr/bin/gpasswd -d %{snlk_user} %{qemu_group}
+/usr/bin/gpasswd -d %{snlk_user} %{vdsm_group}
+
if [ "$1" -eq 0 ]; then
start_conf_section="## beginning of configuration section by vdsm"
end_conf_section="## end of configuration section by vdsm"
--
To view, visit http://gerrit.ovirt.org/26055
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I668552fa037414e9a6aee5b049d61749268f85d0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: vdsm-tool: add the cmd get-engine-web-ca-issuer
by Douglas Schilling Landgraf
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: vdsm-tool: add the cmd get-engine-web-ca-issuer
......................................................................
vdsm-tool: add the cmd get-engine-web-ca-issuer
If oVirt Node is registered via oVirt Engine currently
we don't show to users which engine the node is registered.
This patch extracts the issuer field from engine web ca to use
the CN (commonname) data in ovirt-node-plugin-vdsm.
Change-Id: I70a19f54169498c53cabba0ac75e7a5611762ece
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1039267
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M lib/vdsm/tool/validate_ovirt_certs.py.in
1 file changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/27651/1
diff --git a/lib/vdsm/tool/validate_ovirt_certs.py.in b/lib/vdsm/tool/validate_ovirt_certs.py.in
index 6a8c13f..149dc30 100644
--- a/lib/vdsm/tool/validate_ovirt_certs.py.in
+++ b/lib/vdsm/tool/validate_ovirt_certs.py.in
@@ -35,6 +35,7 @@
PATH_CERT = '/etc/pki/vdsm/certs/'
PATH_CACERT = PATH_CERT + 'cacert.pem'
PATH_VDSMCERT = PATH_CERT + 'vdsmcert.pem'
+PATH_ENGINE_WEB_CA = PATH_CERT + 'engine_web_ca.pem'
def is_our_cafile(cacert):
@@ -60,3 +61,17 @@
os.chown(PATH_CACERT, uid, gid)
ovirtfunctions.ovirt_store_config(PATH_CACERT)
break
+
+
+@expose('get-engine-web-ca-issuer')
+def get_engine_web_ca_issuer():
+ """
+ Extract from engine web ca certificate the issuer field
+ """
+ if os.path.exists(PATH_ENGINE_WEB_CA):
+ cmd = [
+ EX_OPENSSL, 'x509', '-in', PATH_ENGINE_WEB_CA, '-noout', '-issuer'
+ ]
+ rc, out, err = execCmd(cmd, raw=True)
+ if not err:
+ print(out),
--
To view, visit http://gerrit.ovirt.org/27651
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I70a19f54169498c53cabba0ac75e7a5611762ece
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
9 years, 5 months