Change in vdsm[master]: Update except syntax according to pep3110.
by Jenkins CI RO
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Update except syntax according to pep3110.
......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/674/ (2/2)
--
To view, visit http://gerrit.ovirt.org/10942
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2c4ac78dace34a41e1afb9f6560889ad9bd34ddf
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ewoud Kohl van Wijngaarden <ewoud(a)kohlvanwijngaarden.nl>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
11 years, 4 months
Change in vdsm[master]: Update except syntax according to pep3110.
by Jenkins CI RO
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Update except syntax according to pep3110.
......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/709/ (1/2)
--
To view, visit http://gerrit.ovirt.org/10942
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2c4ac78dace34a41e1afb9f6560889ad9bd34ddf
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ewoud Kohl van Wijngaarden <ewoud(a)kohlvanwijngaarden.nl>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
11 years, 4 months
Change in vdsm[master]: tests: add iscsi storage functional test
by zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: tests: add iscsi storage functional test
......................................................................
tests: add iscsi storage functional test
Change-Id: Icaef5d6145b8f493b5eaab0b75564f88a4cb82ce
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M tests/functional/xmlrpcTests.py
M vdsm.spec.in
2 files changed, 191 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/9842/1
diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index c259533..82128f1 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -27,20 +27,25 @@
from testrunner import VdsmTestCase as TestCaseBase
from nose.plugins.skip import SkipTest
+import selinux
from vdsm.config import config
from vdsm.constants import VDSM_USER, VDSM_GROUP, QEMU_PROCESS_USER, EXT_SUDO
+from vdsm.constants import EXT_DD
import storage.sd
import storage.volume
from storage.misc import execCmd
from storage.misc import RollbackContext
+from storage.fileUtils import createdir
from vdsm.utils import CommandPath
+from vdsm.utils import retry
from vdsm import vdscli
if not config.getboolean('vars', 'xmlrpc_enable'):
raise SkipTest("XML-RPC Bindings are disabled")
_mkinitrd = CommandPath("mkinird", "/usr/bin/mkinitrd")
+_tgtadm = CommandPath("tgtadm", "/usr/sbin/tgtadm")
def readableBy(filePath, user):
@@ -198,6 +203,11 @@
def testLocalfs(self):
conf = storageLayouts['localfs']
+ with RollbackContext() as rollback:
+ self._createVdsmStorageLayout(conf, rollback)
+
+ def testIscsi(self):
+ conf = storageLayouts['iscsi']
with RollbackContext() as rollback:
self._createVdsmStorageLayout(conf, rollback)
@@ -387,24 +397,157 @@
class IscsiServer(object):
- def __init__(self, vdsmServer):
+ def __init__(self, vdsmServer, asserts):
self.s = vdsmServer
+ self.asserts = asserts
+ self.address = '127.0.0.1'
+
+ def _createTarget(self, tid, iqn):
+ rc, out, err = execCmd(
+ [_tgtadm.cmd, '--lld', 'iscsi', '--op', 'new', '--mode', 'target',
+ '--tid', str(tid), '-T', iqn])
+ self.asserts.assertEquals(rc, 0)
+
+ def _deleteTarget(self, tid):
+ rc, out, err = execCmd(
+ [_tgtadm.cmd, '--lld', 'iscsi', '--op', 'delete', '--mode',
+ 'target', '--tid', str(tid), '--force'])
+ self.asserts.assertEquals(rc, 0)
+
+ def _tryCreateTarget(self, iqn, rollback):
+ for i in range(1, 100):
+ try:
+ self._createTarget(i, iqn)
+ except AssertionError:
+ continue
+
+ rollback.prependDefer(
+ lambda tid=i: self._deleteTarget(tid))
+ return i
+
+ raise RuntimeError("Can not create iscsi target")
+
+ def _addLUN(self, tid, lunid, backingStore):
+ rc, out, err = execCmd(
+ [_tgtadm.cmd, '--lld', 'iscsi', '--op', 'new', '--mode',
+ 'logicalunit', '--tid', str(tid), '--lun', str(lunid),
+ '-b', backingStore])
+ self.asserts.assertEquals(rc, 0)
+
+ def _deleteLUN(self, tid, lunid):
+ rc, out, err = execCmd(
+ [_tgtadm.cmd, '--lld', 'iscsi', '--op', 'delete', '--mode',
+ 'logicalunit', '--tid', str(tid), '--lun', str(lunid)])
+ self.asserts.assertEquals(rc, 0)
+
+ def _tryAddLUN(self, tid, lunid, backingStore, rollback):
+ self._addLUN(tid, lunid, backingStore)
+ rollback.prependDefer(lambda: self._deleteLUN(tid, lunid))
+
+ def _bindAddress(self, tid, address):
+ rc, out, err = execCmd(
+ [_tgtadm.cmd, '--lld', 'iscsi', '--op', 'bind', '--mode', 'target',
+ '--tid', str(tid), '-I', address])
+ self.asserts.assertEquals(rc, 0)
+
+ def _tryCreateEmptyImage(self, diskPath, rollback):
+ rc, out, err = execCmd(
+ [EXT_DD, 'if=/dev/zero', 'of=%s' % diskPath, 'bs=1M', 'seek=10240',
+ 'count=0'])
+ self.asserts.assertEquals(rc, 0)
+ rollback.prependDefer(
+ lambda diskPath=diskPath: os.unlink(diskPath))
def _createBackend(self, backendDef, rollback):
- # Create iscsi target
- pass
+ pathTgtd = '/var/lib/tgtd'
+ createdir(pathTgtd) # needn't delete this dir, so no undo is added
+ os.chown(pathTgtd, 0, 0)
+ selinux.restorecon(pathTgtd)
+
+ connections = {}
+ for uuid, conn in backendDef.iteritems():
+ iqn = conn['iqn']
+ diskPath = "%s/%s" % (pathTgtd, uuid)
+ self._tryCreateEmptyImage(diskPath, rollback)
+ os.chown(diskPath, 0, 0)
+ selinux.restorecon(diskPath)
+ tid = self._tryCreateTarget(iqn, rollback)
+ self._tryAddLUN(tid, 1, diskPath, rollback)
+ self._bindAddress(tid, self.address)
+ connections[uuid] = {
+ 'type': 'iscsi',
+ 'params': {'portal': {'host': self.address}, 'iqn': iqn}}
+
+ return connections
def _connectBackend(self, connections, rollback):
- # Connect iscsi storage server
- pass
+ r = self.s.storageServer_ConnectionRefs_acquire(connections)
+ self.asserts.assertVdsOK(r)
- def _genTypeSpecificArgs(self, connections, rollback):
- # Create VG
- # Generate UUIDs of those VG
- pass
+ def releaseConnection():
+ import time
+ time.sleep(30)
+ r = self.s.storageServer_ConnectionRefs_release(
+ connections.keys())
+ time.sleep(30)
+ # test will fail if we do not sleep.
+ # the LUN can not be removed from the target.
+ # tgtadm will say it is still occupied,
+ # and iscsiadm still have avtive sessions
+ # even if we remove the storage domain and pools
+ # and connections.
+ # Why ?
+ self.asserts.assertVdsOK(r)
+
+ rollback.prependDefer(releaseConnection)
+ for _refid, status in r['results'].iteritems():
+ self.asserts.assertEquals(status, 0)
+
+ def _tryCreateVG(self, vgName, devName, rollback):
+ r = self.s.createVG(vgName, [devName])
+ self.asserts.assertVdsOK(r)
+ vgid = r['uuid']
+ rollback.prependDefer(
+ lambda: self.asserts.assertVdsOK(
+ self.s.removeVG(vgid)))
+ return vgid
+
+ def _genTypeSpecificArgs(self, backendDef, rollback):
+ iqns = map(lambda conn: conn['iqn'],
+ backendDef.itervalues())
+
+ def getIqnDevs(iqns=iqns):
+ '''find the related device of a iqn'''
+ r = self.s.getDeviceList()
+ devList = r['devList']
+ self.asserts.assertVdsOK(r)
+ iqnDevs = {}
+ for iqn in iqns:
+ for dev in devList:
+ if iqn in map(lambda p: p['iqn'], dev['pathlist']):
+ iqnDevs[iqn] = dev['GUID']
+ break
+ else:
+ raise RuntimeError(
+ 'Can not find related device of iqn %s' % iqn)
+ return iqnDevs
+
+ # changes on the devices may not be known to VDSM immediately
+ iqnDevs = retry(getIqnDevs, expectedException=RuntimeError,
+ timeout=40, sleep=5)
+
+ args = {}
+ for uuid, conn in backendDef.iteritems():
+ iqn = conn['iqn']
+ vgid = self._tryCreateVG(conn['sd'], iqnDevs[iqn], rollback)
+ args[uuid] = vgid
+
+ return args
def prepare(self, backendDef, rollback):
- pass
+ connections = self._createBackend(backendDef, rollback)
+ self._connectBackend(connections, rollback)
+ return self._genTypeSpecificArgs(backendDef, rollback)
storageLayouts = \
@@ -443,5 +586,40 @@
"bace8f68-4c5a-43f2-acb4-fa8daf58c0f9"]}}},
'nfs': {'server': 'blah', 'conn': 'blah', 'sd': 'blah', 'sp': 'blah',
'img': 'blah', 'layout': 'blah'},
- 'iscsi': {'server': 'blah', 'conn': 'blah', 'sd': 'blah', 'sp': 'blah',
- 'img': 'blah', 'layout': 'blah'}}
+ 'iscsi': {
+ 'server': IscsiServer,
+ 'conn': {
+ '3bd3092e-096b-4409-a2de-e10313a0d8af': {
+ 'iqn': 'iqn.2012-12.org.ovirt.tests:vdsmtests0',
+ 'sd': '3f330c2c-9b01-4167-9df5-cf665f95e3a6'},
+ '28ba1368-9f5c-4441-a7fd-94e85435564b': {
+ 'iqn': 'iqn.2012-12.org.ovirt.tests:vdsmtests1',
+ 'sd': 'a73a818b-3341-457a-8139-a6a71194ab7a'}},
+ 'sd': {
+ "3f330c2c-9b01-4167-9df5-cf665f95e3a6": {
+ "name": "test iscsi domain0",
+ "type": "iscsi", "class": "Data",
+ "connUUID": "3bd3092e-096b-4409-a2de-e10313a0d8af"},
+ "a73a818b-3341-457a-8139-a6a71194ab7a": {
+ "name": "test iscsi domain1",
+ "type": "iscsi", "class": "Data",
+ "connUUID": "28ba1368-9f5c-4441-a7fd-94e85435564b"}},
+ 'sp': {
+ "39178935-1f2e-4cd1-8c2d-4f47097d80a3": {
+ "name": "iscsi storage pool", "master_ver": 1, "host": 1,
+ "master_uuid": "3f330c2c-9b01-4167-9df5-cf665f95e3a6"}},
+ 'img': {
+ "a81db3fc-5586-4e35-9785-912c28ada09d": {
+ "description": "Test iscsi volume0", "type": "leaf",
+ "volid": "a921cdf0-b322-4ee8-84e6-8e87c65c016f",
+ "format": "cow", "preallocate": "sparse", "size": 20971520},
+ "35c728e1-edf1-4068-8f25-02d21feb85cd": {
+ "description": "test iscsi volume1", "type": "leaf",
+ "volid": "eb42c709-42a2-4227-a5b6-f368df3a2613",
+ "format": "cow", "preallocate": "sparse", "size": 20971520}},
+ 'layout': {
+ "39178935-1f2e-4cd1-8c2d-4f47097d80a3": {
+ "3f330c2c-9b01-4167-9df5-cf665f95e3a6": [
+ "a81db3fc-5586-4e35-9785-912c28ada09d"],
+ "a73a818b-3341-457a-8139-a6a71194ab7a": [
+ "35c728e1-edf1-4068-8f25-02d21feb85cd"]}}}}
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 9830afe..11fc3fc 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -220,6 +220,7 @@
Requires: vdsm = %{version}-%{release}
Requires: dracut
Requires: python-nose
+Requires: scsi-target-utils
BuildArch: noarch
%description tests
--
To view, visit http://gerrit.ovirt.org/9842
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icaef5d6145b8f493b5eaab0b75564f88a4cb82ce
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
11 years, 4 months
Change in vdsm[master]: functional tests: Wait till backend server of storage connec...
by zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: functional tests: Wait till backend server of storage connection reference is connected
......................................................................
functional tests: Wait till backend server of storage connection reference is connected
Storage connection reference performs the actual connecting in
asynchronous manner, so add a retryAssert on the storage connection
status to wait it gets connected. Otherwise the creation of storage
domain will fail if the backend connection in VDSM is not ready.
Extract a super class for backend servers in functional test, the
waiting for the ready of the connection is put in the super class,
because this waiting can be useful to iscsi and glusterfs testing.
Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M tests/functional/xmlrpcTests.py
1 file changed, 36 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/10352/1
diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index c259533..482266e 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -24,6 +24,7 @@
import grp
import shutil
from contextlib import contextmanager
+from functools import partial
from testrunner import VdsmTestCase as TestCaseBase
from nose.plugins.skip import SkipTest
@@ -336,11 +337,44 @@
self.retryAssert(assertTaskOK, timeout=20)
-class LocalFSServer(object):
+class BackendServer(object):
+ '''Super class of various backend servers'''
+
def __init__(self, vdsmServer, asserts):
self.s = vdsmServer
self.asserts = asserts
+ def _createBackend(self, backendDef, rollback):
+ raise RuntimeError("Not implemented")
+
+ def _assertBackendConnected(self, connections):
+ r = self.s.storageServer_ConnectionRefs_statuses()
+ self.asserts.assertVdsOK(r)
+ status = r['connectionslist']
+ for refid in connections:
+ self.asserts.assertEquals(status[refid]['connected'], True)
+
+ def _connectBackend(self, connections, rollback):
+ r = self.s.storageServer_ConnectionRefs_acquire(connections)
+ self.asserts.assertVdsOK(r)
+ undo = lambda: self.asserts.assertVdsOK(
+ self.s.storageServer_ConnectionRefs_release(connections.keys()))
+ rollback.prependDefer(undo)
+ for _refid, status in r['results'].iteritems():
+ self.asserts.assertEquals(status, 0)
+ self.asserts.retryAssert(
+ partial(self._assertBackendConnected, connections), timeout=40)
+
+ def _genTypeSpecificArgs(self, connections, rollback):
+ raise RuntimeError("Not implemented")
+
+ def prepare(self, backendDef, rollback):
+ connections = self._createBackend(backendDef, rollback)
+ self._connectBackend(connections, rollback)
+ return self._genTypeSpecificArgs(connections, rollback)
+
+
+class LocalFSServer(BackendServer):
def _createBackend(self, backendDef, rollback):
uid = pwd.getpwnam(VDSM_USER)[2]
gid = grp.getgrnam(VDSM_GROUP)[2]
@@ -365,31 +399,14 @@
return connections
- def _connectBackend(self, connections, rollback):
- r = self.s.storageServer_ConnectionRefs_acquire(connections)
- self.asserts.assertVdsOK(r)
- undo = lambda: self.asserts.assertVdsOK(
- self.s.storageServer_ConnectionRefs_release(connections.keys()))
- rollback.prependDefer(undo)
- for _refid, status in r['results'].iteritems():
- self.asserts.assertEquals(status, 0)
-
def _genTypeSpecificArgs(self, connections, rollback):
args = {}
for uuid, conn in connections.iteritems():
args[uuid] = conn['params']['path']
return args
- def prepare(self, backendDef, rollback):
- connections = self._createBackend(backendDef, rollback)
- self._connectBackend(connections, rollback)
- return self._genTypeSpecificArgs(connections, rollback)
-
-class IscsiServer(object):
- def __init__(self, vdsmServer):
- self.s = vdsmServer
-
+class IscsiServer(BackendServer):
def _createBackend(self, backendDef, rollback):
# Create iscsi target
pass
--
To view, visit http://gerrit.ovirt.org/10352
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
11 years, 4 months
Change in vdsm[master]: storage connection monitor: don't recover an unmanaged conne...
by zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: storage connection monitor: don't recover an unmanaged connection
......................................................................
storage connection monitor: don't recover an unmanaged connection
A connection can be deleted (unmanage) when the storage connection
monitor thread is in in Event.wait(). When the monitor thread continues
to execute, it thinks the connection is lost and try to recover it, but
the fact is it is unmanaged. This bug prevent iscsi connections from
releasing cleanly.
This patch checks if the connection is still managed by the monitor
before recovering it.
Change-Id: I9bc2b1f18f3421039b1d85d1e7a47c746ebfc31a
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M vdsm/storage/storageServer.py
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/10297/1
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index b457d5b..4baf042 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -651,6 +651,12 @@
if self._stopEvent.isSet():
break
+ with self._conDictLock:
+ if conId not in self._conDict:
+ # the connection is deleted when we were in wait for the
+ # stop event, so skip it
+ continue
+
if con.isConnected():
continue
--
To view, visit http://gerrit.ovirt.org/10297
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9bc2b1f18f3421039b1d85d1e7a47c746ebfc31a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
11 years, 4 months
Change in vdsm[master]: Update except syntax according to pep3110.
by ewoud@kohlvanwijngaarden.nl
Ewoud Kohl van Wijngaarden has posted comments on this change.
Change subject: Update except syntax according to pep3110.
......................................................................
Patch Set 1: Looks good to me, but someone else must approve
(17 inline comments)
In itself a good start. All of the comments are existing issues that could be solved in later patches and some that should because they're unrelated.
....................................................
File vdsm_reg/deployUtil.py.in
Line 818: try:
Line 819: ttp = time.strptime(VDCTime, '%Y-%m-%dT%H:%M:%S')
Line 820: except ValueError as e:
Line 821: logging.debug("setHostTime: Failed to parse @ENGINENAME@ time. "
Line 822: "message= " + str(e))
unrelated, but could be written as logging.debug("[..] message=%s", e)
Line 823: fReturn = False
Line 824:
Line 825: if fReturn:
Line 826: out, err, rc = _logExec(
....................................................
File vdsm_reg/vdsm-reg-setup.in
Line 220: os.chmod(upgradeDir, 0755)
Line 221: except OSError as err:
Line 222: if err.errno != errno.EEXIST:
Line 223: log.error(
Line 224: "can not create vdsm upgrade dir: %s" % upgradeDir
unrelated, but could be written as log.error("[..]", upgradeDir)
Line 225: )
Line 226:
Line 227: def run(confFile, daemonize):
Line 228: #print "entered run(conf='%s', daemonize='%s')"%(confFile,str(daemonize))
....................................................
File vdsm/storage/blockVolume.py
Line 681: misc.ddWatchCopy(
Line 682: "/dev/zero", lvm.lvPath(sdUUID, lv.name),
Line 683: vars.task.aborting, int(lv.size),
Line 684: recoveryCallback=volume.baseAsyncTasksRollback)
Line 685: except se.ActionStopped, e:
looks like you missed one here
Line 686: raise e
Line 687: except Exception as e:
Line 688: raise se.VolumesZeroingError(lv.name)
Line 689:
....................................................
File vdsm/storage/dispatcher.py
Line 62: result = ctask.prepare(self.func, *args, **kwargs)
Line 63: if type(result) == dict:
Line 64: response.update(result)
Line 65: return response
Line 66: except se.GeneralException, e:
missed one here
Line 67: self.log.error(e.response())
Line 68: return e.response()
Line 69: except BaseException as e:
Line 70: self.log.error(e, exc_info=True)
....................................................
File vdsm/storage/fileVolume.py
Line 140: try:
Line 141: # ddWatchCopy expects size to be in bytes
Line 142: misc.ddWatchCopy("/dev/zero", volPath,
Line 143: vars.task.aborting, sizeBytes)
Line 144: except se.ActionStopped, e:
missed one here
Line 145: raise e
Line 146: except Exception as e:
Line 147: cls.log.error("Unexpected error", exc_info=True)
Line 148: raise se.VolumesZeroingError(volPath)
....................................................
File vdsm/storage/image.py
Line 917: dstVol.extend(newsize)
Line 918: dstPath = dstVol.getVolumePath()
Line 919: # Change destination volume metadata back to the original size.
Line 920: dstVol.setSize(volParams['size'])
Line 921: except se.StorageException, e:
missed one, but it looks like it's not used anyway so maybe just remove it?
Line 922: self.log.error("Unexpected error", exc_info=True)
Line 923: raise
Line 924: except Exception as e:
Line 925: self.log.error("Unexpected error", exc_info=True)
Line 951:
Line 952: if force:
Line 953: # Now we should re-link all deleted hardlinks, if exists
Line 954: self.__templateRelink(destDom, dstImgUUID, dstVolUUID)
Line 955: except se.StorageException, e:
missed an unused one here
Line 956: self.log.error("Unexpected error", exc_info=True)
Line 957: raise
Line 958: except Exception as e:
Line 959: self.log.error("Unexpected error", exc_info=True)
....................................................
File vdsm/storage/lvm.py
Line 662: os.path.basename(device))
Line 663: except OSError as e:
Line 664: if e.errno == errno.ENODEV:
Line 665: raise se.PhysDevInitializationError("%s: %s" %
Line 666: (device, str(e)))
unrelated, but the str(e) could rewritten as e
Line 667: else:
Line 668: raise
Line 669:
Line 670: if force is True:
....................................................
File vdsm/storage/remoteFileHandler.py
Line 395: server.registerFunction(func)
Line 396:
Line 397: for mod in (os, glob, fileUtils):
Line 398: server.registerModule(mod)
Line 399: except Exception as ex:
unused, maybe remove it?
Line 400: logging.root.error("Error creating CrabRPC server", exc_info=True)
Line 401: raise
Line 402:
Line 403: try:
Line 401: raise
Line 402:
Line 403: try:
Line 404: server.serve_forever()
Line 405: except Exception as ex:
unused, maybe remove it?
Line 406: logging.root.error("Error while serving", exc_info=True)
Line 407: raise
Line 408:
Line 409: except BaseException as e:
....................................................
File vdsm/storage/resourceFactories.py
Line 175: except (rm.RequestTimedOutError, se.ResourceAcqusitionFailed), e:
Line 176: log.debug("Cannot acquire volume resource (%s)", str(e))
Line 177: failed = True
Line 178: raise
Line 179: except Exception as e:
unused, maybe remove it?
Line 180: log.debug("Cannot acquire volume resource", exc_info=True)
Line 181: failed = True
Line 182: raise
Line 183: finally:
....................................................
File vdsm/storage/resourceManager.py
Line 820: except ValueError as ex:
Line 821: self.log.debug("%s: request for '%s' could not be "
Line 822: "processed (%s)", self, fullName, ex)
Line 823: raise se.InvalidResourceName()
Line 824: except KeyError as ex:
unused, maybe remove it?
Line 825: self.log.debug("%s: resource '%s' does not exist", self,
Line 826: fullName)
Line 827: except Exception as ex:
Line 828: self.log.warn("Unexpected exception caught while owner "
Line 823: raise se.InvalidResourceName()
Line 824: except KeyError as ex:
Line 825: self.log.debug("%s: resource '%s' does not exist", self,
Line 826: fullName)
Line 827: except Exception as ex:
unused, maybe remove it?
Line 828: self.log.warn("Unexpected exception caught while owner "
Line 829: "'%s' tried to acquire '%s'", self, fullName,
Line 830: exc_info=True)
Line 831: raise se.ResourceException(fullName)
Line 868: except ValueError as ex:
Line 869: self.log.debug("%s: request for '%s' could not be processed "
Line 870: "(%s)", self, fullName, ex)
Line 871: raise se.InvalidResourceName()
Line 872: except KeyError as ex:
unused, maybe remove it?
Line 873: self.log.debug("%s: resource '%s' does not exist", self,
Line 874: fullName)
Line 875: raise se.ResourceDoesNotExist()
Line 876: except Exception as ex:
Line 872: except KeyError as ex:
Line 873: self.log.debug("%s: resource '%s' does not exist", self,
Line 874: fullName)
Line 875: raise se.ResourceDoesNotExist()
Line 876: except Exception as ex:
unused, maybe remove it?
Line 877: self.log.warn("Unexpected exception caught while owner '%s' "
Line 878: "tried to acquire '%s'", self, fullName,
Line 879: exc_info=True)
Line 880: raise se.ResourceException()
....................................................
File vdsm/storage/sp.py
Line 296:
Line 297: try:
Line 298: # Make sure backup domain is active
Line 299: self.checkBackupDomain(__securityOverride=True)
Line 300: except Exception as e:
unused, maybe remove it?
Line 301: self.log.error("Backup domain validation failed",
Line 302: exc_info=True)
Line 303:
Line 304: self.taskMng.loadDumpedTasks(self.tasksDir)
Line 339: self.log.debug("ended.")
Line 340:
Line 341: except Exception as e:
Line 342: self.log.error("Unexpected error", exc_info=True)
Line 343: self.log.error("failed: %s" % str(e))
unrelated, but str(e) could be rewritten as e
Line 344: self.stopSpm(force=True, __securityOverride=True)
Line 345: raise
Line 346:
Line 347: @unsecured
--
To view, visit http://gerrit.ovirt.org/10942
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2c4ac78dace34a41e1afb9f6560889ad9bd34ddf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ewoud Kohl van Wijngaarden <ewoud(a)kohlvanwijngaarden.nl>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
11 years, 4 months
Change in vdsm[master]: Update except syntax according to pep3110.
by asegurap@redhat.com
Antoni Segura Puimedon has posted comments on this change.
Change subject: Update except syntax according to pep3110.
......................................................................
Patch Set 1: Verified
Output of gitpydiff:
antoni@nx01 ~/code/vdsm> gitpydiff
checking tests/miscTests.py
checking vds_bootstrap/vds_bootstrap.py
checking vdsm/API.py
checking vdsm/BindingXMLRPC.py
checking vdsm/configNetwork.py
checking vdsm/libvirtvm.py
checking vdsm/mkimage.py
checking vdsm/netinfo.py
checking vdsm/storage/blockSD.py
checking vdsm/storage/blockVolume.py
checking vdsm/storage/dispatcher.py
checking vdsm/storage/domainMonitor.py
checking vdsm/storage/fileSD.py
checking vdsm/storage/fileUtils.py
checking vdsm/storage/fileVolume.py
checking vdsm/storage/hsm.py
checking vdsm/storage/image.py
checking vdsm/storage/imageRepository/formatConverter.py
checking vdsm/storage/lvm.py
checking vdsm/storage/misc.py
checking vdsm/storage/remoteFileHandler.py
checking vdsm/storage/resourceFactories.py
checking vdsm/storage/resourceManager.py
checking vdsm/storage/sp.py
checking vdsm/storage/storageServer.py
checking vdsm/storage/storage_mailbox.py
checking vdsm/storage/task.py
checking vdsm/storage/taskManager.py
checking vdsm/storage/volume.py
checking vdsm/supervdsm.py
checking vdsm/supervdsmServer.py
checking vdsm/tc.py
checking vdsm/utils.py
checking vdsm/vm.py
checking vdsm_api/BindingJsonRpc.py
checking vdsm_api/Bridge.py
checking vdsm_cli/vdsClient.py
checking vdsm_reg/createDaemon.py
checking vdsm_reg/deployUtil.py.in
antoni@nx01 ~/code/vdsm>
--
To view, visit http://gerrit.ovirt.org/10942
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2c4ac78dace34a41e1afb9f6560889ad9bd34ddf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
11 years, 4 months