Change in vdsm[master]: Add wipeVolume API
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: Add wipeVolume API
......................................................................
Add wipeVolume API
Change-Id: I572099e1fee4ae847de95e27973405ba90b56a9b
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M client/vdsClient.py
M vdsm/API.py
M vdsm/rpc/BindingXMLRPC.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/storage/hsm.py
M vdsm/storage/sdm/__init__.py
6 files changed, 70 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/40628/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index bac146e..c267b75 100755
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -1973,6 +1973,16 @@
else:
return status['status']['code'], status['status']['message']
+ def wipeVolume(self, args):
+ if len(args) != 3:
+ raise ValueError('Wrong number of arguments')
+ sdUUID, imgUUID, volUUID = args
+ status = self.s.wipeVolume(sdUUID, imgUUID, volUUID)
+ if status['status']['code'] == 0:
+ return 0, ''
+ else:
+ return status['status']['code'], status['status']['message']
+
if __name__ == '__main__':
if _glusterEnabled:
diff --git a/vdsm/API.py b/vdsm/API.py
index 6adefa8..a49448b 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -840,6 +840,9 @@
return self._irs.setVolumeLegality(self._sdUUID, self._spUUID,
self._imgUUID, self._UUID, legality)
+ def wipe(self):
+ return self._irs.wipeVolume(self._sdUUID, self._imgUUID, self._UUID)
+
class Image(APIBase):
ctorArgs = ['imageID', 'storagepoolID', 'storagedomainID']
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index f110468..270f7a1 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -1004,6 +1004,10 @@
api = API.StorageDomain(sdUUID)
return api.isolateVolume(srcImgUUID, dstImgUUID, volumeID)
+ def wipeVolume(self, sdUUID, imgUUID, volUUID):
+ volume = API.Volume(volUUID, None, sdUUID, imgUUID)
+ return volume.wipe()
+
def getGlobalMethods(self):
return ((self.vmDestroy, 'destroy'),
(self.vmCreate, 'create'),
@@ -1156,7 +1160,8 @@
(self.volumeCreateContainer, 'createVolumeContainer'),
(self.copyData, 'copyData'),
(self.extendVolumeContainer, 'extendVolumeContainer'),
- (self.isolateVolume, 'isolateVolume'))
+ (self.isolateVolume, 'isolateVolume'),
+ (self.wipeVolume, 'wipeVolume'))
def wrapApiMethod(f):
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index a76db8d..80b1968 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -8312,6 +8312,22 @@
'legality': 'VolumeLegality'}}
##
+# @Volume.wipe:
+#
+# Wipe a volume to ensure previous data is erased.
+#
+# @volumeID: The UUID of the Volume
+#
+# @storagedomainID: The Storage Domain associated with the Volume
+#
+# @imageID: The Image associated with the Volume
+#
+# Since: 4.18.0
+##
+{'command': {'class': 'Volume', 'name': 'wipe'},
+ 'data': {'volumeID': 'UUID', 'storagedomainID': 'UUID', 'imageID': 'UUID'}}
+
+##
# @VM.setNumberOfCpus:
#
# Set the number CPUs for a VM
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 432c8f9..cb51cd1 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3776,3 +3776,16 @@
misc.validateUUID(dstImgUUID, 'dstImgUUID')
vars.task.getSharedLock(STORAGE, sdUUID)
return sdm.isolateVolume(dom, srcImgUUID, dstImgUUID, volumeID)
+
+ @public
+ def wipeVolume(self, sdUUID, imgUUID, volUUID):
+ argsStr = ("sdUUID=%s, imgUUID=%s, volUUID=%s" %
+ (sdUUID, imgUUID, volUUID))
+ vars.task.setDefaultException(se.VolumesZeroingError(argsStr))
+ misc.validateUUID(imgUUID, 'imgUUID')
+ misc.validateUUID(volUUID, 'volUUID')
+ vars.task.getSharedLock(STORAGE, sdUUID)
+ imageSpec = {'sdUUID': sdUUID, 'imgUUID': imgUUID, 'volUUID': volUUID}
+ with sdm.prepareCopy(imageSpec, False, 0, True):
+ self._sdmSchedule('wipeVolume', sdm.wipeVolume, sdUUID, imgUUID,
+ volUUID)
diff --git a/vdsm/storage/sdm/__init__.py b/vdsm/storage/sdm/__init__.py
index 4738813..2113d26 100644
--- a/vdsm/storage/sdm/__init__.py
+++ b/vdsm/storage/sdm/__init__.py
@@ -22,6 +22,7 @@
from contextlib import contextmanager, nested
from .. import image
+from .. import misc
from .. import resourceManager as rm
from .. import sd
from .. import storage_exception as se
@@ -234,6 +235,27 @@
domain.releaseClusterLock()
+def wipeVolume(sdUUID, imgUUID, volUUID):
+ dom = sdCache.produce(sdUUID)
+ imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
+ try:
+ with rmanager.acquireResource(imageResourcesNamespace,
+ imgUUID, rm.LockType.exclusive):
+ vol = dom.produceVolume(imgUUID, volUUID)
+ size = vol.getVolumeSize(bs=1)
+ vol_path = vol.getVolumePath()
+ vol.prepare(rw=True, justme=True)
+ try:
+ vol.setLegality(volume.ILLEGAL_VOL)
+ misc.ddWatchCopy(
+ "/dev/zero", vol_path, vars.task.aborting, int(size))
+ finally:
+ vol.tearDown(imgUUID, volUUID)
+ vol.setLegality(volume.LEGAL_VOL)
+ finally:
+ dom.releaseVolumeLease(imgUUID, volUUID)
+
+
def garbageCollectStorageDomain(domain):
if domain.isISO():
return
--
To view, visit https://gerrit.ovirt.org/40628
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I572099e1fee4ae847de95e27973405ba90b56a9b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
6 years, 11 months
Change in vdsm[master]: api: support multiple 'ipv6addrs' per network and deprecate ...
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: api: support multiple 'ipv6addrs' per network and deprecate 'ipv6addr'
......................................................................
api: support multiple 'ipv6addrs' per network and deprecate 'ipv6addr'
Next, the 'ipv6' hook will be extended to understand a whitespace-separated
list of IPv6 addresses and also testStaticNetworkConfig will learn to pass
multiple IPv6 addresses to VDSM.
IPv4 support is planned but needs discussion (should we accept netmasks or
just CIDR notation?).
Change-Id: I8d16083781919fe5e5d9c75e9dd4ab744afe45be
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M vdsm/network/api.py
M vdsm/network/configurators/ifcfg.py
M vdsm/network/configurators/iproute2.py
M vdsm/network/configurators/pyroute_two.py
M vdsm/network/models.py
5 files changed, 45 insertions(+), 24 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/39307/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index de92fbf..096f89f 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -82,7 +82,7 @@
def _objectivizeNetwork(bridge=None, vlan=None, bonding=None,
bondingOptions=None, nics=None, mtu=None, ipaddr=None,
netmask=None, gateway=None, bootproto=None,
- ipv6addr=None, ipv6gateway=None, ipv6autoconf=None,
+ ipv6addrs=None, ipv6gateway=None, ipv6autoconf=None,
dhcpv6=None, defaultRoute=None, _netinfo=None,
configurator=None, blockingdhcp=None,
implicitBonding=None, opts=None):
@@ -100,7 +100,7 @@
:param netmask: IPv4 mask in dotted decimal format.
:param gateway: IPv4 address in dotted decimal format.
:param bootproto: protocol for getting IP config for the net, e.g., 'dhcp'
- :param ipv6addr: IPv6 address in format address[/prefixlen].
+ :param ipv6addrs: list of IPv6 addresses in the format address[/prefixlen]
:param ipv6gateway: IPv6 address in format address[/prefixlen].
:param ipv6autoconf: whether to use IPv6's stateless autoconfiguration.
:param dhcpv6: whether to use DHCPv6.
@@ -162,7 +162,7 @@
raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'Network defined without '
'devices.')
ipv4 = IPv4(ipaddr, netmask, gateway, defaultRoute)
- ipv6 = IPv6(ipv6addr, ipv6gateway, defaultRoute)
+ ipv6 = IPv6(ipv6addrs, ipv6gateway, defaultRoute)
blockingdhcp = configurator._inRollback or utils.tobool(blockingdhcp)
topNetDev.ipconfig = IpConfig(
ipv4=ipv4, ipv6=ipv6, bootproto=bootproto, blockingdhcp=blockingdhcp,
@@ -249,6 +249,7 @@
@_alterRunningConfig
def _addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None,
netmask=None, prefix=None, mtu=None, gateway=None, dhcpv6=None,
+ ipv6addrs=None,
ipv6addr=None, ipv6gateway=None, ipv6autoconf=None,
force=False, configurator=None, bondingOptions=None,
bridged=True, _netinfo=None, hostQos=None,
@@ -279,6 +280,12 @@
except ValueError as ve:
raise ConfigNetworkError(ne.ERR_BAD_ADDR, "Bad prefix: %s" %
ve)
+ if ipv6addr:
+ if ipv6addrs:
+ raise ConfigNetworkError(ne.ERR_BAD_PARAMS,
+ 'Both ipv6addrs and ipv6addr supplied')
+ else:
+ ipv6addrs = [ipv6addr]
if not utils.tobool(force):
logging.debug('validating network...')
@@ -312,7 +319,8 @@
bridge=network if bridged else None, vlan=vlan, bonding=bonding,
bondingOptions=bondingOptions, nics=nics, mtu=mtu, ipaddr=ipaddr,
netmask=netmask, gateway=gateway, bootproto=bootproto, dhcpv6=dhcpv6,
- blockingdhcp=blockingdhcp, ipv6addr=ipv6addr, ipv6gateway=ipv6gateway,
+ blockingdhcp=blockingdhcp, ipv6addrs=ipv6addrs,
+ ipv6gateway=ipv6gateway,
ipv6autoconf=ipv6autoconf, defaultRoute=defaultRoute,
_netinfo=_netinfo, configurator=configurator, opts=options)
@@ -783,7 +791,8 @@
netmask="<ipv4>"
gateway="<ipv4>"
bootproto="..."
- ipv6addr="<ipv6>[/<prefixlen>]"
+ ipv6addrs=["<ipv6>[/<prefixlen>]", ...]
+ ipv6addr="<ipv6>[/<prefixlen>]" (deprecated)
ipv6gateway="<ipv6>"
ipv6autoconf="0|1"
dhcpv6="0|1"
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index 866ade8..f228306 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -584,10 +584,13 @@
if ipv4.defaultRoute is not None:
cfg += 'DEFROUTE=%s\n' % _to_ifcfg_bool(ipv4.defaultRoute)
cfg += 'NM_CONTROLLED=no\n'
- if ipv6.address or ipconfig.ipv6autoconf or ipconfig.dhcpv6:
+ if ipv6.addresses or ipconfig.ipv6autoconf or ipconfig.dhcpv6:
cfg += 'IPV6INIT=yes\n'
- if ipv6.address is not None:
- cfg += 'IPV6ADDR=%s\n' % pipes.quote(ipv6.address)
+ if ipv6.addresses:
+ cfg += 'IPV6ADDR=%s\n' % pipes.quote(ipv6.addresses[0])
+ if len(ipv6.addresses) > 1:
+ cfg += 'IPV6ADDR_SECONDARIES=%s\n' % pipes.quote(
+ ' '.join(ipv6.addresses[1:]))
if ipv6.gateway is not None:
cfg += 'IPV6_DEFAULTGW=%s\n' % pipes.quote(ipv6.gateway)
elif ipconfig.dhcpv6:
@@ -701,7 +704,10 @@
if ipv4.defaultRoute is None and confParams.get('DEFROUTE'):
ipv4.defaultRoute = _from_ifcfg_bool(confParams['DEFROUTE'])
if confParams.get('IPV6INIT') == 'yes':
- ipv6.address = confParams.get('IPV6ADDR')
+ ipv6addr = confParams.get('IPV6ADDR')
+ ipv6addrs = confParams.get('IPV6ADDR_SECONDARIES')
+ ipv6.addresses = ([ipv6addr] if ipv6addr else []) + (
+ ipv6addrs.split() if ipv6addrs else [])
ipv6.gateway = confParams.get('IPV6_DEFAULTGW')
ipconfig.ipv6autoconf = (
confParams.get('IPV6_AUTOCONF') == 'yes')
diff --git a/vdsm/network/configurators/iproute2.py b/vdsm/network/configurators/iproute2.py
index 1cde1cc..045ed66 100644
--- a/vdsm/network/configurators/iproute2.py
+++ b/vdsm/network/configurators/iproute2.py
@@ -225,16 +225,17 @@
ipconfig = iface.ipconfig
ipv4 = ipconfig.ipv4
ipv6 = ipconfig.ipv6
- if ipv4.address or ipv6.address:
+ if ipv4.address or ipv6.addresses:
self.removeIpConfig(iface)
if ipv4.address:
ipwrapper.addrAdd(iface.name, ipv4.address,
ipv4.netmask)
if ipv4.gateway and ipv4.defaultRoute:
ipwrapper.routeAdd(['default', 'via', ipv4.gateway])
- if ipv6.address:
- ipv6addr, ipv6netmask = ipv6.address.split('/')
- ipwrapper.addrAdd(iface.name, ipv6addr, ipv6netmask, family=6)
+ if ipv6.addresses:
+ for address in ipv6.addresses:
+ ipv6addr, ipv6netmask = address.split('/')
+ ipwrapper.addrAdd(iface.name, ipv6addr, ipv6netmask, family=6)
if ipv6.gateway:
ipwrapper.routeAdd(['default', 'via', ipv6.gateway],
dev=iface.name, family=6)
diff --git a/vdsm/network/configurators/pyroute_two.py b/vdsm/network/configurators/pyroute_two.py
index 221e142..a6833d5 100644
--- a/vdsm/network/configurators/pyroute_two.py
+++ b/vdsm/network/configurators/pyroute_two.py
@@ -59,7 +59,7 @@
ipconfig = iface.ipconfig
ipv4 = ipconfig.ipv4
ipv6 = ipconfig.ipv6
- if ipv4.address or ipv6.address:
+ if ipv4.address or ipv6.addresses:
self.removeIpConfig(iface)
if ipv4.address:
with self.ip.interfaces[iface.name] as i:
@@ -67,9 +67,10 @@
if ipv4.gateway and ipv4.defaultRoute:
self.ip.routes.add({'dst': 'default',
'gateway': ipv4.gateway}).commit()
- if ipv6.address:
+ if ipv6.addresses:
with self.ip.interfaces[iface.name] as i:
- i.add_ip(ipv6.address)
+ for address in ipv6.addresses:
+ i.add_ip(address)
if ipv6.gateway:
self.ip.routes.add({'dst': 'default',
'gateway': ipv6.gateway}).commit()
diff --git a/vdsm/network/models.py b/vdsm/network/models.py
index 1d34c88..2c577de 100644
--- a/vdsm/network/models.py
+++ b/vdsm/network/models.py
@@ -410,20 +410,24 @@
class IPv6(object):
- def __init__(self, address=None, gateway=None, defaultRoute=None):
- if address:
- self.validateAddress(address)
+ def __init__(self, addresses=None, gateway=None, defaultRoute=None):
+ if addresses:
+ # TODO: Do we want this?
+ # if isinstance(addresses, str):
+ # addresses = addresses.split()
+ for address in addresses:
+ self.validateAddress(address)
if gateway:
self.validateGateway(gateway)
elif gateway:
raise ConfigNetworkError(ne.ERR_BAD_ADDR, 'Specified gateway but '
'not ip address.')
- self.address = address
+ self.addresses = addresses
self.gateway = gateway
self.defaultRoute = defaultRoute
def __repr__(self):
- return 'IPv6(%s, %s, %s)' % (self.address, self.gateway,
+ return 'IPv6(%s, %s, %s)' % (self.addresses, self.gateway,
self.defaultRoute)
@classmethod
@@ -465,7 +469,7 @@
if ipv6 is None:
ipv6 = IPv6()
if (ipv4.address and bootproto == 'dhcp') or \
- (ipv6.address and (ipv6autoconf or dhcpv6)):
+ (ipv6.addresses and (ipv6autoconf or dhcpv6)):
raise ConfigNetworkError(ne.ERR_BAD_ADDR, 'Static and dynamic IP '
'configurations are mutually exclusive.')
self.ipv4 = ipv4
@@ -477,8 +481,8 @@
def __nonzero__(self):
# iproute2 and pyroute_two check that IP configuration is not empty
- return bool(self.ipv4.address or self.ipv6.address or self.bootproto or
- self.ipv6autoconf or self.dhcpv6)
+ return bool(self.ipv4.address or self.ipv6.addresses or self.bootproto
+ or self.ipv6autoconf or self.dhcpv6)
def __repr__(self):
return 'IpConfig(%r, %r, %s, %s, %s)' % (self.ipv4, self.ipv6,
--
To view, visit https://gerrit.ovirt.org/39307
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d16083781919fe5e5d9c75e9dd4ab744afe45be
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
6 years, 11 months
Change in vdsm[master]: contrib: Add tool for getting hsm stats
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: contrib: Add tool for getting hsm stats
......................................................................
contrib: Add tool for getting hsm stats
This is a very simple tool showing historgam of hsm calls in the given
log files.
Example:
$ hsmstat vdsm.log.1 vdsm.log.2
8515 getVolumeSize
2258 repoStats
51 getVolumeInfo
30 getVolumesList
19 teardownImage
...
We can get same output or better using logdb by writing some smart sql.
Change-Id: Ia6013da71ca96535b98edace8577a4d8bb529465
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
A contrib/hsmstat
1 file changed, 39 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/38748/1
diff --git a/contrib/hsmstat b/contrib/hsmstat
new file mode 100755
index 0000000..d3400d2
--- /dev/null
+++ b/contrib/hsmstat
@@ -0,0 +1,39 @@
+#!/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
+#
+
+from collections import defaultdict
+import fileinput
+import re
+
+verb_re = re.compile(r" Run and protect: (?P<name>.+)\(")
+
+verbs = defaultdict(int)
+
+for line in fileinput.input():
+ match = verb_re.search(line)
+ if match:
+ name = match.group('name')
+ verbs[name] += 1
+
+histogram = sorted(((count, verb) for verb, count in verbs.iteritems()),
+ reverse=True)
+for count, name in histogram:
+ print " %6d %s" % (count, name)
--
To view, visit https://gerrit.ovirt.org/38748
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6013da71ca96535b98edace8577a4d8bb529465
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
6 years, 11 months
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>
6 years, 11 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>
6 years, 11 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>
6 years, 11 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>
6 years, 11 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>
6 years, 11 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>
6 years, 11 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>
6 years, 11 months