Change in vdsm[master]: fixing pep8 issues in supervdsm
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: fixing pep8 issues in supervdsm
......................................................................
fixing pep8 issues in supervdsm
Change-Id: I7c4531269009e2607ce729270b0eb37428055f0b
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/supervdsmServer.py
1 file changed, 7 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/9672/1
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index 34fefdb..b533af4 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -47,7 +47,7 @@
from storage.fileUtils import chown, resolveGid, resolveUid
from storage.fileUtils import validateAccess as _validateAccess
from vdsm.constants import METADATA_GROUP, EXT_UDEVADM, \
- DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS
+ DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS
from storage.devicemapper import _removeMapping, _getPathsStatus
import storage.misc
import configNetwork
@@ -61,7 +61,7 @@
_UDEV_RULE_FILE_PREFIX = "99-vdsm-"
_UDEV_RULE_FILE_EXT = ".rules"
_UDEV_RULE_FILE_NAME = _UDEV_RULE_FILE_DIR + _UDEV_RULE_FILE_PREFIX + \
- "%s-%s" + _UDEV_RULE_FILE_EXT
+ "%s-%s" + _UDEV_RULE_FILE_EXT
RUN_AS_TIMEOUT = config.getint("irs", "process_pool_timeout")
@@ -207,7 +207,7 @@
@logDecorator
def validateAccess(self, user, groups, *args, **kwargs):
return self._runAs(user, groups, _validateAccess, args=args,
- kwargs=kwargs)
+ kwargs=kwargs)
@logDecorator
def setSafeNetworkConfig(self):
@@ -216,7 +216,7 @@
@logDecorator
def udevTrigger(self, guid):
cmd = [EXT_UDEVADM, 'trigger', '--verbose', '--action', 'change',
- '--property-match=DM_NAME=%s' % guid]
+ '--property-match=DM_NAME=%s' % guid]
rc, out, err = storage.misc.execCmd(cmd, sudo=False)
if rc:
raise OSError(errno.EINVAL, "Could not trigger change for device \
@@ -226,7 +226,7 @@
def appropriateDevice(self, guid, thiefId):
ruleFile = _UDEV_RULE_FILE_NAME % (guid, thiefId)
rule = 'SYMLINK=="mapper/%s", OWNER="%s", GROUP="%s"\n' % (guid,
- DISKIMAGE_USER, DISKIMAGE_GROUP)
+ DISKIMAGE_USER, DISKIMAGE_GROUP)
with open(ruleFile, "w") as rf:
rf.write(rule)
@@ -322,7 +322,7 @@
logging.config.fileConfig(LOG_CONF_PATH)
except:
logging.basicConfig(filename='/dev/stdout', filemode='w+',
- level=logging.DEBUG)
+ level=logging.DEBUG)
log = logging.getLogger("SuperVdsm.Server")
log.warn("Could not init proper logging", exc_info=True)
@@ -351,7 +351,7 @@
log.debug("Setting up keep alive thread")
monThread = threading.Thread(target=__pokeParent,
- args=[int(parentPid), address])
+ args=[int(parentPid), address])
monThread.setDaemon(True)
monThread.start()
--
To view, visit http://gerrit.ovirt.org/9672
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c4531269009e2607ce729270b0eb37428055f0b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 i...
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed
......................................................................
Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed
Change-Id: I7fef7122157dd69f725d793332956a81845dd991
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/mountTests.py
1 file changed, 22 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/9593/1
diff --git a/tests/mountTests.py b/tests/mountTests.py
index d9b64f2..6a914e0 100644
--- a/tests/mountTests.py
+++ b/tests/mountTests.py
@@ -19,14 +19,17 @@
#
from contextlib import contextmanager
-from storage.misc import execCmd
-import storage.mount as mount
-from testValidation import checkSudo
-
-from testrunner import VdsmTestCase as TestCaseBase
+import errno
from tempfile import mkstemp, mkdtemp
import os
import shutil
+
+from nose.plugins.skip import SkipTest
+
+from testrunner import VdsmTestCase as TestCaseBase
+from storage.misc import execCmd
+import storage.mount as mount
+from testValidation import checkSudo
FLOPPY_SIZE = (2 ** 20) * 4
@@ -52,11 +55,17 @@
checkSudo(["mount", "-o", "loop", "somefile", "target"])
checkSudo(["umount", "target"])
mpath = mkdtemp()
- with createFloppyImage(FLOPPY_SIZE) as path:
- m = mount.Mount(path, mpath)
- m.mount(mntOpts="loop")
- try:
- self.assertTrue(m.isMounted())
- finally:
- m.umount()
- shutil.rmtree(mpath)
+ try:
+ with createFloppyImage(FLOPPY_SIZE) as path:
+ m = mount.Mount(path, mpath)
+ m.mount(mntOpts="loop")
+ try:
+ self.assertTrue(m.isMounted())
+ finally:
+ m.umount()
+ shutil.rmtree(mpath)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ raise SkipTest("cannot execute mkfs.ext2")
+
+ raise
--
To view, visit http://gerrit.ovirt.org/9593
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Properly raise OSError in betterPopen
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Properly raise OSError in betterPopen
......................................................................
Properly raise OSError in betterPopen
Change-Id: I2429093229aa1f98263b1d9eb1b5557d49ce52fd
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/betterPopen/createprocess.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/9592/1
diff --git a/vdsm/betterPopen/createprocess.c b/vdsm/betterPopen/createprocess.c
index a57cbae..499bed6 100644
--- a/vdsm/betterPopen/createprocess.c
+++ b/vdsm/betterPopen/createprocess.c
@@ -289,7 +289,8 @@
safeClose(errnofd[1]);
errnofd[1] = -1;
if (read(errnofd[0], &childErrno, sizeof(int)) == sizeof(int)) {
- PyErr_SetString(PyExc_OSError, strerror(childErrno));
+ errno = childErrno;
+ PyErr_SetFromErrno(PyExc_OSError);
goto fail;
}
--
To view, visit http://gerrit.ovirt.org/9592
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2429093229aa1f98263b1d9eb1b5557d49ce52fd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Move guest agent timeout config reading to clientIF.__init__
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Move guest agent timeout config reading to clientIF.__init__
......................................................................
Move guest agent timeout config reading to clientIF.__init__
Change-Id: Id6138f2b47934cb8afc89cd9a2d14867d9db03a9
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/clientIF.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/9396/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 82603af..73fe3c0 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -66,6 +66,7 @@
:param log: a log object to be used for this object's logging.
:type log: :class:`logging.Logger`
"""
+ self.guestAgentTimeout = config.getint('vars', 'guest_agent_timeout')
self.vmContainerLock = threading.Lock()
self._networkSemaphore = threading.Semaphore()
self._shutdownSemaphore = threading.Semaphore()
@@ -100,8 +101,7 @@
self._prepareMOM()
threading.Thread(target=self._recoverExistingVms,
name='clientIFinit').start()
- self.channelListener.settimeout(
- config.getint('vars', 'guest_agent_timeout'))
+ self.channelListener.settimeout(self.guestAgentTimeout)
self.channelListener.start()
self.threadLocal = threading.local()
self.threadLocal.client = ''
--
To view, visit http://gerrit.ovirt.org/9396
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6138f2b47934cb8afc89cd9a2d14867d9db03a9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: fix error handling for misc.NoIntrPoll
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: fix error handling for misc.NoIntrPoll
......................................................................
fix error handling for misc.NoIntrPoll
when recieving signal, poll() raise select.error
fix this to misc.NoIntrPoll to avoid exception
Found in:
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/170/
Change-Id: I272654a9006fdab77e5fab608ac287416d75843e
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/miscTests.py
M vdsm/storage/misc.py
2 files changed, 20 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/9458/1
diff --git a/tests/miscTests.py b/tests/miscTests.py
index fb37b72..d47c883 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -22,6 +22,8 @@
import uuid
import time
import threading
+import select
+import signal
from testrunner import VdsmTestCase as TestCaseBase
import inspect
from vdsm import utils
@@ -1117,3 +1119,19 @@
return misc.findCaller()
self.assertRaises(AssertionError, self._assertFindCaller, _foo)
+
+
+class NoIntrPollTests(TestCaseBase):
+ def testNoIntr(self):
+ def fakeSigchld():
+ for i in range(5):
+ time.sleep(1)
+ os.kill(os.getpid(), signal.SIGCHLD)
+
+ intrThread = threading.Thread(target=fakeSigchld)
+ intrThread.setDaemon(True)
+ intrThread.start()
+ poller = select.poll()
+ tempFd, tempPath = tempfile.mkstemp()
+ poller.register(tempFd, select.POLLERR)
+ misc.NoIntrPoll(poller.poll, 10000)
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 6360dcf..d2ac851 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -1346,8 +1346,8 @@
while True:
try:
return pollfun(timeout)
- except (OSError, IOError), e:
- if not e.errno in (errno.EINTR, errno.EAGAIN):
+ except (os.error, select.error), e:
+ if e.args[0] != errno.EINTR:
raise
timeout = max(0, endtime - time.time())
--
To view, visit http://gerrit.ovirt.org/9458
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I272654a9006fdab77e5fab608ac287416d75843e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: Exclude generated python files from pep8 list
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: Exclude generated python files from pep8 list
......................................................................
Exclude generated python files from pep8 list
Generated files will raise pep8 error because of path substitution:
E501 line too long (86 characters)
Check the py.in for PEP8 is enough for these files.
Change-Id: I73470d5587adec539163b352a02d99909305a1e4
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M Makefile.am
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/9675/1
diff --git a/Makefile.am b/Makefile.am
index 489eb6b..99e1a4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -98,7 +98,7 @@
vdsm_reg/define.py \
$(NULL)
-PEP8_BLACKLIST = apiData.py
+PEP8_BLACKLIST = apiData.py,config.py,constants.py
check-local:
find . -path './.git' -prune -type f -o \
--
To view, visit http://gerrit.ovirt.org/9675
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I73470d5587adec539163b352a02d99909305a1e4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: added glusterVolumeProfileInfo verb
by tjeyasin@redhat.com
Hello Bala.FA, Saggi Mizrahi, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/7436
to review the following change.
Change subject: added glusterVolumeProfileInfo verb
......................................................................
added glusterVolumeProfileInfo verb
Following is the output structure
{ 'statusCode' : CODE,
'volumeName' : VOLUME-NAME,
'brickCount' : BRICK-COUNT,
'bricks' : {
BRICK-NAME: {
'cumulativeStats': {
'blockStat': [
{ 'size': SIZE,
'read': READ-COUNT,
'write': WRITE-COUNT
}, ...],
'fopStat': [
{ 'name': FOP-NAME,
'hits': HITS,
'latencyAvg': AVERAGE-LATENCY,
'latencyMin': MINIMUM-LATENCY,
'latencyMax': MAXIMUM-LATENCY
}, ...],
'duration': DURATION,
'totalRead': TOTAL-READ,
'totalWrite': TOTAL-WRITE },
'intervalStats': {
'blockStat': [
{ 'size': SIZE,
'read': READ-COUNT,
'write': WRITE-COUNT
}, ...],
'fopStat': [
{ 'name': FOP-NAME,
'hits': HITS,
'latencyAvg': AVERAGE-LATENCY,
'latencyMin': MINIMUM-LATENCY,
'latencyMax': MAXIMUM-LATENCY
}, ...],
'duration': DURATION,
'totalRead': TOTAL-READ,
'totalWrite': TOTAL-WRITE }}, ...}}
Change-Id: Ib6a26fa7634b999cd70197c958fe86a6d9ed4a9c
Signed-off-by: Timothy Asir <tjeyasin(a)redhat.com>
---
M vdsm/gluster/api.py
M vdsm/gluster/cli.py
M vdsm/gluster/exception.py
M vdsm_cli/vdsClientGluster.py
4 files changed, 81 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/7436/1
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index dc3ec0b..9073791 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -229,6 +229,11 @@
def volumeProfileStop(self, volumeName, options=None):
self.svdsmProxy.glusterVolumeProfileStop(volumeName)
+ @exportAsVerb
+ def volumeProfileInfo(self, volumeName, options=None):
+ status = self.svdsmProxy.glusterVolumeProfileInfo(volumeName)
+ return {'profileInfo': status}
+
def getGlusterMethods(gluster):
l = []
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index 2618aa1..059bff4 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -155,6 +155,54 @@
return volumeInfoDict
+def _parseGlusterVolumeProfileInfo(tree):
+ fopCumulative = []
+ blkCumulative = []
+ fopInterval = []
+ blkInterval = []
+ bricks = {}
+ for brick in tree.findall('volProfile/brick'):
+ for block in brick.findall('cumulativeStats/blockStats/block'):
+ blkCumulative.append({'size': block.find('size').text,
+ 'read': block.find('reads').text,
+ 'write': block.find('writes').text})
+ for fop in brick.findall('cumulativeStats/fopStats/fop'):
+ fopCumulative.append({'name': fop.find('name').text,
+ 'hits': fop.find('hits').text,
+ 'latencyAvg': fop.find('avgLatency').text,
+ 'latencyMin': fop.find('minLatency').text,
+ 'latencyMax': fop.find('maxLatency').text})
+ for block in brick.findall('intervalStats/blockStats/block'):
+ blkInterval.append({'size': block.find('size').text,
+ 'read': block.find('reads').text,
+ 'write': block.find('writes').text})
+ for fop in brick.findall('intervalStats/fopStats/fop'):
+ fopInterval.append({'name': fop.find('name').text,
+ 'hits': fop.find('hits').text,
+ 'latencyAvg': fop.find('avgLatency').text,
+ 'latencyMin': fop.find('minLatency').text,
+ 'latencyMax': fop.find('maxLatency').text})
+ bricks[brick.find('brickName').text] = {
+ 'cumulativeStats': {
+ 'blockStats': blkCumulative,
+ 'fopStats': fopCumulative,
+ 'duration': brick.find('cumulativeStats/duration').text,
+ 'totalRead': brick.find('cumulativeStats/totalRead').text,
+ 'totalWrite': brick.find('cumulativeStats/totalWrite').text},
+ 'intervalStats': {
+ 'blockStats': blkInterval,
+ 'fopStats': fopInterval,
+ 'duration': brick.find('intervalStats/duration').text,
+ 'totalRead': brick.find('intervalStats/totalRead').text,
+ 'totalWrite': brick.find('intervalStats/totalWrite').text}}
+ status = {
+ 'volumeName': tree.find("volProfile/volname").text,
+ 'brickCount': tree.find("volProfile/brickCount").text,
+ 'statusCode': tree.find("opRet").text,
+ 'bricks': bricks}
+ return status
+
+
@exportToSuperVdsm
def volumeInfo(volumeName=None):
"""
@@ -577,3 +625,16 @@
if err:
raise ge.GlusterVolumeProfileStopFailedException(err[0], err[1])
return True
+
+
+@exportToSuperVdsm
+def volumeProfileInfo(volumeName):
+ command = _getGlusterVolCmd() + ["profile", volumeName, "info"]
+ err, res = _execGluster(command, xml=True)
+ if err:
+ raise ge.GlusterVolumeProfileInfoFailedException(err[0], err[1])
+ xmltree, out = res
+ try:
+ return _parseGlusterVolumeProfileInfo(xmltree)
+ except:
+ raise ge.GlusterXmlErrorException(err=out)
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index f5dfb73..5dea24d 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -328,6 +328,11 @@
message = "Volume profile stop failed"
+class GlusterVolumeProfileInfoFailedException(GlusterVolumeException):
+ code = 4159
+ message = "Volume profile info failed"
+
+
# Host
class GlusterHostException(GlusterException):
code = 4400
diff --git a/vdsm_cli/vdsClientGluster.py b/vdsm_cli/vdsClientGluster.py
index 0a253fe..c93a59f 100644
--- a/vdsm_cli/vdsClientGluster.py
+++ b/vdsm_cli/vdsClientGluster.py
@@ -207,6 +207,11 @@
status = self.s.glusterVolumeProfileStop(args[0])
return status['status']['code'], status['status']['message']
+ def do_glusterVolumeProfileInfo(self, args):
+ status = self.s.glusterVolumeProfileInfo(args[0])
+ pp.pprint(status)
+ return status['status']['code'], status['status']['message']
+
def getGlusterCmdDict(serv):
return {
@@ -373,4 +378,9 @@
('<volume_name>\n\t<volume_name> is existing volume name',
'stop gluster volume profile'
)),
+ 'glusterVolumeProfileInfo':
+ (serv.do_glusterVolumeProfileInfo,
+ ('<volume_name>\n\t<volume_name> is existing volume name',
+ 'get gluster volume profile info'
+ )),
}
--
To view, visit http://gerrit.ovirt.org/7436
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6a26fa7634b999cd70197c958fe86a6d9ed4a9c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: tests: Cleanup apiTests exception handling
by agl@us.ibm.com
Adam Litke has uploaded a new change for review.
Change subject: tests: Cleanup apiTests exception handling
......................................................................
tests: Cleanup apiTests exception handling
As Dan reported in http://gerrit.ovirt.org/#/c/9442/ the behavior of
SocketServer differs between versions of python which causes the exception
raised by sendMessage() to change. Rather than key the expected exception
based on the Python version, clean up the flow so it will behave the same across
Python versions.
Change-Id: I818e5e7b8dd0a1abad94deb65e32c1d76225b839
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
M tests/apiTests.py
1 file changed, 22 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/9499/1
diff --git a/tests/apiTests.py b/tests/apiTests.py
index ff0a785..3e4be6a 100644
--- a/tests/apiTests.py
+++ b/tests/apiTests.py
@@ -176,6 +176,10 @@
_fakeret = {}
+class ProtocolError(Exception):
+ pass
+
+
class JsonRawTest(APITest):
_Size = struct.Struct("!Q")
@@ -191,12 +195,23 @@
try:
sock.connect((ip, port))
sock.sendall(msg)
+ except socket.error, e:
+ raise ProtocolError("Unable to send request: %s", e)
+ try:
data = sock.recv(JsonRawTest._Size.size)
- msgLen = JsonRawTest._Size.unpack(data)[0]
+ except socket.error, e:
+ raise ProtocolError("Unable to read response length: %s", e)
+ if not data:
+ raise ProtocolError("No data received")
+ msgLen = JsonRawTest._Size.unpack(data)[0]
+ try:
data = sock.recv(msgLen)
- return json.loads(data)
- finally:
- sock.close()
+ except socket.error, e:
+ raise ProtocolError("Unable to read response body: %s", e)
+ if len(data) != msgLen:
+ raise ProtocolError("Response body length mismatch")
+ return json.loads(data)
+ sock.close()
def testPing(self):
self.clearAPI()
@@ -227,14 +242,14 @@
self.assertEquals(4, reply['error']['code'])
def testMissingSize(self):
- self.assertRaises(struct.error, self.sendMessage,
+ self.assertRaises(ProtocolError, self.sendMessage,
"malformed message")
def testClientNotJson(self):
msg = "malformed message"
msize = JsonRawTest._Size.pack(len(msg))
msg = msize + msg
- self.assertRaises(struct.error, self.sendMessage, msg)
+ self.assertRaises(ProtocolError, self.sendMessage, msg)
def testSynchronization(self):
def doPing(msg):
@@ -245,7 +260,7 @@
msg = self.buildMessage({'id': 1, 'method': 'Host.ping'})
# Send Truncated message
- self.assertRaises(struct.error, doPing, msg[:-1])
+ self.assertRaises(ProtocolError, doPing, msg[:-1])
# Test that the server recovers
doPing(msg)
--
To view, visit http://gerrit.ovirt.org/9499
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I818e5e7b8dd0a1abad94deb65e32c1d76225b839
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <agl(a)us.ibm.com>
11 years, 5 months
Change in vdsm[master]: apiTests: silence testMissingSize failure on Python 2.6
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: apiTests: silence testMissingSize failure on Python 2.6
......................................................................
apiTests: silence testMissingSize failure on Python 2.6
I did not delve into the reasons of this, but on Python 2.6,
testMissingSize raises socket.error instead of struct.error.
Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/apiTests.py
1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/9442/1
diff --git a/tests/apiTests.py b/tests/apiTests.py
index ff0a785..4100ad0 100644
--- a/tests/apiTests.py
+++ b/tests/apiTests.py
@@ -25,6 +25,7 @@
import errno
import json
import struct
+import sys
from testrunner import VdsmTestCase as TestCaseBase
from vdsm import constants
@@ -73,7 +74,6 @@
self.lastFunc = name
return self.default
- import sys
import imp
from new import classobj
@@ -227,7 +227,12 @@
self.assertEquals(4, reply['error']['code'])
def testMissingSize(self):
- self.assertRaises(struct.error, self.sendMessage,
+ if sys.version_info[0:2] == (2, 6):
+ expectedException = socket.error
+ else:
+ expectedException = struct.error
+
+ self.assertRaises(expectedException, self.sendMessage,
"malformed message")
def testClientNotJson(self):
--
To view, visit http://gerrit.ovirt.org/9442
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: retire netstat
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: retire netstat
......................................................................
retire netstat
net-tools is not installed on F18 by default, and was obsoleted by
iproute a decade ago.
Change-Id: I8417ae3bb2f09404787cd8915984aaa6fb779e7a
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/vdsmd.init.in
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/9651/1
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index 4446ecf..c2fb49c 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -62,7 +62,7 @@
return 1
fi
MANAGEMENT_IP=`$GETCONFITEM $CONF_FILE addresses management_ip 0.0.0.0`
- netstat -ntl | grep -q "$MANAGEMENT_IP:$MANAGEMENT_PORT"
+ ss -ntl | grep -q "$MANAGEMENT_IP:$MANAGEMENT_PORT"
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
log_failure_msg "$prog: port $MANAGEMENT_PORT already bound"
--
To view, visit http://gerrit.ovirt.org/9651
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8417ae3bb2f09404787cd8915984aaa6fb779e7a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
11 years, 5 months