Change in vdsm[master]: virt: migration: add monitor thread control loop
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: migration: add monitor thread control loop
......................................................................
virt: migration: add monitor thread control loop
This patch introduces a control loop in the
monitor thread to factor out the scheduling logic
from the worker method.
This is a necessary step toward the integration
of the MigrationMonitor and MigrationDowntime threads.
Change-Id: Ie422bead060c8ba2bfd4bfada522b91d56697841
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/migration.py
1 file changed, 24 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/25976/1
diff --git a/vdsm/migration.py b/vdsm/migration.py
index 3699ca5..1234471 100644
--- a/vdsm/migration.py
+++ b/vdsm/migration.py
@@ -392,30 +392,34 @@
return MigrationMonitorThread._MIGRATION_MONITOR_INTERVAL > 0
def run(self):
- if self.enabled:
- self.monitor_migration()
- else:
- self.idle()
+ self._vm.log.debug('starting migration monitor thread')
- def monitor_migration(self):
+ step = 1
+ self._lastProgressTime = time.time()
+ self._lowmark = None
+
+ while not self._stop.isSet():
+ self._stop.wait(1.0)
+ if self.enabled:
+ self.monitor_migration(step)
+ step += 1
+
+ self._vm.log.debug('migration monitor thread exiting')
+
+ def monitor_migration(self, step):
def calculateProgress(remaining, total):
if remaining == 0:
return 100
progress = 100 - 100 * remaining / total if total else 0
return progress if (progress < 100) else 99
- self._vm.log.debug('starting migration monitor thread')
-
memSize = int(self._vm.conf['memSize'])
maxTimePerGiB = config.getint('vars',
'migration_max_time_per_gib_mem')
migrationMaxTime = (maxTimePerGiB * memSize + 1023) / 1024
- lastProgressTime = time.time()
- lowmark = None
progress_timeout = config.getint('vars', 'migration_progress_timeout')
- while not self._stop.isSet():
- self._stop.wait(self._MIGRATION_MONITOR_INTERVAL)
+ if step % self._MIGRATION_MONITOR_INTERVAL == 0:
(jobType, timeElapsed, _,
dataTotal, dataProcessed, dataRemaining,
memTotal, memProcessed, memRemaining,
@@ -432,39 +436,36 @@
now - self._startTime,
migrationMaxTime)
abort = True
- elif (lowmark is None) or (lowmark > dataRemaining):
- lowmark = dataRemaining
- lastProgressTime = now
- elif (now - lastProgressTime) > progress_timeout:
+ elif (self._lowmark is None) or (self._lowmark > dataRemaining):
+ self._lowmark = dataRemaining
+ self._lastProgressTime = now
+ elif (now - self._lastProgressTime) > progress_timeout:
# Migration is stuck, abort
self._vm.log.warn(
'Migration is stuck: Hasn\'t progressed in %s seconds. '
- 'Aborting.' % (now - lastProgressTime))
+ 'Aborting.' % (now - self._lastProgressTime))
abort = True
if abort:
self._vm._dom.abortJob()
self.stop()
- break
+ return
- if dataRemaining > lowmark:
+ if dataRemaining > self._lowmark:
self._vm.log.warn(
'Migration stalling: remaining (%sMiB)'
' > lowmark (%sMiB).'
' Refer to RHBZ#919201.',
- dataRemaining / Mbytes, lowmark / Mbytes)
+ dataRemaining / Mbytes, self._lowmark / Mbytes)
if jobType == 0:
- continue
+ return
self.progress = calculateProgress(dataRemaining, dataTotal)
self._vm.log.info('Migration Progress: %s seconds elapsed, %s%% of'
' data processed' %
(timeElapsed / 1000, self.progress))
-
- def idle(self):
- self._stop.wait(1.0)
def stop(self):
self._vm.log.debug('stopping migration monitor thread')
--
To view, visit http://gerrit.ovirt.org/25976
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie422bead060c8ba2bfd4bfada522b91d56697841
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 7 months
Change in vdsm[master]: vm: graphdev: fix device hooks post migration
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: graphdev: fix device hooks post migration
......................................................................
vm: graphdev: fix device hooks post migration
the _deviceXML attribute was not regenerated on
destination VM after migrations.
Change-Id: I6643f81cc5cff1a282da607e7e5759a97b081c7a
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/27933/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e977ff3..20936a7 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -5122,6 +5122,12 @@
if alias in aliasToDevice:
aliasToDevice[alias]._deviceXML = deviceXML.toxml()
+ elif deviceXML.tagName == GRAPHICS_DEVICES:
+ # graphics device do not have aliases, must match by type
+ graphType = deviceXML.getAttribute('type')
+ for devObj in self._devices[GRAPHICS_DEVICES]:
+ if devObj.device == graphType:
+ devObj._deviceXML = deviceXML.toxml()
def waitForMigrationDestinationPrepare(self):
"""Wait until paths are prepared for migration destination"""
--
To view, visit http://gerrit.ovirt.org/27933
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6643f81cc5cff1a282da607e7e5759a97b081c7a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 7 months
Change in vdsm[master]: add xmlrpcTests for cpu pinning
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: add xmlrpcTests for cpu pinning
......................................................................
add xmlrpcTests for cpu pinning
Change-Id: Ia865f0d5eb4c9aabff6cef57b088c55df73a309e
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/functional/xmlrpcTests.py
M tests/vdsClientTests.py
2 files changed, 40 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/8412/1
diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index 9c865db..2684d0f 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -174,3 +174,33 @@
destroyResult = self.s.destroy(VMID)
self.assertVdsOK(destroyResult)
+
+ def testCpuPin(self):
+ self.skipNoKVM()
+
+ def assertVMAndGuestUp():
+ self.assertVmUp(VMID)
+ self.assertGuestUp(VMID)
+
+ VMID = '77777777-ffff-3333-aaaa-222222222222'
+
+ with kernelBootImages() as (kernelPath, initramfsPath):
+ conf = {'display': 'vnc',
+ 'kernel': kernelPath,
+ 'initrd': initramfsPath,
+ 'kernelArgs': 'rd.break=cmdline rd.shell rd.skipfsck',
+ 'kvmEnable': 'true',
+ 'memSize': '256',
+ 'vmId': VMID,
+ 'vmName': 'vdsm_testPinVM',
+ 'vmType': 'kvm',
+ 'cpuPinning': {'emulator': '0', '0': '1'}}
+
+ try:
+ self.assertVdsOK(self.s.create(conf))
+ # wait 65 seconds for VM to come up until timeout
+ self.retryAssert(assertVMAndGuestUp, 65, 1)
+ finally:
+ destroyResult = self.s.destroy(VMID)
+
+ self.assertVdsOK(destroyResult)
diff --git a/tests/vdsClientTests.py b/tests/vdsClientTests.py
index abf3242..57e6e74 100644
--- a/tests/vdsClientTests.py
+++ b/tests/vdsClientTests.py
@@ -118,3 +118,13 @@
allArgs[-1] = 'cpuPinning={0:1,1:0}'
r4 = serv.do_create(['/dev/null'] + allArgs)
self.assertNotEquals(r4, expectResult)
+
+ # test just pin emulator
+ allArgs[-1] = "cpuPinning={emulator:1-3}"
+ r5 = serv.do_create(['/dev/null'] + allArgs)
+ self.assertEquals(r5['cpuPinning'],{'emulator':'1-3'})
+
+ # test pin emultor and vcpu
+ allArgs[-1] = "cpuPinning={emulator:1-3,1:0}"
+ r6 = serv.do_create(['/dev/null'] + allArgs)
+ self.assertEquals(r6['cpuPinning'],{'emulator':'1-3','1':'0'})
--
To view, visit http://gerrit.ovirt.org/8412
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia865f0d5eb4c9aabff6cef57b088c55df73a309e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
9 years, 7 months
Change in vdsm[master]: [WIP]add simple balloon functional testcase
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]add simple balloon functional testcase
......................................................................
[WIP]add simple balloon functional testcase
Change-Id: Ie8140fe1c754d9d4026c503a19420e6552a3f4fe
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/functional/xmlrpcTests.py
1 file changed, 34 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/12820/1
diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index 3eb65e4..88dd2c5 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -19,6 +19,7 @@
#
import os
+import time
import tempfile
import pwd
import grp
@@ -29,6 +30,7 @@
from testrunner import VdsmTestCase as TestCaseBase
from testrunner import permutations, expandPermutations
from nose.plugins.skip import SkipTest
+from momTests import skipNoMOM
try:
import rtslib
except ImportError:
@@ -169,6 +171,38 @@
with RollbackContext() as rollback:
self._runVMKernelBootTemplate(rollback, customization)
+ @skipNoKVM
+ @skipNoMOM
+ def testSmallVMBallooning(self):
+ policyStr = """
+ (def set_guest (guest)
+ {
+ (guest.Control "balloon_target" 0)
+ })
+ (with Guests guest (set_guest guest))"""
+ balloonSpec = {'device': 'memballoon',
+ 'type': 'balloon',
+ 'specParams': {'model': 'virtio'}}
+ customization = {'vmId': '77777777-ffff-3333-bbbb-555555555555',
+ 'vmName': 'vdsm_testBalloonVM',
+ 'devices': [balloonSpec]}
+ policy = {'balloon': policyStr}
+
+ with RollbackContext() as rollback:
+ self._runVMKernelBootTemplate(rollback, customization)
+ self._enableBalloonPolicy(policy, rollback)
+ time.sleep(12) # MOM policy engine wake up evey 10s
+ balloonInf = self.s.getVmStats(
+ customization['vmId'])['statsList'][0]['balloonInfo']
+ self.assertEqual(balloonInf['balloon_cur'], 0)
+
+ def _enableBalloonPolicy(self, policy, rollback):
+ r = self.s.setMOMPolicy(policy)
+ self.assertVdsOK(r)
+ undo = lambda: \
+ self.assertVdsOK(self.s.resetMOMPolicy())
+ rollback.prependDefer(undo)
+
def _runVMKernelBootTemplate(self, rollback, vmDef={}, distro='fedora'):
kernelArgsDistro = {
# Fedora: The initramfs is generated by dracut. The following
--
To view, visit http://gerrit.ovirt.org/12820
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8140fe1c754d9d4026c503a19420e6552a3f4fe
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
9 years, 7 months
Change in vdsm[master]: qemuimg: Handle new output format
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: qemuimg: Handle new output format
......................................................................
qemuimg: Handle new output format
The current qemu-img info parsing logic assumes that if the output is
long enough, the backing image will appear on line 6. In newer qemu
versions, some additional information has been added to the output. In
the case of no backing file, the additional lines will fail to parse.
Handle this by trying to parse line 6 as a backing file and ignoring
regex parse errors for this line only.
Change-Id: Ic229198ab7c2bb9743bdf8629416131186115431
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M lib/vdsm/qemuimg.py
1 file changed, 13 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/27552/1
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index 69912d9..2dfbc4d 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -43,8 +43,15 @@
}
+class _RegexSearchError(Exception):
+ pass
+
+
def __iregexSearch(pattern, text):
- return __iregex[pattern].search(text).group("value")
+ m = __iregex[pattern].search(text)
+ if m is None:
+ raise _RegexSearchError()
+ return m.group("value")
class QImgError(Exception):
@@ -81,8 +88,11 @@
info['clustersize'] = int(__iregexSearch("clustersize", out[4]))
if len(out) > 5:
- info['backingfile'] = __iregexSearch("backingfile", out[5])
- except:
+ try:
+ info['backingfile'] = __iregexSearch("backingfile", out[5])
+ except _RegexSearchError:
+ pass
+ except _RegexSearchError:
raise QImgError(rc, out, err, "unable to parse qemu-img info output")
return info
--
To view, visit http://gerrit.ovirt.org/27552
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic229198ab7c2bb9743bdf8629416131186115431
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
9 years, 7 months
Change in vdsm[master]: vm: reorganize the graphic devices lookup
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: reorganize the graphic devices lookup
......................................................................
vm: reorganize the graphic devices lookup
this patch extracts a method to gather and
return all the graphic devices of a Vm, either
new style (proper device) or legacy (reconstructed
from the display* params).
The correct order of the devices is preserved:
* first the one reconstructed from the legacy params,
if any
* then the additional one
and proper locking (using _confLock) is used to avoid
races.
Change-Id: I231087647e515a1f310de45b659e512444bd0a1d
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 14 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/27596/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 198cbce..445a750 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2651,10 +2651,16 @@
# updated in Vm._run (buildConfDevices and the following code).
# easily reproduced with functional tests, but also possible
# in the wild
- for dev in self.conf.get('devices', []) + self.getConfGraphics():
+ for dev in self._getAllConfGraphicDevices():
+ stats.update(getInfo(dev))
+ break
+
+ def _getAllConfGraphicDevices(self):
+ with self._confLock:
+ devices = self.getConfGraphics() + self.conf.get('devices', [])
+ for dev in devices:
if dev['type'] == GRAPHICS_DEVICES:
- stats.update(getInfo(dev))
- break
+ yield dev
def isMigrating(self):
return self._migrationSourceThread.isAlive()
@@ -3016,8 +3022,9 @@
for dev in devices.values():
newDevices.extend(dev)
- self.conf['devices'] = newDevices
- self._cleanLegacyGraphics()
+ with self._confLock:
+ self.conf['devices'] = newDevices
+ self._cleanLegacyGraphics()
def _cleanLegacyGraphics(self):
"""
@@ -4389,10 +4396,8 @@
@property
def hasSpice(self):
- return any(
- dev['device'] == 'spice'
- for dev in self.conf.get('devices', self.getConfGraphics())
- if dev['type'] == GRAPHICS_DEVICES)
+ return any(dev['device'] == 'spice'
+ for dev in self._getAllConfGraphicDevices())
def _getPid(self):
pid = '0'
--
To view, visit http://gerrit.ovirt.org/27596
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I231087647e515a1f310de45b659e512444bd0a1d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: testing storageTest.py as CI job.
by vvolansk@redhat.com
Vered Volansky has uploaded a new change for review.
Change subject: testing storageTest.py as CI job.
......................................................................
testing storageTest.py as CI job.
Change-Id: I4d0caab1749e075f3650c91161b473e66b19977d
Signed-off-by: Vered Volansky <vvolansk(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/23343/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 0bab95d..0cb7164 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1,6 +1,7 @@
#
# Copyright 2009-2011 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
--
To view, visit http://gerrit.ovirt.org/23343
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d0caab1749e075f3650c91161b473e66b19977d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vered Volansky <vvolansk(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: virt: Avoid timeout log spam due to channel timeouts
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: virt: Avoid timeout log spam due to channel timeouts
......................................................................
virt: Avoid timeout log spam due to channel timeouts
Currently vmchannels.Listener is logging every timeout events every
30 seconds (based on guest_agent_timeout config value):
vmChannels::91::vds::(_handle_timeouts) Timeout on fileno 106.
This patch changes this behaviour to keep track if a timeout has
been logged before and in that case wouldn't log it again until
a new event (like incoming data) has been received.
Change-Id: I82e868ce7c0ab28a9f7983887a097f760c3d0f69
Bug-Url: https://bugzilla.redhat.com/1096312
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/virt/vmchannels.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/27627/1
diff --git a/vdsm/virt/vmchannels.py b/vdsm/virt/vmchannels.py
index d31cd47..b053a64 100644
--- a/vdsm/virt/vmchannels.py
+++ b/vdsm/virt/vmchannels.py
@@ -59,6 +59,7 @@
event)
elif (event & select.EPOLLIN):
obj = self._channels[fileno]
+ obj['timeout_seen'] = False
obj['reconnects'] = 0
try:
if obj['read_cb'](obj['opaque']):
@@ -73,6 +74,7 @@
def _prepare_reconnect(self, fileno):
obj = self._channels.pop(fileno)
+ obj['timeout_seen'] = False
try:
fileno = obj['create_cb'](obj['opaque'])
except:
@@ -89,7 +91,9 @@
now = time.time()
for (fileno, obj) in self._channels.items():
if (now - obj['read_time']) >= self._timeout:
- self.log.debug("Timeout on fileno %d.", fileno)
+ if not obj.get('timeout_seen', False):
+ self.log.debug("Timeout on fileno %d.", fileno)
+ obj['timeout_seen'] = True
try:
obj['timeout_cb'](obj['opaque'])
obj['read_time'] = now
--
To view, visit http://gerrit.ovirt.org/27627
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82e868ce7c0ab28a9f7983887a097f760c3d0f69
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: Create GuestAgent instance in __init__ and connect later
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: Create GuestAgent instance in __init__ and connect later
......................................................................
Create GuestAgent instance in __init__ and connect later
This is not only a cosmetic improvement. There are cases where we
are trying to call methods of the GuestAgent before the instance was
created. To avoid these race conditions we're creating the instance of
the guest agent already in the __init__ phase.
Change-Id: I82f7397b01bff48a3c635eee9912cc67cf722b13
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/guestIF.py
M vdsm/vm.py
2 files changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/26142/1
diff --git a/vdsm/guestIF.py b/vdsm/guestIF.py
index 1f8d18d..1eaa42b 100644
--- a/vdsm/guestIF.py
+++ b/vdsm/guestIF.py
@@ -108,7 +108,7 @@
MAX_MESSAGE_SIZE = 2 ** 20 # 1 MiB for now
def __init__(self, socketName, channelListener, log, user='Unknown',
- ips='', connect=True):
+ ips=''):
self.effectiveApiVersion = _IMPLICIT_API_VERSION_ZERO
self.log = log
self._socketName = socketName
@@ -128,7 +128,8 @@
self._agentTimestamp = 0
self._channelListener = channelListener
self._messageState = MessageState.NORMAL
- if connect:
+
+ def connect(self):
try:
self._prepare_socket()
except:
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 1390c6e..7fbf07a 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -2008,7 +2008,6 @@
self._volPrepareLock = threading.Lock()
self._initTimePauseCode = None
self._initTimeRTC = long(self.conf.get('timeOffset', 0))
- self.guestAgent = None
self._guestEvent = 'Powering up'
self._guestEventTime = 0
self._vmStats = None
@@ -2028,6 +2027,8 @@
self.conf['vmName'] = 'n%s' % self.id
self._guestSocketFile = self._makeChannelPath(_VMCHANNEL_DEVICE_NAME)
self._qemuguestSocketFile = self._makeChannelPath(_QEMU_GA_DEVICE_NAME)
+ self.guestAgent = guestIF.GuestAgent(
+ self._guestSocketFile, self.cif.channelListener, self.log)
self._lastXMLDesc = '<domain><uuid>%s</uuid></domain>' % self.id
self._devXmlHash = '0'
self._released = False
@@ -3128,9 +3129,8 @@
# VmStatsThread may use block devices info from libvirt.
# So, run it after you have this info
self._initVmStats()
- self.guestAgent = guestIF.GuestAgent(
- self._guestSocketFile, self.cif.channelListener, self.log,
- connect=utils.tobool(self.conf.get('vmchannel', 'true')))
+ if utils.tobool(self.conf.get('vmchannel', 'true')):
+ self.guestAgent.connect()
self._guestCpuRunning = (self._dom.info()[0] ==
libvirt.VIR_DOMAIN_RUNNING)
--
To view, visit http://gerrit.ovirt.org/26142
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82f7397b01bff48a3c635eee9912cc67cf722b13
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: logging: Add log handler that enforces perms
by dkuznets@redhat.com
Dima Kuznetsov has uploaded a new change for review.
Change subject: logging: Add log handler that enforces perms
......................................................................
logging: Add log handler that enforces perms
This handler, extending WatchedFileHandler, given the desired uid + gid of the
log file, checks that the running process satisfies the uid + gid
requirement.
Change-Id: I0a4d7212cb311b22e4fb60ffdc45163a496a74d6
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
M vdsm/logUtils.py
1 file changed, 16 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/26728/1
diff --git a/vdsm/logUtils.py b/vdsm/logUtils.py
index 6949d44..dd16249 100644
--- a/vdsm/logUtils.py
+++ b/vdsm/logUtils.py
@@ -19,6 +19,8 @@
#
import logging
+import logging.handlers
+import os
import sys
from functools import wraps
from inspect import ismethod
@@ -163,3 +165,17 @@
raise
except:
self.handleError(record)
+
+
+class EnforcingWatchedFileHandler(logging.handlers.WatchedFileHandler):
+ def __init__(self, uid, gid, *args, **kwargs):
+ self._uid = uid
+ self._gid = gid
+ logging.handlers.WatchedFileHandler.__init__(self, *args, **kwargs)
+
+ def _open(self):
+ if (os.geteuid() != self._uid) or (os.getegid() != self._gid):
+ raise RuntimeError(
+ "Attempt to open log with incorrect credentials"
+ )
+ return logging.handlers.WatchedFileHandler._open(self)
--
To view, visit http://gerrit.ovirt.org/26728
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a4d7212cb311b22e4fb60ffdc45163a496a74d6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
9 years, 8 months