Change in vdsm[master]: contrib: Add tool for getting repoStats statistics
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: contrib: Add tool for getting repoStats statistics
......................................................................
contrib: Add tool for getting repoStats statistics
This tool is useful when debugging storage domain monitoring issues.
Examples:
$ repostat vdsm.log.*
domain: ebcd25b1-1ab0-47e3-aa8b-83ee5f91b5bd
delay avg: 0.093941 min: 0.000430 max: 1.499200
last check avg: 5.117508 min: 0.000000 max: 12.300000
domain: 6d7f7a48-4511-43b8-8abf-d323f7118b19
delay avg: 0.001090 min: 0.000300 max: 0.030056
last check avg: 4.975313 min: 0.000000 max: 10.200000
Change-Id: Id5f7828216058bb401f8a472fa5601e79542def1
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M Makefile.am
A contrib/repostat
2 files changed, 55 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/38749/1
diff --git a/Makefile.am b/Makefile.am
index 34885a1..7407b22 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,6 +49,7 @@
autogen.sh \
build-aux/pkg-version \
contrib/profile-stats \
+ contrib/repostat \
pylintrc \
vdsm.spec \
vdsm.spec.in \
@@ -80,6 +81,7 @@
WHITELIST = \
contrib/profile-stats \
+ contrib/repostat \
init/daemonAdapter \
vdsm/get-conf-item \
vdsm/set-conf-item \
diff --git a/contrib/repostat b/contrib/repostat
new file mode 100755
index 0000000..c140b4c
--- /dev/null
+++ b/contrib/repostat
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 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
+#
+"""
+Parse repoStats log lines and calculate statistics.
+
+Usage: repostat vdsm.log [...]
+"""
+
+import fileinput
+import re
+
+repostat_re = re.compile(r' Run and protect: repoStats, Return response: ')
+
+stats = {}
+
+
+def liststat(a):
+ b = sorted(a)
+ return sum(b) / len(b), b[0], b[-1]
+
+
+for line in fileinput.input():
+ match = repostat_re.search(line)
+ if not match:
+ continue
+ response = eval(line[match.end():])
+ for uuid, info in response.items():
+ stats.setdefault(uuid, {'delays': [], 'checks': []})
+ stats[uuid]['delays'].append(float(info['delay']))
+ stats[uuid]['checks'].append(float(info['lastCheck']))
+
+for uuid, info in stats.iteritems():
+ print 'domain:', uuid
+ print ' delay avg: %f min: %f max: %f' % liststat(info['delays'])
+ print ' last check avg: %f min: %f max: %f' % liststat(info['checks'])
--
To view, visit https://gerrit.ovirt.org/38749
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5f7828216058bb401f8a472fa5601e79542def1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: gluster: rename glusterCreateBrick to glusterBrickCreate
by barumuga@redhat.com
Hello Piotr Kliczewski, Timothy Asir, Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/42308
to review the following change.
Change subject: gluster: rename glusterCreateBrick to glusterBrickCreate
......................................................................
gluster: rename glusterCreateBrick to glusterBrickCreate
To make consistency in function names in supervdsm and verb names in
vdsm, this patch renames verb glusterCreateBrick to glusterBrickCreate
Change-Id: I367a864bc9bf4aa9b6a0d36b64f541fa89c61c0d
Signed-off-by: Bala.FA <barumuga(a)redhat.com>
---
M client/vdsClientGluster.py
M vdsm/gluster/api.py
M vdsm/gluster/apiwrapper.py
M vdsm/gluster/storagedev.py
M vdsm/rpc/vdsmapi-gluster-schema.json
5 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/42308/1
diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index a4bce63..76b91e1 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -633,7 +633,7 @@
pp.pprint(status)
return status['status']['code'], status['status']['message']
- def do_glusterCreateBrick(self, args):
+ def do_glusterBrickCreate(self, args):
params = self._eqSplit(args)
devList = params.get('devices', '').split(',')
brickName = params.get('brickName', '')
@@ -646,7 +646,7 @@
raidParams['stripeSize'] = int(params.get('stripeSize', 0))
raidParams['pdCount'] = int(params.get('pdCount', 0))
- status = self.s.glusterCreateBrick(brickName, mountPoint,
+ status = self.s.glusterBrickCreate(brickName, mountPoint,
devList, fsType, raidParams)
pp.pprint(status)
return status['status']['code'], status['status']['message']
@@ -1172,8 +1172,8 @@
('[volumeName=<volume_name>]',
'snapshot list for given volume'
)),
- 'glusterCreateBrick': (
- serv.do_glusterCreateBrick,
+ 'glusterBrickCreate': (
+ serv.do_glusterBrickCreate,
('brickName=<brick_name> mountPoint=<mountPoint> '
'devices=<device[,device, ...]> '
'[raidType=<raid_type>] [stripeSize=<stripe_size>] '
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 24b8230..918c3cc 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -672,9 +672,9 @@
return {'snapshotList': status}
@exportAsVerb
- def createBrick(self, name, mountPoint, devList, fsType=None,
+ def brickCreate(self, name, mountPoint, devList, fsType=None,
raidParams={}, options=None):
- status = self.svdsmProxy.glusterCreateBrick(name,
+ status = self.svdsmProxy.glusterBrickCreate(name,
mountPoint,
devList,
fsType,
diff --git a/vdsm/gluster/apiwrapper.py b/vdsm/gluster/apiwrapper.py
index 4768a86..f607dd4 100644
--- a/vdsm/gluster/apiwrapper.py
+++ b/vdsm/gluster/apiwrapper.py
@@ -81,9 +81,9 @@
def storageDevicesList(self, options=None):
return self._gluster.storageDevicesList()
- def createBrick(self, name, mountPoint, devList, fsType=None,
+ def brickCreate(self, name, mountPoint, devList, fsType=None,
raidParams={}):
- return self._gluster.createBrick(name, mountPoint,
+ return self._gluster.brickCreate(name, mountPoint,
devList, fsType, raidParams)
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index 2aeabad..f4178e9 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -123,7 +123,7 @@
@makePublic
-def createBrick(brickName, mountPoint, devNameList, fsType=DEFAULT_FS_TYPE,
+def brickCreate(brickName, mountPoint, devNameList, fsType=DEFAULT_FS_TYPE,
raidParams={}):
def _getDeviceList(devNameList):
return [blivetEnv.devicetree.getDeviceByName(devName.split("/")[-1])
diff --git a/vdsm/rpc/vdsmapi-gluster-schema.json b/vdsm/rpc/vdsmapi-gluster-schema.json
index c86f43c..209bfbd 100644
--- a/vdsm/rpc/vdsmapi-gluster-schema.json
+++ b/vdsm/rpc/vdsmapi-gluster-schema.json
@@ -1274,7 +1274,7 @@
'data': {'type': 'str', 'stripeSize': 'int', 'diskCnt': 'int'}}
##
-# @GlusterHost.createBrick:
+# @GlusterHost.brickCreate:
#
# Create a brick for the gluster volume
#
@@ -1293,7 +1293,7 @@
#
# Since: 4.17.0
##
-{'command': {'class': 'GlusterHost', 'name': 'createBrick'},
+{'command': {'class': 'GlusterHost', 'name': 'brickCreate'},
'data': {'name': 'str', 'mountPoint': 'str', 'devList': ['str'],
'*fsType': 'str', '*raidParams': 'RaidDevice'},
'returns': 'bool'}
--
To view, visit https://gerrit.ovirt.org/42308
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I367a864bc9bf4aa9b6a0d36b64f541fa89c61c0d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: tests: Add time per test if nose-timer is available
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: tests: Add time per test if nose-timer is available
......................................................................
tests: Add time per test if nose-timer is available
This patch adds an output like:
resourceManagerTests.ResourceManagerTests.testStressTest: 12.8313s
resourceManagerTests.ResourceManagerTests.testResourceAcquireTimeout: 1.0069s
resourceManagerTests.ResourceManagerTests.testResourceLockSwitch: 0.0108s
resourceManagerTests.ResourceManagerTests.testResourceAutorelease: 0.0101s
resourceManagerTests.ResourceManagerTests.testResourceInvalidation: 0.0093s
resourceManagerTests.ResourceManagerTests.testCrashOnSwitch: 0.0067s
resourceManagerTests.ResourceManagerTests.testResourceSwitchLockTypeFail:
0.0062s
resourceManagerTests.ResourceManagerTests.testCancelExclusiveBetweenShared:
0.0049s
resourceManagerTests.ResourceManagerTests.testAcquireResourceExclusive: 0.0042s
resourceManagerTests.ResourceManagerTests.testCancelRequest: 0.0031s
resourceManagerTests.ResourceManagerTests.testRequestRefCmp: 0.0030s
resourceManagerTests.ResourceManagerTests.testRequestRecancel: 0.0030s
resourceManagerTests.ResourceManagerTests.testResourceStatuses: 0.0029s
resourceManagerTests.ResourceManagerTests.testAccessAttributeNotExposedByRequestRef:
0.0029s
resourceManagerTests.ResourceManagerTests.testFailCreateAfterSwitch: 0.0025s
resourceManagerTests.ResourceManagerTests.testRequestWithBadCallbackOnCancel:
0.0025s
resourceManagerTests.ResourceManagerTests.testAcquireResourceShared: 0.0023s
resourceManagerTests.ResourceManagerTests.testRereleaseResource: 0.0022s
resourceManagerTests.ResourceManagerTests.testResourceWrapper: 0.0020s
resourceManagerTests.ResourceManagerTests.testRequestWithBadCallbackOnGrant:
0.0020s
resourceManagerTests.ResourceManagerTests.testRequestRefStr: 0.0020s
resourceManagerTests.ResourceManagerTests.testAccessAttributeNotExposedByWrapper:
0.0019s
resourceManagerTests.ResourceManagerTests.testErrorInFactory: 0.0017s
resourceManagerTests.ResourceManagerTests.testAcquireNonExistingResource:
0.0016s
resourceManagerTests.ResourceManagerTests.testRequestInvalidResource: 0.0015s
resourceManagerTests.ResourceManagerTests.testRequestRegrant: 0.0015s
resourceManagerTests.ResourceManagerTests.testResourceAcquireInvalidTimeout:
0.0014s
resourceManagerTests.ResourceManagerTests.testReleaseInvalidResource: 0.0014s
resourceManagerTests.ResourceManagerTests.testSingleton: 0.0014s
resourceManagerTests.ResourceManagerTests.testForceRegisterNamespace: 0.0013s
resourceManagerTests.ResourceManagerTests.testListNamespaces: 0.0013s
resourceManagerTests.ResourceManagerTests.testReregisterNamespace: 0.0012s
resourceManagerTests.ResourceManagerTests.testRegisterInvalidNamespace: 0.0012s
At the end of the usual tests if nose-timer is detected in the
system. It shows the tests over 500ms in yellow and those over 5s
in red.
If you want to get this output, do:
pip install nose-timer
Change-Id: I4960b30532a84abd259fb268c7e40a1751847a96
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M tests/run_tests_local.sh.in
M tests/testrunner.py
2 files changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/30171/1
diff --git a/tests/run_tests_local.sh.in b/tests/run_tests_local.sh.in
index d19f22c..f51473d 100644
--- a/tests/run_tests_local.sh.in
+++ b/tests/run_tests_local.sh.in
@@ -7,4 +7,9 @@
@top_srcdir(a)/tests/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 $@
+python -c 'import nosetimer' > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+ EXTRA_ARGS='--with-timer'
+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 $@ "$EXTRA_ARGS"
diff --git a/tests/testrunner.py b/tests/testrunner.py
index eed743f..ec24c2b 100644
--- a/tests/testrunner.py
+++ b/tests/testrunner.py
@@ -40,6 +40,16 @@
from nose import config
from nose import core
from nose import result
+try:
+ from nosetimer.plugin import TimerPlugin
+except ImportError:
+ timer_plugin = None
+else:
+ timer_plugin = TimerPlugin()
+ timer_plugin.enabled = True
+ timer_plugin.timer_ok = 500 # Okay <= 500ms
+ timer_plugin.timer_warning = 5000 # Warn > 5s
+ timer_plugin.timer_no_color = False # Enable color output
from testValidation import SlowTestsPlugin, StressTestsPlugin
@@ -378,6 +388,8 @@
plugins=core.DefaultPluginManager())
conf.plugins.addPlugin(SlowTestsPlugin())
conf.plugins.addPlugin(StressTestsPlugin())
+ if timer_plugin is not None:
+ conf.plugins.addPlugin(timer_plugin)
runner = VdsmTestRunner(stream=conf.stream,
verbosity=conf.verbosity,
--
To view, visit http://gerrit.ovirt.org/30171
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4960b30532a84abd259fb268c7e40a1751847a96
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: ImageManifest: create_image_dir
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: ImageManifest: create_image_dir
......................................................................
ImageManifest: create_image_dir
Change-Id: I94a8cfdd9fb1f3c3fd4e4e2ab409bfd287829351
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/image_manifest_tests.py
M vdsm/storage/image.py
2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/43557/1
diff --git a/tests/image_manifest_tests.py b/tests/image_manifest_tests.py
index a2ac1c0..a27eabd 100644
--- a/tests/image_manifest_tests.py
+++ b/tests/image_manifest_tests.py
@@ -23,6 +23,7 @@
from testlib import VdsmTestCase, namedTemporaryDir
from storage import sd, image
+from storage.sdm import sdm_verb
class ImageManifestTests(VdsmTestCase):
@@ -33,3 +34,14 @@
manifest = image.ImageManifest(tmpdir)
expected = os.path.join(tmpdir, sduuid, sd.DOMAIN_IMAGES, imguuid)
self.assertEquals(expected, manifest.getImageDir(sduuid, imguuid))
+
+ @sdm_verb
+ def test_create_image_dir(self):
+ with namedTemporaryDir() as tmpdir:
+ sduuid = str(uuid.uuid4())
+ imguuid = str(uuid.uuid4())
+ manifest = image.ImageManifest(tmpdir)
+ os.makedirs(os.path.join(tmpdir, sduuid, sd.DOMAIN_IMAGES))
+ manifest.create_image_dir(sduuid, imguuid)
+ self.assertTrue(os.path.exists(manifest.getImageDir(sduuid,
+ imguuid)))
\ No newline at end of file
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 81b2043..5f87921 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -38,6 +38,7 @@
from threadLocal import vars
import resourceFactories
import resourceManager as rm
+from sdm import require_sdm
log = logging.getLogger('Storage.Image')
rmanager = rm.ResourceManager.getInstance()
@@ -97,6 +98,13 @@
"""
return os.path.join(self.repoPath, sdUUID, sd.DOMAIN_IMAGES, imgUUID)
+ @require_sdm
+ def create_image_dir(self, sd_id, img_id):
+ img_dir = self.getImageDir(sd_id, img_id)
+ if not os.path.isdir(img_dir):
+ log.info("Create placeholder %s for image's volumes", img_dir)
+ os.mkdir(img_dir)
+ return img_dir
class Image:
""" Actually represents a whole virtual disk.
--
To view, visit https://gerrit.ovirt.org/43557
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I94a8cfdd9fb1f3c3fd4e4e2ab409bfd287829351
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: tests: Add a live merge functional test
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: tests: Add a live merge functional test
......................................................................
tests: Add a live merge functional test
Test whether we can successfully merge the active layer. Uses lots of
the functional test infrastructure! Only runs if vdsm says it can
support live merge.
Change-Id: Idd5a2f7eedaef9e90981256de66fc3ed21658e89
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/functional/utils.py
M tests/functional/virtTests.py
2 files changed, 185 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/29824/1
diff --git a/tests/functional/utils.py b/tests/functional/utils.py
index 494be98..e3cdba6 100644
--- a/tests/functional/utils.py
+++ b/tests/functional/utils.py
@@ -228,3 +228,41 @@
def updateVmPolicy(self, vmId, vcpuLimit):
result = self.vdscli.updateVmPolicy([vmId, vcpuLimit])
return result['status']['code'], result['status']['message']
+
+ def getTaskStatus(self, taskId):
+ result = self.vdscli.getTaskStatus(taskId)
+ return result['status']['code'], result['status']['message'],\
+ result['taskStatus']
+
+ def getVolumeInfo(self, sdId, spId, imgId, volId):
+ result = self.vdscli.getVolumeInfo(sdId, spId, imgId, volId)
+ return result['status']['code'], result['status']['message'],\
+ result['info']
+
+ def createVolume(self, sdId, spId, imgId, size, volFormat, preallocate,
+ diskType, volId, desc, baseImgId, baseVolId):
+ result = self.vdscli.createVolume(sdId, spId, imgId, size, volFormat,
+ preallocate, diskType, volId, desc,
+ baseImgId, baseVolId)
+ return result['status']['code'], result['status']['message'],\
+ result['uuid']
+
+ def deleteVolume(self, sdId, spId, imgId, volIds, postZero=False,
+ force=False):
+ result = self.vdscli.deleteVolume(sdId, spId, imgId, volIds, postZero,
+ force)
+ return result['status']['code'], result['status']['message'],\
+ result['uuid']
+
+ def snapshot(self, vmId, snapDrives, snapMemVolHandle=''):
+ result = self.vdscli.snapshot(vmId, snapDrives, snapMemVolHandle)
+ return result['status']['code'], result['status']['message']
+
+ def merge(self, vmId, drive, base, top, bandwidth, jobId):
+ result = self.vdscli.merge(vmId, drive, base, top, bandwidth, jobId)
+ return result['status']['code'], result['status']['message']
+
+ def list(self, fullStatus=False, vmList=()):
+ result = self.vdscli.list(fullStatus, vmList)
+ return result['status']['code'], result['status']['message'], \
+ result['vmList']
diff --git a/tests/functional/virtTests.py b/tests/functional/virtTests.py
index 94ce240..b811b92 100644
--- a/tests/functional/virtTests.py
+++ b/tests/functional/virtTests.py
@@ -22,6 +22,7 @@
import math
import tempfile
import logging
+import uuid
from stat import S_IROTH
from functools import partial, wraps
@@ -32,7 +33,8 @@
from testrunner import temporaryPath
from vdsm.utils import CommandPath, RollbackContext
-import storageTests as storage
+import storageTests
+import storage
from storage.misc import execCmd
from utils import VdsProxy, SUCCESS
@@ -109,6 +111,18 @@
return method(self, *args, **kwargs)
else:
raise SkipTest('KVM is not enabled')
+ return wrapped
+
+
+def requireLiveMerge(method):
+ @wraps(method)
+ def wrapped(self, *args, **kwargs):
+ status, msg, result = self.vdsm.getVdsCapabilities()
+ self.assertEqual(status, SUCCESS, msg)
+ if result.get('liveMerge') == 'true':
+ return method(self, *args, **kwargs)
+ else:
+ raise SkipTest('Live Merge is not available')
return wrapped
@@ -227,9 +241,9 @@
@requireKVM
@permutations([['localfs'], ['iscsi'], ['nfs']])
def testVmWithStorage(self, backendType):
- disk = storage.StorageTest()
+ disk = storageTests.StorageTest()
disk.setUp()
- conf = storage.storageLayouts[backendType]
+ conf = storageTests.storageLayouts[backendType]
drives = disk.generateDriveConf(conf)
customization = {'vmId': '88888888-eeee-ffff-aaaa-111111111111',
'vmName': 'testVmWithStorage' + backendType,
@@ -247,8 +261,8 @@
def testVmWithDevice(self, *devices):
customization = {'vmId': '77777777-ffff-3333-bbbb-222222222222',
'vmName': 'testVm', 'devices': [], 'display': 'vnc'}
- storageLayout = storage.storageLayouts['localfs']
- diskSpecs = storage.StorageTest.generateDriveConf(storageLayout)
+ storageLayout = storageTests.storageLayouts['localfs']
+ diskSpecs = storageTests.StorageTest.generateDriveConf(storageLayout)
pciSpecs = {'bus': '0x00', 'domain': '0x0000',
'function': '0x0', 'type': 'pci'}
ccidSpecs = {'slot': '0', 'controller': '0', 'type': 'ccid'}
@@ -412,3 +426,131 @@
self.vdsm.updateVmPolicy(customization['vmId'],
'50')
self.assertEqual(status, SUCCESS, msg)
+
+
+@expandPermutations
+class LiveMergeTest(VirtTestBase):
+ def _waitTask(self, taskId):
+ def assertTaskOK():
+ status, msg, result = self.vdsm.getTaskStatus(taskId)
+ self.assertEqual(status, SUCCESS, msg)
+ self.assertEquals(result['taskState'], 'finished')
+
+ self.retryAssert(assertTaskOK, timeout=60)
+
+ def _waitBlockJobs(self, vmId, jobIds):
+ def assertJobsGone():
+ status, msg, result = self.vdsm.getVmStats(vmId)
+ self.assertEqual(status, SUCCESS, msg)
+ self.assertTrue('vmJobs' in result)
+ self.assertTrue(all([x not in result['vmJobs'].keys()
+ for x in jobIds]))
+
+ self.retryAssert(assertJobsGone, timeout=60)
+
+ def _snapshotVM(self, vmId, drives, rollback):
+ snapDrives = []
+ for drive in drives:
+ sd = drive['domainID']
+ sp = drive['poolID']
+ img = drive['imageID']
+ vol = drive['volumeID']
+ newVol = str(uuid.uuid4())
+ volFormat = storage.volume.COW_FORMAT
+ preallocate = storage.volume.SPARSE_VOL
+ desc = 'snapshot for %s' % vol
+
+ # Create volume and wait
+ status, msg, result = self.vdsm.getVolumeInfo(sd, sp, img, vol)
+ self.assertEqual(status, SUCCESS, msg)
+ size = result['capacity']
+ diskType = result['disktype']
+
+ status, msg, taskId = self.vdsm.createVolume(sd, sp, img, size,
+ volFormat,
+ preallocate, diskType,
+ newVol, desc, img,
+ vol)
+ self.assertEqual(status, SUCCESS, msg)
+ self._waitTask(taskId)
+ undo = lambda sd=sd, sp=sp, img=img, vol=newVol: \
+ self._waitTask(self.vdsm.deleteVolume(sd, sp, img, vol)[2])
+ rollback.prependDefer(undo)
+
+ snapDrives.append({'domainID': sd,
+ 'imageID': img,
+ 'volumeID': newVol,
+ 'baseVolumeID': vol})
+
+ # Create snapshot
+ status, msg = self.vdsm.snapshot(vmId, snapDrives)
+ self.assertEqual(status, SUCCESS, msg)
+ return snapDrives
+
+ def _orderChain(self, vmId, dev, chain):
+ parentMap = {}
+ for vol in chain:
+ status, msg, info = self.vdsm.getVolumeInfo(dev['domainID'],
+ dev['poolID'],
+ dev['imageID'], vol)
+ self.assertEqual(status, SUCCESS, msg)
+ parent = info['parent']
+ parentMap[vol] = parent
+
+ vol = dev['volumeID']
+ chain = list()
+ while True:
+ chain.insert(0, vol)
+ vol = parentMap.get(vol, '00000000-0000-0000-0000-000000000000')
+ if vol == '00000000-0000-0000-0000-000000000000':
+ break
+ return chain
+
+ def _getVolumeChains(self, vmId):
+ chains = {}
+ status, msg, result = self.vdsm.list(True, (vmId,))
+ self.assertEqual(status, SUCCESS, msg)
+ vmDef = result[0]
+ for dev in vmDef['devices']:
+ if dev['device'] != 'disk':
+ continue
+ chains[dev['imageID']] = self._orderChain(vmId, dev,
+ [x['volumeID'] for x in
+ dev['volumeChain']])
+ return chains
+
+ @requireKVM
+ @requireLiveMerge
+ def testCapable(self):
+ pass
+
+ @permutations([['localfs']])
+ def testMergeActiveLayer(self, backendType):
+ disk = storageTests.StorageTest()
+ disk.setUp()
+ conf = storageTests.storageLayouts[backendType]
+ drives = disk.generateDriveConf(conf)
+ vmId = '12121212-abab-baba-abab-222222222222'
+ customization = {'vmId': vmId,
+ 'vmName': 'testMergeActive' + backendType,
+ 'drives': drives,
+ 'display': 'vnc'}
+
+ with RollbackContext() as rollback:
+ disk.createVdsmStorageLayout(conf, 3, rollback)
+ with RunningVm(self.vdsm, customization) as vm:
+ self._waitForStartup(vm, VM_MINIMAL_UPTIME)
+ snapDrives = self._snapshotVM(vmId, drives, rollback)
+ chains = {}
+ jobIds = []
+ for drive in snapDrives:
+ base = drive['baseVolumeID']
+ top = drive['volumeID']
+ jobId = str(uuid.uuid4())
+ chains[drive['imageID']] = [base, top]
+ status, msg = self.vdsm.merge(vmId, drive, base, top, 0,
+ jobId)
+ jobIds.append(jobId)
+ self._waitBlockJobs(vmId, jobIds)
+ actual = self._getVolumeChains(vmId)
+ self.assertEquals(chains, actual)
--
To view, visit http://gerrit.ovirt.org/29824
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd5a2f7eedaef9e90981256de66fc3ed21658e89
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: ipv6 hook: support ipv6addrs
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: ipv6 hook: support ipv6addrs
......................................................................
ipv6 hook: support ipv6addrs
Change-Id: I722d0007840060cdccdb12e4fba2a2066f33c62f
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M vdsm_hooks/ipv6/README
M vdsm_hooks/ipv6/ipv6.py
2 files changed, 12 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/39359/1
diff --git a/vdsm_hooks/ipv6/README b/vdsm_hooks/ipv6/README
index 05bd990..a96e2c2 100644
--- a/vdsm_hooks/ipv6/README
+++ b/vdsm_hooks/ipv6/README
@@ -5,13 +5,18 @@
Requirements:
* oVirt-3.5 (started supporting custom properties)
+New in version 4.18: (?)
+--------------------
+Multiple IPv6 addresses are now accepted, see Usage. Please use 'ipv6addrs'
+property instead of 'ipv6addr' which is deprecated.
+
Preparation on a host:
----------------------
yum install vdsm-hook-ipv6
Preparation on the engine side:
-------------------------------
-PROPERTIES='ipv6addr=.*;ipv6gateway=.*;ipv6autoconf=.*;dhcpv6=.*'
+PROPERTIES='ipv6addrs=.*;ipv6gateway=.*;ipv6autoconf=.*;dhcpv6=.*'
engine-config -s "UserDefinedNetworkCustomProperties=$PROPERTIES" --cver='3.5'
Don't forget to include the names of other custom network properties you may
@@ -20,9 +25,10 @@
Usage:
------
In the oVirt UI open the 'Setup Host Networks' dialog. Proceed to editing
-a desired logical network's properties. Among them you will find 'ipv6addr'
-and 'ipv6gateway', which accept custom IPv6 addresses, plus 'ipv6autoconf'
-and 'dhcpv6', which accept '0', '1' or 'false', 'true'.
+a desired logical network's properties. Among them you will find 'ipv6addrs'
+(which accepts a space-separated list of IPv6 addresses), 'ipv6gateway'
+(a single address), plus 'ipv6autoconf' and 'dhcpv6', which accept '0', '1' or
+'false', 'true'.
You may be warned that the network is in use when confirming the 'Setup Host
Networks' dialog. Make sure to stop any VMs that are using the network.
diff --git a/vdsm_hooks/ipv6/ipv6.py b/vdsm_hooks/ipv6/ipv6.py
index 6c00475..9385fab 100644
--- a/vdsm_hooks/ipv6/ipv6.py
+++ b/vdsm_hooks/ipv6/ipv6.py
@@ -34,7 +34,8 @@
def _process_network(attrs):
- for property_name in ('ipv6addr', 'ipv6gateway', 'ipv6autoconf', 'dhcpv6'):
+ for property_name in ('ipv6addrs', 'ipv6addr', 'ipv6gateway',
+ 'ipv6autoconf', 'dhcpv6'):
value = attrs['custom'].get(property_name)
if value is not None:
attrs[property_name] = value
--
To view, visit https://gerrit.ovirt.org/39359
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I722d0007840060cdccdb12e4fba2a2066f33c62f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: sourceroute: split gathering of routes and rules off configu...
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: sourceroute: split gathering of routes and rules off configure() and remove()
......................................................................
sourceroute: split gathering of routes and rules off configure() and remove()
The code is too complex (for me) to understand. I want to remove the use of
network configurators from the module because they actually call sourceroute
classes' methods only to be called back:
Ifcfg.configureNic, Configurator._addSourceRoute, StaticSourceRoute.configure,
Ifcfg.configureSourceRoute
Ifcfg.removeNic, Ifcfg._ifaceDownAndCleanup, Configurator._removeSourceRoute,
StaticSourceRoute.remove (or DynamicSourceRoute), Ifcfg.removeSourceRoute
Change-Id: I69d8949afbd5b8ba2cf14930533cda99a4580eb0
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M vdsm/network/sourceroute.py
1 file changed, 30 insertions(+), 22 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/41593/1
diff --git a/vdsm/network/sourceroute.py b/vdsm/network/sourceroute.py
index 5f06de0..d7916ed 100644
--- a/vdsm/network/sourceroute.py
+++ b/vdsm/network/sourceroute.py
@@ -25,11 +25,7 @@
from vdsm import netinfo
from vdsm.constants import P_VDSM_RUN
-from vdsm.ipwrapper import IPRoute2Error
-from vdsm.ipwrapper import Route
-from vdsm.ipwrapper import routeShowTable
-from vdsm.ipwrapper import Rule
-from vdsm.ipwrapper import ruleList
+from vdsm.ipwrapper import IPRoute2Error, Route, routeShowTable, Rule, ruleList
from vdsm.utils import rmFile
@@ -67,23 +63,32 @@
Rule(destination=self._network, table=self._table,
srcDevice=self.device)]
- def configure(self):
+ def _prepare_configuration(self):
logging.info(("Configuring gateway - ip: %s, network: %s, " +
"subnet: %s, gateway: %s, table: %s, device: %s") %
(self._ipaddr, self._network, self._mask, self._gateway,
self._table, self.device))
- routes = self._buildRoutes()
- rules = self._buildRules()
+ self.routes = self._buildRoutes()
+ self.rules = self._buildRules()
+ def configure(self):
+ self._prepare_configuration()
try:
- self._configurator.configureSourceRoute(routes, rules, self.device)
+ self._configurator.configureSourceRoute(self.routes, self.rules,
+ self.device)
except IPRoute2Error as e:
logging.error('ip binary failed during source route configuration'
': %s', e.message)
+ def _prepare_removal(self):
+ self.routes = None
+ self.rules = None
+
def remove(self):
- self._configurator.removeSourceRoute(None, None, self.device)
+ self._prepare_removal()
+ self._configurator.removeSourceRoute(self.routes, self.rules,
+ self.device)
class DynamicSourceRoute(StaticSourceRoute):
@@ -157,20 +162,23 @@
return rules
+ def _prepare_removal(self):
+ self.rules = self._getRules(self.device)
+ if self.rules:
+ self.table = self._getTable(self.rules)
+ if self.table:
+ self.routes = self._getRoutes(self.table)
+
def remove(self):
logging.info("Removing gateway - device: %s", self.device)
-
- rules = self._getRules(self.device)
- if rules:
- table = self._getTable(rules)
- if table:
- try:
- self._configurator.removeSourceRoute(
- self._getRoutes(table), rules,
- self.device)
- except IPRoute2Error as e:
- logging.error('ip binary failed during source route '
- 'removal: %s' % e.message)
+ self._prepare_removal()
+ if self.rules and self.table:
+ try:
+ self._configurator.removeSourceRoute(
+ self.routes, self.rules, self.device)
+ except IPRoute2Error as e:
+ logging.error('ip binary failed during source route '
+ 'removal: %s' % e.message)
@staticmethod
def _isLibvirtInterfaceFallback(device):
--
To view, visit https://gerrit.ovirt.org/41593
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69d8949afbd5b8ba2cf14930533cda99a4580eb0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: sourceroute: move exception handling to the respective confi...
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: sourceroute: move exception handling to the respective configurator
......................................................................
sourceroute: move exception handling to the respective configurator
Change-Id: I579b1789522eaed025d1c059bcf7a900e499ef32
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M vdsm/network/configurators/iproute2.py
M vdsm/network/sourceroute.py
2 files changed, 16 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/41594/1
diff --git a/vdsm/network/configurators/iproute2.py b/vdsm/network/configurators/iproute2.py
index c260bfe..bec32f7 100644
--- a/vdsm/network/configurators/iproute2.py
+++ b/vdsm/network/configurators/iproute2.py
@@ -201,17 +201,22 @@
@staticmethod
def configureSourceRoute(routes, rules, device):
- for route in routes:
- routeAdd(route)
-
- for rule in rules:
- ruleAdd(rule)
+ try:
+ for route in routes:
+ routeAdd(route)
+ for rule in rules:
+ ruleAdd(rule)
+ except IPRoute2Error as e:
+ logging.error('Source route configuration failed: %s', e.message)
@staticmethod
def removeSourceRoute(routes, rules, device):
# Routes are removed automatically when the link goes down.
- for rule in rules:
- ruleDel(rule)
+ try:
+ for rule in rules:
+ ruleDel(rule)
+ except IPRoute2Error as e:
+ logging.error('Source route removal failed: %s' % e.message)
class ConfigApplier(object):
diff --git a/vdsm/network/sourceroute.py b/vdsm/network/sourceroute.py
index d7916ed..1fb9626 100644
--- a/vdsm/network/sourceroute.py
+++ b/vdsm/network/sourceroute.py
@@ -74,12 +74,8 @@
def configure(self):
self._prepare_configuration()
- try:
- self._configurator.configureSourceRoute(self.routes, self.rules,
- self.device)
- except IPRoute2Error as e:
- logging.error('ip binary failed during source route configuration'
- ': %s', e.message)
+ self._configurator.configureSourceRoute(self.routes, self.rules,
+ self.device)
def _prepare_removal(self):
self.routes = None
@@ -173,12 +169,8 @@
logging.info("Removing gateway - device: %s", self.device)
self._prepare_removal()
if self.rules and self.table:
- try:
- self._configurator.removeSourceRoute(
- self.routes, self.rules, self.device)
- except IPRoute2Error as e:
- logging.error('ip binary failed during source route '
- 'removal: %s' % e.message)
+ self._configurator.removeSourceRoute(self.routes, self.rules,
+ self.device)
@staticmethod
def _isLibvirtInterfaceFallback(device):
--
To view, visit https://gerrit.ovirt.org/41594
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I579b1789522eaed025d1c059bcf7a900e499ef32
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: api: allow setLogLevel to tune a specific logger
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: api: allow setLogLevel to tune a specific logger
......................................................................
api: allow setLogLevel to tune a specific logger
the not widely known setLogLevel VDSM verb allows to dinamically tune
the log level of the root logger, until the next restart of VDSM.
This patch extends the API to let the client tune any specific
logger.
Change-Id: I8f40488fac04031552f36b9de026a0062ab81db0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/API.py
M vdsm/rpc/BindingXMLRPC.py
M vdsm/rpc/vdsmapi-schema.json
3 files changed, 12 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/38426/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 85478b1..593f336 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1360,7 +1360,7 @@
return {'status': doneCode, 'info': stats}
- def setLogLevel(self, level):
+ def setLogLevel(self, level, name=None):
"""
Set verbosity level of vdsm's log.
@@ -1382,8 +1382,10 @@
except KeyError:
return errCode['unavail']
else:
- logging.info('Setting loglevel to %s (%d)', level, log_level)
- _set_log_level(logging.getLogger(), log_level)
+ logger = logging.getLogger(name)
+ logging.info('Setting loglevel on %s to %s (%d)',
+ logger.name, level, log_level)
+ _set_log_level(logger, log_level)
return {'status': doneCode}
# VM-related functions
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index b01b661..ea0e0c3 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -583,9 +583,9 @@
return api.fenceNode(addr, port, agent, username, password, action,
secure, options, policy)
- def setLogLevel(self, level):
+ def setLogLevel(self, level, name=None):
api = API.Global()
- return api.setLogLevel(level)
+ return api.setLogLevel(level, name)
def setMOMPolicy(self, policy):
api = API.Global()
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 1d919e8..854e7aa 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -4030,10 +4030,14 @@
#
# @level: The new verosity level desired
#
+# @name: #optional If present, change settings only for the logger
+# with this name. Otherwise, change settings for the top-level
+# logger (new in version 4.17.0).
+#
# Since: 4.10.0
##
{'command': {'class': 'Host', 'name': 'setLogLevel'},
- 'data': {'level': 'LoggingLevel'}}
+ 'data': {'level': 'LoggingLevel', '*name': 'str'}}
##
# @Host.setSafeNetworkConfig:
--
To view, visit https://gerrit.ovirt.org/38426
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f40488fac04031552f36b9de026a0062ab81db0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 10 months
Change in vdsm[master]: API: streamline and make setLogLevel correct
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: API: streamline and make setLogLevel correct
......................................................................
API: streamline and make setLogLevel correct
According to the schema, setLogLevel should accept
a log level string ('DEBUG', 'INFO',...). But the code
actually blindly casted the given value to int(), and this suggests
the code actually expected an integer value.
To make things a bit user friendlier and comformant to schema, change
the argument to actually be a log level in string format.
Along the way, this patch streamlines the implementation of setLogLevel
and makes it simpler.
Change-Id: Iaddbb12d13bdbaa7a02255ab209da11e42d2ea97
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/API.py
1 file changed, 21 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/38425/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 5cbda50..85478b1 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1369,13 +1369,22 @@
Doesn't survive a restart
"""
- logging.info('Setting loglevel to %s', level)
- handlers = logging.getLogger().handlers
- [fileHandler] = [h for h in handlers if
- isinstance(h, logging.FileHandler)]
- fileHandler.setLevel(int(level))
+ LEVELS = {
+ 'DEBUG': logging.DEBUG,
+ 'INFO': logging.INFO,
+ 'WARNING': logging.WARNING,
+ 'ERROR': logging.ERROR,
+ 'CRITICAL': logging.CRITICAL
+ }
- return {'status': doneCode}
+ try:
+ log_level = LEVELS[level]
+ except KeyError:
+ return errCode['unavail']
+ else:
+ logging.info('Setting loglevel to %s (%d)', level, log_level)
+ _set_log_level(logging.getLogger(), log_level)
+ return {'status': doneCode}
# VM-related functions
def getVMList(self, fullStatus=False, vmList=()):
@@ -1772,3 +1781,9 @@
logging.warn("options %s is deprecated. Use %s instead" %
(k, _translationMap[k]))
options[_translationMap[k]] = options.pop(k)
+
+
+def _set_log_level(logger, log_level):
+ for handler in logger.handlers:
+ if isinstance(handler, logging.FileHandler):
+ handler.setLevel(log_level)
--
To view, visit https://gerrit.ovirt.org/38425
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaddbb12d13bdbaa7a02255ab209da11e42d2ea97
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 10 months