Francesco Romani has uploaded a new change for review.
Change subject: vm: sampling: delay initialization
......................................................................
vm: sampling: delay initialization
A future MOM integration patch need that sampling starts
once the QEMU PID of a VM is known.
This patch does that.
Change-Id: I950fc6ea2aae4257260cf2301d47153c4c7ff58b
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/31609/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index a429016..0b2a315 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2855,9 +2855,6 @@
supervdsm.getProxy().setPortMirroring(network,
nic.name)
- # VmStatsThread may use block devices info from libvirt.
- # So, run it after you have this info
- self._initVmStats()
if utils.tobool(self.conf.get('vmchannel', 'true')):
try:
self.guestAgent.connect()
@@ -2874,6 +2871,10 @@
self.cont()
self.conf['pid'] = self._getPid()
+ # VmStatsThread may use block devices info from libvirt.
+ # So, run it after you have this info
+ self._initVmStats()
+
nice = int(self.conf.get('nice', '0'))
nice = max(min(nice, 19), 0)
--
To view, visit http://gerrit.ovirt.org/31609
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I950fc6ea2aae4257260cf2301d47153c4c7ff58b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: sampling: mom: add support for alien samplings
......................................................................
sampling: mom: add support for alien samplings
This patch allow a VM to do sampling callbacks
on behalf of other components. These samplings
are considered fully opaque:
they are just a callable without arguments and
an interval in seconds. The VM sampling code will
call periodically these samplings alongside
with the standard VM ones.
This feature will be used by MOM in a future patch
to avoid the need of one monitor thread per VM.
Change-Id: I7b689f11353192858238c587a721b4a9f9d33b9b
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 10 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/31608/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ad1ef2f..a429016 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -206,7 +206,7 @@
# TODO: Remove as soon as there is a hard dependency we can use
_libvirt_metadata_supported = True
- def __init__(self, vm):
+ def __init__(self, vm, extraMonitors=None):
AdvancedStatsThread.__init__(self, log=vm.log, daemon=True)
self._vm = vm
@@ -265,6 +265,13 @@
self.sampleDisk, self.sampleDiskLatency, self.sampleNet,
self.sampleBalloon, self.sampleVmJobs, self.sampleVcpuPinning,
self.sampleCpuTune)
+
+ extraMonitors = (tuple() if extraMonitors is None
+ else tuple(extraMonitors))
+ self.addStatsFunction(
+ AdvancedStatsFunction(mon.collect, mon.interval,
+ self.GENERIC_SAMPLING_WINDOW)
+ for mon in extraMonitors)
def _highWrite(self):
if not self._vm.isDisksStatsCollectionEnabled():
@@ -2732,8 +2739,8 @@
return domxml.toxml()
- def _initVmStats(self):
- self._vmStats = VmStatsThread(self)
+ def _initVmStats(self, extraMonitors=None):
+ self._vmStats = VmStatsThread(self, extraMonitors)
self._vmStats.start()
self._guestEventTime = self._startTime
--
To view, visit http://gerrit.ovirt.org/31608
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b689f11353192858238c587a721b4a9f9d33b9b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Martin Polednik has uploaded a new change for review.
Change subject: hostdev: add support for reporting usb addresses
......................................................................
hostdev: add support for reporting usb addresses
This patch extends the addr field in hostdev tree that holds map of
address fields relevant to the device. This is required in order to
passthrough a usb device
Change-Id: I3d4a4e1d3703abd25c9fa0584ec0e0a1d52b685c
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M vdsm/hostdev.py
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/35785/1
diff --git a/vdsm/hostdev.py b/vdsm/hostdev.py
index e8cdc0a..25f03e9 100644
--- a/vdsm/hostdev.py
+++ b/vdsm/hostdev.py
@@ -39,12 +39,17 @@
return _parse_address(caps, ('host', 'bus', 'target', 'lun'))
+def _parse_usb_address(caps):
+ return _parse_address(caps, ('bus', 'device'))
+
+
def _parse_device_params(device_xml):
"""
Process device_xml and return dict of found known parameters
"""
address_parser = {'pci': _parse_pci_address,
- 'scsi': _parse_scsi_address}
+ 'scsi': _parse_scsi_address,
+ 'usb': _parse_usb_address}
params = {}
--
To view, visit http://gerrit.ovirt.org/35785
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d4a4e1d3703abd25c9fa0584ec0e0a1d52b685c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: net_func_tests: Rollback only when an error happens
......................................................................
net_func_tests: Rollback only when an error happens
Up until now, net_func_tests used RollbackContext that always
performs all the rolling back operations on context exit. This patch
adds a flag to RollbackContext that if explicitely set to True, will
only perform the rollback operations in case the context was left
due to an exception.
Change-Id: Iaeb9bf19f4bf63d3705cfdda92aa6ec7513a8b98
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/utils.py
M tests/functional/networkTests.py
2 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/29817/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 76c2a79..7b06ea2 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -1057,8 +1057,9 @@
More examples see tests/utilsTests.py
'''
- def __init__(self, *args):
+ def __init__(self, on_exception_only=False):
self._finally = []
+ self._on_exception_only = on_exception_only
def __enter__(self):
return self
@@ -1069,6 +1070,9 @@
exception), python re-raises the original exception once this
function is finished.
"""
+ if self._on_exception_only and exc_type is None and exc_value is None:
+ return
+
undoExcInfo = None
for undo, args, kwargs in self._finally:
try:
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index b59ef01..2a58970 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -191,7 +191,7 @@
@wraps(func)
def wrapper(*args, **kwargs):
- with RollbackContext() as rollback:
+ with RollbackContext(on_exception_only=True) as rollback:
rollback.prependDefer(args[0].vdsm_net.restoreNetConfig)
func(*args, **kwargs)
return wrapper
--
To view, visit http://gerrit.ovirt.org/29817
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaeb9bf19f4bf63d3705cfdda92aa6ec7513a8b98
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: virt: move all_channels into DomainDescriptor
......................................................................
virt: move all_channels into DomainDescriptor
before the introduction of the DomainDescriptor
class, we had a bunch of functions/methods who
repeteadly parsed the VM XML Domain using the slow
minidom module.
The introduction of the DomainDescriptor opens
the gate for both more efficient and cleaner processing.
DomainDescriptor should provide methods to return
high-level objects, not low-level ones, e.g, XML document
nodes, which are inevitabily tied to the underlying xml
library being used.
The first step in this (long) journey is to move
vmxml.all_channels into the DomainDescriptor.
This allow us to have both nicer code in vm.Vm
and to save us one unneeded XML parsing.
Change-Id: I870cce435b2e26ff33cbd52f2421c1f3ce661707
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmXmlTests.py
M vdsm/virt/domain_descriptor.py
M vdsm/virt/vm.py
M vdsm/virt/vmxml.py
4 files changed, 45 insertions(+), 40 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/34415/1
diff --git a/tests/vmXmlTests.py b/tests/vmXmlTests.py
index 17ada42..2e73d6f 100644
--- a/tests/vmXmlTests.py
+++ b/tests/vmXmlTests.py
@@ -18,6 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
+from virt import domain_descriptor
from virt import vm
from virt import vmxml
import caps
@@ -32,29 +33,7 @@
from vmTestsData import CONF_TO_DOMXML_NO_VDSM
-@expandPermutations
-class TestVmXmlFunctions(TestCaseBase):
-
- @permutations([[caps.Architecture.X86_64],
- [caps.Architecture.PPC64]])
- def test_has_channel(self, arch):
- for _, dom_xml in self._build_domain_xml(arch):
- self.assertEqual(True, vmxml.has_channel(
- dom_xml, vm._VMCHANNEL_DEVICE_NAME))
-
- @permutations([[caps.Architecture.X86_64], [caps.Architecture.PPC64]])
- def test_all_channels_vdsm_domain(self, arch):
- for _, dom_xml in self._build_domain_xml(arch):
- channels = list(vmxml.all_channels(dom_xml))
- self.assertTrue(len(channels) >= len(vm._AGENT_CHANNEL_DEVICES))
- for name, path in channels:
- self.assertIn(name, vm._AGENT_CHANNEL_DEVICES)
-
- def test_all_channels_extra_domain(self):
- for conf, raw_xml in CONF_TO_DOMXML_NO_VDSM:
- dom_xml = raw_xml % conf
- self.assertNotEquals(sorted(vmxml.all_channels(dom_xml)),
- sorted(vm._AGENT_CHANNEL_DEVICES))
+class VmXmlTestCase(TestCaseBase):
_CONFS = {
caps.Architecture.X86_64: CONF_TO_DOMXML_X86_64,
@@ -65,3 +44,33 @@
for conf, rawXml in self._CONFS[arch]:
domXml = rawXml % conf
yield fake.Domain(domXml, vmId=conf['vmId']), domXml
+
+
+@expandPermutations
+class TestVmXmlFunctions(VmXmlTestCase):
+
+ @permutations([[caps.Architecture.X86_64],
+ [caps.Architecture.PPC64]])
+ def test_has_channel(self, arch):
+ for _, dom_xml in self._build_domain_xml(arch):
+ self.assertEqual(True, vmxml.has_channel(
+ dom_xml, vm._VMCHANNEL_DEVICE_NAME))
+
+
+@expandPermutations
+class TestDomainDescriptor(VmXmlTestCase):
+
+ @permutations([[caps.Architecture.X86_64], [caps.Architecture.PPC64]])
+ def test_all_channels_vdsm_domain(self, arch):
+ for _, dom_xml in self._build_domain_xml(arch):
+ dom = domain_descriptor.DomainDescriptor(dom_xml)
+ channels = list(dom.all_channels())
+ self.assertTrue(len(channels) >= len(vm._AGENT_CHANNEL_DEVICES))
+ for name, path in channels:
+ self.assertIn(name, vm._AGENT_CHANNEL_DEVICES)
+
+ def test_all_channels_extra_domain(self):
+ for conf, raw_xml in CONF_TO_DOMXML_NO_VDSM:
+ dom = domain_descriptor.DomainDescriptor(raw_xml % conf)
+ self.assertNotEquals(sorted(dom.all_channels()),
+ sorted(vm._AGENT_CHANNEL_DEVICES))
diff --git a/vdsm/virt/domain_descriptor.py b/vdsm/virt/domain_descriptor.py
index 3100a25..a5b2956 100644
--- a/vdsm/virt/domain_descriptor.py
+++ b/vdsm/virt/domain_descriptor.py
@@ -52,6 +52,18 @@
def devicesHash(self):
return self._devicesHash
+ def all_channels(self):
+ for channel in self.getDeviceElements('channel'):
+ try:
+ name = channel.getElementsByTagName('target')[0].\
+ getAttribute('name')
+ path = channel.getElementsByTagName('source')[0].\
+ getAttribute('path')
+ except IndexError:
+ continue
+ else:
+ yield name, path
+
def _firstElementByTagName(self, tagName):
elements = self._dom.childNodes[0].getElementsByTagName(tagName)
return elements[0] if elements else None
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 2992674..59cff66 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2703,7 +2703,7 @@
This is necessary to prevent incoming migrations, restoring of VMs and
the upgrade of VDSM with running VMs to fail on this.
"""
- for name, path in vmxml.all_channels(self._domain.xml):
+ for name, path in self._domain.all_channels():
if name not in _AGENT_CHANNEL_DEVICES:
continue
diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py
index eb07ba9..f8b546d 100644
--- a/vdsm/virt/vmxml.py
+++ b/vdsm/virt/vmxml.py
@@ -44,22 +44,6 @@
return False
-def all_channels(domXML):
- domObj = xml.dom.minidom.parseString(domXML)
- for channel in domObj.childNodes[0]. \
- getElementsByTagName('devices')[0]. \
- getElementsByTagName('channel'):
- try:
- name = channel.getElementsByTagName('target')[0].\
- getAttribute('name')
- path = channel.getElementsByTagName('source')[0].\
- getAttribute('path')
- except IndexError:
- continue
- else:
- yield name, path
-
-
def all_devices(domXML):
domObj = xml.dom.minidom.parseString(domXML)
devices = domObj.childNodes[0].getElementsByTagName('devices')[0]
--
To view, visit http://gerrit.ovirt.org/34415
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I870cce435b2e26ff33cbd52f2421c1f3ce661707
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vm: use DomainDescriptor in setTicket
......................................................................
vm: use DomainDescriptor in setTicket
setTicket used to fetch and parse yet again the Domain XML.
Since there is no known good reason to do so, this patch
changes the code to make use of the DomainDescriptor,
in order to gain a bit more of performance and of code brevity.
Change-Id: I512586497209cb631e684c5f09084dcecfca0ec2
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/34545/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 8b17a03..8e221a9 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4187,8 +4187,7 @@
setTicket defaults to the first graphic device.
use updateDevice to select the device.
"""
- graphics = _domParseStr(self._dom.XMLDesc(0)).childNodes[0]. \
- getElementsByTagName('graphics')[0]
+ graphics = self._domain.getDeviceElements('graphics')[0]
return self._setTicketForGraphicDev(
graphics, otp, seconds, connAct, params)
--
To view, visit http://gerrit.ovirt.org/34545
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I512586497209cb631e684c5f09084dcecfca0ec2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>