Wenyi Gao has uploaded a new change for review.
Change subject: Move start_needed_srv and shutdown_conflicting_srv to vdsm-tool
......................................................................
Move start_needed_srv and shutdown_conflicting_srv to vdsm-tool
Change-Id: I54eca4b2cc3a17e9819a0188e5dc4c8bd28161da
Signed-off-by: Wenyi Gao <wenyi(a)linux.vnet.ibm.com>
---
M .gitignore
M vdsm-tool/Makefile.am
A vdsm-tool/base.py
A vdsm-tool/needed_service.py.in
M vdsm.spec.in
M vdsm/vdsmd.init.in
6 files changed, 145 insertions(+), 42 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/8759/1
diff --git a/.gitignore b/.gitignore
index 49a78ef..f9c26d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,7 @@
vdsm/vdsmd.8
vdsm/vdsmd.init
vdsm-tool/load_needed_modules.py
+vdsm-tool/needed_service.py
vdsm-tool/validate_ovirt_certs.py
vdsm_cli/vdsClient
vdsm_cli/vdscli.py
diff --git a/vdsm-tool/Makefile.am b/vdsm-tool/Makefile.am
index 997e339..0ed3226 100644
--- a/vdsm-tool/Makefile.am
+++ b/vdsm-tool/Makefile.am
@@ -27,7 +27,9 @@
dist_vdsmtool_DATA = \
__init__.py \
+ base.py \
load_needed_modules.py \
+ needed_service.py \
passwd.py \
validate_ovirt_certs.py \
$(NULL)
diff --git a/vdsm-tool/base.py b/vdsm-tool/base.py
new file mode 100644
index 0000000..9ded9a1
--- /dev/null
+++ b/vdsm-tool/base.py
@@ -0,0 +1,77 @@
+# Copyright IBM, Corp. 2012
+#
+# 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 subprocess
+
+
+def exec_command(argv):
+ """
+ This function executes a given shell command.
+ """
+ try:
+ p = subprocess.Popen(argv, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out, err = p.communicate()
+ rc = p.returncode
+ except:
+ raise Exception('Failed to execute "%s"', ' '.join(argv),
+ exc_info=True)
+
+ return (rc, out, err)
+
+
+def call_init_function(function, *args, **kwargs):
+ """
+ Call a function from /etc/init.d/functions.
+ """
+ allowed_init_function = ['success', 'failure', 'pidofproc',
+ 'killproc', 'daemon']
+ rc = -1
+ srccmd = 'SYSTEMCTL_SKIP_REDIRECT=true source /etc/init.d/functions;'
+
+ if function not in allowed_init_function:
+ print('Illegal function "%s"', function)
+ return rc
+
+ tmpcmd = function + ' '.join('%s=%s' % item for item in kwargs.iteritems())
+ tmpcmd += ' ' + ' '.join(args)
+ # Only allow to execute one shell command.
+ if any(c in tmpcmd for c in (';', '&&', '||')):
+ print('Illegal function parameters "%s"', tmpcmd)
+ return rc
+
+ cmd = srccmd + tmpcmd
+ try:
+ rc = subprocess.call([cmd], shell=True)
+ except:
+ raise Exception('Failed to execute "%s"', cmd, exc_info=True)
+
+ return rc
+
+
+def print_msg(msg, success=True):
+ """
+ Print message followed by a color string "[ OK ]" or "[Failed]".
+ """
+ print msg,
+ if success:
+ call_init_function('success')
+ else:
+ call_init_function('failure')
+ print
diff --git a/vdsm-tool/needed_service.py.in b/vdsm-tool/needed_service.py.in
new file mode 100644
index 0000000..5266408
--- /dev/null
+++ b/vdsm-tool/needed_service.py.in
@@ -0,0 +1,61 @@
+# Copyright IBM, Corp. 2012
+#
+# 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 os
+
+from vdsm import constants
+from vdsm.tool.base import exec_command, print_msg
+from vdsm.tool import expose
+
+EX_CHKCONFIG = '@CHKCONFIG_PATH@'
+EX_SERVICE = constants.EXT_SERVICE
+
+
+@expose('shutdown-conflicting-srv')
+def shutdown_conflicting_srv():
+ """
+ Shutdown conflicting service
+ """
+ srv = 'libvirt-guests'
+ exec_command([EX_CHKCONFIG, srv, 'off'])
+ rc = exec_command([EX_SERVICE, srv, 'status'])[0]
+ if rc == 0:
+ if os.path.exists('/var/lock/subsys/libvirt-guests'):
+ os.unlink('/var/lock/subsys/libvirt-guests')
+ else:
+ exec_command([EX_SERVICE, srv, 'stop'])
+ return 0
+
+
+@expose('start-needed-srv')
+def start_needed_srv():
+ """
+ Start needed service
+ """
+ services = ['iscsid', 'multipathd', 'ntpd', 'wdmd', 'sanlock']
+ for srv in services:
+ rc = exec_command([EX_SERVICE, srv, 'status'])[0]
+ if rc != 0:
+ print 'Starting %s...' % srv
+ rc = exec_command([EX_SERVICE, srv, 'start'])[0]
+ if rc != 0:
+ print_msg('vdsm: Dependent %s failed to start' % srv, False)
+ return rc
+ exec_command([EX_SERVICE, 'iscsid', 'force-start'])
+ return 0
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f61a36a..dc7ee24 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -771,6 +771,8 @@
%{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/needed_service.py*
+%{python_sitearch}/%{vdsm_name}/tool/base.py*
%files tests
%doc %{_datadir}/%{vdsm_name}/tests/README
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index 2b9ad11..35fb05e 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -32,8 +32,6 @@
CORE_DUMP_PATH=/var/log/core/core.%p.%t.dump
DOM_METADATA_BACKUP_DIR=/var/log/vdsm/backup
CORE_PATTERN=/proc/sys/kernel/core_pattern
-NEEDED_SERVICES="iscsid multipathd ntpd wdmd sanlock"
-CONFLICTING_SERVICES="libvirt-guests"
LCONF=/etc/libvirt/libvirtd.conf
QCONF=/etc/libvirt/qemu.conf
@@ -130,49 +128,11 @@
fi
}
-shutdown_conflicting_srv() {
- local srv
-
- for srv in $CONFLICTING_SERVICES
- do
- /sbin/chkconfig $srv off
- if /sbin/service $srv status > /dev/null 2>&1;
- then
- if [ "$srv" == "libvirt-guests" ]; then
- /bin/rm -f /var/lock/subsys/libvirt-guests
- else
- /sbin/service $srv stop
- fi
- fi
- done
- return 0
-}
libvirt_should_use_upstart() {
[[ -x /sbin/initctl ]]
}
-start_needed_srv() {
- local srv
- local ret_val
-
- for srv in $NEEDED_SERVICES
- do
- if ! /sbin/service $srv status > /dev/null 2>&1;
- then
- echo "Starting $srv..."
- /sbin/service $srv start
- ret_val=$?
- if [ $ret_val -ne 0 ]
- then
- log_failure_msg "$prog: Dependent $srv failed to start"
- return $ret_val
- fi
- fi
- done
-
- /sbin/service iscsid force-start
-}
test_lo() {
if ! LC_ALL=C /sbin/ifconfig lo | /bin/grep -q UP;
@@ -428,7 +388,7 @@
local ret_val
python @VDSMDIR@/hooks.pyc before_vdsm_start
- shutdown_conflicting_srv && stop_libvirtd_sysv
+ /usr/bin/vdsm-tool shutdown-conflicting-srv && stop_libvirtd_sysv
if ! @LIBEXECDIR@/vdsm-gencerts.sh --check; then
echo -n $"Configuring a self-signed VDSM host certificate: "
@@ -443,7 +403,7 @@
return $ret_val
fi
- start_needed_srv && start_libvirtd
+ /usr/bin/vdsm-tool start-needed-srv && start_libvirtd
ret_val=$?
if [ $ret_val -ne 0 ]
then
--
To view, visit http://gerrit.ovirt.org/8759
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54eca4b2cc3a17e9819a0188e5dc4c8bd28161da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Wenyi Gao <wenyi(a)linux.vnet.ibm.com>
Josef Pacula has uploaded a new change for review.
Change subject: minimalistic (incomplete) test for mkimage.py with fail for non-64base data
......................................................................
minimalistic (incomplete) test for mkimage.py with fail for non-64base data
Change-Id: I1a7656359beb5d116ad1919e237fe084a1208d71
Signed-off-by: Josef Pacula <josef.pacula(a)gmail.com>
---
M tests/Makefile.am
A tests/mkimageTests.py
M vdsm/mkimage.py
3 files changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/6275/1
--
To view, visit http://gerrit.ovirt.org/6275
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a7656359beb5d116ad1919e237fe084a1208d71
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Josef Pacula <josef.pacula(a)gmail.com>
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: Logging: config logging in new process of remoteFileHandler
......................................................................
Logging: config logging in new process of remoteFileHandler
When new process of Python is started by PoolHandler.__init__() to run
remoteFileHandler.py, the logging configurations are lost. This patch
sets the configuration for new process of remoteFileHandler.py correctly.
This patch deals with the logging problem described in the following bug
report in the last paragraph of the "Additional info" section.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=875678
Change-Id: I1b3b9e2837d632c7532fcd8f7306ed50b0865b5c
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M vdsm/storage/remoteFileHandler.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/9182/1
diff --git a/vdsm/storage/remoteFileHandler.py b/vdsm/storage/remoteFileHandler.py
index edf8e68..34de3ef 100644
--- a/vdsm/storage/remoteFileHandler.py
+++ b/vdsm/storage/remoteFileHandler.py
@@ -32,6 +32,13 @@
from contextlib import contextmanager
from threading import Thread
+from vdsm import constants
+
+if __name__ == "__main__":
+ from logging import config as lconfig
+ loggerConfFile = constants.P_VDSM_CONF + 'logger.conf'
+ lconfig.fileConfig(loggerConfFile)
+
import misc
import fileUtils
--
To view, visit http://gerrit.ovirt.org/9182
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b3b9e2837d632c7532fcd8f7306ed50b0865b5c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Saggi Mizrahi has uploaded a new change for review.
Change subject: Fix problems with current implementation of forceIscsiRescan
......................................................................
Fix problems with current implementation of forceIscsiRescan
- Move configuration access out to HSM.
- Fix error in logging when reading a bad configuration file.
- Clean up slow child processes so we don't have a zombie leak.
- Fix performance degradation (minTimeout) for fast HBAs.
Change-Id: Ic4e7173086ba15c7706206c5ee1473ed6d334f9e
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/Makefile.am
A tests/iscsiTests.py
M vdsm/config.py.in
M vdsm/storage/hsm.py
M vdsm/storage/iscsi.py
M vdsm/storage/sdc.py
6 files changed, 67 insertions(+), 37 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/8172/1
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 52dfda0..98e9112 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,6 +32,7 @@
guestIFTests.py \
hooksTests.py \
lsblkTests.py \
+ iscsiTests.py \
main.py \
md_utils_tests.py \
miscTests.py \
diff --git a/tests/iscsiTests.py b/tests/iscsiTests.py
new file mode 100644
index 0000000..63138fe
--- /dev/null
+++ b/tests/iscsiTests.py
@@ -0,0 +1,14 @@
+from storage import iscsi
+from testrunner import VdsmTestCase as TestCaseBase
+
+
+class IscsiForceRescanTests(TestCaseBase):
+ def testThatRuns(self):
+ #TODO: It's quite complex actually checking that it did the right
+ # thing. For now just make sure that it runs.
+ iscsi.forceIScsiScan(30)
+
+ def testTimeoutFlow(self):
+ #TODO: It's quite complex actually checking that it did the right
+ # thing. For now just make sure that it runs.
+ iscsi.forceIScsiScan(0)
diff --git a/vdsm/config.py.in b/vdsm/config.py.in
index df85e7e..5dbede3 100644
--- a/vdsm/config.py.in
+++ b/vdsm/config.py.in
@@ -176,11 +176,8 @@
'Storage domain validate timeout, the maximum number of seconds '
'to wait until all the domains will be validated.'),
- ('scsi_rescan_minimal_timeout', '2',
- 'The minimum number of seconds to wait for scsi scan to return.'),
-
- ('scsi_rescan_maximal_timeout', '30',
- 'The maximal number of seconds to wait for scsi scan to return.'),
+ ('scsi_rescan_timeout', '30',
+ 'The number of seconds to wait for scsi scan to return.'),
('sd_health_check_delay', '10',
'Storage domain health check delay, the amount of seconds to '
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index a89274a..b54ee18 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -293,6 +293,13 @@
def storageRefresh():
lvm._lvminfo.bootstrap()
+ iscsiRescanTimeout = config.getint('irs', 'scsi_rescan_timeout')
+ if (iscsiRescanTimeout < 0):
+ self.log.warning("scsi_rescan_timeout as an invalid value, "
+ "using the default: %d",
+ sdCache.iscsiRescanTimeout)
+
+ sdCache.iscsiRescanTimeout = iscsiRescanTimeout
sdCache.refreshStorage()
self.tasksDir = config.get('irs', 'hsm_tasks')
diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index 578b700..4e8f25a 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -29,10 +29,11 @@
import errno
import time
from collections import namedtuple
+import select
+import threading
from vdsm import constants
import misc
-from vdsm.config import config
import devicemapper
from threading import RLock
@@ -349,43 +350,52 @@
except iscsiadm.IscsiError:
pass
+# FIXME: Because of sampling method semantics, the first caller in each round
+# will select the timeout. This doesn't matter as currently the timeout never
+# changes. This shows a fundamental problem with this interface. Changing this
+# to something more generic will take to much work and is not necessary at the
+# moment.
@misc.samplingmethod
-def forceIScsiScan():
- processes = []
- minTimeout = config.getint('irs', 'scsi_rescan_minimal_timeout')
- maxTimeout = config.getint('irs', 'scsi_rescan_maximal_timeout')
+def forceIScsiScan(timeout):
+ poller = select.poll()
+ procs = {}
+
for hba in glob.glob(SCAN_PATTERN):
cmd = [constants.EXT_DD, 'of=' + hba]
p = misc.execCmd(cmd, sudo=False, sync=False)
p.stdin.write("- - -")
p.stdin.flush()
p.stdin.close()
- processes.append((hba, p))
- if (minTimeout > maxTimeout or minTimeout < 0):
- minTimeout = 2
- maxTimeout = 30
- log.warning("One of the following configuration arguments has an ",
- "illegal value: scsi_rescan_minimal_timeout or ",
- "scsi_rescan_maximal_timeout. Set to %s and %s seconds ",
- "respectively.", minTimeout, maxTimeout)
- log.debug("Performing SCSI scan, this will take up to %s seconds",
- maxTimeout)
- time.sleep(minTimeout)
- for i in xrange(maxTimeout - minTimeout):
- for p in processes[:]:
- (hba, proc) = p
- if proc.wait(0):
- if proc.returncode != 0:
- log.warning('returncode for: %s is: %s', hba,
- proc.returncode)
- processes.remove(p)
- if not processes:
- break
- else:
- time.sleep(1)
- else:
- log.warning("Still waiting for scsi scan of hbas: %s",
- tuple(hba for p in processes))
+ fd = p.stdout.fileno()
+ poller.register(fd, 0) # Only HUP and ERR
+ procs[fd] = p
+
+ startTime = time.time()
+ timeLeft = timeout
+ while (len(procs) > 0) and (timeLeft > 0):
+ for fd, event in misc.NoIntrPoll(poller.poll, timeout):
+ poller.unregister(fd)
+ p = procs.pop(fd)
+ p.wait()
+
+ timeLeft = timeout - (time.time() - startTime)
+
+ if len(procs) == 0:
+ return
+
+ log.warn("Not all rescan completed in alotted time")
+
+ # We have to put on a thread that waits for the remaining processes,
+ # otherwise we will end up with zombie children
+
+ def collectSlowProcs(procs):
+ for p in procs.itervalues():
+ p.wait()
+
+ t = threading.Thread(target=collectSlowProcs, args=(procs,))
+ t.setDaemon(True)
+ t.start()
+
def devIsiSCSI(dev):
hostdir = os.path.realpath(os.path.join("/sys/block", dev, "device/../../.."))
diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py
index 90ccc35..bc73291 100644
--- a/vdsm/storage/sdc.py
+++ b/vdsm/storage/sdc.py
@@ -64,6 +64,7 @@
self.__domainCache = {}
self.storage_repo = storage_repo
self.storageStale = True
+ self.iscsiRescanTimeout = 30
def invalidateStorage(self):
self.storageStale = True
@@ -71,7 +72,7 @@
@misc.samplingmethod
def refreshStorage(self):
- multipath.rescan()
+ multipath.rescan(self.iscsiRescanTimeout)
lvm.invalidateCache()
self.storageStale = False
--
To view, visit http://gerrit.ovirt.org/8172
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4e7173086ba15c7706206c5ee1473ed6d334f9e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Bruce Bai has uploaded a new change for review.
Change subject: Title: fix some code style consist with pep8
......................................................................
Title: fix some code style consist with pep8
content: fix some storage code files pep8 style.
Change-Id: I50cf61d9b7815cbdd5571930e3f9be59183a83f4
Signed-off-by: Changming Bai <baichm(a)linux.vnet.ibm.com>
---
M Makefile.am
M vdsm/storage/__init__.py
M vdsm/storage/safelease.py
M vdsm/storage/storageConstants.py
M vdsm/storage/storage_exception.py
M vdsm/storage/sync.py
6 files changed, 373 insertions(+), 33 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/4500/1
--
To view, visit http://gerrit.ovirt.org/4500
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I50cf61d9b7815cbdd5571930e3f9be59183a83f4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bruce Bai <baichm(a)linux.vnet.ibm.com>
Francesco Romani has uploaded a new change for review.
Change subject: hypervisor autodetection for the vdsm capabilities
......................................................................
hypervisor autodetection for the vdsm capabilities
This is a follow up and an extension of the
Change I79f4ab08: add and use hypervisor autodetection in bootstrap.
(see http://gerrit.ovirt.org/#/c/7657 )
The vdsm capability reporting code is enhanced to autonomously
autodetect and report if the vdsm is running under an hypervisor,
thus if the virtualization support has to be emulated.
The hypervisor detection code is the same as the patch mentioned
above, updated following the comment received so far.
The autodetection code is moved in a separate little module
(`cpu_utils.py') which can be shared both by the vdsm and the
vds_bootstrap code.
So far, the two patches are independent and so they use independent
(duplicated) detection code, but a further patch (or an extension
of the current one, if preferred) is planned in order to share
the same module, minimizing the duplication to the point which I believe
is the minimum possible.
With this change and the one mentioned above both applied, there
is no longer need of the `fake_kvm_support' configuration variable.
In the proposed patch it is left as last resort/fallback option,
but it can be removed with a further patch, planned as well.
Change-Id: I565ef639e1f74bdbaef93060f4f25c75085d361b
Signed-off-by: Francesco Romani <fromani(a)gmail.com>
---
M vdsm.spec.in
M vdsm/Makefile.am
M vdsm/caps.py
A vdsm/cpu_utils.py
4 files changed, 82 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/7884/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index bb6730e..fb8bb01 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -559,6 +559,7 @@
%{_datadir}/%{vdsm_name}/blkid.py*
%{_datadir}/%{vdsm_name}/caps.py*
%{_datadir}/%{vdsm_name}/clientIF.py*
+%{_datadir}/%{vdsm_name}/cpu_utils.py*
%{_datadir}/%{vdsm_name}/API.py*
%{_datadir}/%{vdsm_name}/hooking.py*
%{_datadir}/%{vdsm_name}/hooks.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 96c8a56..662190d 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -31,6 +31,7 @@
caps.py \
clientIF.py \
configNetwork.py \
+ cpu_utils.py \
debugPluginClient.py \
guestIF.py \
hooking.py \
diff --git a/vdsm/caps.py b/vdsm/caps.py
index f1641ff..afc88dd 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -41,6 +41,7 @@
from vdsm import utils
from vdsm import constants
import storage.hba
+import cpu_utils
# For debian systems we can use python-apt if available
try:
@@ -228,11 +229,18 @@
return __osversion
+(a)utils.memoized
+def _getHypervisorName():
+ return cpu_utils.findHypervisor()
+
+
def get():
caps = {}
+ fake_kvm = bool(_getHypervisorName()) or \
+ config.getboolean('vars', 'fake_kvm_support')
caps['kvmEnabled'] = \
- str(config.getboolean('vars', 'fake_kvm_support') or
+ (str(fake_kvm) or
os.path.exists('/dev/kvm')).lower()
cpuInfo = CpuInfo()
@@ -243,7 +251,7 @@
caps['cpuSockets'] = str(cpuInfo.sockets())
caps['cpuSpeed'] = cpuInfo.mhz()
- if config.getboolean('vars', 'fake_kvm_support'):
+ if fake_kvm:
caps['cpuModel'] = 'Intel(Fake) CPU'
flags = set(cpuInfo.flags() + ['vmx', 'sse2', 'nx'])
caps['cpuFlags'] = ','.join(flags) + 'model_486,model_pentium,' \
@@ -276,6 +284,7 @@
config.getint('vars', 'host_mem_reserve') +
config.getint('vars', 'extra_mem_reserve'))
caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')
+ caps['hypervisorName'] = _getHypervisorName()
return caps
diff --git a/vdsm/cpu_utils.py b/vdsm/cpu_utils.py
new file mode 100644
index 0000000..c3f402e
--- /dev/null
+++ b/vdsm/cpu_utils.py
@@ -0,0 +1,69 @@
+#
+# Copyright 2008-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
+#
+
+"""
+A module containing miscellaneous cpu detection functions
+used by various vdsm components.
+"""
+
+import struct
+import logging
+import traceback
+
+
+def cpuHypervisorID():
+ # we cannot (yet) use _cpuid because of the different
+ # unpack format.
+ HYPERVISOR_CPUID_LEAF = 0x40000000
+ with open('/dev/cpu/0/cpuid') as f:
+ f.seek(HYPERVISOR_CPUID_LEAF)
+ c = struct.unpack('I12s', f.read(16))
+ return c[1].strip('\x00')
+ return ''
+
+def cpuModelName():
+ with open('/proc/cpuinfo') as f:
+ for line in f:
+ if ':' in line:
+ k, v = line.split(':', 1)
+ k = k.strip()
+ if k == 'model name':
+ return v.strip()
+ return ''
+
+def findHypervisor():
+ name = ''
+ try:
+ hid = cpuHypervisorID()
+ if hid == 'VMwareVMware':
+ name = 'vmware'
+ elif hid == 'Microsoft Hv':
+ name = 'hyperv'
+ elif hid == 'XenVMMXenVMM':
+ name = 'xen'
+ elif hid == 'KVMKVMKVM':
+ name = 'kvm'
+ elif 'QEMU' in cpuModelName():
+ name = 'qemu'
+ logging.debug('detected hypervisor: %s', name)
+ except:
+ logging.error(traceback.format_exc())
+ return name
+
--
To view, visit http://gerrit.ovirt.org/7884
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I565ef639e1f74bdbaef93060f4f25c75085d361b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)gmail.com>
Fernando Granha Jeronimo has uploaded a new change for review.
Change subject: Avoid race condition with vdsm-reg during firstboot
......................................................................
Avoid race condition with vdsm-reg during firstboot
In the vdsm-config script, the vdsm-reg service is disabled to
avoid race conditions, once it is intended to be executed just
before the node is rebooted and the registration process should
take place only after reboot.
Change-Id: I2a215bbe6c467d10cf414b09cdaee5340092198e
Signed-off-by: Fernando Granha Jeronimo <fgranha(a)linux.vnet.ibm.com>
---
M vdsm_reg/vdsm-config
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/8200/1
diff --git a/vdsm_reg/vdsm-config b/vdsm_reg/vdsm-config
index 968d78c..0a030d1 100755
--- a/vdsm_reg/vdsm-config
+++ b/vdsm_reg/vdsm-config
@@ -14,6 +14,16 @@
echo "vdsm-config: starting" | tee $LOG
+ # Disable vdsm-reg service to avoid race condition
+ # when parameters are written to config file and the
+ # service is running. This is necessary, because the
+ # registration process can take place only after reboot.
+ if [ -x /bin/systemctl ] ; then
+ /bin/systemctl stop vdsm-reg.service > /dev/null 2>&1
+ elif [ -x /sbin/service ] ; then
+ /sbin/service vdsm-reg stop > /dev/null 2>&1
+ fi
+
set_vars() {
echo "[vars]" >> $VDSM_CONFIG #Adding ts for the coming scripts.
echo "trust_store_path = " `$GETCONFITEM $VDSM_CONFIG vars trust_store_path /etc/pki/vdsm` >> $VDSM_CONFIG
--
To view, visit http://gerrit.ovirt.org/8200
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a215bbe6c467d10cf414b09cdaee5340092198e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Fernando Granha Jeronimo <fgranha(a)linux.vnet.ibm.com>
Royce Lv has uploaded a new change for review.
Change subject: [WIP]change startup process for vdsm and supervdsm
......................................................................
[WIP]change startup process for vdsm and supervdsm
Using vdsmService to take care of start up and respawn process of
vdsm and supervdsm. Remove the function of vdsm to start previlege
supervdsm process.
Change-Id: I69aae6b0b9529c80291d90c6ad14ff82b21aea53
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
M vdsm.spec.in
M vdsm/Makefile.am
M vdsm/storage/misc.py
M vdsm/supervdsm.py
M vdsm/supervdsmServer.py
M vdsm/vdsm
A vdsm/vdsmService
M vdsm/vdsmd.init.in
M vdsm_reg/Makefile.am
9 files changed, 208 insertions(+), 63 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/4145/1
--
To view, visit http://gerrit.ovirt.org/4145
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69aae6b0b9529c80291d90c6ad14ff82b21aea53
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Eduardo has uploaded a new change for review.
Change subject: Related to BZ# - One shot prepare.
......................................................................
Related to BZ# - One shot prepare.
The number of storage accesses is reduced to 1 or none instead of
the recursive volume images produces.
Change-Id: Id47db9c53199385dd5d08586e4782ea23885eb72
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 7 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/4220/1
--
To view, visit http://gerrit.ovirt.org/4220
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id47db9c53199385dd5d08586e4782ea23885eb72
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Eduardo has uploaded a new change for review.
Change subject: Related to BZ#769502 - One shot prepare.
......................................................................
Related to BZ#769502 - One shot prepare.
The number of storage accesses is reduced to 1 or none instead of
the recursive volume images produces.
Change-Id: I4b6a4e99cf3a657affb4f5e96aa1ac1978a297da
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/image.py
2 files changed, 5 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/4234/1
--
To view, visit http://gerrit.ovirt.org/4234
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b6a4e99cf3a657affb4f5e96aa1ac1978a297da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: deployUtil: Add logging.error() to CPU virt check
......................................................................
deployUtil: Add logging.error() to CPU virt check
Adding logging.error() msg to help users in case CPU
virt support is disable in BIOS.
Change-Id: I3baff7594ad2cfcf4844a30586a2e4a4313a1972
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M vdsm_reg/deployUtil.py.in
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/3549/1
--
To view, visit http://gerrit.ovirt.org/3549
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3baff7594ad2cfcf4844a30586a2e4a4313a1972
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Mark Wu has uploaded a new change for review.
Change subject: Fix MountError exception handling in MountConnection.connect()
......................................................................
Fix MountError exception handling in MountConnection.connect()
The old code swallowed the exception of MountError if dir is removed
successfully. The patches re-raise the exception, which could be
MountError or OSError. In any case, it will stop executing the following
code.
Change-Id: Ic6d9ab419d717345c81fa8e8787e089ccd5a890f
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/storage/storageServer.py
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/9503/1
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 383e04c..6136777 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -202,7 +202,9 @@
os.rmdir(self._getLocalPath())
except OSError as e:
if e.errno != errno.ENOENT:
- raise
+ self.log.warn("Error while removing dir %s",
+ self._getLocalPath(), exc_info=True)
+ raise
try:
fileSD.validateDirAccess(self.getMountObj().getRecord().fs_file)
--
To view, visit http://gerrit.ovirt.org/9503
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6d9ab419d717345c81fa8e8787e089ccd5a890f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Mark Wu has uploaded a new change for review.
Change subject: Enable logging facility for test cases
......................................................................
Enable logging facility for test cases
In current code, there's no log handler configured. So make use of
the logging configured by nose.config for test cases.
Change-Id: Iaf727a2dfe38206737e0711466978277cd95ad34
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M tests/testrunner.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/3712/1
--
To view, visit http://gerrit.ovirt.org/3712
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf727a2dfe38206737e0711466978277cd95ad34
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Eduardo has uploaded a new change for review.
Change subject: BZ#836161 - Clean up.
......................................................................
BZ#836161 - Clean up.
Change-Id: Icf01de7dc8bf0a903ebf94d9e33ffad9a195b7de
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 0 insertions(+), 71 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/8507/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 78fbe66..0ade40d 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1766,73 +1766,6 @@
image.Image(repoPath).multiMove(srcDomUUID, dstDomUUID, imgDict, vmUUID, force)
- def deleteImage(self, sdUUID, imgUUID, postZero, force):
- """
- Deletes an Image folder with all its volumes.
-
- This function assumes that imgUUID is locked.
- In addition to removing image, this function also does the following:
- If removing a template from a backup SD which has dependent images:
- - creates a fake template.
- If removing the last image which depends on a fake template:
- - removes the fake template as well
- :param sdUUID: The UUID of the storage domain that contains the images.
- :type sdUUID: UUID
- :param imgUUID: The UUID of the image you want to delete.
- :type imgUUID: UUID
- :param postZero: bool
- :param force: Should the operation be forced.
- :type force: bool
- """
- # TODO: This function works on domains. No relation with pools.
- # Therefore move this to the relevant *sd module
- repoPath = os.path.join(self.storage_repository, self.spUUID)
- img = image.Image(repoPath)
- dom = sdCache.produce(sdUUID)
- allVols = dom.getAllVolumes()
- # Filter volumes related to this image
- imgsByVol = sd.getVolsOfImage(allVols, imgUUID)
- if all(len(v.imgs) == 1 for k, v in imgsByVol.iteritems()):
- # This is a self contained regular image, i.e. it's either an image
- # which is not based on a template or a template which has no
- # derived images, e.g. not derived from a template
- img.delete(sdUUID=sdUUID, imgUUID=imgUUID, postZero=postZero, force=force)
- else:
- # This is either a template with derived images or a derived image
- # so needs further scrutiny
- ts = tuple((volName, vol.imgs) for volName, vol in
- imgsByVol.iteritems() if len(vol.imgs) > 1)
- if len(ts) != 1:
- raise se.ImageValidationError("Image points to multiple"
- "templates %s in %s from %s" % \
- (ts, imgsByVol, allVols))
- # TODO: Lock the template, reload allVols.
- # template = ts[0] = [(tName, tImgs)]
- tName, tImgs = ts[0]
- # getAllVolumes makes the template self img the 1st one in tImgs
- templateImage = tImgs[0]
- numOfDependentImgs = len(tImgs) - 1
- if templateImage != imgUUID:
- # Removing an image based on a template
- img.delete(sdUUID=sdUUID, imgUUID=imgUUID, postZero=postZero, force=force)
- if numOfDependentImgs == 1 and dom.produceVolume(templateImage, tName).isFake():
- # Remove the fake template since last consumer was removed
- img.delete(sdUUID=sdUUID, imgUUID=templateImage, postZero=False, force=True)
-
- # Removing a template with dependencies
- elif force:
- img.delete(sdUUID=sdUUID, imgUUID=templateImage, postZero=postZero,
- force=force)
- elif not dom.isBackup():
- raise se.ImagesActionError("Can't remove template with children %s",
- allVols)
- else:
- # Removing a template with dependencies in backup domain
- # A fake template will be created
- img.delete(sdUUID=sdUUID, imgUUID=imgUUID, postZero=postZero, force=True)
- tParams = dom.produceVolume(imgUUID, tName).getVolumeParams()
- img.createFakeTemplate(sdUUID=sdUUID, volParams=tParams)
-
def mergeSnapshots(self, sdUUID, vmUUID, imgUUID, ancestor, successor, postZero):
"""
Merges the source volume to the destination volume.
@@ -2012,10 +1945,6 @@
def preDeleteRename(self, sdUUID, imgUUID):
repoPath = os.path.join(self.storage_repository, self.spUUID)
return image.Image(repoPath).preDeleteRename(sdUUID, imgUUID)
-
- def validateDelete(self, sdUUID, imgUUID):
- repoPath = os.path.join(self.storage_repository, self.spUUID)
- image.Image(repoPath).validateDelete(sdUUID, imgUUID)
def validateVolumeChain(self, sdUUID, imgUUID):
repoPath = os.path.join(self.storage_repository, self.spUUID)
--
To view, visit http://gerrit.ovirt.org/8507
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf01de7dc8bf0a903ebf94d9e33ffad9a195b7de
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Alon Bar-Lev has uploaded a new change for review.
Change subject: build: use architecture independent location of site-packages if possible
......................................................................
build: use architecture independent location of site-packages if possible
Currently all vdsm python modules go into pyexecdir, which is the
architecture specific location.
Python architecture independent modules should go into pythondir.
In x86_64 system locations are:
pythondir = /usr/lib/python2.7/site-packages
pyexecdir = /usr/lib64/python2.7/site-packages
Both are in default search path of python:
---
print(sys.path)"
['', '/root', '/usr/lib64/python27.zip', '/usr/lib64/python2.7',
'/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk',
'/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload',
'/usr/lib64/python2.7/site-packages',
'/usr/lib64/python2.7/site-packages/gst-0.10',
'/usr/lib64/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages',
'/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
---
In vdsm project only the betterPopen package is architecture specific,
it should go into pyexecdir while all other packages should go into
pythondir.
Change-Id: I975cab5c885697d3c43d083e243f8004587fd2bc
Signed-off-by: Alon Bar-Lev <alonbl(a)redhat.com>
---
M configure.ac
M vdsm/betterPopen/Makefile.am
2 files changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/6098/1
--
To view, visit http://gerrit.ovirt.org/6098
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I975cab5c885697d3c43d083e243f8004587fd2bc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl(a)redhat.com>
Ryan Harper has uploaded a new change for review.
Change subject: vdsmd: remove bashisms found with checkbashism script on ubuntu
......................................................................
vdsmd: remove bashisms found with checkbashism script on ubuntu
Ubuntu uses dash for its /bin/sh and some of the shell scripting
includes bashisms that come through even with bash --posix (aka
/bin/sh -> /bin/bash.
Most of the fixes fall into the following changes:
- Using '=' instead of '==' for comparison
- Using '[ ]' instead of '[[ ]]' for test
- replacing {..} with seq
The remaining bashisms are around emitting messages, updating these
would require moving to using gettext's shell helper for producing
intl. lang equivalents.
To find files in the repository that need scanning, I looked for files
with '/bin/sh' in the file, excluding non-shell script files. For each
of the files that filtered through, I ran checkbashisms to see if the
file needed a closer look.
% find . -type f | egrep -v "(configure|build|aclocal|.py|Makefile|README|.git|autom4te.cache)" | xargs -i grep -l "/bin/sh" {}
./scripts/make_device_config.sh
./scripts/create_config
./scripts/feature_to_c.sh
./scripts/hxtool
./scripts/signrom.sh
./scripts/tracetool
./scripts/qemu-binfmt-conf.sh
./scripts/update-linux-headers.sh
./scripts/check-qerror.sh
./vdsm/sudoers.vdsm.in
./vdsm/vdsm-logrotate
./vdsm/vdsmd.init.in
./autogen.sh
./vdsm_cli/vdsClient.in
./tests/run_tests.sh.in
./tests/run_tests_local.sh.in
./vdsm_reg/vdsm-reg-logrotate
(platechiller) vdsm % find . -type f | egrep -v "(configure|build|aclocal|.py|Makefile|README|.git|autom4te.cache)" | xargs -i grep -l "/bin/sh" {} | xargs -i bash -c 'P={}; checkbashisms $P &>/dev/null || echo $P'
./vdsm/vdsmd.init.in
Only vdsmd.init.in needed fixing.
Change-Id: Iece592e9cc3dfa361c99812461d783bff7f780a0
Signed-off-by: Ryan Harper <ryanh(a)us.ibm.com>
---
M vdsm/vdsmd.init.in
1 file changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/8336/1
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index 0012157..2c0e894 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -112,13 +112,13 @@
local listen_tcp auth_tcp ssl
ssl=`$GETCONFITEM $CONF_FILE vars ssl true | tr A-Z a-z`
- [ "$ssl" == true ] && return 0
+ [ "$ssl" = "true" ] && return 0
listen_tcp="`get_libvirt_conf_item $LCONF listen_tcp`"
auth_tcp="`get_libvirt_conf_item $LCONF auth_tcp`"
spice_tls="`get_libvirt_conf_item $QCONF spice_tls`"
- if [ "$listen_tcp" == 1 -a "$auth_tcp" == '"none"' -a "$spice_tls" == 0 ];
+ if [ "$listen_tcp" = "1" -a "$auth_tcp" = '"none"' -a "$spice_tls" = "0" ];
then
return 0
else
@@ -138,7 +138,7 @@
/sbin/chkconfig $srv off
if /sbin/service $srv status > /dev/null 2>&1;
then
- if [ "$srv" == "libvirt-guests" ]; then
+ if [ "$srv" = "libvirt-guests" ]; then
/bin/rm -f /var/lock/subsys/libvirt-guests
else
/sbin/service $srv stop
@@ -149,7 +149,7 @@
}
libvirt_should_use_upstart() {
- [[ -x /sbin/initctl ]]
+ [ -x /sbin/initctl ]
}
start_needed_srv() {
@@ -297,7 +297,7 @@
set_if_default $lconf host_uuid \"$(uuidgen)\"
set_if_default $qconf dynamic_ownership 0
- if [[ "$ssl" == true ]]; then
+ if [ "$ssl" = "true" ]; then
set_if_default $qconf spice_tls 1
else
set_if_default $qconf spice_tls 0
@@ -314,7 +314,7 @@
if [ -f $ts/certs/cacert.pem -a \
-f $ts/certs/vdsmcert.pem -a \
-f $ts/keys/vdsmkey.pem -a \
- "$ssl" == true ];
+ "$ssl" = "true" ];
then
set_if_default $lconf ca_file \"$ts/certs/cacert.pem\"
set_if_default $lconf cert_file \"$ts/certs/vdsmcert.pem\"
@@ -389,7 +389,7 @@
stop_libvirtd_sysv() {
# stop libvirt SysV service if we intend to configure upstart
- if libvirt_should_use_upstart && ! [[ -f /etc/init/libvirtd.conf ]]; then
+ if libvirt_should_use_upstart && ! [ -f /etc/init/libvirtd.conf ]; then
/sbin/chkconfig libvirtd off
/sbin/service libvirtd stop
fi
@@ -400,7 +400,7 @@
# its socket is not yet ready. Once issue fixed on libvirt,
# this workaround should be removed.
- for i in {1..50}
+ for i in $(seq 1 50)
do
if /usr/bin/virsh -r version > /dev/null 2>&1; then
return 0
@@ -426,14 +426,14 @@
/bin/grep libvirtd.upstart | /usr/bin/tail -1`
target=/etc/init/libvirtd.conf
- if [[ -f "$packaged" ]] && ! diff -q "$packaged" "$target" >/dev/null;
+ if [ -f "$packaged" ] && ! diff -q "$packaged" "$target" >/dev/null;
then
/bin/cp -p "$packaged" "$target" || return 1
/sbin/initctl reload-configuration
fi
startout=`/sbin/initctl start libvirtd 2>&1`
- if [[ "$?" -eq 0 || "$startout" =~ .*already\ running.* ]];
+ if [ "$?" -eq 0 || "$startout" =~ .*already\ running.* ];
then
await_libvirt_start_workaround
return 0
@@ -480,7 +480,7 @@
mk_dom_backup
mk_run_path
/bin/chmod 1777 /dev/shm
- if [ $is_coredump == true ]; then
+ if [ $is_coredump = "true" ]; then
export DAEMON_COREFILE_LIMIT=unlimited
echo $CORE_DUMP_PATH > $CORE_PATTERN
fi
--
To view, visit http://gerrit.ovirt.org/8336
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iece592e9cc3dfa361c99812461d783bff7f780a0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ryan Harper <ryanh(a)us.ibm.com>
Wenchao Xia has uploaded a new change for review.
Change subject: SUDO change, move fuser call to super vdsm
......................................................................
SUDO change, move fuser call to super vdsm
supervdsm.fuser() will return out result from executing, and
fuser.py will parse it.
Change-Id: I0bb881e6bcad213db1d186e70f41b22d78ee3ecf
Signed-off-by: wenchao xia <xiawenc(a)linux.vnet.ibm.com>
---
M vdsm/storage/fuser.py
M vdsm/supervdsmServer.py
2 files changed, 20 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/5314/1
--
To view, visit http://gerrit.ovirt.org/5314
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bb881e6bcad213db1d186e70f41b22d78ee3ecf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
Mark Wu has uploaded a new change for review.
Change subject: move ifaceUsers, bondingOtherUsers and nicOtherUsers to netinfo
......................................................................
move ifaceUsers, bondingOtherUsers and nicOtherUsers to netinfo
Change-Id: Ib4426551dd5bc6b4889c5cae40e7145df51b52db
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/nativeNetConfig.py
M vdsm/netinfo.py
2 files changed, 51 insertions(+), 53 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/9318/1
diff --git a/vdsm/nativeNetConfig.py b/vdsm/nativeNetConfig.py
index a0ad7a3..aca4a33 100644
--- a/vdsm/nativeNetConfig.py
+++ b/vdsm/nativeNetConfig.py
@@ -62,55 +62,6 @@
return rc
-def ifaceUsers(iface):
- "Returns a list of entities using the interface"
- _netinfo = netinfo.NetInfo()
- users = set()
- for n, ndict in _netinfo.networks.iteritems():
- if ndict['bridged'] and iface in ndict['ports']:
- users.add(n)
- elif not ndict['bridged'] and iface == ndict['iface']:
- users.add(n)
- for b, bdict in _netinfo.bondings.iteritems():
- if iface in bdict['slaves']:
- users.add(b)
- for v, vdict in _netinfo.vlans.iteritems():
- if iface == vdict['iface']:
- users.add(v)
- return users
-
-
-def nicOtherUsers(bridge, vlan, bonding, nic):
- """
- Returns a list of interfaces using a nic,
- other than the specified one (used for validation)
- """
- if bonding:
- owner = bonding
- elif vlan:
- owner = nic + '.' + vlan
- else:
- owner = bridge
- users = ifaceUsers(nic)
- if bonding:
- users.update(bondingOtherUsers(bridge, vlan, bonding))
- users.discard(owner)
- return users
-
-
-def bondingOtherUsers(bridge, vlan, bonding):
- """
- Return a list of nics/interfaces using a bonding,
- other than the specified one (used for validation)
- """
- if vlan:
- owner = bonding + '.' + vlan
- else:
- owner = bridge
- users = ifaceUsers(bonding)
- users.discard(owner)
- return users
-
# This function must respect the order used in:
#
# /etc/rc.d/init.d/network
@@ -446,7 +397,7 @@
if bridge:
conf += 'BRIDGE=%s\n' % pipes.quote(bridge)
- if ifaceUsers(bonding):
+ if netinfo.NetInfo().ifaceUsers(bonding):
confParams = netinfo.getIfaceCfg(bonding)
if not ipaddr:
ipaddr = confParams.get('IPADDR', None)
@@ -479,7 +430,7 @@
if bonding:
conf += 'MASTER=%s\nSLAVE=yes\n' % pipes.quote(bonding)
- if ifaceUsers(nic):
+ if _netinfo.ifaceUsers(nic):
confParams = netinfo.getIfaceCfg(nic)
if not ipaddr:
ipaddr = confParams.get('IPADDR', None)
@@ -1029,13 +980,14 @@
# The (relatively) new setupNetwork verb allows to remove a network
# defined on top of an bonding device without break the bond itself.
if implicitBonding:
- if bonding and not bondingOtherUsers(network, vlan, bonding):
+ if bonding and not _netinfo.bondingOtherUsers(network,
+ vlan, bonding):
ifdown(bonding)
configWriter.removeBonding(bonding)
iface = None if bonding == iface else iface
for nic in nics:
- if not nicOtherUsers(network, vlan, bonding, nic):
+ if not _netinfo.nicOtherUsers(network, vlan, bonding, nic):
ifdown(nic)
configWriter.removeNic(nic)
ifup(nic)
diff --git a/vdsm/netinfo.py b/vdsm/netinfo.py
index b6d1a1f..83e23ac 100644
--- a/vdsm/netinfo.py
+++ b/vdsm/netinfo.py
@@ -502,3 +502,49 @@
"""
return [netname for (netname, net) in networks().iteritems()
if not 'bridge' in net]
+
+ def ifaceUsers(self, iface):
+ "Returns a list of entities using the interface"
+ users = set()
+ for n, ndict in self.networks.iteritems():
+ if ndict['bridged'] and iface in ndict['ports']:
+ users.add(n)
+ elif not ndict['bridged'] and iface == ndict['iface']:
+ users.add(n)
+ for b, bdict in self.bondings.iteritems():
+ if iface in bdict['slaves']:
+ users.add(b)
+ for v, vdict in self.vlans.iteritems():
+ if iface == vdict['iface']:
+ users.add(v)
+ return users
+
+ def bondingOtherUsers(self, bridge, vlan, bonding):
+ """
+ Return a list of nics/interfaces using a bonding,
+ other than the specified one (used for validation)
+ """
+ if vlan:
+ owner = bonding + '.' + vlan
+ else:
+ owner = bridge
+ users = self.ifaceUsers(bonding)
+ users.discard(owner)
+ return users
+
+ def nicOtherUsers(self, bridge, vlan, bonding, nic):
+ """
+ Returns a list of interfaces using a nic,
+ other than the specified one (used for validation)
+ """
+ if bonding:
+ owner = bonding
+ elif vlan:
+ owner = nic + '.' + vlan
+ else:
+ owner = bridge
+ users = self.ifaceUsers(nic)
+ if bonding:
+ users.update(self.bondingOtherUsers(bridge, vlan, bonding))
+ users.discard(owner)
+ return users
--
To view, visit http://gerrit.ovirt.org/9318
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4426551dd5bc6b4889c5cae40e7145df51b52db
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Jan Lieskovsky has uploaded a new change for review.
Change subject: vdsm_hooks: Add support for checkimages VDSM hook
......................................................................
vdsm_hooks: Add support for checkimages VDSM hook
Introduce the checkimages VDSM hook - perform consistency
check on a qcow2 format disk image using the QEMU disk
image utility.
VDSM hook alternative to the validateImage SPM command.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=611183
Change-Id: Ib4d88fb46a725d2c525d10ce2fcc808bba5b0ab4
Signed-off-by: Jan Lieskovsky <jlieskov(a)redhat.com>
---
M configure.ac
M vdsm.spec.in
M vdsm_hooks/Makefile.am
A vdsm_hooks/checkimages/Makefile.am
A vdsm_hooks/checkimages/README
A vdsm_hooks/checkimages/before_vm_start.py
6 files changed, 155 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/9154/1
diff --git a/configure.ac b/configure.ac
index 7cb12ef..1498e3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -192,6 +192,7 @@
tests/functional/Makefile
vds_bootstrap/Makefile
vdsm_cli/Makefile
+ vdsm_hooks/checkimages/Makefile
vdsm_hooks/directlun/Makefile
vdsm_hooks/faqemu/Makefile
vdsm_hooks/fileinject/Makefile
diff --git a/vdsm.spec.in b/vdsm.spec.in
index c117ee5..3bd0865 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -200,6 +200,15 @@
%description tests
A test suite for verifying the functionality of a running vdsm instance
+%package hook-checkimages
+Summary: Qcow2 disk image format check hook for VDSM
+BuildArch: noarch
+Requires: vdsm
+
+%description hook-checkimages
+VDSM hook used to perform consistency check on a qcow2 format disk image
+using the QEMU disk image utility.
+
%package hook-vhostmd
Summary: VDSM hook set for interaction with vhostmd
Requires: vhostmd
@@ -802,6 +811,10 @@
%{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_qemucmdline
%if 0%{?with_hooks}
+%files hook-checkimages
+%defattr(-, root, root, -)
+%{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/60_checkimages
+
%files hook-directlun
%defattr(-, root, root, -)
%{_sysconfdir}/sudoers.d/50_vdsm_hook_directlun
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index e6a8280..e4d4986 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -25,6 +25,7 @@
# Additional hooks
if HOOKS
SUBDIRS += \
+ checkimages \
directlun \
fileinject \
floppy \
diff --git a/vdsm_hooks/checkimages/Makefile.am b/vdsm_hooks/checkimages/Makefile.am
new file mode 100644
index 0000000..ad28f25
--- /dev/null
+++ b/vdsm_hooks/checkimages/Makefile.am
@@ -0,0 +1,31 @@
+#
+# 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
+#
+#
+
+EXTRA_DIST = \
+ before_vm_start.py
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
+ $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
+ $(DESTDIR)$(vdsmhooksdir)/before_vm_start/60_checkimages
+
+uninstall-local:
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/60_checkimages
diff --git a/vdsm_hooks/checkimages/README b/vdsm_hooks/checkimages/README
new file mode 100644
index 0000000..8959955
--- /dev/null
+++ b/vdsm_hooks/checkimages/README
@@ -0,0 +1,10 @@
+checkimages hook:
+================
+
+VDSM hook used to perform consistency check on a qcow2 format disk image
+using the QEMU disk image utility.
+
+example:
+ checkimages=true,timeout:1.12
+
+Note: Timeout value is taken in seconds. Check of 1GB image takes ~0.02 s.
diff --git a/vdsm_hooks/checkimages/before_vm_start.py b/vdsm_hooks/checkimages/before_vm_start.py
new file mode 100755
index 0000000..a80a042
--- /dev/null
+++ b/vdsm_hooks/checkimages/before_vm_start.py
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+
+import os
+import sys
+import traceback
+
+import hooking
+
+'''
+checkimages vdsm hook
+=====================
+Hook performs consistency check on all qcow2 format disk images of a
+particular VM using the QEMU disk image utility.
+
+syntax:
+ checkimages=^true,timeout:(none|\d+\.{1}\d+)$
+
+example:
+ checkimages=true,timeout:1.12
+
+Note: Timeout value is taken in seconds. Check of 1GB image takes ~0.02 s.
+
+'''
+
+def checkImage(path, timeout):
+ '''
+ Check qcow2 image using qemu-img QEMU utility
+ '''
+
+ cmd = ['/usr/bin/qemu-img', 'check', '-f', 'qcow2', path]
+
+ # No timeout was provided. Run the check without limitation
+ # till the qemu-img command finished
+ if timeout is None:
+ rc, out, err = hooking.execCmd(cmd, sudo=False, raw=True)
+
+ # Timeout was provided. Enforce check termination on timeout
+ # expiration
+ else:
+ p = hooking.execCmd(cmd, sudo=False, raw=True, sync=False)
+
+ if not p.wait(timeout):
+ p.kill()
+ sys.stderr.write('checkimages: Image check operation timed out.\n')
+ sys.exit(2)
+
+ out, err = p.communicate()
+ rc = p.returncode
+
+ if rc == 0:
+ sys.stderr.write('checkimages: Checking image %s returned: %s\n' % \
+ (path, out))
+ else:
+ sys.stderr.write('checkimages: Error running %s command: %s\n' %
+ (' '.join(cmd), err))
+ sys.exit(2)
+
+
+if os.environ.has_key('checkimages'):
+
+ timeout = None
+
+ try:
+ checkimages = os.environ['checkimages']
+ # Might not be necessary. But for any case check we succeeded:
+ # 1) Obtaining provided timeout value
+ # 2) Converting provided value to float
+ try:
+ req_timeout = checkimages.split(',')[1].split(':')[1]
+ if req_timeout != 'none':
+ timeout = float(req_timeout)
+ except:
+ sys.stderr.write('checkimages: Error obtaining timeout value. ' \
+ 'Continuing with no timeout.\n')
+
+ domxml = hooking.read_domxml()
+ disks = domxml.getElementsByTagName('disk')
+
+ for disk in disks:
+ sources = disk.getElementsByTagName('source')
+ drivers = disk.getElementsByTagName('driver')
+
+ if (len(sources) > 0 and len(drivers) > 0):
+ disk_path = sources[0].getAttribute('file')
+ disk_type = drivers[0].getAttribute('type')
+
+ if ((disk_path and disk_type) and (disk_type == 'qcow2')):
+ sys.stderr.write('checkimages: Checking disk = %s\n' %
+ disk_path)
+ checkImage(disk_path, timeout)
+ elif disk_type != 'qcow2':
+ sys.stderr.write('checkimages: Disk = %s is not qcow2 ' \
+ 'disk image format one. Ignoring.\n' %
+ disk_path)
+
+ except:
+ sys.stderr.write('checkimages [unexpected error]: %s\n' %
+ traceback.format_exc())
+ sys.exit(2)
--
To view, visit http://gerrit.ovirt.org/9154
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4d88fb46a725d2c525d10ce2fcc808bba5b0ab4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Jan Lieskovsky <jlieskov(a)redhat.com>
ShaoHe Feng has uploaded a new change for review.
Change subject: make compression type configurable, support gzip and xz
......................................................................
make compression type configurable, support gzip and xz
autoconf check for presense of xz, and if not found fallback on gzip
Change-Id: I4d88e9d40aefc87564c9c7e23f0d28aaad867aca
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M Makefile.am
M autobuild.sh
M configure.ac
M vdsm.spec.in
4 files changed, 32 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/4174/1
--
To view, visit http://gerrit.ovirt.org/4174
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d88e9d40aefc87564c9c7e23f0d28aaad867aca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Federico Simoncelli has uploaded a new change for review.
Change subject: [WIP] Add copyVolumes command to the SPM
......................................................................
[WIP] Add copyVolumes command to the SPM
Early implementation (the API might change).
Change-Id: Ia19dd9b779a06ff88efed2eef52c1d152cdc797c
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/storage/hsm.py
M vdsm/storage/image.py
M vdsm/storage/sp.py
5 files changed, 92 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/2885/1
--
To view, visit http://gerrit.ovirt.org/2885
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia19dd9b779a06ff88efed2eef52c1d152cdc797c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Federico Simoncelli has uploaded a new change for review.
Change subject: Don't rotate core dump logs on Fedora
......................................................................
Don't rotate core dump logs on Fedora
Core dumps are a system-level configuration and VDSM shouldn't try to
override what the sysadmin decides.
Change-Id: I0a2e86614475fd13de3888b956b5512a24016281
---
M configure.ac
M vdsm.spec.in
M vdsm/Makefile.am
A vdsm/cdumps-logrotate.conf
A vdsm/vdsm-logrotate.conf
D vdsm/vdsm-logrotate.conf.in
6 files changed, 27 insertions(+), 22 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/991/1
--
To view, visit http://gerrit.ovirt.org/991
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a2e86614475fd13de3888b956b5512a24016281
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Federico Simoncelli has uploaded a new change for review.
Change subject: Rename volumeCopy API to volumeCollapse
......................................................................
Rename volumeCopy API to volumeCollapse
copyImage (the internal call used by the former volumeCopy) creates
a new template/volume collapsing the whole chain (base->volUUID).
This is not just a nomenclature problem since we need to implement
the real volumeCopy.
Change-Id: Ide39bb54d2a97b3ba8d4712750ff10a67c5764f2
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
2 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/2968/1
--
To view, visit http://gerrit.ovirt.org/2968
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide39bb54d2a97b3ba8d4712750ff10a67c5764f2
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: Extend the range of Vm's niceness to allow increasing cpu shares
......................................................................
Extend the range of Vm's niceness to allow increasing cpu shares
The current range of Vm's niceness is [0, 19], and the default value 0
represnts the biggest cpu shares. So if we want to assign more cpu shares
to one vm, we have to give a higher niceness to other vms.This patch extends
the range to [-19, 19], which makes the default value 0 be the middle of it.
It's more flexible for client to set Vm's niceness.
Change-Id: I5ae55daa5655dbd10c200dfd81ba80d8e71abfb5
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/6289/1
--
To view, visit http://gerrit.ovirt.org/6289
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ae55daa5655dbd10c200dfd81ba80d8e71abfb5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Mark Wu has uploaded a new change for review.
Change subject: Replace calling setSchedulerParameters() with filling its XML description.
......................................................................
Replace calling setSchedulerParameters() with filling its XML description.
This patch changes to fill cgroup cpu.share into its XML description to set
Vm's niceness instead of calling setSchedulerParameters(). It can save us a
libvirt call on VM statup.
Change-Id: I211e191022f5a18fa7d97d5a8fb42e10729ddd06
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/6290/1
--
To view, visit http://gerrit.ovirt.org/6290
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I211e191022f5a18fa7d97d5a8fb42e10729ddd06
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Mark Wu has uploaded a new change for review.
Change subject: Allow tobool() convert int into bool.
......................................................................
Allow tobool() convert int into bool.
The original code return False for any number. This patch makes
it return the result of bool(number). That means for any nonzero nubmer
it returns True, and returns False for 0.
This patch also adds a test case for tobool().
Change-Id: I6ae878b1171fe6827441751d6f02167e12e8bc03
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M tests/Makefile.am
A tests/utilsTests.py
M vdsm/utils.py
3 files changed, 39 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/8480/1
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a5e4c64..eb21f25 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,12 +42,13 @@
parted_utils_tests.py \
permutationTests.py \
persistentDictTests.py \
- restTests.py \
- restData.py \
- tcTests.py \
- vdsClientTests.py \
remoteFileHandlerTests.py \
- resourceManagerTests.py
+ resourceManagerTests.py \
+ restData.py \
+ restTests.py \
+ tcTests.py \
+ utilsTests.py \
+ vdsClientTests.py
dist_noinst_DATA = \
run_tests_local.sh
diff --git a/tests/utilsTests.py b/tests/utilsTests.py
new file mode 100644
index 0000000..01d8de0
--- /dev/null
+++ b/tests/utilsTests.py
@@ -0,0 +1,32 @@
+#
+# Copyright IBM Corp. 2012
+#
+# 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 vdsm import utils
+from testrunner import VdsmTestCase as TestCaseBase
+
+
+class TestUtils(TestCaseBase):
+
+ def test_tobool(self):
+ self.assertEqual(utils.tobool('true'), True)
+ self.assertEqual(utils.tobool('false'), False)
+ self.assertEqual(utils.tobool('foo'), False)
+ self.assertEqual(utils.tobool(None), False)
+ self.assertEqual(utils.tobool(0), False)
+ self.assertEqual(utils.tobool(1), True)
diff --git a/vdsm/utils.py b/vdsm/utils.py
index 0dbb342..96aa928 100644
--- a/vdsm/utils.py
+++ b/vdsm/utils.py
@@ -657,7 +657,7 @@
return False
if type(s) == bool:
return s
- if s.lower() == 'true':
+ if type(s) == str and s.lower() == 'true':
return True
return bool(int(s))
except:
--
To view, visit http://gerrit.ovirt.org/8480
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ae878b1171fe6827441751d6f02167e12e8bc03
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: Add synchronous mode for udevTrigger
......................................................................
Add synchronous mode for udevTrigger
udevadm trigger was asynchronous. Execute udevadm settle after
udevadm trigger, then it can works as synchronous.
Change-Id: I731c3ef6fe945c7c0278d638bf4cc8164345fd01
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm/storage/hsm.py
M vdsm/supervdsmServer.py
2 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/6916/1
--
To view, visit http://gerrit.ovirt.org/6916
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I731c3ef6fe945c7c0278d638bf4cc8164345fd01
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: BZ#809497: connectStroragServer will fail if iscsi session already exists
......................................................................
BZ#809497: connectStroragServer will fail if iscsi session already exists
Add check for connection. If iscsi session existed, will not add
iscsi node.
Change-Id: I3e012e69b5b27841e6f29cce0e1864b8acf332c2
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm/storage/storageServer.py
1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/5957/1
--
To view, visit http://gerrit.ovirt.org/5957
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e012e69b5b27841e6f29cce0e1864b8acf332c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: add hack for regenerate vdsm.spec with configure param from vdsm.spec
......................................................................
add hack for regenerate vdsm.spec with configure param from vdsm.spec
Because vdsm.spec was generated before rpm build, @marco@
wasn't generated with configure params from vdsm.spec. This hack
will fix this problem.
Change-Id: I2fdf228f79f6f626f4faa9c6a7f342a2c60d4f54
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M Makefile.am
M autobuild.sh
2 files changed, 15 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/5790/1
--
To view, visit http://gerrit.ovirt.org/5790
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fdf228f79f6f626f4faa9c6a7f342a2c60d4f54
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: add configure variable vdsmcoredumpdir for /var/log/core
......................................................................
add configure variable vdsmcoredumpdir for /var/log/core
6106db0db4832fd0e9a9f08c288d524d99fb0799 was reverted.
Because vdsm.spec was generated before rpm build, so we won't
use @VDSMCOREDUMPDIR@ in vdsm.spec.in.
Change-Id: I993c5d550dd828800eb6ac68e74072489caa996a
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M build-aux/Makefile.subs
M configure.ac
M vdsm/Makefile.am
M vdsm/sos/vdsm.py.in
M vdsm/vdsm-logrotate.conf.in
R vdsm/vdsm-logrotate.in
6 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/5723/1
--
To view, visit http://gerrit.ovirt.org/5723
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I993c5d550dd828800eb6ac68e74072489caa996a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: remove su directive in logrotate for el6
......................................................................
remove su directive in logrotate for el6
In el6 didn't support su directive, so remove it and add limition
in spec file.
Change-Id: Ie01d9b020b0d70ae76ab1e4d81626202fd8d12c6
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm.spec.in
M vdsm/vdsm-logrotate-coredump.conf.in
2 files changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/5155/1
--
To view, visit http://gerrit.ovirt.org/5155
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie01d9b020b0d70ae76ab1e4d81626202fd8d12c6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: add vdsm-tool verb configure-core-dump
......................................................................
add vdsm-tool verb configure-core-dump
Change-Id: Ifed530a35339e1e2a366a61f1bce1a8c9e71db53
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm-tool/Makefile.am
A vdsm-tool/configureCoreDump.py
M vdsm.spec.in
M vdsm/constants.py.in
M vdsm/vdsmd.init.in
5 files changed, 48 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/5154/1
--
To view, visit http://gerrit.ovirt.org/5154
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifed530a35339e1e2a366a61f1bce1a8c9e71db53
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: move monitored_paths to configure.ac
......................................................................
move monitored_paths to configure.ac
move monitored_paths to configure.ac, then we can make it configurable
Change-Id: I5d2c468c56f0c97eadacd1905c7e7def5a207963
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M build-aux/Makefile.subs
M configure.ac
M vdsm/constants.py.in
M vdsm/utils.py
4 files changed, 10 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/5153/1
--
To view, visit http://gerrit.ovirt.org/5153
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d2c468c56f0c97eadacd1905c7e7def5a207963
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: split logrotate configure into two file for coredump and log
......................................................................
split logrotate configure into two file for coredump and log
We will only collected core dump for rl6 in default, so split
it into two file will easy for config.
Change-Id: Ic22b4ac89583aa8a73863a7c3e1574895159c978
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm.spec.in
M vdsm/Makefile.am
R vdsm/vdsm-logrotate-coredump
A vdsm/vdsm-logrotate-coredump.conf.in
A vdsm/vdsm-logrotate-log
A vdsm/vdsm-logrotate-log.conf.in
D vdsm/vdsm-logrotate.conf.in
7 files changed, 50 insertions(+), 30 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/5152/1
--
To view, visit http://gerrit.ovirt.org/5152
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic22b4ac89583aa8a73863a7c3e1574895159c978
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Xu He Jie has uploaded a new change for review.
Change subject: Remove '/var/log/core' for fedora
......................................................................
Remove '/var/log/core' for fedora
Remove '/var/log/core' for fedora, this directory only be created
for RHEL
Change-Id: I594b5aa2ecaad1b1a268fa231a5769ef437ec75e
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M build-aux/Makefile.subs
M configure.ac
M vdsm/Makefile.am
M vdsm/constants.py.in
M vdsm/sos/vdsm.py.in
M vdsm/utils.py
M vdsm/vdsm-logrotate.conf.in
A vdsm/vdsm-logrotate.conf.rhel.in
M vdsm/vdsmd.init.in
9 files changed, 56 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/4348/1
--
To view, visit http://gerrit.ovirt.org/4348
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I594b5aa2ecaad1b1a268fa231a5769ef437ec75e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
Mark Wu has uploaded a new change for review.
Change subject: Refactor configNetwork.py: add a new class NativeConfigurator
......................................................................
Refactor configNetwork.py: add a new class NativeConfigurator
Basically, this patch just adds a new class NativeConfigurator and moves
the functions of add, delete, edit and setup network into that class.
The purpose of this patch is to make it easy to integrate netcf support
by adding a wrapper to the actual network configurator.
Change-Id: I052955a8e2b7b92b123a5179afd15b79798e6c50
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/configNetwork.py
1 file changed, 440 insertions(+), 414 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/7915/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 12e5e5b..803ba3c 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -855,293 +855,6 @@
_validateInterNetworkCompatibility(_netinfo, vlan, nic, bridged)
-def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None,
- netmask=None, mtu=None, gateway=None, force=False,
- configWriter=None, bondingOptions=None, bridged=True,
- **options):
- nics = nics or ()
- _netinfo = netinfo.NetInfo()
- bridged = utils.tobool(bridged)
-
- if mtu:
- mtu = int(mtu)
-
- # Validation
- if not utils.tobool(force):
- logging.debug('validating network...')
- _addNetworkValidation(_netinfo, network=network,
- vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr,
- netmask=netmask, gateway=gateway, bondingOptions=bondingOptions,
- bridged=bridged, **options)
-
- logging.info("Adding network %s with vlan=%s, bonding=%s, nics=%s,"
- " bondingOptions=%s, mtu=%s, bridged=%s, options=%s",
- network, vlan, bonding, nics, bondingOptions,
- mtu, bridged, options)
-
- if configWriter is None:
- configWriter = ConfigWriter()
-
- prevmtu = None
- if mtu:
- prevmtu = configWriter.getMaxMtu(nics, mtu)
-
- nic = nics[0] if nics else None
- iface = bonding or nic
-
- # take down nics that need to be changed
- vlanedIfaces = [v['iface'] for v in _netinfo.vlans.values()]
- if bonding not in vlanedIfaces:
- for nic in nics:
- if nic not in vlanedIfaces:
- ifdown(nic)
-
- if bridged:
- configWriter.addBridge(network, ipaddr=ipaddr, netmask=netmask,
- mtu=mtu, gateway=gateway, **options)
- ifdown(network)
- # We need to define (if requested) ip, mask & gateway on ifcfg-*
- # only on most top device according to following order:
- # bridge -> vlan -> bond -> nic
- # For lower level devices we should ignore it.
- # reset ip, netmask, gateway for lower level devices
- ipaddr = netmask = gateway = None
-
- # For VLAN we should attach bridge only to the VLAN device
- # rather than to underlying NICs or bond
- brName = network if bridged else None
- bridgeForNic = None if vlan else brName
-
- # We want to create config files (ifcfg-*) in top-down order
- # (bridge->vlan->bond->nic) to be able to handle IP/NETMASK
- # correctly for bridgeless networks
- if vlan:
- # don't ifup VLAN interface here, it should be done last,
- # after the bond and nic up
- configWriter.addVlan(vlan, iface, network=brName,
- mtu=mtu, bridged=bridged,
- ipaddr=ipaddr, netmask=netmask,
- gateway=gateway, **options)
- iface += '.' + vlan
- # reset ip, netmask, gateway for lower level devices
- ipaddr = netmask = gateway = None
-
- # First we need to prepare all conf files
- if bonding:
- configWriter.addBonding(bonding, bridge=bridgeForNic,
- bondingOptions=bondingOptions,
- mtu=max(prevmtu, mtu),
- ipaddr=ipaddr, netmask=netmask,
- gateway=gateway, **options)
- # reset ip, netmask, gateway for lower level devices
- ipaddr = netmask = gateway = None
-
- for nic in nics:
- configWriter.addNic(nic, bonding=bonding,
- bridge=bridgeForNic if not bonding else None,
- mtu=max(prevmtu, mtu),
- ipaddr=ipaddr, netmask=netmask,
- gateway=gateway, **options)
-
- # Now we can run ifup for all interfaces
- if bonding:
- ifup(bonding)
-
- # NICs must be activated in the same order of boot time
- # to expose the correct MAC address.
- for nic in nicSort(nics):
- ifup(nic)
-
- # Now we can ifup VLAN interface, because bond and nic already up
- if vlan:
- ifup(iface)
-
- if bridged:
- if options.get('bootproto') == 'dhcp' and \
- not utils.tobool(options.get('blockingdhcp')):
- # wait for dhcp in another thread,
- # so vdsm won't get stuck (BZ#498940)
- t = threading.Thread(target=ifup, name='ifup-waiting-on-dhcp',
- args=(network,))
- t.daemon = True
- t.start()
- else:
- ifup(network)
-
- # add libvirt network
- configWriter.createLibvirtNetwork(network, bridged, iface)
-
-
-def assertBridgeClean(bridge, vlan, bonding, nics):
- brifs = os.listdir('/sys/class/net/%s/brif/' % bridge)
- for nic in nics:
- try:
- brifs.remove(nic)
- except:
- pass
- if vlan:
- brif = (bonding or nics[0]) + '.' + vlan
- else:
- brif = bonding
- try:
- brifs.remove(brif)
- except:
- pass
-
- if brifs:
- raise ConfigNetworkError(ne.ERR_USED_BRIDGE,
- 'bridge %s has interfaces %s connected' % (bridge, brifs))
-
-
-def showNetwork(network):
- _netinfo = netinfo.NetInfo()
- if network not in _netinfo.networks:
- print "Network %r doesn't exist" % network
- return
-
- bridged = _netinfo.networks[network]['bridged']
- print "Network %s(Bridged: %s):" % (network, bridged)
-
- nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
-
- if bridged:
- ipaddr = _netinfo.networks[network]['addr']
- netmask = _netinfo.networks[network]['netmask']
- gateway = _netinfo.networks[network]['gateway']
- print "ipaddr=%s, netmask=%s, gateway=%s" % (ipaddr, netmask, gateway)
- else:
- iface = _netinfo.networks[network]['iface']
- ipaddr = _netinfo.nics[iface]['addr']
- netmask = _netinfo.nics[iface]['netmask']
- print "ipaddr=%s, netmask=%s" % (ipaddr, netmask)
-
- print "vlan=%s, bonding=%s, nics=%s" % (vlan, bonding, nics)
-
-
-def listNetworks():
- _netinfo = netinfo.NetInfo()
- print "Networks:", _netinfo.networks.keys()
- print "Vlans:", _netinfo.vlans.keys()
- print "Nics:", _netinfo.nics.keys()
- print "Bondings:", _netinfo.bondings.keys()
-
-
-def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
- configWriter=None, implicitBonding=True, **options):
- _netinfo = netinfo.NetInfo()
-
- if configWriter is None:
- configWriter = ConfigWriter()
-
- if network not in _netinfo.networks:
- logging.info("Network %r: doesn't exist in libvirt database", network)
- if network in netinfo.bridges():
- configWriter.removeBridge(network)
- else:
- raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
- "Cannot delete network %r: It doesn't exist "
- "in the system" % network)
-
- if vlan:
- configWriter.removeVlan(vlan, bonding or nics[0])
-
- return
-
- nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
- bridged = _netinfo.networks[network]['bridged']
-
- logging.info("Removing network %s with vlan=%s, bonding=%s, nics=%s,"
- "options=%s" % (network, vlan, bonding, nics, options))
-
- if not utils.tobool(force):
- if bonding:
- validateBondingName(bonding)
- if set(nics) != set(_netinfo.bondings[bonding]["slaves"]):
- raise ConfigNetworkError(ne.ERR_BAD_NIC,
- "delNetwork: %s are not all nics enslaved to %s" %
- (nics, bonding))
- if vlan:
- validateVlanId(vlan)
- if bridged:
- assertBridgeClean(network, vlan, bonding, nics)
-
- configWriter.setNewMtu(network=network, bridged=bridged)
- configWriter.removeLibvirtNetwork(network)
-
- # We need to gather NetInfo again to refresh networks info from libvirt.
- # The deleted bridge should never be up at this stage.
- if network in netinfo.NetInfo().networks:
- raise ConfigNetworkError(ne.ERR_USED_BRIDGE,
- "delNetwork: bridge %s still exists" % network)
-
- if network and bridged:
- configWriter.removeBridge(network)
-
- nic = nics[0] if nics else None
- iface = bonding if bonding else nic
- if iface:
- if vlan:
- configWriter.removeVlan(vlan, iface)
- else:
- cf = configWriter.NET_CONF_PREF + iface
- if not bridged:
- # When removing bridgeless non-VLANed network
- # we need to remove IP/NETMASK from the cfg file
- for key in ('IPADDR', 'NETMASK', 'GATEWAY', 'BOOTPROTO'):
- configWriter._updateConfigValue(cf, key, '', True)
- else:
- # When removing bridged non-VLANed network
- # we need to remove BRIDGE from the cfg file
- configWriter._updateConfigValue(cf, 'BRIDGE', '', True)
-
- # The (relatively) new setupNetwork verb allows to remove a network
- # defined on top of an bonding device without break the bond itself.
- if implicitBonding:
- if bonding and not bondingOtherUsers(network, vlan, bonding):
- ifdown(bonding)
- configWriter.removeBonding(bonding)
- iface = None if bonding == iface else iface
-
- for nic in nics:
- if not nicOtherUsers(network, vlan, bonding, nic):
- ifdown(nic)
- configWriter.removeNic(nic)
- iface = None if nic == iface else iface
-
- # Now we can restart changed interface
- if iface:
- ifdown(iface)
- ifup(iface)
-
-
-def clientSeen(timeout):
- start = time.time()
- while timeout >= 0:
- if os.stat(constants.P_VDSM_CLIENT_LOG).st_mtime > start:
- return True
- time.sleep(1)
- timeout -= 1
- return False
-
-
-def editNetwork(oldBridge, newBridge, vlan=None, bonding=None, nics=None,
- **options):
- configWriter = ConfigWriter()
- try:
- delNetwork(oldBridge, configWriter=configWriter, **options)
- addNetwork(newBridge, vlan=vlan, bonding=bonding, nics=nics,
- configWriter=configWriter, **options)
- except:
- configWriter.restoreBackups()
- raise
- if utils.tobool(options.get('connectivityCheck', False)):
- if not clientSeen(int(options.get('connectivityTimeout',
- CONNECTIVITY_TIMEOUT_DEFAULT))):
- delNetwork(newBridge, force=True)
- configWriter.restoreBackups()
- return define.errCode['noConPeer']['status']['code']
-
-
def _validateNetworkSetup(networks={}, bondings={}):
_netinfo = netinfo.NetInfo()
@@ -1171,73 +884,441 @@
"Unknown nics in: %r" % list(nics))
-def _editBondings(bondings, configWriter):
- """ Add/Edit bond interface """
- logger = logging.getLogger("_editBondings")
+def assertBridgeClean(bridge, vlan, bonding, nics):
+ brifs = os.listdir('/sys/class/net/%s/brif/' % bridge)
+ for nic in nics:
+ try:
+ brifs.remove(nic)
+ except:
+ pass
+ if vlan:
+ brif = (bonding or nics[0]) + '.' + vlan
+ else:
+ brif = bonding
+ try:
+ brifs.remove(brif)
+ except:
+ pass
- _netinfo = netinfo.NetInfo()
+ if brifs:
+ raise ConfigNetworkError(ne.ERR_USED_BRIDGE,
+ 'bridge %s has interfaces %s connected' % (bridge, brifs))
- for bond, bondAttrs in bondings.iteritems():
- logger.debug("Creating/Editing bond %s with attributes %s",
- bond, bondAttrs)
- brNets = list(_netinfo.getBridgedNetworksForIface(bond))
- # Only one bridged-non-VLANed network allowed on same nic/bond
- bridge = brNets[0] if brNets else None
+def clientSeen(timeout):
+ start = time.time()
+ while timeout >= 0:
+ if os.stat(constants.P_VDSM_CLIENT_LOG).st_mtime > start:
+ return True
+ time.sleep(1)
+ timeout -= 1
+ return False
- mtu = None
- if bond in _netinfo.bondings:
- # Save MTU for future set on NICs
- confParams = netinfo.getIfaceCfg(bond)
- mtu = confParams.get('MTU', None)
- if mtu:
- mtu = int(mtu)
- ifdown(bond)
- # Take down all bond's NICs.
- for nic in _netinfo.getNicsForBonding(bond):
- ifdown(nic)
- configWriter.removeNic(nic)
+class NativeConfigurator():
- # Note! In case we have bridge up and connected to the bond
- # we will get error in log:
- # (ifdown) bridge XXX is still up; can't delete it
- # But, we prefer this behaviour instead of taking bridge down
- # Anyway, we will not be able to take it down with connected VMs
+ def addNetwork(self, network, vlan=None, bonding=None, nics=None,
+ ipaddr=None, netmask=None, mtu=None, gateway=None,
+ force=False, configWriter=None, bondingOptions=None,
+ bridged=True, **options):
+ nics = nics or ()
+ _netinfo = netinfo.NetInfo()
+ bridged = utils.tobool(bridged)
+
+ if mtu:
+ mtu = int(mtu)
+
+ # Validation
+ if not utils.tobool(force):
+ logging.debug('validating network...')
+ _addNetworkValidation(_netinfo, network=network,
+ vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr,
+ netmask=netmask, gateway=gateway,
+ bondingOptions=bondingOptions, bridged=bridged, **options)
+
+ logging.info("Adding network %s with vlan=%s, bonding=%s, nics=%s,"
+ " bondingOptions=%s, mtu=%s, bridged=%s, options=%s",
+ network, vlan, bonding, nics, bondingOptions,
+ mtu, bridged, options)
+
+ if configWriter is None:
+ configWriter = ConfigWriter()
+
+ prevmtu = None
+ if mtu:
+ prevmtu = configWriter.getMaxMtu(nics, mtu)
+
+ nic = nics[0] if nics else None
+ iface = bonding or nic
+
+ # take down nics that need to be changed
+ vlanedIfaces = [v['iface'] for v in _netinfo.vlans.values()]
+ if bonding not in vlanedIfaces:
+ for nic in nics:
+ if nic not in vlanedIfaces:
+ ifdown(nic)
+
+ if bridged:
+ configWriter.addBridge(network, ipaddr=ipaddr, netmask=netmask,
+ mtu=mtu, gateway=gateway, **options)
+ ifdown(network)
+ # We need to define (if requested) ip, mask & gateway on ifcfg-*
+ # only on most top device according to following order:
+ # bridge -> vlan -> bond -> nic
+ # For lower level devices we should ignore it.
+ # reset ip, netmask, gateway for lower level devices
+ ipaddr = netmask = gateway = None
+
+ # For VLAN we should attach bridge only to the VLAN device
+ # rather than to underlying NICs or bond
+ brName = network if bridged else None
+ bridgeForNic = None if vlan else brName
+
+ # We want to create config files (ifcfg-*) in top-down order
+ # (bridge->vlan->bond->nic) to be able to handle IP/NETMASK
+ # correctly for bridgeless networks
+ if vlan:
+ # don't ifup VLAN interface here, it should be done last,
+ # after the bond and nic up
+ configWriter.addVlan(vlan, iface, network=brName,
+ mtu=mtu, bridged=bridged,
+ ipaddr=ipaddr, netmask=netmask,
+ gateway=gateway, **options)
+ iface += '.' + vlan
+ # reset ip, netmask, gateway for lower level devices
+ ipaddr = netmask = gateway = None
# First we need to prepare all conf files
- configWriter.addBonding(bond, bridge=bridge, mtu=mtu,
- bondingOptions=bondAttrs.get('options', None))
+ if bonding:
+ configWriter.addBonding(bonding, bridge=bridgeForNic,
+ bondingOptions=bondingOptions,
+ mtu=max(prevmtu, mtu),
+ ipaddr=ipaddr, netmask=netmask,
+ gateway=gateway, **options)
+ # reset ip, netmask, gateway for lower level devices
+ ipaddr = netmask = gateway = None
- for nic in bondAttrs['nics']:
- configWriter.addNic(nic, bonding=bond, mtu=mtu)
+ for nic in nics:
+ configWriter.addNic(nic, bonding=bonding,
+ bridge=bridgeForNic if not bonding else None,
+ mtu=max(prevmtu, mtu),
+ ipaddr=ipaddr, netmask=netmask,
+ gateway=gateway, **options)
# Now we can run ifup for all interfaces
- ifup(bond)
+ if bonding:
+ ifup(bonding)
+
# NICs must be activated in the same order of boot time
# to expose the correct MAC address.
- for nic in nicSort(bondAttrs['nics']):
+ for nic in nicSort(nics):
ifup(nic)
+ # Now we can ifup VLAN interface, because bond and nic already up
+ if vlan:
+ ifup(iface)
-def _removeBondings(bondings, configWriter):
- """ Remove bond interface """
- logger = logging.getLogger("_removeBondings")
+ if bridged:
+ if options.get('bootproto') == 'dhcp' and \
+ not utils.tobool(options.get('blockingdhcp')):
+ # wait for dhcp in another thread,
+ # so vdsm won't get stuck (BZ#498940)
+ t = threading.Thread(target=ifup, name='ifup-waiting-on-dhcp',
+ args=(network,))
+ t.daemon = True
+ t.start()
+ else:
+ ifup(network)
- _netinfo = netinfo.NetInfo()
+ # add libvirt network
+ configWriter.createLibvirtNetwork(network, bridged, iface)
- for bond, bondAttrs in bondings.items():
- if 'remove' in bondAttrs:
- nics = _netinfo.getNicsForBonding(bond)
- logger.debug("Removing bond %r with nics = %s", bond, nics)
- ifdown(bond)
- configWriter.removeBonding(bond)
+ def delNetwork(self, network, vlan=None, bonding=None, nics=None,
+ force=False, configWriter=None, implicitBonding=True,
+ **options):
+ _netinfo = netinfo.NetInfo()
+
+ if configWriter is None:
+ configWriter = ConfigWriter()
+
+ if network not in _netinfo.networks:
+ logging.info("Network %r: doesn't exist in libvirt database",
+ network)
+ if network in netinfo.bridges():
+ configWriter.removeBridge(network)
+ else:
+ raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
+ "Cannot delete network %r: It doesn't exist "
+ "in the system" % network)
+
+ if vlan:
+ configWriter.removeVlan(vlan, bonding or nics[0])
+
+ return
+
+ nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
+ bridged = _netinfo.networks[network]['bridged']
+
+ logging.info("Removing network %s with vlan=%s, bonding=%s, nics=%s,"
+ "options=%s" % (network, vlan, bonding, nics, options))
+
+ if not utils.tobool(force):
+ if bonding:
+ validateBondingName(bonding)
+ if set(nics) != set(_netinfo.bondings[bonding]["slaves"]):
+ raise ConfigNetworkError(ne.ERR_BAD_NIC,
+ "delNetwork: %s are not all nics enslaved to %s" %
+ (nics, bonding))
+ if vlan:
+ validateVlanId(vlan)
+ if bridged:
+ assertBridgeClean(network, vlan, bonding, nics)
+
+ configWriter.setNewMtu(network=network, bridged=bridged)
+ configWriter.removeLibvirtNetwork(network)
+
+ # We need to gather NetInfo again to refresh networks info from
+ # libvirt. The deleted bridge should never be up at this stage.
+ if network in netinfo.NetInfo().networks:
+ raise ConfigNetworkError(ne.ERR_USED_BRIDGE,
+ "delNetwork: bridge %s still exists" % network)
+
+ if network and bridged:
+ configWriter.removeBridge(network)
+
+ nic = nics[0] if nics else None
+ iface = bonding if bonding else nic
+ if iface:
+ if vlan:
+ configWriter.removeVlan(vlan, iface)
+ else:
+ cf = configWriter.NET_CONF_PREF + iface
+ if not bridged:
+ # When removing bridgeless non-VLANed network
+ # we need to remove IP/NETMASK from the cfg file
+ for key in ('IPADDR', 'NETMASK', 'GATEWAY', 'BOOTPROTO'):
+ configWriter._updateConfigValue(cf, key, '', True)
+ else:
+ # When removing bridged non-VLANed network
+ # we need to remove BRIDGE from the cfg file
+ configWriter._updateConfigValue(cf, 'BRIDGE', '', True)
+
+ # The (relatively) new setupNetwork verb allows to remove a network
+ # defined on top of an bonding device without break the bond itself.
+ if implicitBonding:
+ if bonding and not bondingOtherUsers(network, vlan, bonding):
+ ifdown(bonding)
+ configWriter.removeBonding(bonding)
+ iface = None if bonding == iface else iface
for nic in nics:
- ifdown(nic)
- configWriter.removeNic(nic)
+ if not nicOtherUsers(network, vlan, bonding, nic):
+ ifdown(nic)
+ configWriter.removeNic(nic)
+ iface = None if nic == iface else iface
- del bondings[bond]
+ # Now we can restart changed interface
+ if iface:
+ ifdown(iface)
+ ifup(iface)
+
+ def editNetwork(self, oldBridge, newBridge, vlan=None, bonding=None,
+ nics=None, **options):
+ configWriter = ConfigWriter()
+ try:
+ self.delNetwork(oldBridge, configWriter=configWriter, **options)
+ self.addNetwork(newBridge, vlan=vlan, bonding=bonding, nics=nics,
+ configWriter=configWriter, **options)
+ except:
+ configWriter.restoreBackups()
+ raise
+ if utils.tobool(options.get('connectivityCheck', False)):
+ if not clientSeen(int(options.get('connectivityTimeout',
+ CONNECTIVITY_TIMEOUT_DEFAULT))):
+ delNetwork(newBridge, force=True)
+ configWriter.restoreBackups()
+ return define.errCode['noConPeer']['status']['code']
+
+ def _editBondings(self, bondings, configWriter):
+ """ Add/Edit bond interface """
+ logger = logging.getLogger("_editBondings")
+
+ _netinfo = netinfo.NetInfo()
+
+ for bond, bondAttrs in bondings.iteritems():
+ logger.debug("Creating/Editing bond %s with attributes %s",
+ bond, bondAttrs)
+
+ brNets = list(_netinfo.getBridgedNetworksForIface(bond))
+ # Only one bridged-non-VLANed network allowed on same nic/bond
+ bridge = brNets[0] if brNets else None
+
+ mtu = None
+ if bond in _netinfo.bondings:
+ # Save MTU for future set on NICs
+ confParams = netinfo.getIfaceCfg(bond)
+ mtu = confParams.get('MTU', None)
+ if mtu:
+ mtu = int(mtu)
+
+ ifdown(bond)
+ # Take down all bond's NICs.
+ for nic in _netinfo.getNicsForBonding(bond):
+ ifdown(nic)
+ configWriter.removeNic(nic)
+
+ # Note! In case we have bridge up and connected to the bond
+ # we will get error in log:
+ # (ifdown) bridge XXX is still up; can't delete it
+ # But, we prefer this behaviour instead of taking bridge down
+ # Anyway, we will not be able to take it down with connected VMs
+
+ # First we need to prepare all conf files
+ configWriter.addBonding(bond, bridge=bridge, mtu=mtu,
+ bondingOptions=bondAttrs.get('options', None))
+
+ for nic in bondAttrs['nics']:
+ configWriter.addNic(nic, bonding=bond, mtu=mtu)
+
+ # Now we can run ifup for all interfaces
+ ifup(bond)
+ # NICs must be activated in the same order of boot time
+ # to expose the correct MAC address.
+ for nic in nicSort(bondAttrs['nics']):
+ ifup(nic)
+
+ def _removeBondings(self, bondings, configWriter):
+ """ Remove bond interface """
+ logger = logging.getLogger("_removeBondings")
+
+ _netinfo = netinfo.NetInfo()
+
+ for bond, bondAttrs in bondings.items():
+ if 'remove' in bondAttrs:
+ nics = _netinfo.getNicsForBonding(bond)
+ logger.debug("Removing bond %r with nics = %s", bond, nics)
+ ifdown(bond)
+ configWriter.removeBonding(bond)
+
+ for nic in nics:
+ ifdown(nic)
+ configWriter.removeNic(nic)
+
+ del bondings[bond]
+
+ def setupNetworks(self, networks={}, bondings={}, **options):
+
+ logger = logging.getLogger("setupNetworks")
+
+ try:
+ _netinfo = netinfo.NetInfo()
+ configWriter = ConfigWriter()
+ networksAdded = set()
+ # keep set netsWithNewBonds to be able remove
+ # a new added network if connectivity check fail.
+ # If a new network needs to be created on top of existing bond,
+ # we will need to keep the bond on rollback flow,
+ # else we will break the new created bond.
+ netsWithNewBonds = set()
+
+ logger.debug("Setting up network according to configuration: "
+ "networks:%r, bondings:%r, options:%r" % (networks,
+ bondings, options))
+
+ force = options.get('force', False)
+ if not utils.tobool(force):
+ logging.debug("Validating configuration")
+ _validateNetworkSetup(dict(networks), dict(bondings))
+
+ logger.debug("Applying...")
+ try:
+ # Remove edited networks and networks with 'remove' attribute
+ for network, networkAttrs in networks.items():
+ if network in _netinfo.networks:
+ logger.debug("Removing network %r" % network)
+ self.delNetwork(network, configWriter=configWriter,
+ force=force, implicitBonding=False)
+ if 'remove' in networkAttrs:
+ del networks[network]
+ else:
+ networksAdded.add(network)
+
+ # Remove bonds with 'remove' attribute
+ self._removeBondings(bondings, configWriter)
+
+ # Check whether bonds should be resized
+ self._editBondings(bondings, configWriter)
+
+ # We need to use the newest host info
+ _ni = netinfo.NetInfo()
+ for network, networkAttrs in networks.iteritems():
+ d = dict(networkAttrs)
+ if 'bonding' in d:
+ # we may not receive any information
+ # about the bonding device if it is unchanged
+ # In this case check whether this bond exists
+ # on host and take its parameters
+ if bondings.get(d['bonding']):
+ d['nics'] = bondings[d['bonding']]['nics']
+ d['bondingOptions'] = \
+ bondings[d['bonding']].get('options', None)
+ # we create a new bond
+ if network in networksAdded:
+ netsWithNewBonds.add(network)
+ elif d['bonding'] in _ni.bondings:
+ logger.debug("Updating bond %r info", d['bonding'])
+ d['nics'] = _ni.bondings[d['bonding']]['slaves']
+ d['bondingOptions'] = \
+ _ni.bondings[d['bonding']]['cfg'].get(
+ 'BONDING_OPTS', None)
+ else:
+ d['nics'] = [d.pop('nic')]
+ d['force'] = force
+
+ logger.debug("Adding network %r" % network)
+ self.addNetwork(network, configWriter=configWriter,
+ implicitBonding=True, **d)
+
+ if utils.tobool(options.get('connectivityCheck', True)):
+ logger.debug('Checking connectivity...')
+ if not clientSeen(int(options.get('connectivityTimeout',
+ CONNECTIVITY_TIMEOUT_DEFAULT))):
+ logger.info('Connectivity check failed, rolling back')
+ for network in networksAdded:
+ self.delNetwork(network, force=True,
+ implicitBonding=network in netsWithNewBonds)
+ raise ConfigNetworkError(ne.ERR_LOST_CONNECTION,
+ 'connectivity check failed')
+ except:
+ configWriter.restoreBackups()
+ raise
+
+ except Exception, e:
+ # SuperVdsm eats the error, so let's print it ourselves
+ logger.error(e, exc_info=True)
+ raise
+
+
+configurator = NativeConfigurator()
+
+
+def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None,
+ netmask=None, mtu=None, gateway=None, force=False,
+ bondingOptions=None, bridged=True, **options):
+ configurator.addNetwork(network, vlan, bonding, nics, ipaddr, netmask, mtu,
+ gateway, force, bondingOptions, bridged, **options)
+
+
+def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
+ implicitBonding=True, **options):
+ configurator.delNetwork(network, vlan, bonding, nics, force,
+ implicitBonding, **options)
+
+
+def editNetwork(oldBridge, newBridge, vlan=None, bonding=None, nics=None,
+ **options):
+ configurator.editNetwork(oldBridge, newBridge, vlan, bonding, nics,
+ **options)
def setupNetworks(networks={}, bondings={}, **options):
@@ -1277,95 +1358,40 @@
the attachment in the network's attributes). Similarly, if you edit
a bonding, it's not necessary to specify its networks.
"""
- logger = logging.getLogger("setupNetworks")
+ configurator.setupNetworks(networks, bondings, **options)
- try:
- _netinfo = netinfo.NetInfo()
- configWriter = ConfigWriter()
- networksAdded = set()
- # keep set netsWithNewBonds to be able remove
- # a new added network if connectivity check fail.
- # If a new network needs to be created on top of existing bond,
- # we will need to keep the bond on rollback flow,
- # else we will break the new created bond.
- netsWithNewBonds = set()
- logger.debug("Setting up network according to configuration: "
- "networks:%r, bondings:%r, options:%r" % (networks,
- bondings, options))
+def showNetwork(network):
+ _netinfo = netinfo.NetInfo()
+ if network not in _netinfo.networks:
+ print "Network %r doesn't exist" % network
+ return
- force = options.get('force', False)
- if not utils.tobool(force):
- logging.debug("Validating configuration")
- _validateNetworkSetup(dict(networks), dict(bondings))
+ bridged = _netinfo.networks[network]['bridged']
+ print "Network %s(Bridged: %s):" % (network, bridged)
- logger.debug("Applying...")
- try:
- # Remove edited networks and networks with 'remove' attribute
- for network, networkAttrs in networks.items():
- if network in _netinfo.networks:
- logger.debug("Removing network %r" % network)
- delNetwork(network, configWriter=configWriter, force=force,
- implicitBonding=False)
- if 'remove' in networkAttrs:
- del networks[network]
- else:
- networksAdded.add(network)
+ nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
- # Remove bonds with 'remove' attribute
- _removeBondings(bondings, configWriter)
+ if bridged:
+ ipaddr = _netinfo.networks[network]['addr']
+ netmask = _netinfo.networks[network]['netmask']
+ gateway = _netinfo.networks[network]['gateway']
+ print "ipaddr=%s, netmask=%s, gateway=%s" % (ipaddr, netmask, gateway)
+ else:
+ iface = _netinfo.networks[network]['iface']
+ ipaddr = _netinfo.nics[iface]['addr']
+ netmask = _netinfo.nics[iface]['netmask']
+ print "ipaddr=%s, netmask=%s" % (ipaddr, netmask)
- # Check whether bonds should be resized
- _editBondings(bondings, configWriter)
+ print "vlan=%s, bonding=%s, nics=%s" % (vlan, bonding, nics)
- # We need to use the newest host info
- _ni = netinfo.NetInfo()
- for network, networkAttrs in networks.iteritems():
- d = dict(networkAttrs)
- if 'bonding' in d:
- # we may not receive any information
- # about the bonding device if it is unchanged
- # In this case check whether this bond exists
- # on host and take its parameters
- if bondings.get(d['bonding']):
- d['nics'] = bondings[d['bonding']]['nics']
- d['bondingOptions'] = \
- bondings[d['bonding']].get('options', None)
- # we create a new bond
- if network in networksAdded:
- netsWithNewBonds.add(network)
- elif d['bonding'] in _ni.bondings:
- logger.debug("Updating bond %r info", d['bonding'])
- d['nics'] = _ni.bondings[d['bonding']]['slaves']
- d['bondingOptions'] = \
- _ni.bondings[d['bonding']]['cfg'].get(
- 'BONDING_OPTS', None)
- else:
- d['nics'] = [d.pop('nic')]
- d['force'] = force
- logger.debug("Adding network %r" % network)
- addNetwork(network, configWriter=configWriter,
- implicitBonding=True, **d)
-
- if utils.tobool(options.get('connectivityCheck', True)):
- logger.debug('Checking connectivity...')
- if not clientSeen(int(options.get('connectivityTimeout',
- CONNECTIVITY_TIMEOUT_DEFAULT))):
- logger.info('Connectivity check failed, rolling back')
- for network in networksAdded:
- delNetwork(network, force=True,
- implicitBonding=network in netsWithNewBonds)
- raise ConfigNetworkError(ne.ERR_LOST_CONNECTION,
- 'connectivity check failed')
- except:
- configWriter.restoreBackups()
- raise
-
- except Exception, e:
- # SuperVdsm eats the error, so let's print it ourselves
- logger.error(e, exc_info=True)
- raise
+def listNetworks():
+ _netinfo = netinfo.NetInfo()
+ print "Networks:", _netinfo.networks.keys()
+ print "Vlans:", _netinfo.vlans.keys()
+ print "Nics:", _netinfo.nics.keys()
+ print "Bondings:", _netinfo.bondings.keys()
def setSafeNetworkConfig():
--
To view, visit http://gerrit.ovirt.org/7915
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I052955a8e2b7b92b123a5179afd15b79798e6c50
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Adding threads limitation to misc.tmap
......................................................................
Adding threads limitation to misc.tmap
Using threads queue to keep the threads order and limit threads count
I moved the function code next to itmap for readability.
Currently noone calls to tmap function, so I don't care to change and
fix it now to avoid future bugs.
Exceptions that related to the queue usage will be raised as part of
the function's exceptions.
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Change-Id: I07845bfd78b9215e8994ac2ebe46a7ff78c85625
---
M vdsm/storage/misc.py
1 file changed, 59 insertions(+), 36 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/8858/1
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 426d181..f1a4581 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -1085,42 +1085,6 @@
return tuple(res)
-def tmap(func, iterable):
- resultsDict = {}
- error = [None]
-
- def wrapper(f, arg, index):
- try:
- resultsDict[index] = f(arg)
- except Exception, e:
- # We will throw the last error received
- # we can only throw one error, and the
- # last one is as good as any. This shouldn't
- # happen. Wrapped methods should not throw
- # exceptions, if this happens it's a bug
- log.error("tmap caught an unexpected error", exc_info=True)
- error[0] = e
- resultsDict[index] = None
-
- threads = []
- for i, arg in enumerate(iterable):
- t = threading.Thread(target=wrapper, args=(func, arg, i))
- threads.append(t)
- t.start()
-
- for t in threads:
- t.join()
-
- results = [None] * len(resultsDict)
- for i, result in resultsDict.iteritems():
- results[i] = result
-
- if error[0] is not None:
- raise error[0]
-
- return tuple(results)
-
-
def getfds():
return [int(fd) for fd in os.listdir("/proc/self/fd")]
@@ -1251,6 +1215,65 @@
raise exception
+def tmap(func, iterable, maxthreads=UNLIMITED_THREADS):
+ """
+ Make an iterator that computes the function using arguments from the
+ iterable by running each operation in a different thread in specific
+ order.
+ maxthreads stands for maximum threads that we can initiate simultaneosly.
+ If we reached to max threads the function waits for thread to
+ finish before initiate the next one.
+ """
+ if maxthreads < 1 and maxthreads != UNLIMITED_THREADS:
+ raise ValueError("Wrong input passed to function tmap: %s", maxthreads)
+
+ resultsDict = {}
+ error = [None]
+
+ def wrapper(f, arg, index):
+ try:
+ resultsDict[index] = f(arg)
+ except Exception, e:
+ # We will throw the last error received
+ # we can only throw one error, and the
+ # last one is as good as any. This shouldn't
+ # happen. Wrapped methods should not throw
+ # exceptions, if this happens it's a bug
+ log.error("tmap caught an unexpected error", exc_info=True)
+ error[0] = e
+ resultsDict[index] = None
+
+ if maxthreads != UNLIMITED_THREADS:
+ threadsQueue = Queue.Queue(maxthreads)
+ else:
+ threadsQueue = Queue.Queue()
+
+ for i, arg in enumerate(iterable):
+ if not threadsQueue.full():
+ t = threading.Thread(target=wrapper, args=(func, arg, i))
+ threadsQueue.put_nowait(t)
+ t.start()
+ else:
+ # waits for the first unfinished thread in list to finish if we
+ # have already initiate all possible thread's slots (maxthreads)
+ if threadsQueue.empty():
+ raise RuntimeError("No thread initieated")
+ else:
+ threadsQueue.get_nowait().join()
+
+ while not threadsQueue.empty():
+ threadsQueue.get(False).join()
+
+ results = [None] * len(resultsDict)
+ for i, result in resultsDict.iteritems():
+ results[i] = result
+
+ if error[0] is not None:
+ raise error[0]
+
+ return tuple(results)
+
+
def itmap(func, iterable, maxthreads=UNLIMITED_THREADS):
"""
Make an iterator that computes the function using
--
To view, visit http://gerrit.ovirt.org/8858
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I07845bfd78b9215e8994ac2ebe46a7ff78c85625
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Yaniv Bronhaim has uploaded a new change for review.
Change subject: testRegeneration of remoteFileHandler fails when running all tests
......................................................................
testRegeneration of remoteFileHandler fails when running all tests
It happens when timeout is raised when calling to testEcho (we expect to
normal result), this happens because handlers were full with testTimeout
requests. This patch split the calls, and test the same issue.
When all file handlers are done working, we release them and allow other
handlers to start.
Change-Id: I35ae1258d01455ad2fe131cd17bc3dff89224c1b
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M tests/remoteFileHandlerTests.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/9412/1
diff --git a/tests/remoteFileHandlerTests.py b/tests/remoteFileHandlerTests.py
index 9508536..6c9233e 100644
--- a/tests/remoteFileHandlerTests.py
+++ b/tests/remoteFileHandlerTests.py
@@ -51,6 +51,7 @@
the requests"""
for i in range(HANDLERS_NUM * 2):
self.testTimeout()
+ for i in range(HANDLERS_NUM):
self.testEcho()
def tearDown(self):
--
To view, visit http://gerrit.ovirt.org/9412
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I35ae1258d01455ad2fe131cd17bc3dff89224c1b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gal Hammer has uploaded a new change for review.
Change subject: BZ#841555 A migration failure with an "AttributeError" exception.
......................................................................
BZ#841555 A migration failure with an "AttributeError" exception.
Libvirt sometimes send the SUSPENDED/SUSPENDED_PAUSED event
after RESUMED/RESUMED_MIGRATED (when VM status is PAUSED
when migration completes, see qemuMigrationFinish function).
In this case self._dom is None because the function
_waitForIncomingMigrationFinish didn't update it yet.
Change-Id: I3b7ed13c6dc8d1d590449118cf167290f4630070
Signed-off-by: Gal Hammer <ghammer(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/6901/1
--
To view, visit http://gerrit.ovirt.org/6901
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b7ed13c6dc8d1d590449118cf167290f4630070
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Gal Hammer <ghammer(a)redhat.com>
Eduardo has uploaded a new change for review.
Change subject: BZ#840407 - Create a fake template when moving to backup SD.
......................................................................
BZ#840407 - Create a fake template when moving to backup SD.
This code is repeated twice because the copy in deprecated
moveMultipleImages() will be removed when this image will be
removed in the next version.
All the related fake template code should be removed.
Change-Id: Ibbeef2480e03cc075b80880485739139e496d0b6
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 26 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/6519/1
--
To view, visit http://gerrit.ovirt.org/6519
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbeef2480e03cc075b80880485739139e496d0b6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Peter V. Saveliev has uploaded a new change for review.
Change subject: migrateStatus() progress report
......................................................................
migrateStatus() progress report
The percentage is based on libvirt dataTotal and dataProcessed
fields of the virDomainJobInfo struct
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
Change-Id: I3ff00e85c88e865cd81697d427d6bd5473e0f79e
---
M vdsm/vm.py
1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/6824/1
--
To view, visit http://gerrit.ovirt.org/6824
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ff00e85c88e865cd81697d427d6bd5473e0f79e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
Eduardo has uploaded a new change for review.
Change subject: Rename parent volume in blockSD.getAllVolumes.
......................................................................
Rename parent volume in blockSD.getAllVolumes.
Change-Id: I62f1385e4af90a923c5d97a71571bea8780aa339
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/blockSD.py
1 file changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/8608/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index e596fb6..d8f7824 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -159,14 +159,14 @@
for vName in vols.iterkeys():
res[vName] = {'imgs': [], 'parent': None}
- for vName, vImg, vPar in vols.itervalues():
- res[vName]['parent'] = vPar
+ for vName, vImg, parentVol in vols.itervalues():
+ res[vName]['parent'] = parentVol
if vImg not in res[vName]['imgs']:
res[vName]['imgs'].insert(0, vImg)
- if vPar != sd.BLANK_UUID and \
+ if parentVol != sd.BLANK_UUID and \
not vName.startswith(blockVolume.image.REMOVED_IMAGE_PREFIX) \
- and vImg not in res[vPar]['imgs']:
- res[vPar]['imgs'].append(vImg)
+ and vImg not in res[parentVol]['imgs']:
+ res[parentVol]['imgs'].append(vImg)
return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent']))
for k, v in res.iteritems())
--
To view, visit http://gerrit.ovirt.org/8608
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I62f1385e4af90a923c5d97a71571bea8780aa339
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Gal Hammer has uploaded a new change for review.
Change subject: BZ#829110 Remove a "Domain not found" error from stats thread.
......................................................................
BZ#829110 Remove a "Domain not found" error from stats thread.
Removed redundant code which changed VM status if error occured on
the stats thead.
Change-Id: I1f648b9e3a70dca66cbf056c1f143bc6f0455e4a
Signed-off-by: Gal Hammer <ghammer(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 0 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/7746/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 6323d0c..2f6e544 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -291,17 +291,6 @@
if ex.get_error_code() != libvirt.VIR_ERR_NO_DOMAIN:
return False
- # If a VM is down, hibernating, migrating, destroyed or in the
- # process of being shutdown we were expecting it to disappear
- if ((self._vm.lastStatus in ('Down',
- 'Saving State', 'Migration Source'))
- or self._vm.destroyed
- or self._vm._guestEvent == 'Powering down'):
- return True
-
- self._log.debug("VM not found, moving to Down", exc_info=True)
- self._vm.setDownStatus(ERROR, str(ex))
-
return True
--
To view, visit http://gerrit.ovirt.org/7746
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f648b9e3a70dca66cbf056c1f143bc6f0455e4a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Gal Hammer <ghammer(a)redhat.com>
Igor Lvovsky has uploaded a new change for review.
Change subject: configNetwork: _updateConfigValue: Add a new line char '\n' at the end of the line
......................................................................
configNetwork: _updateConfigValue: Add a new line char '\n' at the end of the line
This patch remove an empty line from the middle of iface
config file when removing network with custom MTU.
Example:
---------
[root@zeus02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
HWADDR=78:ac:c0:11:79:79
NM_CONTROLLED=no
STP=no
MTU=9000[root@zeus02 ~]#
Change-Id: I6030f0c92a2f3f2572b52cc48df6198da5cd2847
Signed-off-by: Igor Lvovsky <ilvovsky(a)redhat.com>
---
M vdsm/configNetwork.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/7688/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 74d19c7..20f1136 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -558,7 +558,7 @@
if not line.startswith(entry + '=') ]
if not delete:
- entries.append('\n' + entry + '=' + value)
+ entries.append(entry + '=' + value + '\n')
self._backup(conffile)
with open(conffile, 'w') as f:
--
To view, visit http://gerrit.ovirt.org/7688
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6030f0c92a2f3f2572b52cc48df6198da5cd2847
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Igor Lvovsky <ilvovsky(a)redhat.com>
Dan Kenigsberg has uploaded a new change for review.
Change subject: Expose a custom property for tunnelled migration of a VM
......................................................................
Expose a custom property for tunnelled migration of a VM
Change-Id: Id713b455db4f9bf437720b64c92bba9377cd89ae
---
M vdsm/libvirtvm.py
1 file changed, 9 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/2551/1
--
To view, visit http://gerrit.ovirt.org/2551
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id713b455db4f9bf437720b64c92bba9377cd89ae
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Deepak C Shetty has uploaded a new change for review.
Change subject: [RFC] Support for GLUSTERFS_DOMAIN
......................................................................
[RFC] Support for GLUSTERFS_DOMAIN
This patch introduces a new storage domain of type
GLUSTERFS_DOMAIN, which uses gluster as the storage backend.
In GLUSTERFS_DOMAIN, vdsm creates the storage domain by mounting
the gluster volume (akin to nfs mounting export path). VMs
created using this domain exploit the QEMU's gluster block
backend. Instead of accessing the vmdisk as a file path, it
accesses the vmdisk as a network disk device, served by gluster
server/volume.
This patch attempts to re-use nfsSD core logic to support
domain of type GLUSTERFS_DOMAIN.
Also has some changes to pass pep8 checks
Change-Id: I9ac37da88625f20d148beaf53bb6371c15b33ad7
Signed-off-by: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
---
M vdsm.spec.in
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/libvirtvm.py
M vdsm/storage/Makefile.am
M vdsm/storage/fileSD.py
A vdsm/storage/glusterVolume.py
M vdsm/storage/hsm.py
M vdsm/storage/nfsSD.py
M vdsm/storage/sd.py
M vdsm/storage/volume.py
M vdsm/vm.py
12 files changed, 124 insertions(+), 34 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/6856/1
--
To view, visit http://gerrit.ovirt.org/6856
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ac37da88625f20d148beaf53bb6371c15b33ad7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
Lee Yarwood has uploaded a new change for review.
Change subject: [WIP] BZ#748386 - qemuConvert test cases
......................................................................
[WIP] BZ#748386 - qemuConvert test cases
Adds some simple qemu-img tests against volume.qemuConvert() to ensure
volumes remain the correct format after being converted.
Change-Id: I1c9f302928c246f7ce195d169f8d5a533df1a344
Signed-off-by: Lee Yarwood <lyarwood(a)redhat.com>
---
A tests/qemuImgTests.py
A vdsm/storage/fakeVolume.py
2 files changed, 214 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/9290/1
diff --git a/tests/qemuImgTests.py b/tests/qemuImgTests.py
new file mode 100644
index 0000000..e1cc70c
--- /dev/null
+++ b/tests/qemuImgTests.py
@@ -0,0 +1,148 @@
+#
+# 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
+#
+
+from testrunner import VdsmTestCase as TestCase
+
+import tempfile
+import uuid
+import os
+
+
+from storage.threadLocal import vars
+from storage.fakeVolume import FakeFileVolume
+import storage.task as task
+import storage.volume as volume
+import storage.misc as misc
+
+EXT_QEMUIMG = '/bin/qemu-img'
+EXT_DD = '/bin/dd'
+VOL_SIZE = "10M"
+VOL_ALLOC = "20"
+
+class FileVolumes():
+
+ def __init__(self):
+ self.dir = tempfile.mkdtemp()
+ self.sduuid = str(uuid.uuid4())
+ self.imguuid = str(uuid.uuid4())
+ self.repo = self.dir + "/" + self.sduuid + "/images/" + self.imguuid
+ os.makedirs(self.repo)
+
+ def genPathUUID(self):
+ u = str(uuid.uuid4())
+ p = self.repo + "/" + u
+ return p, u
+
+
+ def createCOW(self):
+ path, voluuid = self.genPathUUID()
+ misc.execCmd([EXT_QEMUIMG, "create", "-f", "qcow2", path, VOL_SIZE],sync=False)
+ return FakeFileVolume(repoPath=self.dir, sdUUID=self.sduuid, imgUUID=self.imguuid, volUUID=voluuid,
+ volFormat=volume.COW_FORMAT, volPath=path)
+
+ def createRAW(self):
+ path, voluuid = self.genPathUUID()
+ misc.execCmd([EXT_QEMUIMG, "create", "-f", "raw", path, VOL_SIZE],sync=False)
+ return FakeFileVolume(repoPath=self.dir, sdUUID=self.sduuid, imgUUID=self.imguuid, volUUID=voluuid,
+ volFormat=volume.RAW_FORMAT, volPath=path)
+
+ def createCOWPrealloc(self):
+ v = self.createCOW()
+ misc.execCmd([EXT_DD, "if=/dev/zero", "of=%s" % v.getVolumePath(), "bs=512"])
+ return v
+
+
+ def createCOWChild(self,parent):
+ path, voluuid = self.genPathUUID()
+ misc.execCmd([EXT_QEMUIMG, "create", "-f", "qcow2", "-o", "backing_file=%s/%s,backing_fmt=raw" %
+ (self.repo,parent.volUUID), self.repo + "/" + voluuid, VOL_SIZE],sync=False)
+ fake = FakeFileVolume(repoPath=self.dir, sdUUID=self.sduuid, imgUUID=self.imguuid, volUUID=voluuid,
+ volFormat=volume.COW_FORMAT, volPath=path)
+ # Hack to avoid a call to sdc.produce() later when we try to find the parent.
+ fake.setParent(parent.volUUID)
+ fake.setParentVolume(parent)
+ return fake
+
+ def cleanUp(self):
+ os.rmdir(self.dir)
+
+
+class qemuImgRebaseTestCase(TestCase):
+ """
+
+ """
+
+class qemuImgCreateTestCase(TestCase):
+ """
+
+ """
+
+class qemuImgConvertTestCase(TestCase):
+
+
+ def runQemuConvert(self, src, dst):
+
+ vars.task = task.Task(id=None, name='qemuImgTests')
+ try:
+ (rc, out, err) = volume.qemuConvert(src, dst, vars.task.aborting)
+ self.assertFalse(rc)
+ except Exception:
+ self.fail()
+
+
+ def testFileQemuConvert(self):
+ # create the repo
+ t = FileVolumes()
+
+ # RAW to RAW
+ src = t.createRAW()
+ dst = t.createRAW()
+ self.runQemuConvert(src, dst)
+
+ # QCOW2 to RAW
+ #src = t.createCOW()
+ #dst = t.createRAW()
+ #self.runQemuConvert(src, dst)
+
+ # RAW to QCOW2
+ #src = t.createRAW()
+ #dst = t.createCOW()
+ #self.runQemuConvert(src, dst)
+
+ # RAW<-QCOW2 to RAW<-QCOW2
+ parent = t.createRAW()
+ src = t.createCOWChild(parent)
+ dst = t.createCOW()
+ self.runQemuConvert(src, dst)
+
+ # Convert a COW parent child to another COW
+ # RAW<-QCOW2<-QCOW2 to RAW<-QCOW2<-QCOW2
+ rawParent = t.createRAW()
+ src = t.createCOWChild(rawParent)
+ cowChild = t.createCOWChild(src)
+ dst = t.createCOW()
+ self.runQemuConvert(src,dst)
+
+
+
+
+ def testBlockQemuConvert(self):
+ pass
+
diff --git a/vdsm/storage/fakeVolume.py b/vdsm/storage/fakeVolume.py
new file mode 100644
index 0000000..72516b7
--- /dev/null
+++ b/vdsm/storage/fakeVolume.py
@@ -0,0 +1,66 @@
+#
+# 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 volume
+import misc
+
+class FakeFileVolume(volume.Volume):
+ """
+ A fake file volume class to aid with testing.
+ """
+
+ def __init__(self, repoPath, sdUUID, imgUUID, volUUID, volFormat, volPath):
+ volume.Volume.__init__(self, repoPath, sdUUID, imgUUID, volUUID)
+
+ self.md = {"SIZE": None,"TYPE":None,"FORMAT":None,"DISKTYPE":None,"VOLTYPE":None,
+ "PUUID":None,"DOMAIN":None,"CTIME":None,"IMAGE":None,"DESCRIPTION":None,
+ "LEGALITY":None,"MTIME":None,"ILLEGAL":None,"LEGAL":None,"FAKE":None}
+
+ self.setFormat(volFormat)
+ self.setVolumePath(volPath)
+ self.parentVolume = None
+
+ def validateImagePath(self):
+ pass
+
+ def validateVolumePath(self):
+ pass
+
+ def setVolumePath(self,volPath):
+ self.volumePath = volPath
+
+ def setParent(self, puuid):
+ self.setMetaParam(volume.PUUID, puuid)
+
+ def getParent(self):
+ return self.getMetaParam(volume.PUUID)
+
+ def setParentVolume(self,parent):
+ self.parentVolume = parent
+
+ def getParentVolume(self):
+ return self.parentVolume
+
+ def setMetadata(self, m, mid=None):
+ for k,v in m.iteritems():
+ self.md[k] = v
+
+ def getMetadata(self):
+ return self.md
--
To view, visit http://gerrit.ovirt.org/9290
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c9f302928c246f7ce195d169f8d5a533df1a344
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lee Yarwood <lyarwood(a)redhat.com>
Mark Wu has uploaded a new change for review.
Change subject: Extract bonding options building into a separate function.
......................................................................
Extract bonding options building into a separate function.
To make setupNetworks shorter, move the bonding options building code
into a separate function.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Change-Id: I77fefefcefa05f5bd0d7fa2755357d88b7aa615e
---
M vdsm/configNetwork.py
1 file changed, 30 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/8885/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 3940446..6de38e3 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1249,6 +1249,30 @@
del bondings[bond]
+def _buildBondOptions(bondName, bondings):
+ logger = logging.getLogger("_buildBondOptions")
+
+ # We need to use the newest host info
+ _ni = netinfo.NetInfo()
+
+ bond = {}
+ if bondings.get(bondName):
+ bond['nics'] = bondings[bondName]['nics']
+ bond['bondingOptions'] = bondings[bondName].get('options', None)
+ elif bondName in _ni.bondings:
+ # We may not receive any information about the bonding device if it is
+ # unchanged. In this case check whether this bond exists on host and
+ # take its parameters.
+ logger.debug("Fetching bond %r info", bondName)
+ existingBond = _ni.bondings[bondName]
+ bond['nics'] = existingBond['slaves']
+ bond['bondingOptions'] = existingBond['cfg'].get('BONDING_OPTS', None)
+ else:
+ raise ConfigNetworkError(ne.ERR_BAD_PARAMS, "No given bonding option, \
+ nor existing bond %s found." % bondName)
+ return bond
+
+
def setupNetworks(networks={}, bondings={}, **options):
"""Add/Edit/Remove configuration for networks and bondings.
@@ -1292,12 +1316,6 @@
_netinfo = netinfo.NetInfo()
configWriter = ConfigWriter()
networksAdded = set()
- # keep set netsWithNewBonds to be able remove
- # a new added network if connectivity check fail.
- # If a new network needs to be created on top of existing bond,
- # we will need to keep the bond on rollback flow,
- # else we will break the new created bond.
- netsWithNewBonds = set()
logger.debug("Setting up network according to configuration: "
"networks:%r, bondings:%r, options:%r" % (networks,
@@ -1327,28 +1345,10 @@
# Check whether bonds should be resized
_editBondings(bondings, configWriter)
- # We need to use the newest host info
- _ni = netinfo.NetInfo()
for network, networkAttrs in networks.iteritems():
d = dict(networkAttrs)
if 'bonding' in d:
- # we may not receive any information
- # about the bonding device if it is unchanged
- # In this case check whether this bond exists
- # on host and take its parameters
- if bondings.get(d['bonding']):
- d['nics'] = bondings[d['bonding']]['nics']
- d['bondingOptions'] = \
- bondings[d['bonding']].get('options', None)
- # we create a new bond
- if network in networksAdded:
- netsWithNewBonds.add(network)
- elif d['bonding'] in _ni.bondings:
- logger.debug("Updating bond %r info", d['bonding'])
- d['nics'] = _ni.bondings[d['bonding']]['slaves']
- d['bondingOptions'] = \
- _ni.bondings[d['bonding']]['cfg'].get(
- 'BONDING_OPTS', None)
+ d.update(_buildBondOptions(d['bonding'], bondings))
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
@@ -1363,8 +1363,11 @@
CONNECTIVITY_TIMEOUT_DEFAULT))):
logger.info('Connectivity check failed, rolling back')
for network in networksAdded:
- delNetwork(network, force=True,
- implicitBonding=network in netsWithNewBonds)
+ # If the new added network was created on top of
+ # existing bond, we need to keep the bond on rollback
+ # flow, else we will break the new created bond.
+ isNew = networkAttrs['bonding'] in bondings
+ delNetwork(network, force=True, implicitBonding=isNew)
raise ConfigNetworkError(ne.ERR_LOST_CONNECTION,
'connectivity check failed')
except:
--
To view, visit http://gerrit.ovirt.org/8885
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77fefefcefa05f5bd0d7fa2755357d88b7aa615e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
ShaoHe Feng has uploaded a new change for review.
Change subject: Add a flag to libvirtvm's status to report watchdog event
......................................................................
Add a flag to libvirtvm's status to report watchdog event
This flag will be set once watchdog event is triggered.
And thie flag will be not cleanup after it is set unless the client
restart or shutdown VM. So add a timestamp in the message of this flag.
The timestamp is the time in seconds since the Epoch.
When the client poll this flag, it should record and check the timestamp
to make sure that the event is already triggered.
Change-Id: I7aa676299c748d761e216469569156140a79af65
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/9429/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3439dc3..15d3187 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -2225,6 +2225,8 @@
except IndexError:
return "Received unknown watchdog action(%s)" % action
+ self.watchdogEvent = "Time: %s, Action: %s" % (time.time(),
+ actionToString(action))
self.log.debug("Watchdog event comes from guest %s. "
"Action: %s", self.conf['vmName'],
actionToString(action))
@@ -2449,6 +2451,8 @@
def getStats(self):
stats = vm.Vm.getStats(self)
stats['hash'] = self._devXmlHash
+ if hasattr(self, "watchdogEvent"):
+ stats["watchdogEvent"] = self.watchdogEvent
return stats
def _getBalloonInfo(self):
--
To view, visit http://gerrit.ovirt.org/9429
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7aa676299c748d761e216469569156140a79af65
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Changing threadName when using multiprocessing package
......................................................................
Changing threadName when using multiprocessing package
multiprocessing.manager adds current process name in front of current
threadName. This patch changes the name back to Thread-[No].
Change-Id: I541beb63fd5e1a2f7d6eed7f66f4970bf37a6705
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=868663
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/supervdsmServer.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/9037/1
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index a1bf8e6..a5bfc68 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -74,6 +74,9 @@
def wrapper(*args, **kwargs):
try:
+ threadName = threading.current_thread().name
+ if threadName.find('|') != -1:
+ _, threading.current_thread().name = threadName.split('|')
return func(*args, **kwargs)
except:
callbackLogger.error("Error in %s", func.__name__, exc_info=True)
--
To view, visit http://gerrit.ovirt.org/9037
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I541beb63fd5e1a2f7d6eed7f66f4970bf37a6705
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Yaniv Bronhaim has uploaded a new change for review.
Change subject: prepare volume instead of prepare blockSD
......................................................................
prepare volume instead of prepare blockSD
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=851837
change the call of activateVolume to llprepare volume, and
teardown instead of deactiveVolume, which sperates lv
syscall operation to only verifies that the lv is in used as
part of the volume. If the sd is in use by the checked volume,
we want to keep ref counter to sign this volume, and when we
teardown it, we verify that there are no references to the same
sd before deactivate it.
Change-Id: I25b9c260a7de5f883420a5322f90195b3379e80e
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/storage/image.py
1 file changed, 2 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/8050/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index d004046..97112dc 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -383,8 +383,7 @@
chain.insert(0, tmplVolume)
# Activating the volumes
- sdCache.produce(sdUUID).activateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
+ sdCache.produce(sdUUID).llPrepare()
return chain
@@ -392,11 +391,8 @@
chain = self.getChain(sdUUID, imgUUID, volUUID)
# Deactivating the volumes
- sdCache.produce(sdUUID).deactivateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
-
# Do not deactivate the template yet (might be in use by an other vm)
- # TODO: reference counting to deactivate when unused
+ sdCache.produce(sdUUID).teardown(sdUUID, volUUIDs=[vol.volUUID for vol in chain])
def __templateRelink(self, destDom, imgUUID, volUUID):
"""
--
To view, visit http://gerrit.ovirt.org/8050
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I25b9c260a7de5f883420a5322f90195b3379e80e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Deepak C Shetty has uploaded a new change for review.
Change subject: Unify produceVolume
......................................................................
Unify produceVolume
Unify produceVolume function and make it use getVolumeClass
so that subclasses can override getVolumeClass to specify
their own Volume and ensure that produceVolume works
properly with subclass supplying their own volumeclass.
Change-Id: I367582b2741dc0276ec64d8d13fa1e4953f0314b
Signed-off-by: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/sd.py
3 files changed, 7 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/8115/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index e596fb6..2da277d 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -477,14 +477,6 @@
return time.time() - t
- def produceVolume(self, imgUUID, volUUID):
- """
- Produce a type specific volume object
- """
- repoPath = self._getRepoPath()
- return blockVolume.BlockVolume(repoPath, self.sdUUID, imgUUID, volUUID)
-
-
def getVolumeClass(self):
"""
Return a type specific volume generator object
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 054fadb..ae06c90 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -215,13 +215,6 @@
filesDict[fileName] = stats
return filesDict
- def produceVolume(self, imgUUID, volUUID):
- """
- Produce a type specific volume object
- """
- repoPath = self._getRepoPath()
- return fileVolume.FileVolume(repoPath, self.sdUUID, imgUUID, volUUID)
-
def getVolumeClass(self):
"""
Return a type specific volume generator object
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 55c5b12..4e7485f 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -358,6 +358,13 @@
self.log.warn("Resource namespace %s already registered",
volumeResourcesNamespace)
+ def produceVolume(self, imgUUID, volUUID):
+ """
+ Produce a type specific volume object
+ """
+ repoPath = self._getRepoPath()
+ return self.getVolumeClass()(repoPath, self.sdUUID, imgUUID, volUUID)
+
def getVolumeClass(self):
"""
Return a type specific volume generator object
--
To view, visit http://gerrit.ovirt.org/8115
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I367582b2741dc0276ec64d8d13fa1e4953f0314b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
Deepak C Shetty has uploaded a new change for review.
Change subject: Introduce getMountPoint for NfsStorageDomain
......................................................................
Introduce getMountPoint for NfsStorageDomain
Move the code to generate the mount point into a seperate
function, so that classes reusing NfsStorageDomain can
override the function to present their own mount point path.
Change-Id: I80f98eddcc31c1f01f42af838ecc483abb955f41
Signed-off-by: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
---
M vdsm/storage/nfsSD.py
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/8085/1
diff --git a/vdsm/storage/nfsSD.py b/vdsm/storage/nfsSD.py
index d84fee6..6b53208 100644
--- a/vdsm/storage/nfsSD.py
+++ b/vdsm/storage/nfsSD.py
@@ -71,8 +71,7 @@
# Create local path
mntPath = fileUtils.transformPath(remotePath)
- mntPoint = os.path.join(cls.storage_repository,
- sd.DOMAIN_MNT_POINT, mntPath)
+ mntPoint = cls.getMountPoint(mntPath)
cls._preCreateValidation(sdUUID, mntPoint, remotePath, version)
@@ -94,6 +93,11 @@
return fsd
+ @classmethod
+ def getMountPoint(cls, mountPath):
+ return os.path.join(cls.storage_repository,
+ sd.DOMAIN_MNT_POINT, mountPath)
+
def selftest(self):
"""
Run internal self test
--
To view, visit http://gerrit.ovirt.org/8085
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I80f98eddcc31c1f01f42af838ecc483abb955f41
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
Adam Litke has uploaded a new change for review.
Change subject: libvirtvm: Cast text to string when creating text node
......................................................................
libvirtvm: Cast text to string when creating text node
When creating a text node for a libvirt domain xml file, the content of the node
is expected to be a string. To avoid errors in the xml file, cast the parameter
to a string representation when creating the child node.
Change-Id: Id22db83062eaf85645c2d61c83f3f20943918413
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/7832/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3306cc2..eaf899d 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -542,7 +542,7 @@
def appendChildWithText(self, childName, text):
childNode = self.doc.createElement(childName)
- textNode = self.doc.createTextNode(text)
+ textNode = self.doc.createTextNode(str(text))
childNode.appendChild(textNode)
self.dom.appendChild(childNode)
--
To view, visit http://gerrit.ovirt.org/7832
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id22db83062eaf85645c2d61c83f3f20943918413
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <agl(a)us.ibm.com>
Greg Padgett has uploaded a new change for review.
Change subject: WIP storage: Alert for using vdsm.conf nfs_mount_options
......................................................................
WIP storage: Alert for using vdsm.conf nfs_mount_options
This adds a framework and an alert for when nfs_mount_options is used.
The nfs_mount_options setting is deprecated, so if it is set, send an
alert to the engine when it calls getVdsCapabilities. A mechanism to
send the alert was placed here in particular because it the interval in
which the engine calls this API most closely matches the interval in
which the problem can be found and/or corrected.
Note that this was originally for bug 826921, but a new bug will be
created specifically for the alerting code in subsequent patches.
Change-Id: I8520238e0b41eb95d035128681dc3b71a953e644
Bug-Url: https://bugzilla.redhat.com/826921
Signed-off-by: Greg Padgett <gpadgett(a)redhat.com>
---
M Makefile.am
M vdsm.spec.in
M vdsm/caps.py
M vdsm/storage/Makefile.am
M vdsm/storage/storage_exception.py
M vdsm_api/vdsmapi-schema.json
6 files changed, 42 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/8979/1
diff --git a/Makefile.am b/Makefile.am
index 2850256..3d7cb2c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,6 +68,7 @@
vdsm/parted_utils.py \
vdsm/rest/BindingREST.py \
vdsm/rest/Controller.py \
+ vdsm/storage/alerts.py \
vdsm/storage/blockVolume.py \
vdsm/storage/devicemapper.py \
vdsm/storage/domainMonitor.py \
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 37f37a3..7e35e4b 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -643,6 +643,7 @@
%{_libexecdir}/%{vdsm_name}/ovirt_functions.sh
%{_libexecdir}/%{vdsm_name}/vdsm-gencerts.sh
%{_datadir}/%{vdsm_name}/storage/__init__.py*
+%{_datadir}/%{vdsm_name}/storage/alerts.py*
%{_datadir}/%{vdsm_name}/storage/blockSD.py*
%{_datadir}/%{vdsm_name}/storage/blockVolume.py*
%{_datadir}/%{vdsm_name}/storage/devicemapper.py*
diff --git a/vdsm/caps.py b/vdsm/caps.py
index cfe4caf..c33e23f 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -40,6 +40,7 @@
import hooks
from vdsm import utils
import storage.hba
+from storage.alerts import getStorageAlerts
# For debian systems we can use python-apt if available
try:
@@ -295,9 +296,16 @@
config.getint('vars', 'extra_mem_reserve'))
caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')
+ caps['alerts'] = _getAlerts()
+
return caps
+def _getAlerts():
+ # Only storage alerts are currently propagated
+ return getStorageAlerts()
+
+
def _getIfaceByIP(addr, fileName='/proc/net/route'):
remote = struct.unpack('I', socket.inet_aton(addr))[0]
for line in itertools.islice(file(fileName), 1, None):
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index cff09be..96cc368 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -23,6 +23,7 @@
vdsmstoragedir = $(vdsmdir)/storage
dist_vdsmstorage_PYTHON = \
__init__.py \
+ alerts.py \
blockSD.py \
blockVolume.py \
devicemapper.py \
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 54e64e6..9275ae7 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -174,6 +174,17 @@
message = "Directory cleanup failure"
+class MiscDeprecatedNFSOptions(StorageException):
+ def __init__(self, options):
+ self.value = "options=%s" % (options,)
+ code = 2009
+ message = "Using deprecated nfs_mount_options parameter from vdsm.conf."\
+ " This parameter will continue to be supported in versions 3.x,"\
+ " but may be removed in a future version of oVirt. Please"\
+ " upgrade domains to V3 or greater and set the parameters from"\
+ " the GUI to ensure compatibility with future versions."
+
+
#################################################
# Volumes Exceptions
#################################################
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 5f0b391..5c7cc92 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -839,6 +839,22 @@
'key': 'SoftwarePackage', 'value': 'SoftwarePackageInfo'}
##
+# @Alert:
+#
+# Alert information for this Host.
+#
+# @code: The alert code
+#
+# @message: A detailed alert string
+#
+# @value: #optional Detailed alert parameters
+#
+# Since: 4.10.1
+##
+{'type': 'Alert',
+ 'data': {'code': 'int', 'message': 'str', '*value': 'str'}}
+
+##
# @VdsmCapabilities:
#
# Host information and capabilities.
@@ -900,6 +916,8 @@
# @netConfigDirty: Indicates if there are uncommitted changes to the
# network configuration
#
+# @alerts: A list of alerts for the host
+#
# Since: 4.10.0
#
# Notes: Since ovirt-engine cannot parse software versions in 'x.y.z' format,
@@ -919,7 +937,8 @@
'emulatedMachines': ['str'], 'ISCSIInitiatorName': 'str',
'HBAInventory': 'HbaInventory', 'vmTypes': ['VmType'],
'memSize': 'uint', 'reservedMem': 'uint',
- 'guestOverhead': 'uint', 'netConfigDirty': 'bool'}}
+ 'guestOverhead': 'uint', 'netConfigDirty': 'bool',
+ 'alerts': ['Alert']}}
##
# @Host.getCapabilities:
--
To view, visit http://gerrit.ovirt.org/8979
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8520238e0b41eb95d035128681dc3b71a953e644
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <gpadgett(a)redhat.com>
Saggi Mizrahi has uploaded a new change for review.
Change subject: Add callback to the plethora of retry halting possibilities
......................................................................
Add callback to the plethora of retry halting possibilities
Change-Id: Idb5a2158f008b41133352dcfb4926ad21dcceea1
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/miscTests.py
M vdsm/storage/misc.py
2 files changed, 35 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/8093/1
diff --git a/tests/miscTests.py b/tests/miscTests.py
index bec6539..c8bcf09 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -621,6 +621,35 @@
self.assertEquals(misc._alignData(1, 1), (1, 1, 1))
+class RetryTests(TestCaseBase):
+ def testStopCallback(self):
+ counter = [0]
+ limit = 4
+ def stopCallback():
+ counter[0] += 1
+ if counter[0] == limit:
+ return True
+
+ return False
+
+ def foo():
+ print counter[0]
+ if counter[0] == (limit - 1):
+ return
+
+ raise RuntimeError("If at first you don't succeed, try, try again."
+ "Then quit. There's no point in being a damn"
+ "fool about it.")
+ # W. C. Fields
+
+ self.assertRaises(RuntimeError, misc.retry, foo, tries=(limit - 1), sleep=0,
+ stopCallback=stopCallback)
+
+ counter[0] = 0
+ misc.retry(foo, RuntimeError, tries=limit, sleep=0,
+ stopCallback=stopCallback)
+
+
class ValidateDDBytes(TestCaseBase):
def testValidInputTrue(self):
"""
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 161726b..ef0c74e 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -728,7 +728,7 @@
def retry(func, expectedException=Exception, tries=None,
- timeout=None, sleep=1):
+ timeout=None, sleep=1, stopCallback=None):
"""
Retry a function. Wraps the retry logic so you don't have to
implement it each time you need it.
@@ -741,6 +741,8 @@
the method. It will just not run it if it ended after the
timeout.
:param sleep: Time to sleep between calls in seconds.
+ :param stopCallback: A function that takes no parameters and invokes a
+ bail-out when it returns with a positive value.
"""
if tries in [0, None]:
tries = -1
@@ -761,6 +763,9 @@
if (timeout > 0) and ((time.time() - startTime) > timeout):
raise
+ if stopCallback is not None and stopCallback():
+ raise
+
time.sleep(sleep)
--
To view, visit http://gerrit.ovirt.org/8093
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb5a2158f008b41133352dcfb4926ad21dcceea1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Ryan Harper has uploaded a new change for review.
Change subject: pylint:vdsm/*.py cast output to str() for .strip()/splitlines()
......................................................................
pylint:vdsm/*.py cast output to str() for .strip()/splitlines()
************* Module caps
E:187,35:osversion: Instance of 'list' has no 'splitlines' member (but some types could not be inferred
************* Module configNetwork
E: 68,7:ifdown: Instance of 'list' has no 'strip' member (but some types could not be inferred)
E: 70,7:ifdown: Instance of 'list' has no 'strip' member (but some types could not be inferred)
E: 71,49:ifdown: Instance of 'list' has no 'splitlines' member (but some types could not be inferred)
E: 80,7:ifup: Instance of 'list' has no 'strip' member (but some types could not be inferred)
E: 82,7:ifup: Instance of 'list' has no 'strip' member (but some types could not be inferred)
************* Module netinfo
E: 45,23:nics: Instance of '_Chainmap' has no 'split' member (but some types could not be inferred)
E:137,22:ifconfig: Instance of 'list' has no 'split' member (but some types could not be inferred)
************* Module utils
E:681,42:getHostUUID: Instance of 'list' has no 'splitlines' member (but some types could not be inferred)
wrapper command and config output with str() to help pylint.
Change-Id: Iae2c0ece02d5e41e0080bf41c0d9ea3544965274
Signed-off-by: Ryan Harper <ryanh(a)us.ibm.com>
---
M vdsm/caps.py
M vdsm/configNetwork.py
M vdsm/netinfo.py
M vdsm/utils.py
4 files changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/3444/1
--
To view, visit http://gerrit.ovirt.org/3444
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae2c0ece02d5e41e0080bf41c0d9ea3544965274
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ryan Harper <ryanh(a)us.ibm.com>
Ryan Harper has uploaded a new change for review.
Change subject: Remove rhev strings from vdsm_hooks directory and scripts
......................................................................
Remove rhev strings from vdsm_hooks directory and scripts
Change-Id: I3a6012529af0e81e9c4163db33fa02a046c42920
Signed-off-by: Ryan Harper <ryanh(a)us.ibm.com>
---
M vdsm_hooks/README
M vdsm_hooks/persist-vdsm-hooks.in
M vdsm_hooks/sriov/README
M vdsm_hooks/unpersist-vdsm-hook
4 files changed, 13 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/3293/1
--
To view, visit http://gerrit.ovirt.org/3293
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a6012529af0e81e9c4163db33fa02a046c42920
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ryan Harper <ryanh(a)us.ibm.com>