Change in vdsm[master]: tests: Add symlink mount test
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: tests: Add symlink mount test
......................................................................
Patch Set 6: Verified+1
This version fixes pep8 issue introduced by the previous version.
--
To view, visit http://gerrit.ovirt.org/27514
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9f3d6333921505846f345d015907e5f6174af4f8
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Enrico Tagliavini <enrico.tagliavini(a)gmail.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Enrico Tagliavini <enrico.tagliavini(a)gmail.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Xavi Francisco <xfrancis(a)redhat.com>
Gerrit-Reviewer: Yoav Kleinberger <ykleinbe(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
9 years, 10 months
Change in vdsm[master]: vdsm: extend image over jsonrpc
by Dan Kenigsberg
Dan Kenigsberg has posted comments on this change.
Change subject: vdsm: extend image over jsonrpc
......................................................................
Patch Set 6: Code-Review+1
--
To view, visit http://gerrit.ovirt.org/29359
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I437a23e04f97fb89eb4cd5646b73d9b1bddf240a
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
9 years, 10 months
Change in vdsm[master]: tests: Add symlink mount test
by ykleinbe@redhat.com
Yoav Kleinberger has posted comments on this change.
Change subject: tests: Add symlink mount test
......................................................................
Patch Set 5: Code-Review+1
--
To view, visit http://gerrit.ovirt.org/27514
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9f3d6333921505846f345d015907e5f6174af4f8
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Enrico Tagliavini <enrico.tagliavini(a)gmail.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Enrico Tagliavini <enrico.tagliavini(a)gmail.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Xavi Francisco <xfrancis(a)redhat.com>
Gerrit-Reviewer: Yoav Kleinberger <ykleinbe(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
9 years, 10 months
Change in vdsm[master]: vdsm: extend image over jsonrpc
by Oved Ourfali
Oved Ourfali has posted comments on this change.
Change subject: vdsm: extend image over jsonrpc
......................................................................
Patch Set 6: Code-Review+1
--
To view, visit http://gerrit.ovirt.org/29359
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I437a23e04f97fb89eb4cd5646b73d9b1bddf240a
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
9 years, 10 months
Change in vdsm[master]: virt: Restore BC for block type live snapshots
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: virt: Restore BC for block type live snapshots
......................................................................
virt: Restore BC for block type live snapshots
Commit 02741ce introduced a regression in older hosts running libvirt <
1.2.2 where libvirt rejects the type='block' and source/dev combination.
Eric Blake suggested that this could be worked around by supplying the
old format and new format in the domainshapshot XML document. This
union would continue to work as before on old hosts but would pick up
the correct block snapshot behavior on newer versions. Basically, we
still express the disk type but we repeat the newPath inside both a dev
and file attribute.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115126
Change-Id: I85290f17842ada6c04695bf45ffd1b1108c63d55
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/29567/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 6e937fc..7cca83e 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4022,11 +4022,14 @@
disk = XMLElement('disk', name=vmDev, snapshot='external',
type=sourceType)
+ # Libvirt versions before 1.2.2 do not understand 'type' and treat
+ # all snapshots as if they are type='file'. In order to ensure
+ # proper handling of block snapshots in modern libvirt versions,
+ # we specify type='block' and dev=path for block volumes but we
+ # always speficy the file=path for backwards compatibility.
+ args = {'type': sourceType, 'file': newPath}
if sourceType == 'block':
- args = {'dev': newPath}
- elif sourceType == 'file':
- args = {'file': newPath}
- args['type'] = sourceType
+ args['dev'] = newPath
disk.appendChildWithArgs('source', **args)
return disk
--
To view, visit http://gerrit.ovirt.org/29567
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I85290f17842ada6c04695bf45ffd1b1108c63d55
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: Collect current QoS settings for IO devices and report throu...
by Martin Sivak
Martin Sivák has uploaded a new change for review.
Change subject: Collect current QoS settings for IO devices and report through RunningVmStats
......................................................................
Collect current QoS settings for IO devices and report through RunningVmStats
Change-Id: Ie4fab132b60ce6ae2285115034f3d1ffcdca9e9d
Signed-off-by: Martin Sivak <msivak(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vm.py
3 files changed, 60 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/28712/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index c1cc112..4dd0641 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -183,6 +183,8 @@
('vm_sample_cpu_tune_interval', '15', None),
+ ('vm_sample_io_tune_interval', '15', None),
+
('trust_store_path', '@TRUSTSTORE@',
'Where the certificates and keys are situated.'),
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index dd97594..341b6c6 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -2307,6 +2307,23 @@
'*ioTune': 'VmDiskDeviceIoTuneParams'}}
##
+# @VmDiskDeviceTuneParams:
+#
+# Extra parameters for VM disk devices.
+#
+# @name: #optional The name of the taget device
+#
+# @path: #optional The path of the taget device
+#
+# @ioTune: IO tune parameters
+#
+# Since: 4.15.0
+##
+{'type': 'VmDiskDeviceTuneParams',
+ 'data': {'*name': 'str', '*path': 'str',
+ 'ioTune': 'VmDiskDeviceIoTuneParams'}}
+
+##
# @VmDiskDeviceVolumeChainEntry:
#
# Identifies one volume in a VM disk device volume chain.
@@ -6281,6 +6298,9 @@
# @vcpuUserLimit: #optional Cpu usage hard limit in percents.
# (new in version 4.15.0)
#
+# @ioTune: #optional Current QoS settings for IO devices
+# (new in version 4.15.0)
+#
# Since: 4.10.0
##
{'type': 'RunningVmStats',
@@ -6304,7 +6324,8 @@
'displayInfo': ['VmDisplayInfo'], '*vmJobs': 'VmJobsMap',
'*vNodeRuntimeInfo': 'VmNumaNodeRuntimeInfoMap',
'displayInfo': ['VmDisplayInfo'], '*vcpuQuota': 'int',
- '*vcpuPeriod': 'int', '*vcpuCount': 'int', '*vcpuUserLimit': 'int'}}
+ '*vcpuPeriod': 'int', '*vcpuCount': 'int', '*vcpuUserLimit': 'int',
+ '*ioTune': ['VmDiskDeviceTuneParams']}}
##
# @VmStats:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d4129f9..a1b034f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -180,9 +180,10 @@
class VmStatsThread(sampling.AdvancedStatsThread):
MBPS_TO_BPS = 10 ** 6 / 8
- # CPU tune sampling window
+ # CPU and IO tune sampling window
# minimum supported value is 2
CPU_TUNE_SAMPLING_WINDOW = 2
+ IO_TUNE_SAMPLING_WINDOW = 2
def __init__(self, vm):
sampling.AdvancedStatsThread.__init__(self, log=vm.log, daemon=True)
@@ -237,6 +238,11 @@
self._sampleCpuTune,
config.getint('vars', 'vm_sample_cpu_tune_interval'),
self.CPU_TUNE_SAMPLING_WINDOW))
+ self.sampleIoTune = (
+ sampling.AdvancedStatsFunction(
+ self._sampleIoTune,
+ config.getint('vars', 'vm_sample_io_tune_interval'),
+ self.IO_TUNE_SAMPLING_WINDOW))
self.addStatsFunction(
self.highWrite, self.updateVolumes, self.sampleCpu,
@@ -319,6 +325,34 @@
infos['vcpuLimit'] = nodeList[0].childNodes[0].data
return infos
+
+ def _sampleIoTune(self):
+ info = []
+ for device in self._vm._devices:
+ if not isVdsmImage(device):
+ continue
+
+ try:
+ info.append({
+ "name": device.name,
+ "path": device.get("path"),
+ "ioTune": self._vm._dom.blockIoTune(
+ device.name,
+ libvirt.VIR_DOMAIN_AFFECT_CURRENT)
+ })
+ except libvirt.libvirtError:
+ self._log.exception("Error while collecting ioTune for %s",
+ device.name)
+
+ return info
+
+ def _getIoTuneStats(self, stats):
+ sInfo, eInfo, sampleInterval = self.sampleIoTune.getStats()
+
+ if sInfo is None:
+ return
+
+ stats['ioTune'] = eInfo
def _diff(self, prev, curr, val):
return prev[val] - curr[val]
@@ -553,6 +587,7 @@
self._getDiskLatency(stats)
self._getBalloonStats(stats)
self._getVmJobs(stats)
+ self._getIoTuneStats(stats)
vmNumaNodeRuntimeMap = numaUtils.getVmNumaNodeRuntimeInfo(self._vm)
if vmNumaNodeRuntimeMap:
--
To view, visit http://gerrit.ovirt.org/28712
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4fab132b60ce6ae2285115034f3d1ffcdca9e9d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msivak(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: net: remove last dependency on ifcfg persistence
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: net: remove last dependency on ifcfg persistence
......................................................................
net: remove last dependency on ifcfg persistence
Up until now, some of the most corner case behavior (removal of
partially broken networks) was only working for ifcfg persistence
or ifcfg configurator + unified persistence.
This patch cleans the api from ifcfgisms.
Change-Id: Ia5d682eaf93b488fac0391bf4b84394d73d7f485
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/netconfpersistence.py
M vdsm/network/api.py
M vdsm/network/configurators/ifcfg.py
3 files changed, 49 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/28530/1
diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py
index 4114577..b92e10c 100644
--- a/lib/vdsm/netconfpersistence.py
+++ b/lib/vdsm/netconfpersistence.py
@@ -199,3 +199,15 @@
def restore(self):
restore()
return RunningConfig()
+
+
+def configuredPorts(network):
+ nic = network.get('nic')
+ bond = network.get('bonding')
+ vlan = network.get('vlan', '')
+ if bond:
+ return [bond + vlan]
+ elif nic:
+ return [nic + vlan]
+ else: # isolated bridged network
+ return []
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index bf210b4..01ace74 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -30,7 +30,6 @@
from vdsm import netinfo
from vdsm import utils
-from .configurators.ifcfg import ConfigWriter
from .configurators import libvirt
from .errors import ConfigNetworkError
from . import errors as ne
@@ -52,7 +51,19 @@
from .configurators.ifcfg import Ifcfg
return Ifcfg
+
+def _getPersistenceModule():
+ persistence = config.get('vars', 'net_persistence')
+ if persistence == 'unified':
+ from vdsm import netconfpersistence
+ return netconfpersistence
+ else:
+ from .configurators import ifcfg
+ return ifcfg
+
+
ConfiguratorClass = _getConfiguratorClass()
+persistence = _getPersistenceModule()
def objectivizeNetwork(bridge=None, vlan=None, bonding=None,
@@ -364,13 +375,23 @@
print "Bondings:", _netinfo.bondings.keys()
+def _configuredPorts(bridge, configurator):
+ """Returns the configured ports for a bridge"""
+ if config.get('vars', 'net_persistence') == 'unified':
+ return persistence.configuredPorts(
+ configurator.runningConfig.networks[bridge])
+ else:
+ return persistence.configuredPorts(bridge)
+
+
def _delBrokenNetwork(network, netAttr, configurator):
'''Adapts the network information of broken networks so that they can be
deleted via delNetwork.'''
_netinfo = netinfo.NetInfo()
_netinfo.networks[network] = netAttr
if _netinfo.networks[network]['bridged']:
- _netinfo.networks[network]['ports'] = ConfigWriter.ifcfgPorts(network)
+ _netinfo.networks[network]['ports'] = _configuredPorts(network,
+ configurator)
elif not os.path.exists('/sys/class/net/' + netAttr['iface']):
# Bridgeless broken network without underlying device
libvirt.removeNetwork(network)
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index 8dc5743..48e303b 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -516,20 +516,6 @@
else:
os.remove(fpath)
- @classmethod
- def ifcfgPorts(cls, network):
- ports = []
- for filePath in glob.iglob(netinfo.NET_CONF_PREF + '*'):
- with open(filePath, 'r') as confFile:
- for line in confFile:
- if line.startswith('BRIDGE=' + network):
- port = filePath[filePath.rindex('-') + 1:]
- logging.debug('port %s found in ifcfg for %s', port,
- network)
- ports.append(port)
- break
- return ports
-
def writeConfFile(self, fileName, configuration):
'''Backs up the previous contents of the file referenced by fileName
writes the new configuration and sets the specified access mode.'''
@@ -801,3 +787,17 @@
else:
rc, out, err = _ifup(iface)
return rc
+
+
+def configuredPorts(bridge):
+ ports = []
+ for filePath in glob.iglob(netinfo.NET_CONF_PREF + '*'):
+ with open(filePath) as confFile:
+ for line in confFile:
+ if line.startswith('BRIDGE=' + bridge):
+ port = filePath[filePath.rindex('-') + 1:]
+ logging.debug('port %s found in ifcfg for %s', port,
+ bridge)
+ ports.append(port)
+ break
+ return ports
--
To view, visit http://gerrit.ovirt.org/28530
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia5d682eaf93b488fac0391bf4b84394d73d7f485
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: virt: migration: cleanup the migration mode
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: migration: cleanup the migration mode
......................................................................
virt: migration: cleanup the migration mode
This patch adds constants for state and helper methods,
to avoid the client code to mess up with the migration.SourceThread
internals.
Change-Id: I2bfbc71e25dddf623ad2d79d5ee66f1501dbb81b
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/migration.py
M vdsm/virt/vm.py
2 files changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/29111/1
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index e79d97f..38543b9 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -35,6 +35,10 @@
from . import vmstatus
+MODE_REMOTE = 'remote'
+MODE_FILE = 'file'
+
+
class SourceThread(threading.Thread):
"""
A thread that takes care of migration on the source vdsm.
@@ -73,6 +77,9 @@
self._migrationCanceledEvt = False
self._monitorThread = None
+ def isHibernating(self):
+ return self_mode == MODE_FILE
+
def getStat(self):
"""
Get the status of the migration.
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 234b75a..2b28473 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2859,7 +2859,7 @@
if self.lastStatus in statuses:
return {'status': self.lastStatus}
elif self.isMigrating():
- if self._migrationSourceThread._mode == 'file':
+ if self._migrationSourceThread.isHibernating():
return {'status': vmstatus.SAVING_STATE}
else:
return {'status': vmstatus.MIGRATION_SOURCE}
--
To view, visit http://gerrit.ovirt.org/29111
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bfbc71e25dddf623ad2d79d5ee66f1501dbb81b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: netlink: add qdisc information retrieval
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: netlink: add qdisc information retrieval
......................................................................
netlink: add qdisc information retrieval
libnl-3 has support for reporting and creating some traffic control
entities. This patch adds support for iterating over queuing
disciplines. E.g:
tc cli output:
~/c/l/l/r/qdisc ❯❯❯ tc qdisc show
qdisc pfifo_fast 8002: dev em1 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc mq 0: dev wlp3s0 root
qdisc pfifo_fast 0: dev tun0 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
~/c/l/l/r/qdisc ❯❯❯
would be:
[{'handle': '8001:0',
'index': 3,
'kind': 'hfsc',
'label': 'em1',
'mtu': 1500,
'parent': 'ffff:ffff'},
{'handle': '0:0',
'index': 4,
'kind': 'mq',
'label': 'wlp3s0',
'mtu': 1500,
'parent': 'ffff:ffff'},
{'handle': '0:0',
'index': 7,
'kind': 'pfifo_fast',
'label': 'tun0',
'mtu': 1500,
'parent': 'ffff:ffff'}]
Change-Id: If71aae9de70bd708897dc24db849f6ab73ed3e21
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M configure.ac
M debian/vdsm-python.install
M lib/vdsm/netlink/Makefile.am
A lib/vdsm/netlink/tc/Makefile.am
A lib/vdsm/netlink/tc/__init__.py
A lib/vdsm/netlink/tc/qdisc.py
M vdsm.spec.in
7 files changed, 150 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/28404/1
diff --git a/configure.ac b/configure.ac
index 04ee756..a70c730 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,6 +264,7 @@
lib/Makefile
lib/vdsm/Makefile
lib/vdsm/netlink/Makefile
+ lib/vdsm/netlink/tc/Makefile
lib/vdsm/tool/Makefile
lib/yajsonrpc/Makefile
lib/zombiereaper/Makefile
diff --git a/debian/vdsm-python.install b/debian/vdsm-python.install
index bb7339e..ab6adff 100644
--- a/debian/vdsm-python.install
+++ b/debian/vdsm-python.install
@@ -14,6 +14,8 @@
./usr/lib/python2.7/dist-packages/vdsm/netlink/__init__.py
./usr/lib/python2.7/dist-packages/vdsm/netlink/addr.py
./usr/lib/python2.7/dist-packages/vdsm/netlink/link.py
+./usr/lib/python2.7/dist-packages/vdsm/netlink/tc/__init__.py
+./usr/lib/python2.7/dist-packages/vdsm/netlink/tc/qdisc.py
./usr/lib/python2.7/dist-packages/vdsm/profile.py
./usr/lib/python2.7/dist-packages/vdsm/qemuimg.py
./usr/lib/python2.7/dist-packages/vdsm/tool/__init__.py
diff --git a/lib/vdsm/netlink/Makefile.am b/lib/vdsm/netlink/Makefile.am
index d947a91..08476b0 100644
--- a/lib/vdsm/netlink/Makefile.am
+++ b/lib/vdsm/netlink/Makefile.am
@@ -18,6 +18,8 @@
#
include $(top_srcdir)/build-aux/Makefile.subs
+SUBDIRS = tc
+
vdsmnetlinkdir = $(vdsmpylibdir)/netlink
dist_vdsmnetlink_PYTHON = \
__init__.py \
diff --git a/lib/vdsm/netlink/tc/Makefile.am b/lib/vdsm/netlink/tc/Makefile.am
new file mode 100644
index 0000000..0c43f23
--- /dev/null
+++ b/lib/vdsm/netlink/tc/Makefile.am
@@ -0,0 +1,25 @@
+# Copyright 2014 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
+#
+include $(top_srcdir)/build-aux/Makefile.subs
+
+vdsmnetlinktcdir = $(vdsmpylibdir)/netlink/tc
+dist_vdsmnetlink_PYTHON = \
+ __init__.py \
+ qdisc.py \
+ $(NULL)
diff --git a/lib/vdsm/netlink/tc/__init__.py b/lib/vdsm/netlink/tc/__init__.py
new file mode 100644
index 0000000..c4f0d74
--- /dev/null
+++ b/lib/vdsm/netlink/tc/__init__.py
@@ -0,0 +1,55 @@
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+from .. import _ethtool_uses_libnl3, LIBNL_ROUTE
+from .. import _char_proto, _int_proto
+from ..link import _link_index_to_name
+
+
+def _tc_info(link_cache, tc):
+ index = _rtnl_tc_get_ifindex(tc)
+ return {
+ 'handle': _handle2str(_rtnl_tc_get_handle(tc)),
+ 'index': index,
+ 'kind': _rtnl_tc_get_kind(tc),
+ 'label': _link_index_to_name(link_cache, index),
+ 'mtu': _rtnl_tc_get_mtu(tc),
+ 'parent': _handle2str(_rtnl_tc_get_parent(tc))}
+
+
+def _handle2str(handle):
+ first = (handle & 0xFFFF0000) >> 16
+ second = handle & 0x0000FFFF
+ return '%x:%x' % (first, second)
+
+# C function prototypes
+# http://docs.python.org/2/library/ctypes.html#function-prototypes
+# This helps ctypes know the calling conventions it should use to communicate
+# with the binary interface of libnl and which types it should allocate and
+# cast. Without it ctypes fails when not running on the main thread.
+if _ethtool_uses_libnl3():
+ pass
+else: # libnl-1
+ # Not implemented for libnl1
+ pass
+
+_rtnl_tc_get_handle = _int_proto(('rtnl_tc_get_handle', LIBNL_ROUTE))
+_rtnl_tc_get_ifindex = _int_proto(('rtnl_tc_get_ifindex', LIBNL_ROUTE))
+_rtnl_tc_get_kind = _char_proto(('rtnl_tc_get_kind', LIBNL_ROUTE))
+_rtnl_tc_get_mtu = _int_proto(('rtnl_tc_get_mtu', LIBNL_ROUTE))
+_rtnl_tc_get_parent = _int_proto(('rtnl_tc_get_parent', LIBNL_ROUTE))
diff --git a/lib/vdsm/netlink/tc/qdisc.py b/lib/vdsm/netlink/tc/qdisc.py
new file mode 100644
index 0000000..dd06707
--- /dev/null
+++ b/lib/vdsm/netlink/tc/qdisc.py
@@ -0,0 +1,62 @@
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+from ctypes import CFUNCTYPE, byref, c_int, c_void_p
+from functools import partial
+
+from .. import _cache_manager, _nl_cache_get_first, _nl_cache_get_next
+from .. import LIBNL_ROUTE, _nl_geterror, _pool
+from ..link import _nl_link_cache
+from . import _tc_info
+
+
+def iter_qdiscs():
+ """Generator that yields an information dictionary for each queuing
+ discipline in the system"""
+ with _pool.socket() as sock:
+ with _nl_qdisc_cache(sock) as qdisc_cache:
+ with _nl_link_cache(sock) as link_cache: # for index to label
+ qdisc = _nl_cache_get_first(qdisc_cache)
+ while qdisc:
+ yield _info(link_cache, qdisc)
+ qdisc = _nl_cache_get_next(qdisc)
+
+
+def _info(link_cache, qdisc):
+ """Returns a dictionary with the queuing discipline information"""
+ data = _tc_info(link_cache, qdisc)
+ return data
+
+# C function prototypes
+# http://docs.python.org/2/library/ctypes.html#function-prototypes
+# This helps ctypes know the calling conventions it should use to communicate
+# with the binary interface of libnl and which types it should allocate and
+# cast. Without it ctypes fails when not running on the main thread.
+_qdisc_alloc_cache = CFUNCTYPE(c_int, c_void_p, c_void_p)(
+ ('rtnl_qdisc_alloc_cache', LIBNL_ROUTE))
+
+
+def _rtnl_qdisc_alloc_cache(sock):
+ """Wraps the new addr alloc cache to expose the libnl1 signature"""
+ cache = c_void_p()
+ err = _qdisc_alloc_cache(sock, byref(cache))
+ if err:
+ raise IOError(-err, _nl_geterror())
+ return cache
+
+_nl_qdisc_cache = partial(_cache_manager, _rtnl_qdisc_alloc_cache)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index c885367..61e731e 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1156,6 +1156,7 @@
%{_bindir}/vdsm-tool
%dir %{python_sitearch}/%{vdsm_name}
%dir %{python_sitearch}/%{vdsm_name}/netlink
+%dir %{python_sitearch}/%{vdsm_name}/netlink/tc
%dir %{python_sitearch}/%{vdsm_name}/tool
%{python_sitearch}/%{vdsm_name}/__init__.py*
%{python_sitearch}/%{vdsm_name}/compat.py*
@@ -1169,6 +1170,8 @@
%{python_sitearch}/%{vdsm_name}/netlink/__init__.py*
%{python_sitearch}/%{vdsm_name}/netlink/addr.py*
%{python_sitearch}/%{vdsm_name}/netlink/link.py*
+%{python_sitearch}/%{vdsm_name}/netlink/tc/__init__.py*
+%{python_sitearch}/%{vdsm_name}/netlink/qdisc.py*
%{python_sitearch}/%{vdsm_name}/profile.py*
%{python_sitearch}/%{vdsm_name}/qemuimg.py*
%{python_sitearch}/%{vdsm_name}/SecureXMLRPCServer.py*
--
To view, visit http://gerrit.ovirt.org/28404
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If71aae9de70bd708897dc24db849f6ab73ed3e21
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 10 months