Change in vdsm[master]: xmlrpc: marshalling of Long type
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: xmlrpc: marshalling of Long type
......................................................................
Patch Set 2: Code-Review-1
vdsm must support older engines which cannot handle such values.
--
To view, visit http://gerrit.ovirt.org/34856
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I56341566e4add6a093ba89eb81e09ee9e7a631b1
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
9 years, 5 months
Change in vdsm[master]: xmlrpc: marshalling of Long type
by asegurap@redhat.com
Antoni Segura Puimedon has posted comments on this change.
Change subject: xmlrpc: marshalling of Long type
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
http://gerrit.ovirt.org/#/c/34856/2/vdsm/rpc/BindingXMLRPC.py
File vdsm/rpc/BindingXMLRPC.py:
Line 46:
Line 47:
Line 48: class BindingXMLRPC(object):
Line 49: def __init__(self, cif, log, port):
Line 50: xmlrpclib.Marshaller.dispatch[type(0L)] = (
I'd much rather have you do:
import types # in line 28.
xmlrpclib.Marshaller.dispatch[types.LongType] = (...
Line 51: lambda _, v, w: w(_STRING_VALUE % v)
Line 52: )
Line 53: self.cif = cif
Line 54: self.log = log
--
To view, visit http://gerrit.ovirt.org/34856
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I56341566e4add6a093ba89eb81e09ee9e7a631b1
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 5 months
Change in vdsm[master]: xmlrpc: marshalling of Long type
by Martin Sivak
Martin Sivák has posted comments on this change.
Change subject: xmlrpc: marshalling of Long type
......................................................................
Patch Set 1: Code-Review-1
(2 comments)
http://gerrit.ovirt.org/#/c/34856/1/vdsm/rpc/BindingXMLRPC.py
File vdsm/rpc/BindingXMLRPC.py:
Line 41: _glusterEnabled = True
Line 42: except ImportError:
Line 43: _glusterEnabled = False
Line 44:
Line 45: value = "<value><string>%s</string></value>\n"
I would probably use _STRING_VALUE or something like that
Line 46:
Line 47:
Line 48: class BindingXMLRPC(object):
Line 49: def __init__(self, cif, log, port):
Line 1040: (self.merge, 'merge'),
Line 1041: (self.vmUpdateVmPolicy, 'updateVmPolicy'),
Line 1042: (self.vmSetIoTune, 'setIoTune'),
Line 1043: (self.vmGetIoTunePolicy, 'getIoTunePolicy'),
Line 1044: (self.floatTest, 'floatTest'))
This does seem to be a leftover from development..
Line 1045:
Line 1046: def getIrsMethods(self):
Line 1047: return ((self.domainActivate, 'activateStorageDomain'),
Line 1048: (self.domainAttach, 'attachStorageDomain'),
--
To view, visit http://gerrit.ovirt.org/34856
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I56341566e4add6a093ba89eb81e09ee9e7a631b1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 5 months
Change in vdsm[ovirt-3.5]: Adding the possibility to skip checks on rpmbuild
by ybronhei@redhat.com
Hello Douglas Schilling Landgraf, David Caro, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/34766
to review the following change.
Change subject: Adding the possibility to skip checks on rpmbuild
......................................................................
Adding the possibility to skip checks on rpmbuild
This way you can build the rpms skipping the tests just defining the variable
with_check to 0 when running rpmbuild, also skipping checks by default when
building on el* based hosts
Change-Id: I674ae8f8e5ff8b21a0175197bd42e61af6075afd
Signed-off-by: David Caro <dcaroest(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/29213
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/34766/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 4490d8f..e83572c 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -20,6 +20,11 @@
# touch configure.ac or Makefile.am.
%{!?enable_autotools:%define enable_autotools 0}
+# Skips check since rhel default repos lack pep8 and pyflakes
+%if ! 0%{?rhel}
+%global with_check 1
+%endif
+
# Required paths
%if 0%{?fedora} >= 18
%global _polkitdir %{_datadir}/polkit-1/rules.d
@@ -105,7 +110,7 @@
BuildRequires: libtool
%endif
-%if !0%{?rhel}
+%if 0%{?with_check}
BuildRequires: pyflakes
BuildRequires: python-pep8
%endif
@@ -717,7 +722,9 @@
%endif
%check
+%if 0%{?with_check}
make check
+%endif
%clean
rm -rf %{buildroot}
--
To view, visit http://gerrit.ovirt.org/34766
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I674ae8f8e5ff8b21a0175197bd42e61af6075afd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: David Caro <dcaroest(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: net_tests: Move network unit tests into package
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: net_tests: Move network unit tests into package
......................................................................
net_tests: Move network unit tests into package
This patch brings together the network unit tests under a directory
to improve the organization and as a possible step for a future
cohesive network package with code and tests.
Change-Id: I6960ce365d67ab4bb0a5475d7957e6117bef7e60
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M configure.ac
M tests/Makefile.am
A tests/network/Makefile.am
R tests/network/apiTests.py
R tests/network/ipwrapperTests.py
R tests/network/modelsTests.py
R tests/network/netconfTests.py
R tests/network/netconfpersistenceTests.py
R tests/network/netinfoTests.py
R tests/network/netmaskconversions
R tests/network/tcTests.py
R tests/network/tc_filter_show.out
M tests/run_tests_local.sh.in
13 files changed, 63 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/26874/1
diff --git a/configure.ac b/configure.ac
index 12828be..944e17f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -267,6 +267,7 @@
lib/zombiereaper/Makefile
tests/Makefile
tests/functional/Makefile
+ tests/network/Makefile
vds_bootstrap/Makefile
vdsm-tool/Makefile
vdsm/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 39c6cad..6fb834f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2012 Red Hat, Inc.
+# Copyright 2012-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
include $(top_srcdir)/build-aux/Makefile.subs
-SUBDIRS = functional
+SUBDIRS = functional network
test_modules = \
alignmentScanTests.py \
@@ -29,7 +29,6 @@
cPopenTests.py \
capsTests.py \
clientifTests.py \
- configNetworkTests.py \
fileVolumeTests.py \
fileUtilTests.py \
fuserTests.py \
@@ -38,7 +37,6 @@
glusterTestData.py \
guestagentTests.py \
hooksTests.py \
- ipwrapperTests.py \
iscsiTests.py \
jsonRpcTests.py \
jsonRpcUtils.py \
@@ -52,10 +50,6 @@
mkimageTests.py \
monkeypatchTests.py \
mountTests.py \
- netconfpersistenceTests.py \
- netconfTests.py \
- netinfoTests.py \
- netmodelsTests.py \
outOfProcessTests.py \
parted_utils_tests.py \
permutationTests.py \
@@ -66,7 +60,6 @@
securableTests.py \
sslTests.py \
storageMailboxTests.py \
- tcTests.py \
toolTests.py \
transportWrapperTests.py \
utilsTests.py \
@@ -111,8 +104,6 @@
glusterVolumeTasks.xml \
lvs_3386c6f2-926f-42c4-839c-38287fac8998.out \
mem_info.out \
- netmaskconversions \
- tc_filter_show.out \
$(NULL)
dist_vdsmtests_PYTHON = \
diff --git a/tests/network/Makefile.am b/tests/network/Makefile.am
new file mode 100644
index 0000000..f241a4b
--- /dev/null
+++ b/tests/network/Makefile.am
@@ -0,0 +1,53 @@
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+net_testsdir = ${vdsmtestsdir}/network
+
+dist_net_tests_PYTHON = \
+ apiTests.py \
+ ipwrapperTests.py \
+ netconfpersistenceTests.py \
+ netconfTests.py \
+ netinfoTests.py \
+ modelsTests.py \
+ tcTests.py \
+ $(NULL)
+
+MODULES = \
+ network/apiTests.py \
+ network/ipwrapperTests.py \
+ network/netconfpersistenceTests.py \
+ network/netconfTests.py \
+ network/netinfoTests.py \
+ network/modelsTests.py \
+ network/tcTests.py \
+ $(NULL)
+
+
+
+dist_net_tests_DATA = \
+ netmaskconversions \
+ tc_filter_show.out \
+ $(NULL)
+
+check-local:
+ @echo '*** Running network tests. To skip this step place NOSE_EXCLUDE=.* ***'
+ @echo '*** into your environment. Do not submit untested code! ***'
+ $(top_srcdir)/tests/run_tests_local.sh $(MODULES)
diff --git a/tests/configNetworkTests.py b/tests/network/apiTests.py
similarity index 100%
rename from tests/configNetworkTests.py
rename to tests/network/apiTests.py
diff --git a/tests/ipwrapperTests.py b/tests/network/ipwrapperTests.py
similarity index 100%
rename from tests/ipwrapperTests.py
rename to tests/network/ipwrapperTests.py
diff --git a/tests/netmodelsTests.py b/tests/network/modelsTests.py
similarity index 98%
rename from tests/netmodelsTests.py
rename to tests/network/modelsTests.py
index a2a3ee3..5da708b 100644
--- a/tests/netmodelsTests.py
+++ b/tests/network/modelsTests.py
@@ -34,7 +34,7 @@
from monkeypatch import MonkeyPatch
-class TestNetmodels(TestCaseBase):
+class TestModels(TestCaseBase):
def testIsVlanIdValid(self):
vlanIds = ('badValue', Vlan.MAX_ID + 1)
diff --git a/tests/netconfTests.py b/tests/network/netconfTests.py
similarity index 100%
rename from tests/netconfTests.py
rename to tests/network/netconfTests.py
diff --git a/tests/netconfpersistenceTests.py b/tests/network/netconfpersistenceTests.py
similarity index 100%
rename from tests/netconfpersistenceTests.py
rename to tests/network/netconfpersistenceTests.py
diff --git a/tests/netinfoTests.py b/tests/network/netinfoTests.py
similarity index 100%
rename from tests/netinfoTests.py
rename to tests/network/netinfoTests.py
diff --git a/tests/netmaskconversions b/tests/network/netmaskconversions
similarity index 100%
rename from tests/netmaskconversions
rename to tests/network/netmaskconversions
diff --git a/tests/tcTests.py b/tests/network/tcTests.py
similarity index 100%
rename from tests/tcTests.py
rename to tests/network/tcTests.py
diff --git a/tests/tc_filter_show.out b/tests/network/tc_filter_show.out
similarity index 100%
rename from tests/tc_filter_show.out
rename to tests/network/tc_filter_show.out
diff --git a/tests/run_tests_local.sh.in b/tests/run_tests_local.sh.in
index 0a229c0..787d9b2 100644
--- a/tests/run_tests_local.sh.in
+++ b/tests/run_tests_local.sh.in
@@ -3,8 +3,11 @@
PYTHON_EXE="@PYTHON@"
fi
-if [ ! -f @top_srcdir(a)/tests/jsonrpc-tests.server.crt ] || [ ! -f @top_srcdir(a)/tests/jsonrpc-tests.server.csr ] || [ ! -f @top_srcdir(a)/tests/jsonrpc-tests.server.key ]; then
- @top_srcdir(a)/tests/makecert.sh
+# The following line is taken from http://stackoverflow.com/a/246128/206009
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+if [ ! -f "$DIR/jsonrpc-tests.server.crt" ] || [ ! -f "$DIR/jsonrpc-tests.server.csr" ] || [ ! -f "$DIR/jsonrpc-tests.server.key" ]; then
+ $DIR/makecert.sh
fi
-PYTHONDONTWRITEBYTECODE=1 LC_ALL=C PYTHONPATH="@top_srcdir@/lib:@top_srcdir@/vdsm:@top_srcdir@/client:@top_srcdir@/vdsm_api:$PYTHONPATH" "$PYTHON_EXE" @top_srcdir(a)/tests/testrunner.py --local-modules $@
+PYTHONDONTWRITEBYTECODE=1 LC_ALL=C PYTHONPATH="$DIR/../lib:$DIR/../vdsm:$DIR/../client:$DIR/../vdsm_api:$PYTHONPATH" "$PYTHON_EXE" $DIR/testrunner.py --local-modules $@
--
To view, visit http://gerrit.ovirt.org/26874
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6960ce365d67ab4bb0a5475d7957e6117bef7e60
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: cleanup: drop several unused local variables
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: cleanup: drop several unused local variables
......................................................................
cleanup: drop several unused local variables
Change-Id: Ib81c292f900154819e8852c21ae389c323034999
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M client/vdsClient.py
M lib/vdsm/netinfo.py
M lib/yajsonrpc/protonReactor.py
M tests/functional/networkTests.py
M tests/functional/virtTests.py
M tests/hookValidation.py
M tests/hooksTests.py
M tests/jsonRpcTests.py
M tests/miscTests.py
M tests/testValidation.py
M tests/vmTests.py
M vds_bootstrap/setup
M vds_bootstrap/vds_bootstrap.py
M vds_bootstrap/vds_bootstrap_complete.py
M vdsm/storage/hsm.py
M vdsm/storage/iscsi.py
M vdsm/storage/misc.py
M vdsm/storage/remoteFileHandler.py
M vdsm/storage/resourceManager.py
M vdsm/storage/sp.py
M vdsm/storage/task.py
M vdsm/vm.py
M vdsm_api/Bridge.py
M vdsm_api/process-schema.py
M vdsm_api/vdsmapi.py
25 files changed, 23 insertions(+), 49 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/35/20535/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index 37dd7cb..4c09546 100644
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -842,7 +842,6 @@
masterDom = args[3]
domList = args[4].split(",")
mVer = int(args[5])
- pool = None
if len(args) > 6:
pool = self.s.createStoragePool(poolType, spUUID,
poolName, masterDom,
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index e8f2b8d..cf70089 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -93,8 +93,6 @@
The list of nics is built by filtering out nics defined
as hidden, fake or hidden bonds (with related nics'slaves).
"""
- res = []
-
def isHiddenNic(device):
"""
Returns boolean given the device name stating
@@ -397,7 +395,7 @@
"Convert an integer to the corresponding ip address in the dot-notation"
ip_address = []
- for i in xrange(4):
+ for _ in xrange(4):
ip_num, ip_val = divmod(ip_num, 256)
ip_address.append(str(ip_val))
diff --git a/lib/yajsonrpc/protonReactor.py b/lib/yajsonrpc/protonReactor.py
index 557600c..7892e3c 100644
--- a/lib/yajsonrpc/protonReactor.py
+++ b/lib/yajsonrpc/protonReactor.py
@@ -376,7 +376,6 @@
proton.pn_link_advance(link)
def createListener(self, address, acceptHandler):
- host, port = address
return self._scheduleOp(True, self._createListener, address,
acceptHandler)
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index a9149be..ba93343 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -377,7 +377,7 @@
for index in range(VLAN_COUNT)]
with dummyIf(1) as nics:
firstVlan, firstVlanId = NET_VLANS[0]
- status, msg = self.vdsm_net.addNetwork(firstVlan, vlan=firstVlanId,
+ _ = self.vdsm_net.addNetwork(firstVlan, vlan=firstVlanId,
bond=BONDING_NAME,
nics=nics, opts=opts)
with nonChangingOperstate(BONDING_NAME):
diff --git a/tests/functional/virtTests.py b/tests/functional/virtTests.py
index cdb695a..85781f7 100644
--- a/tests/functional/virtTests.py
+++ b/tests/functional/virtTests.py
@@ -83,7 +83,7 @@
def _genInitramfs():
fd, path = tempfile.mkstemp()
cmd = [_mkinitrd.cmd, "-f", path, _kernelVer]
- rc, out, err = execCmd(cmd, sudo=False)
+ _ = execCmd(cmd, sudo=False)
os.chmod(path, 0o644)
return path
diff --git a/tests/hookValidation.py b/tests/hookValidation.py
index 80e7239..208ed35 100644
--- a/tests/hookValidation.py
+++ b/tests/hookValidation.py
@@ -67,8 +67,6 @@
cookie_file = _createHookScript(hook_path, hook_name, hook_script)
- output = None
-
try:
kwargs['hook_cookiefile'] = cookie_file
output = test_function(*args, **kwargs)
diff --git a/tests/hooksTests.py b/tests/hooksTests.py
index 1018a4e..ddb3530 100644
--- a/tests/hooksTests.py
+++ b/tests/hooksTests.py
@@ -42,7 +42,7 @@
echo -n %s >> "$_hook_domxml"
"""
scripts = [tempfile.NamedTemporaryFile(dir=dirName, delete=False)
- for n in xrange(Q)]
+ for _ in xrange(Q)]
scripts.sort(key=lambda f: f.name)
for n, script in enumerate(scripts):
script.write(code % n)
diff --git a/tests/jsonRpcTests.py b/tests/jsonRpcTests.py
index a7b565f..00025ae 100644
--- a/tests/jsonRpcTests.py
+++ b/tests/jsonRpcTests.py
@@ -85,7 +85,7 @@
def serve(reactor):
try:
reactor.process_requests()
- except socket.error as e:
+ except socket.error:
pass
except Exception as e:
self.log.error("Reactor died unexpectedly", exc_info=True)
diff --git a/tests/miscTests.py b/tests/miscTests.py
index c836e55..1a9a16c 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -432,7 +432,7 @@
os.chmod(dstPath, 0o666)
#Copy
- rc, out, err = misc.ddWatchCopy(srcPath, dstPath, None, len(data))
+ _ = misc.ddWatchCopy(srcPath, dstPath, None, len(data))
#Get copied data
readData = open(dstPath).read()
@@ -448,7 +448,7 @@
fd, path = tempfile.mkstemp()
try:
- for i in xrange(repetitions):
+ for _ in xrange(repetitions):
os.write(fd, data)
self.assertEquals(os.stat(path).st_size, misc.MEGA)
except:
@@ -474,7 +474,7 @@
self.assertEquals(os.stat(path).st_size, misc.MEGA * 2)
with open(path, "r") as f:
- for i in xrange(repetitions):
+ for _ in xrange(repetitions):
self.assertEquals(f.read(len(data)), data)
finally:
os.unlink(path)
@@ -501,7 +501,7 @@
misc.MEGA * 2 + len(add_data))
with open(path, "r") as f:
- for i in xrange(repetitions):
+ for _ in xrange(repetitions):
self.assertEquals(f.read(len(data)), data)
# Checking the additional data
self.assertEquals(f.read(len(add_data)), add_data)
@@ -535,7 +535,7 @@
os.chmod(dstPath, 0o666)
#Copy
- rc, out, err = misc.ddWatchCopy(srcPath, dstPath, None, len(data))
+ _ = misc.ddWatchCopy(srcPath, dstPath, None, len(data))
#Get copied data
readData = open(dstPath).read()
diff --git a/tests/testValidation.py b/tests/testValidation.py
index d370971..92790d9 100644
--- a/tests/testValidation.py
+++ b/tests/testValidation.py
@@ -110,7 +110,7 @@
def wrapper(*args, **kwargs):
if not os.path.exists('/sys/module/dummy'):
cmd_modprobe = [modprobe.cmd, "dummy"]
- rc, out, err = utils.execCmd(cmd_modprobe, sudo=True)
+ _ = utils.execCmd(cmd_modprobe, sudo=True)
return f(*args, **kwargs)
return wrapper
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 1f69f0a..9d91723 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -390,7 +390,7 @@
driveInput.update({'shared': 'UNKNOWN-VALUE'})
with self.assertRaises(ValueError):
- drive = vm.Drive({}, self.log, **driveInput)
+ _ = vm.Drive({}, self.log, **driveInput)
def testDriveXML(self):
SERIAL = '54-a672-23e5b495a9ea'
diff --git a/vds_bootstrap/setup b/vds_bootstrap/setup
index 778dc12..701df8b 100755
--- a/vds_bootstrap/setup
+++ b/vds_bootstrap/setup
@@ -63,7 +63,6 @@
return False, HYPERVISOR_RELEASE_FILE + ", " + REDHAT_RELEASE_FILE
def get_id_line():
- line = ''
RELEASE_FILE = None
try:
@@ -193,7 +192,6 @@
import calendar
return_value = False
- ticket = None
try:
time_struct = time.strptime(systime, '%Y-%m-%dT%H:%M:%S')
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index a9dc901..e45c8b6 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -289,7 +289,6 @@
"""
status = "OK"
message = 'Host properly registered with RHN/Satellite.'
- rc = True
try:
rc = bool(deployUtil.yumListPackages(VDSM_NAME))
@@ -316,7 +315,6 @@
"""
status = "OK"
message = 'Available VDSM matches requirements'
- rc = True
try:
rc = deployUtil.yumSearchVersion(VDSM_NAME, VDSM_MIN_VER)
@@ -393,7 +391,6 @@
"""
os_status = "FAIL"
kernel_status = "FAIL"
- os_message = "Unsupported platform version"
os_name = "Unknown OS"
kernel_message = ''
self.rc = True
@@ -741,8 +738,6 @@
return self.rc
def _addNetwork(self, vdcName, vdcPort):
- fReturn = True
-
#add management bridge
try:
fReturn = deployUtil.makeBridge(
@@ -859,9 +854,6 @@
# TODO remove legacy
if deployUtil.getBootstrapInterfaceVersion() == 1 and \
engine_ssh_key is None:
- vdcAddress = None
- vdcPort = None
-
vdcAddress, vdcPort = deployUtil.getAddress(url)
if vdcAddress is not None:
strKey = deployUtil.getAuthKeysFile(vdcAddress, vdcPort)
diff --git a/vds_bootstrap/vds_bootstrap_complete.py b/vds_bootstrap/vds_bootstrap_complete.py
index fd18847..07c3610 100755
--- a/vds_bootstrap/vds_bootstrap_complete.py
+++ b/vds_bootstrap/vds_bootstrap_complete.py
@@ -101,7 +101,6 @@
except:
arg = 1
- res = True
try:
res = deployUtil.instCert(rnum, VDSM_CONF_FILE)
if res:
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 4579763..322ee8b 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1095,7 +1095,7 @@
misc.validateN(hostID, 'hostID')
# already disconnected/or pool is just unknown - return OK
try:
- pool = self.getPool(spUUID)
+ _ = self.getPool(spUUID)
except se.StoragePoolUnknown:
self.log.warning("disconnect sp: %s failed. Known pools %s",
spUUID, self.pools)
@@ -1861,7 +1861,7 @@
self.log.info("spUUID=%s master=%s", spUUID, masterDom)
try:
- pool = self.getPool(spUUID)
+ _ = self.getPool(spUUID)
except se.StoragePoolUnknown:
pool = sp.StoragePool(spUUID, self.domainMonitor, self.taskMng)
else:
diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index 7da94ab..9976026 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -415,7 +415,7 @@
log.debug("Performing SCSI scan, this will take up to %s seconds",
maxTimeout)
time.sleep(minTimeout)
- for i in xrange(maxTimeout - minTimeout):
+ for _ in xrange(maxTimeout - minTimeout):
for p in processes[:]:
(hba, proc) = p
if proc.wait(0):
@@ -429,7 +429,7 @@
time.sleep(1)
else:
log.warning("Still waiting for scsi scan of hbas: %s",
- tuple(hba for p in processes))
+ tuple(hba for _ in processes))
def devIsiSCSI(dev):
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index fc13a9c..5245264 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -484,7 +484,6 @@
log.debug("dir: %s, prefixName: %s, versions: %s" %
(directory, prefixName, gen))
gen = int(gen)
- files = os.listdir(directory)
files = glob.glob("%s*" % prefixName)
fd = {}
for fname in files:
@@ -614,7 +613,6 @@
return self.acquire(True)
def acquire(self, exclusive):
- currentEvent = None
currentThread = threading.currentThread()
# Handle reacquiring lock in the same thread
@@ -1081,7 +1079,7 @@
maxthreads -= 1
# waiting for rest threads to end
- for i in xrange(threadsCount):
+ for _ in xrange(threadsCount):
yield respQueue.get()
diff --git a/vdsm/storage/remoteFileHandler.py b/vdsm/storage/remoteFileHandler.py
index 5b24053..accf51c 100644
--- a/vdsm/storage/remoteFileHandler.py
+++ b/vdsm/storage/remoteFileHandler.py
@@ -275,7 +275,7 @@
def __init__(self, numOfHandlers):
self._numOfHandlers = numOfHandlers
self.handlers = [None] * numOfHandlers
- self.occupied = [Lock() for i in xrange(numOfHandlers)]
+ self.occupied = [Lock() for _ in xrange(numOfHandlers)]
def _isHandlerAvailable(self, poolHandler):
if poolHandler is None:
diff --git a/vdsm/storage/resourceManager.py b/vdsm/storage/resourceManager.py
index 14049dc..486ea18 100644
--- a/vdsm/storage/resourceManager.py
+++ b/vdsm/storage/resourceManager.py
@@ -926,7 +926,7 @@
return req.wait(timeout)
# req not found - check that it is not granted
- for fullName in self.resources:
+ for _ in self.resources:
return True
# Note that there is a risk of another thread that is racing with us
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 38cd453..db66662 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1326,7 +1326,6 @@
self.log.info("spUUID=%s sdUUID=%s", self.spUUID, sdUUID)
vms = self._getVMsPath(sdUUID)
# We should exclude 'masterd' link from IMG_METAPATTERN globing
- vmUUID = ovf = imgList = ''
for vm in vmList:
if not vm:
continue
diff --git a/vdsm/storage/task.py b/vdsm/storage/task.py
index 4eff5c1..0532b02 100644
--- a/vdsm/storage/task.py
+++ b/vdsm/storage/task.py
@@ -872,10 +872,7 @@
def _runJobs(self):
result = ""
- code = 100
- message = "Unknown Error"
i = 0
- j = None
try:
if self.aborting():
raise se.TaskAborted("shutting down")
@@ -891,7 +888,6 @@
if result is None:
result = ""
i += 1
- j = None
self._updateResult(0, "%s jobs completed successfully" % i, result)
self._updateState(State.finished)
self.log.debug('Task.run: exit - success: result %s' % result)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 0c12334..5e1c7f1 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -3058,7 +3058,7 @@
self._dom.attachDevice(nicXml)
except libvirt.libvirtError as e:
self.log.error("Hotplug failed", exc_info=True)
- nicXml = hooks.after_nic_hotplug_fail(
+ _ = hooks.after_nic_hotplug_fail(
nicXml, self.conf, params=customProps)
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
return errCode['noVM']
@@ -3760,7 +3760,7 @@
"trying again without it (%s)", e)
try:
self._dom.snapshotCreateXML(snapxml, snapFlags)
- except Exception as e:
+ except Exception:
self.log.error("Unable to take snapshot", exc_info=True)
if memoryParams:
self.cif.teardownVolumePath(memoryVol)
diff --git a/vdsm_api/Bridge.py b/vdsm_api/Bridge.py
index b9fdaf8..4812354 100644
--- a/vdsm_api/Bridge.py
+++ b/vdsm_api/Bridge.py
@@ -34,7 +34,6 @@
def dispatch(self, name, argobj):
methodName = name.replace('.', '_')
- result = None
try:
fn = getattr(self, methodName)
except AttributeError:
diff --git a/vdsm_api/process-schema.py b/vdsm_api/process-schema.py
index c4bda0d..307d498 100755
--- a/vdsm_api/process-schema.py
+++ b/vdsm_api/process-schema.py
@@ -255,12 +255,12 @@
# Union member types
names = strip_stars(s.get('data', []))
types = filter_types(names)
- details = [None for n in names]
+ details = [None for _ in names]
attr_table('Types', names, types, details)
elif 'enum' in s:
# Enum values
names = strip_stars(s.get('data', []))
- types = [None for n in names]
+ types = [None for _ in names]
details = [s['info_data'][n] for n in names]
attr_table('Values', names, types, details)
elif 'map' in s:
diff --git a/vdsm_api/vdsmapi.py b/vdsm_api/vdsmapi.py
index db29c13..c38ff01 100644
--- a/vdsm_api/vdsmapi.py
+++ b/vdsm_api/vdsmapi.py
@@ -92,7 +92,6 @@
def parse_schema(fp):
exprs = []
expr = ''
- expr_eval = None
for line in fp:
if line.startswith('#') or line == '\n':
--
To view, visit http://gerrit.ovirt.org/20535
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib81c292f900154819e8852c21ae389c323034999
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: vm: move device setup into __init__
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: move device setup into __init__
......................................................................
vm: move device setup into __init__
Device hierarchy should never change except fot hotplug/hotunplug.
Besides avoiding RuntimeError, this is more correct and safer.
Change-Id: I5e5a8e7916bb0c0d2519949397a5c1c64085e08e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmTestsData.py
M tests/vmfakelib.py
M vdsm/clientIF.py
M vdsm/virt/vm.py
4 files changed, 38 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/34753/1
diff --git a/tests/vmTestsData.py b/tests/vmTestsData.py
index 3316598..bb84412 100644
--- a/tests/vmTestsData.py
+++ b/tests/vmTestsData.py
@@ -29,7 +29,7 @@
'smp': '1', 'cpuPinning': {}, 'numaTune': {}, 'maxVCpus': '160',
'tabletEnable': False,
'displayNetwork': 'mydisp', 'custom': {},
- 'guestNumaNodes': []},
+ 'guestNumaNodes': [], 'devices': []},
"""<?xml version="1.0" encoding="utf-8"?>
<domain type="kvm">
@@ -50,6 +50,11 @@
path="/var/lib/libvirt/qemu/channels/%(vmId)s.org.qemu.guest_agent.0"/>
</channel>
<input bus="ps2" type="mouse"/>
+ <memballoon model="none"/>
+ <graphics autoport="yes" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1" type="vnc">
+ <listen network="vdsm-mydisp" type="network"/>
+ </graphics>
</devices>
<os>
<type arch="x86_64" machine="pc">hvm</type>
@@ -93,7 +98,7 @@
'smp': '1', 'cpuPinning': {}, 'numaTune': {}, 'maxVCpus': '160',
'tabletEnable': False,
'displayNetwork': 'mydisp', 'custom': {},
- 'guestNumaNodes': []},
+ 'guestNumaNodes': [], 'devices': []},
"""<?xml version="1.0" encoding="utf-8"?>
<domain type="kvm"
@@ -116,6 +121,11 @@
</channel>
<input bus="usb" type="mouse"/>
<emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <memballoon model="none"/>
+ <graphics autoport="yes" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1" type="vnc">
+ <listen network="vdsm-mydisp" type="network"/>
+ </graphics>
</devices>
<os>
<type arch="ppc64" machine="pc">hvm</type>
diff --git a/tests/vmfakelib.py b/tests/vmfakelib.py
index 83c5b7a..1baa681 100644
--- a/tests/vmfakelib.py
+++ b/tests/vmfakelib.py
@@ -169,6 +169,8 @@
(libvirtconnection, 'get', Connection)]):
vmParams = {'vmId': 'TESTING'}
vmParams.update({} if params is None else params)
+ if 'devices' not in vmParams:
+ vmParams['devices'] = tuple()
cif = ClientIF()
fake = vm.Vm(cif, vmParams)
cif.vmContainer[fake.id] = fake
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 440e5e7..30a38da 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -457,8 +457,7 @@
try:
# Do not prepare volumes when system goes down
if self._enabled:
- vmObj.preparePaths(
- vmObj.buildConfDevices()[vm.DISK_DEVICES])
+ vmObj.preparePaths(vmObj.getDiskDevicesConf())
except:
self.log.error("Vm %s recovery failed",
vmId, exc_info=True)
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 05b15e9..05ee6b0 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1302,6 +1302,8 @@
self._liveMergeCleanupThreads = {}
self._shutdownReason = None
+ self._setupDevices()
+
def _get_lastStatus(self):
PAUSED_STATES = (vmstatus.POWERING_DOWN, vmstatus.REBOOT_IN_PROGRESS,
vmstatus.UP)
@@ -1516,7 +1518,7 @@
'type': GRAPHICS_DEVICES,
'device': (
'spice'
- if self.conf['display'] in ('qxl', 'qxlnc')
+ if self.conf.get('display') in ('qxl', 'qxlnc')
else 'vnc'),
'specParams': makeSpecParams(self.conf)}]
@@ -2643,20 +2645,30 @@
except Exception:
self.log.warning('failed to set Vm niceness', exc_info=True)
+ def _setupDevices(self):
+ devices = self.buildConfDevices()
+
+ if not self.recovering:
+ self._updateDevices(devices)
+
+ for devType, devClass in self.DeviceMapping:
+ for dev in devices[devType]:
+ self._devices[devType].append(devClass(self.conf, self.log,
+ **dev))
+
def _run(self):
self.log.info("VM wrapper has started")
- devices = self.buildConfDevices()
- self._updateDiskSizes(devices[DISK_DEVICES])
+ drives = list(self.getDiskDevicesConf())
+ self._updateDiskSizes(drives)
# recovery flow note:
# we do not start disk stats collection here since
# in the recovery flow irs may not be ready yet.
# Disk stats collection is started from clientIF at the end
# of the recovery process.
if not self.recovering:
- self.preparePaths(devices[DISK_DEVICES])
- self._prepareTransientDisks(devices[DISK_DEVICES])
- self._updateDevices(devices)
+ self.preparePaths(drives)
+ self._prepareTransientDisks(drives)
# We need to save conf here before we actually run VM.
# It's not enough to save conf only on status changes as we did
# before, because if vdsm will restarted between VM run and conf
@@ -2664,11 +2676,6 @@
# So, to get proper device objects during VM recovery flow
# we must to have updated conf before VM run
self.saveState()
-
- for devType, devClass in self.DeviceMapping:
- for dev in devices[devType]:
- self._devices[devType].append(devClass(self.conf, self.log,
- **dev))
# We should set this event as a last part of drives initialization
self._pathsPreparedEvent.set()
@@ -5362,6 +5369,11 @@
if dev['type'] == BALLOON_DEVICES:
yield dev
+ def getDiskDevicesConf(self):
+ for dev in self.conf['devices']:
+ if dev['type'] == DISK_DEVICES:
+ yield dev
+
@property
def sdIds(self):
"""
--
To view, visit http://gerrit.ovirt.org/34753
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e5a8e7916bb0c0d2519949397a5c1c64085e08e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: spec: require latest version of IOProcess
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: spec: require latest version of IOProcess
......................................................................
spec: require latest version of IOProcess
This version includes an important fix for
IOProcess being referenced by the communication thread
Change-Id: Ic70d15fe0b9827707a51654e31327f7a50c479ac
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/34403/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 0ba2f5e..5cdb53c 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -91,7 +91,7 @@
BuildRequires: psmisc
BuildRequires: python-cpopen >= 1.3
BuildRequires: python-inotify
-BuildRequires: python-ioprocess >= 0.12
+BuildRequires: python-ioprocess >= 0.14
BuildRequires: python-pthreading
BuildRequires: qemu-img
BuildRequires: rpm-python
@@ -128,7 +128,7 @@
Requires: python-inotify
Requires: python-argparse
Requires: python-cpopen >= 1.3
-Requires: python-ioprocess >= 0.12
+Requires: python-ioprocess >= 0.14
Requires: python-pthreading >= 0.1.3-3
Requires: %{name}-infra = %{version}-%{release}
Requires: rpm-python
@@ -361,7 +361,7 @@
Requires: %{name}-infra = %{version}-%{release}
Requires: python-cpopen >= 1.2.3-5
Requires: m2crypto
-Requires: python-ioprocess >= 0.12
+Requires: python-ioprocess >= 0.14
BuildArch: noarch
%description python
--
To view, visit http://gerrit.ovirt.org/34403
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic70d15fe0b9827707a51654e31327f7a50c479ac
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
9 years, 5 months