Change in vdsm[master]: vm: spice support to clipboard copypaste disable
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: spice support to clipboard copypaste disable
......................................................................
vm: spice support to clipboard copypaste disable
since version 0.9.3, libvirt allows to optionally disable copy and paste
in the spice protocolol:
http://libvirt.org/formatdomain.html#elementsGraphics
this patch expose this capability in VDSM, in the VM definition.
The new parameter is optional and enabled by default for backward
compatibility.
No XML changes are produced at all unless the new parameter is
specified.
Change-Id: I1f8195da0c3ba2663027b77ea8a858e5ba17c48e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmTests.py
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 38 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/22646/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index f9f2785..be1c6c1 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -229,6 +229,20 @@
<channel mode="secure" name="playback"/>
<channel mode="secure" name="record"/>
<channel mode="secure" name="display"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <clipboard copypaste="no"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <channel mode="secure" name="main"/>
</graphics>"""]
spiceChannelXML = """
@@ -242,7 +256,13 @@
{'display': 'qxl', 'displayPort': '-1', 'displaySecurePort': '-1',
'spiceSecureChannels':
- "smain,sinputs,scursor,splayback,srecord,sdisplay"}]
+ "smain,sinputs,scursor,splayback,srecord,sdisplay"},
+
+ {'display': 'qxl', 'displayPort': '-1', 'displaySecurePort': '-1',
+ 'copyPasteEnable': 'false'},
+
+ {'display': 'qxl', 'displayPort': '-1', 'displaySecurePort': '-1',
+ 'copyPasteEnable': 'true', 'spiceSecureChannels': "smain"}]
for vmConf, xml in zip(vmConfs, expectedXMLs):
vmConf.update(self.conf)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 0a602cb..306ceb3 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1108,6 +1108,12 @@
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
+
+ or
+
+ <graphics autoport="yes" port="5910" tlsPort="5890" type="spice">
+ <clipboard copypaste='no'/>
+ </graphics>
"""
graphicsAttrs = {'port': self.conf['displayPort'], 'autoport': 'yes'}
if self.conf['display'] == 'vnc':
@@ -1129,6 +1135,9 @@
for channel in self.conf['spiceSecureChannels'].split(','):
graphics.appendChildWithArgs('channel', name=channel[1:],
mode='secure')
+ if not utils.tobool(self.conf.get('copyPasteEnable', True)):
+ clipboard = XMLElement('clipboard', copypaste='no')
+ graphics.appendChild(clipboard)
vmc = XMLElement('channel', type='spicevmc')
vmc.appendChildWithArgs('target', type='virtio',
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index ce9204f..f813e77 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2781,6 +2781,10 @@
#
# @clientIp: The IP address of the client connected to the display
#
+# @copyPasteEnable: #optional Specify if copy and paste is enabled.
+# Currently relevant for @qxl devices only.
+# (new in version 4.13.0)
+#
# @cpuShares: #optional The host scheduling priority (relative to
# other VMs). In case both cpuShares and nice are
# present, cpuShares will be used.
@@ -2847,10 +2851,10 @@
# Since: 4.10.0
##
{'type': 'VmDefinition',
- 'data': {'acpiEnable': 'bool', 'clientIp': 'str', 'cpuShares': 'str',
- '*cpuType': 'str', '*custom': 'StringMap', '*devices': ['VmDevice'],
- 'display': 'VmDisplayType', 'displayIp': 'str',
- 'displayPort': 'int', 'displaySecurePort': 'int',
+ 'data': {'acpiEnable': 'bool', 'clientIp': 'str', '*copyPasteEnable': 'bool',
+ 'cpuShares': 'str', '*cpuType': 'str', '*custom': 'StringMap',
+ '*devices': ['VmDevice'], 'display': 'VmDisplayType',
+ 'displayIp': 'str', 'displayPort': 'int', 'displaySecurePort': 'int',
'*emulatedMachine': 'str', '*keyboardLayout': 'str',
'kvmEnable': 'bool', 'memSize': 'uint', 'memGuaranteedSize': 'uint',
'nicModel': 'str', 'nice': 'int', '*pauseCode': 'str',
--
To view, visit http://gerrit.ovirt.org/22646
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f8195da0c3ba2663027b77ea8a858e5ba17c48e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years
Change in vdsm[master]: Remove rsyslog requirement and leave the check of syslog fd ...
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Remove rsyslog requirement and leave the check of syslog fd availability
......................................................................
Remove rsyslog requirement and leave the check of syslog fd availability
Some use syslog-ng instead of rsyslog daemon, this provides the same fd
to communicate with syslog. Instead of hard requirement in spec file, we
leave the check during pre-start and update the output.
Change-Id: I997c6b92b5567b4593fdaf3c7dd33739f59ffb85
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1083100
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M debian/control
M debian/dependencyMap.txt
M init/vdsmd_init_common.sh.in
M vdsm.spec.in
4 files changed, 3 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/26941/1
diff --git a/debian/control b/debian/control
index 45c2b1c..24092f6 100644
--- a/debian/control
+++ b/debian/control
@@ -109,7 +109,6 @@
python-sepolgen,
qemu-kvm (>= 1.4.0),
qemu-utils (>= 1.4.0),
- rsyslog,
sanlock (>= 2.4),
sanlock-python (>= 2.4),
sasl2-bin,
diff --git a/debian/dependencyMap.txt b/debian/dependencyMap.txt
index 91ef0a3..640eb4b 100644
--- a/debian/dependencyMap.txt
+++ b/debian/dependencyMap.txt
@@ -62,7 +62,6 @@
qemu-img >= 2:0.15.0-4 qemu-utils
qemu-kvm >= 2:0.15.0-4 qemu-kvm
rpm-python python-rpm
-rsyslog rsyslog
sanlock >= 2.4-2 TooOld:sanlock libsanlock-dev libsanlock-client1
sanlock-python self packaged:sanlock-python
sed >= 4.2.1-10 sed
diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 505072e..e27cd50 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -75,8 +75,9 @@
task_syslog_available() {
if ! [ -S "/dev/log" ]; then
- echo "Cannot communicate with syslog deamon for reports. " \
- "Check rsyslog.conf"
+ echo "Cannot communicate with syslog daemon for reports. " \
+ "Install syslog daemon provider and configure it properly." \
+ "Alternatives: rsyslog, syslog-ng"
return 1
fi
return 0
diff --git a/vdsm.spec.in b/vdsm.spec.in
index fd47bf6..8de7a52 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -107,7 +107,6 @@
Requires: which
Requires: sudo >= 1.7.3
Requires: logrotate
-Requires: rsyslog
Requires: xz
Requires: ntp
Requires: iproute
--
To view, visit http://gerrit.ovirt.org/26941
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I997c6b92b5567b4593fdaf3c7dd33739f59ffb85
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
10 years
Change in vdsm[master]: virt: stats: move core static stats in a method
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: stats: move core static stats in a method
......................................................................
virt: stats: move core static stats in a method
this patch moves the basic core VM statistics
in a separate method. No functional changes.
Change-Id: I9b5f6cafe5bc1a9b1b27bf974cdeffdebf09d75a
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 19 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/26550/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ec40c67..313fd8d 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2411,22 +2411,8 @@
self._addExitedVmStats(stats)
return stats
- stats = {
- 'displayPort': self.conf['displayPort'],
- 'displaySecurePort': self.conf['displaySecurePort'],
- 'displayType': self.conf['display'],
- 'displayIp': self.conf['displayIp'],
- 'pid': self.conf['pid'],
- 'vmType': self.conf['vmType'],
- 'kvmEnable': self._kvmEnable,
- 'network': {}, 'disks': {},
- 'monitorResponse': str(self._monitorResponse),
- 'elapsedTime': str(int(time.time() - self._startTime)), }
- if 'cdrom' in self.conf:
- stats['cdrom'] = self.conf['cdrom']
- if 'boot' in self.conf:
- stats['boot'] = self.conf['boot']
-
+ stats = {}
+ self._addStaticVmStats(stats)
self._addDynamicVmStats(stats)
self._addVmStatusStats(stats)
@@ -2458,6 +2444,23 @@
if 'timeOffset' in self.conf:
stats['timeOffset'] = self.conf['timeOffset']
+ def _addStaticVmStats(self, stats):
+ stats['displayPort'] = self.conf['displayPort']
+ stats['displaySecurePort'] = self.conf['displaySecurePort']
+ stats['displayType'] = self.conf['display']
+ stats['displayIp'] = self.conf['displayIp']
+ stats['pid'] = self.conf['pid']
+ stats['vmType'] = self.conf['vmType']
+ stats['kvmEnable'] = self._kvmEnable
+ stats['network'] = {}
+ stats['disks'] = {}
+ stats['monitorResponse'] = str(self._monitorResponse),
+ stats['elapsedTime'] = str(int(time.time() - self._startTime))
+ if 'cdrom' in self.conf:
+ stats['cdrom'] = self.conf['cdrom']
+ if 'boot' in self.conf:
+ stats['boot'] = self.conf['boot']
+
def _addDynamicVmStats(self, stats):
decStats = {}
try:
--
To view, visit http://gerrit.ovirt.org/26550
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b5f6cafe5bc1a9b1b27bf974cdeffdebf09d75a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years
Change in vdsm[master]: volume: use qemuimg and remove custom qemuConvert
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: volume: use qemuimg and remove custom qemuConvert
......................................................................
volume: use qemuimg and remove custom qemuConvert
Change-Id: Ic27770241495e21737f926b1820494377467383b
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/image.py
M vdsm/storage/volume.py
2 files changed, 18 insertions(+), 47 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/26921/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 0c8232b..eac9c5a 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -743,17 +743,16 @@
dstVol.prepare(rw=True, setrw=True)
try:
- (rc, out, err) = volume.qemuConvert(
- volParams['path'], dstPath, volParams['volFormat'],
- dstVolFormat, vars.task.aborting,
- size=srcVol.getVolumeSize(bs=1),
- dstvolType=dstVol.getType())
- if rc:
- raise se.StorageException("rc: %s, err: %s" %
- (rc, err))
+ # TODO: handle preallocation with 'dd'
+ qemuimg.convert(volParams['path'], dstPath,
+ vars.task.aborting,
+ volume.fmt2str(volParams['volFormat']),
+ volume.fmt2str(dstVolFormat))
except ActionStopped:
raise
- except se.StorageException as e:
+ except qemuimg.QImgError:
+ self.log.exception('conversion failure for volume %s',
+ srcVol.volUUID)
raise se.CopyImageError(str(e))
# Mark volume as SHARED
@@ -960,7 +959,7 @@
# volume and rebase successor's children (if exists) on top of it.
# Step 1: Create an empty volume named sucessor_MERGE similar to
# ancestor volume.
- # Step 2: qemuConvert successor -> sucessor_MERGE
+ # Step 2: qemuimg.convert successor -> sucessor_MERGE
# Step 3: Rename successor to _remove_me__successor
# Step 4: Rename successor_MERGE to successor
# Step 5: Unsafely rebase successor's children on top of temporary
@@ -983,17 +982,17 @@
newVol = sdDom.produceVolume(imgUUID=srcVolParams['imgUUID'],
volUUID=newUUID)
with newVol.scopedPrepare(rw=True, justme=True, setrw=True):
-
# Step 2: Convert successor to new volume
# qemu-img convert -f qcow2 successor -O raw newUUID
- (rc, out, err) = volume.qemuConvert(
- srcVolParams['path'], newVol.getVolumePath(),
- srcVolParams['volFormat'], volParams['volFormat'],
- vars.task.aborting, size=volParams['apparentsize'],
- dstvolType=newVol.getType())
- if rc:
- self.log.error("qemu-img convert failed: rc=%s, out=%s, "
- "err=%s", rc, out, err)
+ try:
+ qemuimg.convert(srcVolParams['path'],
+ newVol.getVolumePath(),
+ vars.task.aborting,
+ volume.fmt2str(srcVolParams['volFormat']),
+ volume.fmt2str(volParams['volFormat']))
+ except qemuimg.QImgError:
+ self.log.exception('conversion failure for volume %s',
+ srcVol.volUUID)
raise se.MergeSnapshotsError(newUUID)
if chList:
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 3eeb028..de38bd4 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -25,8 +25,6 @@
from contextlib import contextmanager
import image
-from vdsm import constants
-from vdsm import utils
from vdsm import qemuimg
import storage_exception as se
import sd
@@ -987,29 +985,3 @@
by reducing the lv to minimal size required
"""
pass
-
-
-def qemuConvert(src, dst, src_fmt, dst_fmt, stop, size, dstvolType):
- """
- Convert the 'src' image (or chain of images) into a new single 'dst'
- """
- src_fmt = fmt2str(src_fmt)
- dst_fmt = fmt2str(dst_fmt)
- log.debug('(qemuConvert): COPY %s (%s) to %s (%s) START' %
- (src, src_fmt, dst, dst_fmt))
-
- if (src_fmt == "raw" and dst_fmt == "raw" and
- dstvolType == PREALLOCATED_VOL):
- (rc, out, err) = misc.ddWatchCopy(
- src=src, dst=dst,
- stop=stop, size=size)
- else:
- cmd = [constants.EXT_QEMUIMG, "convert",
- "-t", "none", "-f", src_fmt, src,
- "-O", dst_fmt, dst]
- (rc, out, err) = misc.watchCmd(cmd, stop=stop,
- ioclass=utils.IOCLASS.IDLE,
- nice=utils.NICENESS.HIGH)
-
- log.debug('(qemuConvert): COPY %s to %s DONE' % (src, dst))
- return (rc, out, err)
--
To view, visit http://gerrit.ovirt.org/26921
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic27770241495e21737f926b1820494377467383b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years
Change in vdsm[master]: spice: support to clipboard copypaste disable
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: spice: support to clipboard copypaste disable
......................................................................
spice: support to clipboard copypaste disable
since version 0.9.3, libvirt allows to optionally disable copy and paste
in the spice protocolol:
http://libvirt.org/formatdomain.html#elementsGraphics
this patch expose this capability in VDSM, in the VM definition.
The new parameter is optional and enabled by default for backward
compatibility.
No XML changes are produced at all unless the new parameter is
specified.
Change-Id: I15f3d74860b99d805d1d204704ec06afcd729484
Bug-Url: https://bugzilla.redhat.com/800155
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmTests.py
M vdsm/virt/vm.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 43 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/26916/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 96b81eb..91ee466 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -405,9 +405,38 @@
'spiceSecureChannels':
"smain,sinputs,scursor,splayback,srecord,sdisplay"}]
- self._verifyGraphicsXML(expectedXMLs, vmConfs)
+ self._verifyGraphicsXML(expectedXMLs, vmConfs, True)
- def _verifyGraphicsXML(self, expectedXMLs, vmConfs):
+ def testGraphicsDeviceXML(self):
+ expectedXMLs = [
+ """
+ <graphics autoport="yes" listen="0" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <clipboard copypaste="no"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <channel mode="secure" name="main"/>
+ </graphics>"""]
+
+ vmConfs = [
+ {'type': 'graphics', 'device': 'spice',
+ 'specParams': {
+ 'port': '-1', 'tlsPort': '-1',
+ 'copyPasteEnable': 'false'}},
+
+ {'type': 'graphics', 'device': 'spice',
+ 'specParams': {
+ 'port': '-1', 'tlsPort': '-1',
+ 'spiceSecureChannels': 'smain'}}]
+
+ self._verifyGraphicsXML(expectedXMLs, vmConfs, False)
+
+ def _verifyGraphicsXML(self, expectedXMLs, vmConfs, isLegacy):
spiceChannelXML = """
<channel type="spicevmc">
<target name="com.redhat.spice.0" type="virtio"/>
@@ -416,11 +445,12 @@
for vmConf, xml in zip(vmConfs, expectedXMLs):
vmConf.update(self.conf)
with FakeVM(vmConf) as fake:
- dev = vm.GraphicsDevice.getDeviceFromConf(vmConf)
+ dev = vm.GraphicsDevice.getDeviceFromConf(vmConf) \
+ if isLegacy else vmConf
graph = vm.GraphicsDevice(vmConf, self.log, **dev)
self.assertXML(graph.getXML(), xml)
- if fake.hasSpice():
+ if fake.hasSpice:
self.assertXML(graph.getSpiceVmcChannelsXML(),
spiceChannelXML)
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 11470f4..d68c292 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1411,10 +1411,14 @@
graphics = XMLElement('graphics', **graphicsAttrs)
+ if not utils.tobool(self.specParams.get('copyPasteEnable', True)):
+ clipboard = XMLElement('clipboard', copypaste='no')
+ graphics.appendChild(clipboard)
+
# handle deprecated channel name in a smart way,
# not just chop 1st char!
if graphicsAttrs['type'] == 'spice':
- if self.specParams.get('spiceSecureChannels'):
+ if 'spiceSecureChannels' in self.specParams:
for chan in self.specParams['spiceSecureChannels'].split(','):
graphics.appendChildWithArgs('channel', name=chan[1:],
mode='secure')
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index c25ba90..0300a27 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2520,12 +2520,15 @@
#
# @spiceSecureChannels: #optional Secure space channels, comma separated
#
+# @copyPasteEnable: #optional Specify if copy and paste is enabled.
+# Currently relevant for @spice devices only.
+#
# Since: 4.15.0
##
{'type': 'VmGraphicsDeviceSpecParams',
'data': {'port': 'uint', '*tlsPort': 'uint', '*keyMap': 'str',
'*disableTicketing': 'bool', '*displayNetwork': 'str',
- '*spiceSecureChannels': 'str'}}
+ '*spiceSecureChannels': 'str', '*copyPasteEnable': 'bool'}}
##
# @VmGraphicsDevice:
--
To view, visit http://gerrit.ovirt.org/26916
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I15f3d74860b99d805d1d204704ec06afcd729484
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years
Change in vdsm[master]: vm: simplify the releaseVm flow
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: simplify the releaseVm flow
......................................................................
vm: simplify the releaseVm flow
After inspection of the libvirt code, turns out
the time.sleep(30) we currently have in the releaseVm
flow is redundant and wasteful.
Libvirt (~1.2.3) already has hardcoded (!) timeout to handle
the QEMU process termination, and this patch leverages that.
Before this patch, the sequence of events triggered
by the dom.destroy() call in the worst case scenario
(QEMU not responding) is:
- send SIGTERM (clean shutdown request)
- wait 10s (libvirt, hardcoded)
- (fails)
- log error (libvirt, vdsm)
- wait 30s (vdsm)
- send SIGTERM (clean shutdown request)
- wait 10s (libvirt)
- (fails)
- log error (libvirt)
- send SIGKILL (forced shutdown request)
- wait 5s( libvirt, hardcoded)
total time: 10+30+10+5 = 45s (all hardcoded!)
With this patch, the flow becomes:
- send SIGTERM (clean shutdown request)
- wait 10s (libvirt, hardcoded)
- (fails)
- log error (libvirt, vdsm)
- send SIGTERM (clean shutdown request)
- wait 10s (libvirt)
- (fails)
- log error (libvirt)
- send SIGKILL (forced shutdown request)
- wait 5s( libvirt, hardcoded)
total time: 10+10+5 = 25s (no values hardcoded in VDSM)
Change-Id: Ia25794217e63dd4c755d9c141a2e941e4baa6fd3
Bug-Url: https://bugzilla.redhat.com/1091389
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 20 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/27175/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 79ff40b..655689a 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4257,16 +4257,7 @@
if self.guestAgent:
self.guestAgent.stop()
if self._dom:
- try:
- self._dom.destroyFlags(
- libvirt.VIR_DOMAIN_DESTROY_GRACEFUL)
- except libvirt.libvirtError as e:
- if (e.get_error_code() ==
- libvirt.VIR_ERR_OPERATION_FAILED):
- self.log.warn("Failed to destroy VM '%s' "
- "gracefully", self.conf['vmId'])
- time.sleep(30)
- self._dom.destroy()
+ self._destroyVm()
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
self.log.warning("libvirt domain not found", exc_info=True)
@@ -4288,6 +4279,25 @@
return {'status': doneCode}
+ def _destroyVm(self):
+ """
+ dom.destroy() goes like this (as libvirt ~1.2.3):
+ - sends SIGTERM (clean shutdown)
+ - waits for 10s (hardcoded)
+ - if !GRACEFUL:
+ - sends SIGKILL (forced shutdown)
+ - waits for 5s more (hardcoded)
+ so we actually do two clean shutdown requests and
+ if the second fails, we resort to forced shutdown.
+ """
+ try:
+ self._dom.destroyFlags(libvirt.VIR_DOMAIN_DESTROY_GRACEFUL)
+ except libvirt.libvirtError as e:
+ if e.get_error_code() == libvirt.VIR_ERR_OPERATION_FAILED:
+ self.log.warn("Failed to destroy VM '%s' "
+ "gracefully", self.conf['vmId'])
+ self._dom.destroy()
+
def deleteVm(self):
"""
Clean VM from the system
--
To view, visit http://gerrit.ovirt.org/27175
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia25794217e63dd4c755d9c141a2e941e4baa6fd3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years
Change in vdsm[ovirt-3.3]: profiling: Add an application wide profile
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: profiling: Add an application wide profile
......................................................................
profiling: Add an application wide profile
The built in Python profilers are good for single thread profile but
given the excessive multi-threaded nature of vdsm, they are useless for
understing where we spend our time.
This patch uses yappi <http://code.google.com/p/yappi> to create an
application wide profile. A new profile_enable configuration was added
to enable profiling.
Change-Id: I523f52c981f7bb34f3168d3117f00ed5eb6962f8
Relates-to: https://bugzilla.redhat.com/1074097
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/vdsm
2 files changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/26158/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index a229998..db01568 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -29,6 +29,9 @@
('core_dump_enable', 'true',
'Enable core dump.'),
+ ('profile_enable', 'false',
+ 'Enable whole process profiling (requires yappi profiler).'),
+
('host_mem_reserve', '256',
'Reserves memory for the host to prevent VMs from using all the '
'physical pages. The values are in Mbytes.'),
diff --git a/vdsm/vdsm b/vdsm/vdsm
index aa1bb87..59223ed 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -20,6 +20,7 @@
import syslog
from logging import config as lconfig
+from vdsm.config import config
from vdsm import constants
import zombieReaper
import dsaversion
@@ -55,12 +56,23 @@
signal.signal(signal.SIGUSR1, sigusr1Handler)
zombieReaper.registerSignalHandler()
+ if config.getboolean('vars', 'profile_enable'):
+ logging.debug("Starting profiling")
+ import yappi
+ yappi.start()
+
from clientIF import clientIF # must import after config is read
cif = clientIF.getInstance(log)
cif.start()
try:
while running[0]:
signal.pause()
+
+ if config.getboolean('vars', 'profile_enable'):
+ logging.debug("Stopping profiling")
+ yappi.stop()
+ stats = yappi.get_func_stats()
+ stats.save(constants.P_VDSM_RUN + 'vdsmd.prof', 'pstat')
finally:
cif.prepareForShutdown()
--
To view, visit http://gerrit.ovirt.org/26158
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I523f52c981f7bb34f3168d3117f00ed5eb6962f8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
10 years
Change in vdsm[ovirt-3.3]: clientIF: Clean up shutdown process
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: clientIF: Clean up shutdown process
......................................................................
clientIF: Clean up shutdown process
clientIF.serve used to check if shutdown process has started once every
3 seconds, leading to unwanted delay, that may cause vdsm to be killed
before a profile was written.
This patch changes clientIF.serve to start the bindings and return,
allowing the upper layer to wait for a shutdown signal in a more
efficiant way. This allows stopping a profile when shutdown signal is
received, before starting the shutdown process, ensuring that a profile
is written even if shutdown process got stuck and vdsm is killed.
This way is also more safe, as prepareForShutdown is called from the
main thread, instead of the signal handler context, where it is not safe
to call any code. In particular, setting a threading.Event in this
context cause a deadlock.
Change-Id: If7bfa9f7da81ffdfb581299cd14ec4edb50be5fb
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/clientIF.py
M vdsm/vdsm
2 files changed, 10 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/26157/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 47851b1..664011f 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -245,11 +245,9 @@
finally:
self._shutdownSemaphore.release()
- def serve(self):
+ def start(self):
for binding in self.bindings.values():
binding.start()
- while self._enabled:
- time.sleep(3)
def _initIRS(self):
self.irs = None
diff --git a/vdsm/vdsm b/vdsm/vdsm
index 4fc11c7..aa1bb87 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -39,11 +39,11 @@
def serve_clients(log):
cif = None
+ running = [True]
def sigtermHandler(signum, frame):
- if cif:
- log.debug("Received signal %s" % signum)
- cif.prepareForShutdown()
+ log.debug("Received signal %s" % signum)
+ running[0] = False
def sigusr1Handler(signum, frame):
if cif and cif.irs:
@@ -57,7 +57,12 @@
from clientIF import clientIF # must import after config is read
cif = clientIF.getInstance(log)
- cif.serve()
+ cif.start()
+ try:
+ while running[0]:
+ signal.pause()
+ finally:
+ cif.prepareForShutdown()
def run(pidfile=None):
--
To view, visit http://gerrit.ovirt.org/26157
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If7bfa9f7da81ffdfb581299cd14ec4edb50be5fb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
10 years
Change in vdsm[ovirt-3.3]: sysvinit: Give vdsm enough time to write profile
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: sysvinit: Give vdsm enough time to write profile
......................................................................
sysvinit: Give vdsm enough time to write profile
Previously vdsm was killed brutally if it did exit 2 seconds after
receiving a SIGTERM. Currently clientIF check if shutdown is started
only once every 3 seconds. This make it impossible to write profile data
when vdsm is terminated.
This patch enlarge the shutdown delay to 10 seconds. This works fine for
profiling of serveral minutes of idle vdsm.
Change-Id: I5434caff5bc95e2a76345191dec9ce4e33070a57
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M init/sysvinit/vdsmd.init.in
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/26156/1
diff --git a/init/sysvinit/vdsmd.init.in b/init/sysvinit/vdsmd.init.in
index dc7847e..32a0279 100755
--- a/init/sysvinit/vdsmd.init.in
+++ b/init/sysvinit/vdsmd.init.in
@@ -148,7 +148,8 @@
log_failure_msg "$prog: not running"
RETVAL=0
else
- killproc -p "$PIDFILE" -d 2
+ # Give process enough time for saving profiling data
+ killproc -p "$PIDFILE" -d 10
RETVAL=$?
[ "$RETVAL" = 0 ] && "@RM_PATH@" -f "$LOCK_FILE" > /dev/null 2>&1
fi
--
To view, visit http://gerrit.ovirt.org/26156
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5434caff5bc95e2a76345191dec9ce4e33070a57
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
10 years
Change in vdsm[master]: virt: graphdev: handle ticket for multiple devices
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: graphdev: handle ticket for multiple devices
......................................................................
virt: graphdev: handle ticket for multiple devices
This patch extends the setTicket() _reviveTicket()
support for the multiple graphics devices scenario.
Change-Id: I62f56ea47399b0d26aafce053ea1201457564b73
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 15 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/26897/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d5299ba..f82f335 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4246,8 +4246,16 @@
return {'status': doneCode, 'vmList': self.status()}
def setTicket(self, otp, seconds, connAct, params):
- graphics = _domParseStr(self._dom.XMLDesc(0)).childNodes[0]. \
- getElementsByTagName('graphics')[0]
+ res = {'status': doneCode}
+ for graphics in _domParseStr(self._dom.XMLDesc(0)).childNodes[0]. \
+ getElementsByTagName('graphics'):
+ res = self._setTicketForGraphicDev(graphics, otp,
+ seconds, connAct, params)
+ if res['status']['code'] != 0:
+ break
+ return res
+
+ def _setTicketForGraphicDev(self, graphics, otp, seconds, connAct, params):
graphics.setAttribute('passwd', otp)
if int(seconds) > 0:
validto = time.strftime('%Y-%m-%dT%H:%M:%S',
@@ -4268,9 +4276,12 @@
def _reviveTicket(self, newlife):
"""Revive an existing ticket, if it has expired or about to expire"""
- graphics = _domParseStr(
+ for graphics in _domParseStr(
self._dom.XMLDesc(libvirt.VIR_DOMAIN_XML_SECURE)). \
- childNodes[0].getElementsByTagName('graphics')[0]
+ childNodes[0].getElementsByTagName('graphics'):
+ self._reviveTicketForGraphicDev(graphics, newlife)
+
+ def _reviveTicketForGraphicDev(self, graphics, newlife):
validto = max(time.strptime(graphics.getAttribute('passwdValidTo'),
'%Y-%m-%dT%H:%M:%S'),
time.gmtime(time.time() + newlife))
--
To view, visit http://gerrit.ovirt.org/26897
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I62f56ea47399b0d26aafce053ea1201457564b73
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years