Federico Simoncelli has uploaded a new change for review.
Change subject: upgrade: skip volume lease for faulty metadata offsets
......................................................................
upgrade: skip volume lease for faulty metadata offsets
This check has been added to overcome bz882276 (during the domain
upgrade). Few vdsm releases (4.9 prior 496c0c3) generated metadata
offsets higher than 2048 - 100 - 1 that would not permit sanlock
to store the volume resource in the leases LV.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=882276
Change-Id: Ic84108d4fbe0dfee9fe1d57c802f99dd937cd8ec
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/imageRepository/formatConverter.py
1 file changed, 23 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/9600/1
diff --git a/vdsm/storage/imageRepository/formatConverter.py b/vdsm/storage/imageRepository/formatConverter.py
index cd32a62..a0edaab 100644
--- a/vdsm/storage/imageRepository/formatConverter.py
+++ b/vdsm/storage/imageRepository/formatConverter.py
@@ -18,7 +18,9 @@
# Refer to the README and COPYING files for full details of the license
#
+import errno
import logging
+import sanlock
from vdsm import qemuImg
@@ -27,6 +29,10 @@
from storage import image
from storage import safelease
from storage import volume
+from storage import blockVolume
+
+
+BLKVOL_MAX_OFFSET = sd.LEASES_SIZE - blockVolume.RESERVED_LEASES - 1
def __convertDomainMetadataToTags(domain, targetVersion):
@@ -153,7 +159,23 @@
log.debug("Creating the volume lease for %s", volUUID)
metaId = vol.getMetadataId()
- vol.newVolumeLease(metaId, domain.sdUUID, volUUID)
+
+ try:
+ vol.newVolumeLease(metaId, domain.sdUUID, volUUID)
+ except sanlock.SanlockException, e:
+ metaOffset = (vol.getMetaOffset()
+ if hasattr(vol, "getMetaOffset") else 0
+ # This check has been added to overcome BZ#882276 (during
+ # the domain upgrade). Few vdsm releases (4.9 prior 496c0c3)
+ # generated metadata offsets higher than 2048 - 100 - 1 that
+ # would not permit sanlock to store the volume resource in
+ # the leases LV.
+ if e.errno == errno.ENOSPC and metaOffset > BLKVOL_MAX_OFFSET:
+ log.error("The volume lease for %s has not been "
+ "initialized due bz882276, metadata offset "
+ "too high: %s", volUUID, metaOffset)
+ else:
+ raise
# If this volume is used as a template let's update the other
# volume's permissions and share the volume lease (at the moment
--
To view, visit http://gerrit.ovirt.org/9600
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic84108d4fbe0dfee9fe1d57c802f99dd937cd8ec
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Mark Wu has uploaded a new change for review.
Change subject: Fix return value of shutdown() on failure
......................................................................
Fix return value of shutdown() on failure
Change-Id: Ice01a8db664c8c1a3ca32c15de4865f362e7210e
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/vm.py
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/5434/1
--
To view, visit http://gerrit.ovirt.org/5434
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice01a8db664c8c1a3ca32c15de4865f362e7210e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: concurrency: Vdscli uses a new HTTP conn per req.
......................................................................
concurrency: Vdscli uses a new HTTP conn per req.
Python-2.7 changed xmlrpclib's implementation detail of spawining
a new http/https connection per each request to add support for
Keepalive. Unfortunately, this implementation detail was also what
made the xmlrpclib's Transport be thread-safe.
This change reverts the change in Transport, thus mantaining the
thread-safety of our python client code for unencrypted
communications.
Change-Id: Ifb08df759051bb340423958280e88df5792e9ed2
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm_cli/vdscli.py.in
1 file changed, 21 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/9329/1
diff --git a/vdsm_cli/vdscli.py.in b/vdsm_cli/vdscli.py.in
index 2af41b7..9d5d8a3 100644
--- a/vdsm_cli/vdscli.py.in
+++ b/vdsm_cli/vdscli.py.in
@@ -19,7 +19,8 @@
# Refer to the README and COPYING files for full details of the license
#
-import xmlrpclib
+from xmlrpclib import Server, ServerProxy, Transport
+import httplib
import subprocess
import os
from vdsm import SecureXMLRPCServer
@@ -28,6 +29,21 @@
d_tsPath = '@TRUSTSTORE@'
d_addr = '0'
d_port = '54321'
+
+
+class SingleRequestTransport(Transport):
+ '''Python 2.7 Transport introduced a change that makes it reuse connections
+ by default when new connections are requested for a host with an existing
+ connection. This class reverts the change to avoid the concurrency
+ issues.'''
+
+ def make_connection(self, host):
+ '''Creates a new HTTPConnection to the host.'''
+ # create a HTTP connection object from a host descriptor
+ chost, self._extra_headers, x509 = self.get_host_info(host)
+ #store the host argument along with the connection object
+ self._connection = host, httplib.HTTPConnection(chost)
+ return self._connection[1]
def __guessDefaults():
@@ -109,10 +125,11 @@
transport = TransportClass(key_file=KEYFILE,
cert_file=CERTFILE, ca_certs=CACERT)
- server = xmlrpclib.ServerProxy('https://%s' % addrport,
- transport=transport)
+ server = ServerProxy('https://%s' % addrport,
+ transport=transport)
else:
- server = xmlrpclib.Server('http://%s' % addrport)
+ server = Server('http://%s' % addrport,
+ transport=SingleRequestTransport(use_datetime=0))
return server
if __name__ == '__main__':
--
To view, visit http://gerrit.ovirt.org/9329
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb08df759051bb340423958280e88df5792e9ed2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
Federico Simoncelli has uploaded a new change for review.
Change subject: vdsm-tool: add the sebool configuration module
......................................................................
vdsm-tool: add the sebool configuration module
This patch moves the sebool configuration from a shell scriptlet in the
rpm package to the vdsm-tool command.
Change-Id: I01baf1c17f7cad2a0525b261be6b5ac648576252
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm-tool/Makefile.am
A vdsm-tool/seboolsetup.py
M vdsm.spec.in
3 files changed, 69 insertions(+), 36 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/9362/1
diff --git a/vdsm-tool/Makefile.am b/vdsm-tool/Makefile.am
index 997e339..348940e 100644
--- a/vdsm-tool/Makefile.am
+++ b/vdsm-tool/Makefile.am
@@ -29,5 +29,6 @@
__init__.py \
load_needed_modules.py \
passwd.py \
+ seboolsetup.py \
validate_ovirt_certs.py \
$(NULL)
diff --git a/vdsm-tool/seboolsetup.py b/vdsm-tool/seboolsetup.py
new file mode 100644
index 0000000..dee1e58
--- /dev/null
+++ b/vdsm-tool/seboolsetup.py
@@ -0,0 +1,63 @@
+#
+# Copyright 2012 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
+#
+
+import seobject
+from vdsm.tool import expose
+
+SEBOOL_ENABLED = "on"
+SEBOOL_DISABLED = "off"
+
+VDSM_SEBOOL_LIST = [
+ "virt_use_fusefs",
+ "virt_use_nfs",
+ "virt_use_samba",
+ "sanlock_use_fusefs",
+ "sanlock_use_nfs",
+ "sanlock_use_samba",
+ "virt_use_sanlock",
+]
+
+
+def setup_booleans(status):
+ sebool_obj = seobject.booleanRecords()
+ sebool_status = sebool_obj.get_all()
+
+ sebool_obj.start()
+
+ for sebool_variable in VDSM_SEBOOL_LIST:
+ if status and not all(sebool_status[sebool_variable]):
+ sebool_obj.modify(sebool_variable, SEBOOL_ENABLED)
+
+ if not status and any(sebool_status[sebool_variable]):
+ sebool_obj.modify(sebool_variable, SEBOOL_DISABLED)
+
+ sebool_obj.finish()
+
+
+@expose("sebool-enable")
+def sebool_enable():
+ """Enable the required selinux booleans"""
+ setup_booleans(True)
+
+
+@expose("sebool-disable")
+def sebool_disable():
+ """Disable the required selinux booleans"""
+ setup_booleans(False)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 3fa3395..033ce1a 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -456,30 +456,8 @@
/usr/sbin/usermod -a -G %{qemu_group},%{snlk_group} %{vdsm_user}
/usr/sbin/usermod -a -G %{qemu_group},%{vdsm_group} %{snlk_user}
-# vdsm makes extensive use of nfs-exported images
-# The next lines will collect the default selinux behaviour for the booleans
-virtNFS=$(/usr/sbin/semanage boolean -l | /bin/grep virt_use_nfs | cut -d ',' -f 2)
-virtSANLOCK=$(/usr/sbin/semanage boolean -l | /bin/grep virt_use_sanlock | cut -d ',' -f 2)
-snlkNFS=$(/usr/sbin/semanage boolean -l | /bin/grep sanlock_use_nfs | cut -d ',' -f 2)
-
-# Set the booleans and persist it across reboots
-if [[ "${virtNFS}" == *off* || "${virtSANLOCK}" == *off* || \
- "${snlkNFS}" == *off* ]]; then
- /usr/sbin/semanage boolean -m -S targeted -F /dev/stdin << _EOF
-virt_use_nfs=1
-virt_use_sanlock=1
-sanlock_use_nfs=1
-_EOF
-fi
-
-# Set the current state of SELinux booleans
-if /usr/sbin/selinuxenabled; then
- /usr/sbin/setsebool virt_use_nfs on
- /usr/sbin/setsebool virt_use_sanlock on
- /usr/sbin/setsebool sanlock_use_nfs on
-fi
-
%post
+%{_bindir}/vdsm-tool sebool-enable
# set the vdsm "secret" password for libvirt
%{_bindir}/vdsm-tool set-saslpasswd
@@ -521,17 +499,7 @@
/bin/sed -i '/# VDSM section begin/,/# VDSM section end/d' \
/etc/sysctl.conf
- /usr/sbin/semanage boolean -m -S targeted -F /dev/stdin << _EOF
-virt_use_nfs=0
-virt_use_sanlock=0
-sanlock_use_nfs=0
-_EOF
-
- if /usr/sbin/selinuxenabled; then
- /usr/sbin/setsebool virt_use_nfs off
- /usr/sbin/setsebool virt_use_sanlock off
- /usr/sbin/setsebool sanlock_use_nfs off
- fi
+ %{_bindir}/vdsm-tool sebool-disable
/usr/sbin/saslpasswd2 -p -a libvirt -d vdsm@ovirt
@@ -794,9 +762,10 @@
%{python_sitearch}/%{vdsm_name}/betterPopen/__init__.py*
%{python_sitearch}/%{vdsm_name}/betterPopen/createprocess.so
%{python_sitearch}/%{vdsm_name}/tool/__init__.py*
-%{python_sitearch}/%{vdsm_name}/tool/passwd.py*
-%{python_sitearch}/%{vdsm_name}/tool/validate_ovirt_certs.py*
%{python_sitearch}/%{vdsm_name}/tool/load_needed_modules.py*
+%{python_sitearch}/%{vdsm_name}/tool/passwd.py*
+%{python_sitearch}/%{vdsm_name}/tool/seboolsetup.py*
+%{python_sitearch}/%{vdsm_name}/tool/validate_ovirt_certs.py*
%files tests
%doc %{_datadir}/%{vdsm_name}/tests/README
--
To view, visit http://gerrit.ovirt.org/9362
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01baf1c17f7cad2a0525b261be6b5ac648576252
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>