Change in vdsm[master]: vdsm: refactor all_devices using etree
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: refactor all_devices using etree
......................................................................
vdsm: refactor all_devices using etree
More hacky than functions which return standard values,
all_devices is expected to return back xml.dom.Element - small
hack is therefore introduced to keep this behaviour even when
internally using etree
Change-Id: Id83e7282319041bd5e6fdc0ef48eb2e1cd543841
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M vdsm/virt/vmxml.py
1 file changed, 13 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/32453/1
diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py
index 4171c5c..17443f6 100644
--- a/vdsm/virt/vmxml.py
+++ b/vdsm/virt/vmxml.py
@@ -61,12 +61,11 @@
def all_devices(domXML):
- domObj = xml.dom.minidom.parseString(domXML)
- devices = domObj.childNodes[0].getElementsByTagName('devices')[0]
+ domObj = etree.fromstring(domXML)
+ devices = domObj.find('devices')
- for deviceXML in devices.childNodes:
- if deviceXML.nodeType == xml.dom.Node.ELEMENT_NODE:
- yield deviceXML
+ for deviceXML in devices:
+ yield _domElement(deviceXML)
def filter_devices_with_alias(devices):
@@ -494,6 +493,15 @@
return self.conf.get('maxVCpus', self._getSmp())
+def _domElement(etreeElement):
+ """
+ Hack required in order to refactor functions in this module while
+ keeping other modules working as intended. Returns xml.dom.Element
+ instead of etree.Element
+ """
+ return xml.dom.minidom.parseString(etreeElement.tostring())
+
+
if sys.version_info[:2] == (2, 6):
# A little unrelated hack to make xml.dom.minidom.Document.toprettyxml()
# not wrap Text node with whitespace.
--
To view, visit http://gerrit.ovirt.org/32453
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id83e7282319041bd5e6fdc0ef48eb2e1cd543841
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: vdsm: refactor all_channels using etree
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: refactor all_channels using etree
......................................................................
vdsm: refactor all_channels using etree
all_channels is a helper function currently located in vmxml
that lists all channels specified in domain's xml.
This patch refactors this function to use dom and adds simple
test to verify it is acting as before.
Change-Id: I8afeffe4a6373e8e6534f9c98b7bb844effaf565
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M tests/vmTests.py
M vdsm/virt/vmxml.py
2 files changed, 20 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/32448/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 33c944a..09e58c5 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -492,6 +492,21 @@
self.assertEqual(expected, vmxml.has_channel(domxml.dom.toprettyxml(),
'org.linux-kvm.port.0'))
+ def testAllChannels(self):
+ channels = {'org.linux-kvm.port.0': '/tmp/linux-socket',
+ 'org.redhat.port.0': '/tmp/redhat-socket',
+ 'org.dummy.port.0': '/tmp/dummy-socket',
+ 'org.dumb.port.0': '',
+ '': '/tmp/big-socket'}
+
+ domxml = vmxml.Domain(self.conf, self.log, caps.Architecture.X86_64)
+ for name, path in channels.items():
+ domxml._appendAgentDevice(path, name)
+
+ for name, path in vmxml.all_channels(domxml.dom.toprettyxml()):
+ self.assertIn(name, channels)
+ self.assertEqual(path, channels[name])
+
def testInputXMLX86_64(self):
expectedXMLs = [
"""<input bus="ps2" type="mouse"/>""",
diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py
index 4171c5c..440ab37 100644
--- a/vdsm/virt/vmxml.py
+++ b/vdsm/virt/vmxml.py
@@ -45,16 +45,12 @@
def all_channels(domXML):
- domObj = xml.dom.minidom.parseString(domXML)
- for channel in domObj.childNodes[0]. \
- getElementsByTagName('devices')[0]. \
- getElementsByTagName('channel'):
+ domObj = etree.fromstring(domXML)
+ for channel in domObj.find('devices').findall('channel'):
try:
- name = channel.getElementsByTagName('target')[0].\
- getAttribute('name')
- path = channel.getElementsByTagName('source')[0].\
- getAttribute('path')
- except IndexError:
+ name = channel.find('target').attrib['name']
+ path = channel.find('source').attrib['path']
+ except KeyError:
continue
else:
yield name, path
--
To view, visit http://gerrit.ovirt.org/32448
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8afeffe4a6373e8e6534f9c98b7bb844effaf565
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: logs: improve VDSM logs human-readability
by ykleinbe@redhat.com
Yoav Kleinberger has uploaded a new change for review.
Change subject: logs: improve VDSM logs human-readability
......................................................................
logs: improve VDSM logs human-readability
In this patch I introduce a new formatting for log messages that is more
uniform and much easier to read. I find the previous format extremely
hard to look at.
Change-Id: I65fcc843b4c2c6f1b0f438937a0702b80b714978
Signed-off-by: Yoav Kleinberger <ykleinbe(a)redhat.com>
---
M vdsm/logger.conf.in
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/28869/1
diff --git a/vdsm/logger.conf.in b/vdsm/logger.conf.in
index e7ff032..00f5590 100644
--- a/vdsm/logger.conf.in
+++ b/vdsm/logger.conf.in
@@ -67,7 +67,7 @@
format: %(message)s
[formatter_long]
-format: %(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::(%(funcName)s) %(message)s
+format: %(asctime)s %(levelname)s %(threadName)s: %(message)s (in function %(funcName)s %(pathname)s:%(lineno)d)
[formatter_sysform]
format= vdsm %(name)s %(levelname)s %(message)s
--
To view, visit http://gerrit.ovirt.org/28869
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65fcc843b4c2c6f1b0f438937a0702b80b714978
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yoav Kleinberger <ykleinbe(a)redhat.com>
9 years, 2 months
Change in vdsm[master]: vdsm-tool: vdsm-id: add force option to force generate id
by Alon Bar-Lev
Alon Bar-Lev has uploaded a new change for review.
Change subject: vdsm-tool: vdsm-id: add force option to force generate id
......................................................................
vdsm-tool: vdsm-id: add force option to force generate id
this is handy to hide the existence and usage of /etc/vdsm/vdsm.id from
users (other components).
Change-Id: I89f1e29c9cdad0cadb32545fa27c1702ad2e116a
Signed-off-by: Alon Bar-Lev <alonbl(a)redhat.com>
---
M lib/vdsm/tool/vdsm-id.py
M lib/vdsm/utils.py
2 files changed, 35 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/20808/1
diff --git a/lib/vdsm/tool/vdsm-id.py b/lib/vdsm/tool/vdsm-id.py
index 109c382..01f94a9 100644
--- a/lib/vdsm/tool/vdsm-id.py
+++ b/lib/vdsm/tool/vdsm-id.py
@@ -17,9 +17,13 @@
# Refer to the README and COPYING files for full details of the license
#
+
+import sys
+import argparse
+
+
from vdsm.utils import getHostUUID
from vdsm.tool import expose
-import sys
@expose("vdsm-id")
@@ -27,7 +31,19 @@
"""
Printing host uuid
"""
- hostUUID = getHostUUID(False)
+ parser = argparse.ArgumentParser('vdsm-tool configure')
+ parser.add_argument(
+ '--force',
+ dest='force',
+ default=False,
+ action='store_true',
+ help='Generate vdsmid if not available',
+ )
+ args = parser.parse_args(sys.argv[2:])
+ hostUUID = getHostUUID(
+ legacy=False,
+ force=args.force,
+ )
if hostUUID is None:
raise RuntimeError('Cannot retrieve host UUID')
sys.stdout.write(hostUUID)
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 78d055e..d38a273 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -48,6 +48,7 @@
import subprocess
import threading
import time
+import uuid
from cpopen import CPopen as BetterPopen
import constants
@@ -599,7 +600,7 @@
__hostUUID = None
-def getHostUUID(legacy=True):
+def getHostUUID(legacy=True, force=False):
global __hostUUID
if __hostUUID:
return __hostUUID
@@ -624,6 +625,14 @@
if p.returncode == 0 and 'Not' not in out:
#Avoid error string - 'Not Settable' or 'Not Present'
__hostUUID = out.strip()
+ elif force:
+ hostid = str(uuid.uuid4())
+ with open(constants.P_VDSM_NODE_ID, 'w') as f:
+ f.write("%s\n", hostid)
+ if isOvirtNode():
+ from ovirtnode import ovirtfunctions
+ ovirtfunctions.ovirt_store_config(constants.P_VDSM_NODE_ID)
+ __hostUUID = hostid
else:
logging.warning('Could not find host UUID.')
@@ -877,3 +886,10 @@
logging.error("Panic: %s", msg, exc_info=True)
os.killpg(0, 9)
sys.exit(-3)
+
+
+def isOvirtNode():
+ return (
+ os.path.exists('/etc/rhev-hypervisor-release') or
+ glob.glob('/etc/ovirt-node-*-release')
+ )
--
To view, visit http://gerrit.ovirt.org/20808
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I89f1e29c9cdad0cadb32545fa27c1702ad2e116a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl(a)redhat.com>
9 years, 2 months
Change in vdsm[master]: vdsm: add check for hostdev passthrough to caps
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: add check for hostdev passthrough to caps
......................................................................
vdsm: add check for hostdev passthrough to caps
Currently only for intel + will not be 100% accurate source
Change-Id: I789f93679740e87b2f5a88351261bc58852990d4
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M vdsm/caps.py
1 file changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/30471/1
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 0993939..2b0aa21 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -246,6 +246,32 @@
return None
+def _iommuPresent(cmdline):
+ if 'intel_iommu' in cmdline:
+ if 'intel_iommu=off' not in cmdline:
+ return 'yes'
+
+ return 'no'
+
+
+def _getIommuSupport():
+ try:
+ import systemd.journal
+ reader = systemd.journal.Reader()
+ reader.this_boot()
+ reader.add_match(_TRANSPORT='kernel')
+ for index, entry in enumerate(reader):
+ if 'Command line:' in entry['MESSAGE']:
+ return _iommuPresent(entry['MESSAGE'])
+ except:
+ with open('/var/log/dmesg', 'r') as fd:
+ for index, line in enumerate(fd):
+ if 'Command line:' in line:
+ return _iommuPresent(line)
+
+ return 'no'
+
+
@utils.memoized
def getLiveMergeSupport():
"""
@@ -642,6 +668,7 @@
caps['autoNumaBalancing'] = getAutoNumaBalancingInfo()
caps['selinux'] = _getSELinux()
+ caps['hostdevSupport'] = _getIommuSupport()
liveSnapSupported = _getLiveSnapshotSupport(targetArch)
if liveSnapSupported is not None:
--
To view, visit http://gerrit.ovirt.org/30471
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I789f93679740e87b2f5a88351261bc58852990d4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
9 years, 2 months
Change in vdsm[master]: vm: fix race in shutdown reason reporting
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: fix race in shutdown reason reporting
......................................................................
vm: fix race in shutdown reason reporting
This patch fix a race in the reporting of
the shutdown exit reason.
Change-Id: I69944134aa9c6f6b3cc40998857ac96540cf9d52
Relates-To: https://bugzilla.redhat.com/557125
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 13 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/31797/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e7f91ec..c76c155 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1572,6 +1572,7 @@
self._powerDownEvent = threading.Event()
self._liveMergeCleanupThreads = {}
self._shutdownReason = None
+ self._shutdownLock = threading.Lock()
def _get_lastStatus(self):
PAUSED_STATES = (vmstatus.POWERING_DOWN, vmstatus.REBOOT_IN_PROGRESS,
@@ -1995,10 +1996,12 @@
# state
response = self.releaseVm()
if not response['status']['code']:
- if self._shutdownReason is None:
+ with self._shutdownLock:
+ reason = self._shutdownReason
+ if reason is None:
self.setDownStatus(ERROR, vmexitreason.LOST_QEMU_CONNECTION)
else:
- self.setDownStatus(NORMAL, self._shutdownReason)
+ self.setDownStatus(NORMAL, reason)
self._powerDownEvent.set()
def _loadCorrectedTimeout(self, base, doubler=20, load=None):
@@ -4657,13 +4660,15 @@
dev.custom)
hooks.before_vm_destroy(self._lastXMLDesc, self.conf)
- self._shutdownReason = vmexitreason.ADMIN_SHUTDOWN
+ with self._shutdownLock:
+ self._shutdownReason = vmexitreason.ADMIN_SHUTDOWN
self._destroyed = True
return self.releaseVm()
def acpiShutdown(self):
- self._shutdownReason = vmexitreason.ADMIN_SHUTDOWN
+ with self._shutdownLock:
+ self._shutdownReason = vmexitreason.ADMIN_SHUTDOWN
self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
def setBalloonTarget(self, target):
@@ -5209,9 +5214,10 @@
hooks.after_vm_hibernate(self._lastXMLDesc, self.conf)
else:
if detail == libvirt.VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN:
- if self._shutdownReason is None:
- # do not overwrite admin shutdown, if present
- self._shutdownReason = vmexitreason.USER_SHUTDOWN
+ with self._shutdownLock:
+ if self._shutdownReason is None:
+ # do not overwrite admin shutdown, if present
+ self._shutdownReason = vmexitreason.USER_SHUTDOWN
self._onQemuDeath()
elif event == libvirt.VIR_DOMAIN_EVENT_SUSPENDED:
self._guestCpuRunning = False
--
To view, visit http://gerrit.ovirt.org/31797
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69944134aa9c6f6b3cc40998857ac96540cf9d52
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 2 months
Change in vdsm[master]: WIP: mom: better integration
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: WIP: mom: better integration
......................................................................
WIP: mom: better integration
this patch makes integration with MOM more efficient.
MOM is being updated to drop the implicit requirement of one thread
per VM being monitored, which of course scales poorly.
MOM will demand the actual call of the monitoring callbacks
to the hypervisor (VDSM) which can do that whatever way fits best
(event loop, threads, thread pool...) on the overall architecture.
The drawback is that MOM and VDSM requires a little bit complex
handshake, because each other can perform the registration
of the sampling code only at startup.
Moreover, now VM sampling must accapt opaque sampling code from
the outside, but this fits quite cleanly with the current and
with the future planned architecture.
This patch implement these new changes needed by VDSM.
Change-Id: I669e91be77c468b6fe8405d5b840d9fbb0dc2430
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm.spec.in
M vdsm/clientIF.py
M vdsm/virt/vm.py
3 files changed, 19 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/31599/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 362067d..01ed15f 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -132,7 +132,7 @@
Requires: libnl
Requires: %{name}-xmlrpc = %{version}-%{release}
Requires: %{name}-jsonrpc = %{version}-%{release}
-Requires: mom >= 0.4.1
+Requires: mom >= 0.5.0
Requires: numactl
%ifarch x86_64
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index bb42ee4..a84a96c 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -395,8 +395,9 @@
self.log.warning('vm %s already exists' %
vmParams['vmId'])
return errCode['exist']
- vm = Vm(self, vmParams, vmRecover)
- self.vmContainer[vmParams['vmId']] = vm
+ with self.mom.register(vmParams['vmId']) as mmon:
+ vm = Vm(self, vmParams, vmRecover, vmMonitors=(mmon,))
+ self.vmContainer[vmParams['vmId']] = vm
finally:
container_len = len(self.vmContainer)
vm.run()
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 5b607b5..7510c55 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -195,7 +195,7 @@
# CPU tune sampling window
# minimum supported value is 2
- CPU_TUNE_SAMPLING_WINDOW = 2
+ GENERIC_SAMPLING_WINDOW = 2
# This flag will prevent excessive log flooding when running
# on libvirt with no support for metadata xml elements.
@@ -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
@@ -258,13 +258,22 @@
AdvancedStatsFunction(
self._sampleCpuTune,
config.getint('vars', 'vm_sample_cpu_tune_interval'),
- self.CPU_TUNE_SAMPLING_WINDOW))
+ self.GENERIC_SAMPLING_WINDOW))
self.addStatsFunction(
self.highWrite, self.updateVolumes, self.sampleCpu,
self.sampleDisk, self.sampleDiskLatency, self.sampleNet,
self.sampleBalloon, self.sampleVmJobs, self.sampleVcpuPinning,
self.sampleCpuTune)
+
+ extraMonitors = (tuple() if extraMonitors is None
+ else tuple(extraMonitors))
+ for mon in extraMonitors:
+ self.addStatsFunction(
+ AdvancedStatsFunction(
+ mon.collect,
+ mon.interval,
+ self.GENERIC_SAMPLING_WIDNOW))
def _highWrite(self):
if not self._vm.isDisksStatsCollectionEnabled():
@@ -1478,7 +1487,7 @@
caps.Architecture.PPC64: 'scsi'}
return DEFAULT_DISK_INTERFACES[self.arch]
- def __init__(self, cif, params, recover=False):
+ def __init__(self, cif, params, recover=False, monitors=None):
"""
Initialize a new VM instance.
@@ -1557,6 +1566,7 @@
self._powerDownEvent = threading.Event()
self._liveMergeCleanupThreads = {}
+ self._extraMonitors = tuple() if monitors is None else monitors
def _get_lastStatus(self):
PAUSED_STATES = (vmstatus.POWERING_DOWN, vmstatus.REBOOT_IN_PROGRESS,
@@ -2733,7 +2743,7 @@
return domxml.toxml()
def _initVmStats(self):
- self._vmStats = VmStatsThread(self)
+ self._vmStats = VmStatsThread(self, self._extraMonitors)
self._vmStats.start()
self._guestEventTime = self._startTime
--
To view, visit http://gerrit.ovirt.org/31599
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I669e91be77c468b6fe8405d5b840d9fbb0dc2430
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 2 months
Change in vdsm[master]: vm: sampling: delay initialization
by fromani@redhat.com
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>
9 years, 2 months
Change in vdsm[master]: sampling: mom: add support for alien samplings
by fromani@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>
9 years, 2 months
Change in vdsm[master]: net_func_tests: Rollback only when an error happens
by asegurap@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>
9 years, 3 months