Change in vdsm[master]: vm: hyperv: hyperv enlightenment optimizations
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: hyperv: hyperv enlightenment optimizations
......................................................................
vm: hyperv: hyperv enlightenment optimizations
This patch the hyperv enlightenment optimizations.
The optimizations are both for stability and for performance, and they
are added on top of the HyperV support.
The parameters are hardcoded and not externally configurable because
they are not supposed to be changed very often, if changed at all;
moreover, this patch already implements the optimal recommended settings.
Change-Id: Ia10cb4ce254b6e6f560c045aff9e68846fe4771f
Bug-Url: https://bugzilla.redhat.com/1083529
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmTests.py
M vdsm/virt/vm.py
2 files changed, 18 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/29234/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 7ee2eb8..9317887 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -327,6 +327,8 @@
<acpi/>
<hyperv>
<relaxed state="on"/>
+ <vapic state="on"/>
+ <spinlocks retries="8191" state="on"/>
</hyperv>
</features>"""
conf = {'hypervEnable': 'true'}
@@ -382,7 +384,7 @@
def testHyperVClockXML(self):
clockXML = """
<clock adjustment="-3600" offset="variable">
- <timer name="rtc" tickpolicy="catchup" track="guest"/>
+ <timer name="hypervclock" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>"""
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ec8ca12..4f3c531 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -717,13 +717,20 @@
<clock offset="variable" adjustment="-3600">
<timer name="rtc" tickpolicy="catchup">
</clock>
+
+ for hyperv:
+ <clock offset="variable" adjustment="-3600">
+ <timer name="hypervclock" tickpolicy="catchup">
+ </clock>
"""
+
+ clockName = 'hypervclock' if self._isHyperV() else 'rtc'
+ # 'hypervclock' does not support the 'track' attribute.
+ # libvirt docs is not very clear here.
m = XMLElement('clock', offset='variable',
adjustment=str(self.conf.get('timeOffset', 0)))
- rtc = m.appendChildWithArgs('timer', name='rtc', tickpolicy='catchup')
- if utils.tobool(self.conf.get('hypervEnable', 'false')):
- rtc.setAttrs(track='guest')
+ m.appendChildWithArgs('timer', name=clockName, tickpolicy='catchup')
m.appendChildWithArgs('timer', name='pit', tickpolicy='delay')
if self.arch == caps.Architecture.X86_64:
@@ -841,6 +848,11 @@
hyperv.appendChildWithArgs('relaxed', state='on')
# turns off an internal Windows watchdog, and by doing so avoids
# some high load BSODs.
+ hyperv.appendChildWithArgs('vapic', state='on')
+ hyperv.appendChildWithArgs(
+ 'spinlocks', state='on', retries='8191')
+ # performance optimization flags, that can improve the performance
+ # by 10% to much more (in extreme cases of resources overcommit).
def appendCpu(self):
"""
--
To view, visit http://gerrit.ovirt.org/29234
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia10cb4ce254b6e6f560c045aff9e68846fe4771f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: client: Add warning prompt on dangerous commands
by dkuznets@redhat.com
Dima Kuznetsov has uploaded a new change for review.
Change subject: client: Add warning prompt on dangerous commands
......................................................................
client: Add warning prompt on dangerous commands
Added a warning and confirmation prompt for the following commands:
* deactivateStorageDomain
* deleteImage
* deleteVolume
* deleteVolumeByDescr
* destroyStoragePool
* extendStorageDomain
* extendVolume
* forcedDetachStorageDomain
* formatStorageDomain
* mergeSnapshots
* moveImage
* moveMultiImage
* reconstructMaster
* releaseDomainLock
* removeVG
Also added '--force' flag to bypass warnings and prompts (intended for
scripts).
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1005923
Change-Id: Idea34ad7c3d5b66993bcb56b61e7edb0549ef9fb
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
M client/vdsClient.py
M lib/vdsm/vdscli.py.in
M tests/vdsClientTests.py
3 files changed, 95 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/28174/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index 0235837..0eb4aac 100644
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -85,6 +85,7 @@
print "-m\tList supported methods and their params (Short help)"
print "-s [--truststore path]\tConnect to server with SSL."
print "-o, --oneliner\tShow the key-val information in one line."
+ print "--force\tDo not prompt on dangerous commands (not recommended)."
print "\tIf truststore path is not specified, use defaults."
print "\nCommands"
verbs = cmd.keys()
@@ -2070,11 +2071,12 @@
'Create a new VG from devices devlist (list of dev '
'GUIDs)'
)),
- 'removeVG': (serv.removeVG,
+ 'removeVG': (vdscli.request_confirmation(serv.removeVG),
('<vgUUID>',
'remove the VG identified by its UUID'
)),
- 'extendStorageDomain': (serv.extendStorageDomain,
+ 'extendStorageDomain': (vdscli.request_confirmation(
+ serv.extendStorageDomain),
('<sdUUID> <spUUID> <devlist>',
'Extend the Storage Domain by adding devices'
' devlist (list of dev GUIDs)'
@@ -2132,7 +2134,8 @@
('<spUUID> <sdUUID>',
'acquire storage domain lock'
)),
- 'releaseDomainLock': (serv.releaseDomainLock,
+ 'releaseDomainLock': (vdscli.request_confirmation(
+ serv.releaseDomainLock),
('<spUUID> <sdUUID>',
'release storage domain lock'
)),
@@ -2154,7 +2157,8 @@
('<spUUID> <vmUUID> [sdUUID]',
'Remove VM from pool or Backup domain'
)),
- 'reconstructMaster': (serv.reconstructMaster,
+ 'reconstructMaster': (vdscli.request_confirmation(
+ serv.reconstructMaster),
('<spUUID> <poolName> <masterDom> '
'<domDict>({sdUUID1=status,sdUUID2=status,...})'
' <masterVersion>, [<lockPolicy> '
@@ -2171,7 +2175,8 @@
'Create new storage pool with single/multiple '
'image data domain'
)),
- 'destroyStoragePool': (serv.destroyStoragePool,
+ 'destroyStoragePool': (vdscli.request_confirmation(
+ serv.destroyStoragePool),
('<spUUID> <id> <scsi-key>',
'Destroy storage pool',
'Parameter scsi-key is ignored (maintained '
@@ -2227,7 +2232,8 @@
'Activate a storage domain that is already '
'a member in a storage pool.'
)),
- 'deactivateStorageDomain': (serv.deactivateStorageDomain,
+ 'deactivateStorageDomain': (vdscli.request_confirmation(
+ serv.deactivateStorageDomain),
('<domain UUID> <pool UUID> <new master '
'domain UUID> <masterVer>',
'Deactivate a storage domain. '
@@ -2241,12 +2247,14 @@
' UUID> <masterVer>',
'Detach a storage domain from a storage pool.'
)),
- 'forcedDetachStorageDomain': (serv.forcedDetachStorageDomain,
+ 'forcedDetachStorageDomain': (vdscli.request_confirmation(
+ serv.forcedDetachStorageDomain),
('<domain UUID> <pool UUID>',
'Forced detach a storage domain from a '
'storage pool.'
)),
- 'formatStorageDomain': (serv.formatStorageDomain,
+ 'formatStorageDomain': (vdscli.request_confirmation(
+ serv.formatStorageDomain),
('<domain UUID> [<autoDetach>]',
'Format detached storage domain.'
)),
@@ -2269,7 +2277,8 @@
'<srcImgUUID> <srcVolUUID>',
'Creates new volume or snapshot'
)),
- 'extendVolumeSize': (serv.extendVolumeSize, (
+ 'extendVolumeSize': (vdscli.request_confirmation(
+ serv.extendVolumeSize), (
'<spUUID> <sdUUID> <imgUUID> <volUUID> <newSize>',
'Extend the volume size (virtual disk size seen by the guest).',
)),
@@ -2287,12 +2296,13 @@
'<Legality>',
'Set volume legality (ILLEGAL/LEGAL).'
)),
- 'deleteVolume': (serv.deleteVolume,
+ 'deleteVolume': (vdscli.request_confirmation(serv.deleteVolume),
('<sdUUID> <spUUID> <imgUUID> <volUUID>,...,<volUUID>'
' <postZero> [<force>]',
'Deletes an volume if its a leaf. Else returns error'
)),
- 'deleteVolumeByDescr': (serv.deleteVolumeByDescr,
+ 'deleteVolumeByDescr': (vdscli.request_confirmation(
+ serv.deleteVolumeByDescr),
('<part of description> <sdUUID> <spUUID> '
'<imgUUID>',
'Deletes list of volumes(only leafs) '
@@ -2391,11 +2401,11 @@
' <enabled = true/false>',
'Enable or disable Hosted Engine HA'
' maintenance')),
- 'deleteImage': (serv.deleteImage,
+ 'deleteImage': (vdscli.request_confirmation(serv.deleteImage),
('<sdUUID> <spUUID> <imgUUID> [<postZero>] [<force>]',
'Delete Image folder with all volumes.',
)),
- 'moveImage': (serv.moveImage,
+ 'moveImage': (vdscli.request_confirmation(serv.moveImage),
('<spUUID> <srcDomUUID> <dstDomUUID> <imgUUID> <vmUUID>'
' <op = COPY_OP/MOVE_OP> [<postZero>] [ <force>]',
'Move/Copy image between storage domains within same '
@@ -2423,7 +2433,7 @@
'Download an image from a remote endpoint using the specified',
'methodArgs.'
)),
- 'moveMultiImage': (serv.moveMultiImage,
+ 'moveMultiImage': (vdscli.request_confirmation(serv.moveMultiImage),
('<spUUID> <srcDomUUID> <dstDomUUID> '
'<imgList>({imgUUID=postzero,'
'imgUUID=postzero,...}) <vmUUID> [<force>]',
@@ -2439,7 +2449,7 @@
'Do it by collapse and copy the whole chain '
'(baseVolUUID->srcVolUUID)'
)),
- 'mergeSnapshots': (serv.mergeSnapshots,
+ 'mergeSnapshots': (vdscli.request_confirmation(serv.mergeSnapshots),
('<sdUUID> <spUUID> <vmUUID> <imgUUID> <Ancestor '
'Image uuid> <Successor Image uuid> [<postZero>]',
'Merge images from successor to ancestor.',
@@ -2574,8 +2584,8 @@
try:
opts, args = getopt.getopt(sys.argv[1:], "hmso", ["help", "methods",
"SSL", "truststore=",
- "oneliner"])
-
+ "oneliner", "force"])
+ vdscli.REQUEST_CONFIRMATION = True
for o, v in opts:
if o == "-h" or o == "--help":
usage(commands)
@@ -2589,6 +2599,8 @@
serv.truststore = v
if o == '-o' or o == '--oneliner':
serv.pretty = False
+ if o == '--force':
+ vdscli.REQUEST_CONFIRMATION = False
if len(args) < 2:
raise Exception("Need at least two arguments")
server, command = args[0:2]
diff --git a/lib/vdsm/vdscli.py.in b/lib/vdsm/vdscli.py.in
index 5fa7528..2ac21b2 100644
--- a/lib/vdsm/vdscli.py.in
+++ b/lib/vdsm/vdscli.py.in
@@ -21,6 +21,7 @@
import xmlrpclib
import subprocess
+import functools
import os
import re
import sys
@@ -165,3 +166,25 @@
d_useSSL, d_tsPath)
server = connect()
print server.getVdsCapabilities()
+
+
+USER_WARNING = """
+Please note that vdsClient is not a supported tool and should be used only with
+direct guidance from support representative.
+
+This operation might cause data corruption, would you like to proceed?
+[n][Y] """.lstrip()
+
+
+REQUEST_CONFIRMATION = False
+
+
+def request_confirmation(f):
+ @functools.wraps(f)
+ def wrapper(*args, **kwargs):
+ if REQUEST_CONFIRMATION:
+ resp = raw_input(USER_WARNING).decode('string_escape')
+ if resp != 'Y':
+ sys.exit(1)
+ return f(*args, **kwargs)
+ return wrapper
diff --git a/tests/vdsClientTests.py b/tests/vdsClientTests.py
index 41e93fc..8d9b943 100644
--- a/tests/vdsClientTests.py
+++ b/tests/vdsClientTests.py
@@ -22,12 +22,15 @@
from tempfile import mkstemp
from contextlib import contextmanager
import subprocess
+import sys
+import StringIO
from testrunner import VdsmTestCase as TestCaseBase
from monkeypatch import MonkeyPatch
import vdsClient
from vdsm.vdscli import __getLocalVdsName as getLocalVdsName
+import vdsm.vdscli as vdscli
@contextmanager
@@ -150,6 +153,7 @@
class vdscliTests(TestCaseBase):
+
@MonkeyPatch(subprocess, 'Popen', lambda *y, **x: _FakePopen(
'subject= /O=VDSM Certificate/CN=myhost\n'))
def test__getLocalVdsName1(self):
@@ -166,3 +170,42 @@
def test__getLocalVdsName3(self):
cn = getLocalVdsName('fake')
self.assertEquals('0', cn)
+
+
+class ConfirmationTests(TestCaseBase):
+ def testDefaultOff(self):
+ @vdscli.request_confirmation
+ def foobar():
+ return 101
+
+ self.assertEquals(foobar(), 101)
+
+ @MonkeyPatch(vdscli, 'REQUEST_CONFIRMATION', True)
+ @MonkeyPatch(sys, 'stdin', StringIO.StringIO('n\n'))
+ def testDenied(self):
+ lst = []
+
+ @vdscli.request_confirmation
+ def appent_to_lst():
+ lst.append(1)
+
+ try:
+ appent_to_lst()
+ except SystemExit:
+ pass
+ self.assertEquals(lst, [])
+
+ @MonkeyPatch(vdscli, 'REQUEST_CONFIRMATION', True)
+ @MonkeyPatch(sys, 'stdin', StringIO.StringIO('Y\n'))
+ def testConfirmed(self):
+ lst = []
+
+ @vdscli.request_confirmation
+ def appent_to_lst():
+ lst.append(1)
+
+ try:
+ appent_to_lst()
+ except SystemExit:
+ pass
+ self.assertEquals(lst, [1])
--
To view, visit http://gerrit.ovirt.org/28174
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idea34ad7c3d5b66993bcb56b61e7edb0549ef9fb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: spice: support to agent file transfer disable
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: spice: support to agent file transfer disable
......................................................................
spice: support to agent file transfer disable
Spice has agent based file transfer support.
This option can be disabled in QEMU, and libvirt has support
to pass this flag to the underlying QEMU.
This patch expose this capability in VDSM, in the VM definition,
implementing the VDSM part of bz983019.
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: Icc98a346baca4ab163ff30e891ae80535e49caa4
Bug-Url: https://bugzilla.redhat.com/983019
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M debian/control
M tests/vmTests.py
M vdsm.spec.in
M vdsm/virt/vm.py
M vdsm_api/vdsmapi-schema.json
5 files changed, 40 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/26917/1
diff --git a/debian/control b/debian/control
index 45c2b1c..ddbaab3 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@
python-cpopen (>= 1.3),
python-dmidecode,
python-ethtool (>=0.8),
- python-libvirt (>= 1.0.2),
+ python-libvirt (>= 1.2.2),
python-m2crypto,
python-netaddr,
python-nose,
@@ -81,8 +81,8 @@
libnl1,
libsanlock-client1 (>= 2.4),
libsanlock-dev (>= 2.4),
- libvirt-bin (>= 1.0.2),
- libvirt0 (>= 1.0.2),
+ libvirt-bin (>= 1.2.2),
+ libvirt0 (>= 1.2.2),
linux-image-generic (>= 3.6),
logrotate,
lvm2 (>= 2.02.95),
@@ -98,7 +98,7 @@
python-dmidecode,
python-ethtool (>= 0.8),
python-ethtool (>= 0.8),
- python-libvirt (>= 1.0.2),
+ python-libvirt (>= 1.2.2),
python-m2crypto,
python-netaddr,
python-parted,
@@ -294,7 +294,7 @@
Package: vdsm-hook-sriov
Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, python (>=2.7.3), vdsm (>= ${source:Version}), libvirt-bin (>= 1.0.2-1)
+Depends: ${shlibs:Depends}, ${misc:Depends}, python (>=2.7.3), vdsm (>= ${source:Version}), libvirt-bin (>= 1.2.2-1)
Description: sr-iov support for VDSM
sr-iov hook enable to add virtual functions exposed by the device
directly to a virtual machine.
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 91ee466..11695b3 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -421,6 +421,20 @@
passwdValidTo="1970-01-01T00:00:01" port="-1"
tlsPort="-1" type="spice">
<channel mode="secure" name="main"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <filetransfer enable="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 = [
@@ -432,6 +446,16 @@
{'type': 'graphics', 'device': 'spice',
'specParams': {
'port': '-1', 'tlsPort': '-1',
+ 'spiceSecureChannels': 'smain'}},
+
+ {'type': 'graphics', 'device': 'spice',
+ 'specParams': {
+ 'port': '-1', 'tlsPort': '-1',
+ 'fileTransferEnable': 'false'}},
+
+ {'type': 'graphics', 'device': 'spice',
+ 'specParams': {
+ 'port': '-1', 'tlsPort': '-1',
'spiceSecureChannels': 'smain'}}]
self._verifyGraphicsXML(expectedXMLs, vmConfs, False)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index fd47bf6..af339e2 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -131,7 +131,7 @@
%endif
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 18
-Requires: libvirt-daemon >= 1.0.2-1
+Requires: libvirt-daemon >= 1.2.2-1
Requires: libvirt-daemon-config-nwfilter
Requires: libvirt-daemon-driver-network
Requires: libvirt-daemon-driver-nwfilter
@@ -140,7 +140,7 @@
%if 0%{?rhel}
Requires: libvirt >= 0.10.2-29.el6_5.4
%else
-Requires: libvirt >= 1.0.2-1
+Requires: libvirt >= 1.2.2-1
%endif
%endif
Requires: libvirt-python, libvirt-lock-sanlock, libvirt-client
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d68c292..27c2aab 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1415,6 +1415,10 @@
clipboard = XMLElement('clipboard', copypaste='no')
graphics.appendChild(clipboard)
+ if not utils.tobool(self.specParams.get('fileTransferEnable', True)):
+ filetransfer = XMLElement('filetransfer', enable='no')
+ graphics.appendChild(filetransfer)
+
# handle deprecated channel name in a smart way,
# not just chop 1st char!
if graphicsAttrs['type'] == 'spice':
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 0300a27..0a8c506 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2523,12 +2523,16 @@
# @copyPasteEnable: #optional Specify if copy and paste is enabled.
# Currently relevant for @spice devices only.
#
+# @fileTransferEnable: #optional Specify if file transfer is enabled.
+# Currently relevant for @qxl devices only.
+#
# Since: 4.15.0
##
{'type': 'VmGraphicsDeviceSpecParams',
'data': {'port': 'uint', '*tlsPort': 'uint', '*keyMap': 'str',
'*disableTicketing': 'bool', '*displayNetwork': 'str',
- '*spiceSecureChannels': 'str', '*copyPasteEnable': 'bool'}}
+ '*spiceSecureChannels': 'str', '*copyPasteEnable': 'bool',
+ '*fileTransferEnable': 'bool'}}
##
# @VmGraphicsDevice:
--
To view, visit http://gerrit.ovirt.org/26917
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc98a346baca4ab163ff30e891ae80535e49caa4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: vm: make new timekeeping revertable
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: make new timekeeping revertable
......................................................................
vm: make new timekeeping revertable
The commit Icb0752e54a4cb9ff609b8ddfaf5c8fe2ed5b9e72
implemented the new timekeeping options recommended
by QEMU developers.
In order to maximize the backward compatibility and
to deal with possible regression with old guests,
this patch makes the new timekeeping settings revertable
by exposing a new configuration variable.
The default is enabled because those settings, being
recommended, are supposed to be safe.
Change-Id: I471be44454dcae6e73c46a473eb1eee19a5275ab
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/vm.py
2 files changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/24443/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 01590a1..075face 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -192,6 +192,9 @@
('transient_disks_repository', '@VDSMLIBDIR@/transient',
'Local path to the transient disks repository.'),
+
+ ('new_timekeeping_enable', 'true',
+ 'Enable the new recomended QEMU time keeping settings'),
]),
# Section: [ksm]
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 9371049..d3baca8 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -970,10 +970,12 @@
m = XMLElement('clock', offset='variable',
adjustment=str(self.conf.get('timeOffset', 0)))
m.appendChildWithArgs('timer', name='rtc', tickpolicy='catchup')
- m.appendChildWithArgs('timer', name='pit', tickpolicy='delay')
- if self.arch == caps.Architecture.X86_64:
- m.appendChildWithArgs('timer', name='hpet', present='no')
+ if config.getboolean('vars', 'new_timekeeping_enable'):
+ m.appendChildWithArgs('timer', name='pit', tickpolicy='delay')
+
+ if self.arch == caps.Architecture.X86_64:
+ m.appendChildWithArgs('timer', name='hpet', present='no')
self.dom.appendChild(m)
--
To view, visit http://gerrit.ovirt.org/24443
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I471be44454dcae6e73c46a473eb1eee19a5275ab
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: gluster: command to create a public key file
by dnarayan@redhat.com
Hello Bala.FA,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/17644
to review the following change.
Change subject: gluster: command to create a public key file
......................................................................
gluster: command to create a public key file
This executes the command to create a public key file
which will have public keys of all the hosts of source cluster.
This is needed for password-less communication between
slave cluster hosts during geo-replication
Change-Id: If8c979a89ce11a1622819c474b59dcf088733594
Signed-off-by: ndarshan <dnarayan(a)redhat.com>
---
M vdsm/gluster/cli.py
M vdsm/gluster/exception.py
2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/17644/1
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index bac6d1c..64529ae 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -897,3 +897,12 @@
return _parseVolumeProfileInfo(xmltree, nfs)
except _etreeExceptions:
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
+
+@makePublic
+def createPublicKeyFile():
+ command = _getGlusterSystemCmd() + ["execute", "gsec_create"]
+ rc, out, err = _execGluster(command)
+ if rc:
+ raise ge.GlusterGeoRepPublicKeyFileCreationFailedException(rc, out, err)
+ else:
+ return True
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index c569a9e..1ee73bb 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -484,3 +484,14 @@
prefix = "%s: " % (action)
self.message = prefix + "Service action is not supported"
self.err = [self.message]
+
+#geo-replication
+class GlusterGeoRepException(GlusterException):
+ code = 4560
+ message = "Gluster Geo-Replication Exception"
+
+
+class GlusterGeoRepPublicKeyFileCreationFailedException(GlusterGeoRepException):
+ code = 4561
+ message = "Creation of public key file failed"
+
--
To view, visit http://gerrit.ovirt.org/17644
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If8c979a89ce11a1622819c474b59dcf088733594
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ndarshan <dnarayan(a)redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: virt: Add a function to execute a qemu monitor command
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: virt: Add a function to execute a qemu monitor command
......................................................................
virt: Add a function to execute a qemu monitor command
Sometimes it is necessary to execute a monitor command directly (eg. if
libvirt does not yet support a certain qemu feature). Libvirt will mark
the VM as 'tainted' once this is done for the first time. The reason is
that making modifications to a VM using this facility could cause a
split-brain situation. It is generally harmless to execute monitor
commands which act in a read-only fashion. This function is also useful
as a utility for developers who are working on new features.
Change-Id: I3e9e07ba0c236c0938b129ae90af825f18f0e644
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/27950/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9cc9958..de27a53 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -30,9 +30,11 @@
import threading
import time
import xml.dom.minidom
+import json
# 3rd party libs imports
import libvirt
+import libvirt_qemu
# vdsm imports
from vdsm import constants
@@ -4948,6 +4950,15 @@
if 'tlsPort' in dev:
self.conf['displaySecurePort'] = dev['tlsPort']
+ def _internalQMPMonitorCommand(self, cmdDict):
+ """
+ Execute a qemu monitor command directly.
+ WARNING: This will cause libvirt to mark the VM as tainted.
+ """
+ jsonCmd = json.dumps(cmdDict)
+ ret = libvirt_qemu.qemuMonitorCommand(self._dom, jsonCmd, 0)
+ return json.loads(ret)
+
def _getNetworkIp(network):
try:
--
To view, visit http://gerrit.ovirt.org/27950
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e9e07ba0c236c0938b129ae90af825f18f0e644
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: storage: ignore missing pv metadata
by xfrancis@redhat.com
Xavi Francisco has uploaded a new change for review.
Change subject: storage: ignore missing pv metadata
......................................................................
storage: ignore missing pv metadata
Ignore missing metadata when trying to parse PV information from a
problematic LVM device.
When vdsm tries to read metadata from a LVM physical volume and
there's an error, the lvm command exits normally but no pv metadata
is retrieved and a message is printed in stderr. When this happens the
method getPV() in LVM returns None. This has to be checked whenever the
PV metadata is needed to avoid throwing an exception.
Change-Id: I9932b044c8b439dc8b1f09191a5d89f4bc44c38a
Bug-Url: https://bugzilla.redhat.com/1048696
Signed-off-by: Xavi Francisco <xfrancis(a)redhat.com>
---
M vdsm/storage/blockSD.py
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/27442/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 377b132..c41e737 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -668,6 +668,10 @@
continue
pv = lvm.getPV(dev)
+ if not pv:
+ cls.log.warning("Could not get metadata from the device: %s",
+ dev)
+ continue
pvInfo = {}
pvInfo["guid"] = os.path.basename(pv.name)
pvInfo["uuid"] = pv.uuid
--
To view, visit http://gerrit.ovirt.org/27442
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9932b044c8b439dc8b1f09191a5d89f4bc44c38a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xavi Francisco <xfrancis(a)redhat.com>
9 years, 1 month
Change in vdsm[master]: Query interface for all VM fields
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: Query interface for all VM fields
......................................................................
Query interface for all VM fields
Change-Id: Iddb4657d738ca0406950d07b84a7c85721e80b78
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1083070
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
A lib/vdsm/trackable.py
M vdsm/API.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vm.py
4 files changed, 511 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/28819/1
diff --git a/lib/vdsm/trackable.py b/lib/vdsm/trackable.py
new file mode 100644
index 0000000..7455025
--- /dev/null
+++ b/lib/vdsm/trackable.py
@@ -0,0 +1,223 @@
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+"""
+ Implementation for Trackable, a wrapper for objects whose values should be
+ trackable for changes
+"""
+
+import collections
+import threading
+
+
+class ChangeCounter(object):
+ def __init__(self):
+ self._counter_lock = threading.Lock()
+ self._current = 0
+
+ def next(self):
+ with self._counter_lock:
+ self._current += 1
+ return self._current
+
+
+_counter = ChangeCounter()
+
+
+class Trackable(object):
+ """
+ Trackable implements common functionality of TrackableMapping and
+ TrackableSequence and it is not required to be used.
+ """
+ def __init__(self):
+ super(Trackable, self).__init__()
+ self._last_changed = _counter.next()
+ self._item_last_changed = {}
+ self._tracked = None
+ self._watcher = None
+ self._track_depth = 0
+
+ def _set_item(self, key, value):
+ needs_update = True
+ if key in self._tracked:
+ old = self._tracked[key]
+ if isinstance(old, Trackable):
+ old._update(value)
+ # if an item is updated through _update it does not need to
+ # we are not propagating the update, this would bubble up on
+ # it's own
+ needs_update = False
+ elif old == value:
+ # Not updated, no change required
+ needs_update = False
+ else:
+ self._tracked.__setitem__(key, _wrap(value, self,
+ self._track_depth))
+ else:
+ self._tracked.__setitem__(key, _wrap(value, self,
+ self._track_depth))
+ if needs_update:
+ self._on_item_changed(key)
+
+ def _on_item_removed(self, key):
+ changed = _counter.next()
+ self._last_changed = changed
+ if self._watcher:
+ self._on_subitem_changed(changed)
+ del self._item_last_changed[key]
+
+ def _on_item_changed(self, key):
+ changed = _counter.next()
+ self._last_changed = changed
+ if self._watcher:
+ self._on_subitem_changed(changed)
+ self._item_last_changed[key] = changed
+
+ def _on_subitem_changed(self, changed):
+ self._last_changed = changed
+ if self._watcher:
+ self._watcher._on_subitem_changed(changed)
+
+ def changed(self, since, key=None):
+ if not key:
+ return self._last_changed > since
+ if isinstance(self._tracked.get(key, None), Trackable):
+ return self._tracked[key].changed(since=since)
+ return self._item_last_changed[key] > since
+
+ def last_changed(self):
+ return self._last_changed
+
+
+def _wrap(v, watcher, track_depth):
+ if track_depth == 0 or isinstance(v, Trackable):
+
+ return v
+ elif isinstance(v, collections.MutableSequence):
+ return TrackableSequence(tracked=v, _watcher=watcher,
+ track_depth=track_depth - 1)
+ elif isinstance(v, collections.MutableMapping):
+ return TrackableMapping(tracked=v, _watcher=watcher,
+ track_depth=track_depth - 1)
+ return v
+
+
+class TrackableSequence(collections.MutableSequence, Trackable):
+ """
+ TrackableSequence implements a mutable sequence interface to
+ track changes to the elements in the list.
+ """
+ def __init__(self, tracked=None, track_depth=0, _watcher=None):
+ super(TrackableSequence, self).__init__()
+ self._tracked = tracked.__class__() if tracked else []
+ self._track_depth = track_depth
+ self._watcher = _watcher
+ if tracked:
+ for elem in tracked:
+ self.append(elem)
+
+ def insert(self, index, value):
+ self._tracked.insert(index, _wrap(value, self, self._track_depth))
+ self._on_item_changed(index)
+
+ def _update(self, value):
+ # lists when different need a full update
+ if self._tracked != value:
+ self._item_last_changed = {}
+ self._tracked = self._tracked.__class__()
+ for elem in value:
+ self.append(elem)
+
+ def __setitem__(self, key, value):
+ self._set_item(key, value)
+
+ def __getitem__(self, key):
+ return self._tracked.__getitem__(key)
+
+ def __delitem__(self, idx):
+ self._tracked.__delitem__(idx)
+ if not isinstance(self._tracked, Trackable):
+ self._on_item_removed(idx)
+
+ def __len__(self):
+ return self._tracked.__len__()
+
+ def __iter__(self):
+ return self._tracked.__iter__()
+
+ def __hash__(self):
+ return self._tracked.__hash__()
+
+
+class TrackableMapping(Trackable, collections.MutableMapping):
+ """
+ TrackableMapping implements a mutable mapping interface to track
+ changes in the keys/values in a mapping and acts like a proxy thereof
+ """
+ def __init__(self, tracked=None, track_depth=0, _watcher=None):
+ """
+ :param tracked: The object which should be tracked usually a dict
+ :param track_depth: The depth the tracking should be applied
+ the default value is 0 which means only the current
+ objects keys are tracked.
+ :return:
+ """
+ super(TrackableMapping, self).__init__()
+ self._tracked = tracked.__class__() if tracked else {}
+ self._track_depth = track_depth
+ self._watcher = _watcher
+ if tracked:
+ for k, v in tracked.iteritems():
+ self[k] = v
+
+ def update(self, value, filter_if=None):
+ for k in value.keys():
+ if filter and filter(k):
+ continue
+ self[k] = value[k]
+
+ def _update(self, value):
+ for k in self._tracked.keys():
+ if k not in value:
+ del self[k]
+ elif self._tracked[k] != value[k]:
+ self[k] = value[k]
+ for k in value.keys():
+ if k not in self._tracked:
+ self[k] = value[k]
+
+ def __setitem__(self, key, value):
+ self._set_item(key, value)
+
+ def __getitem__(self, key):
+ return self._tracked.__getitem__(key)
+
+ def __delitem__(self, key):
+ self._tracked.__delitem__(key)
+ if not isinstance(self._tracked, Trackable):
+ self._on_item_removed(key)
+
+ def __len__(self):
+ return self._tracked.__len__()
+
+ def __iter__(self):
+ return self._tracked.__iter__()
+
+ def __hash__(self):
+ return self._tracked.__hash__()
\ No newline at end of file
diff --git a/vdsm/API.py b/vdsm/API.py
index ff2627e..5464d5f 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -353,6 +353,20 @@
return errCode['noVM']
return v.migrateStatus()
+ def query(self, fields=None, changedSince=-1, runHooks=True):
+ v = self._cif.vmContainer.get(self._UUID)
+ if not v:
+ return errCode['noVM']
+
+ if runHooks:
+ hooks.before_get_vm_stats()
+ stats = v.query(fields=fields, changedSince=changedSince).copy()
+ stats['vmId'] = self._UUID
+ if runHooks:
+ stats = hooks.after_get_vm_stats([stats])[0]
+ return {'status': doneCode, 'dataList': [stats]}
+
+
def getStats(self, runHooks=True):
"""
Obtain statistics of the specified VM
@@ -1194,6 +1208,21 @@
self.log.error("failed to retrieve hardware info", exc_info=True)
return errCode['hwInfoErr']
+ def queryVms(self, vmIDs=None, fields=None, changedSince=-1):
+ hooks.before_get_all_vm_stats()
+ vms = self.getVMList()
+ statsList = []
+ for s in vms['vmList']:
+ if vmIDs and s['vmId'] not in vmIDs:
+ continue
+ response = VM(s['vmId']).query(fields=fields,
+ changedSince=changedSince,
+ runHooks=False)
+ if response:
+ statsList.append(response['dataList'][0])
+ statsList = hooks.after_get_all_vm_stats(statsList)
+ return {'status': doneCode, 'dataList': statsList}
+
def getAllVmStats(self):
"""
Get statistics of all running VMs.
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index af563c0..dc475de 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -3190,6 +3190,248 @@
{'type': 'VmShortStatus',
'data': {'vmId': 'UUID', 'status': 'VmStatus'}}
+
+##
+# @VmData:
+#
+# All available queryable data fields of a VM instance.
+#
+# @acpiEnable: #optional Indicates if ACPI is enabled inside the
+# VM
+#
+# @appsList: #optional A list of installed applications with
+# their versions
+#
+# @balloonInfo: #optional Guest memory balloon information
+#
+# @boot: #optional An alias for the type of device used to
+# boot the VM
+#
+# @cdrom: #optional The path to an ISO image used in the VM's
+# CD-ROM device
+#
+# @clientIp: #optional 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.
+#
+# @cpuShares: #optional The host scheduling priority (relative to
+# other VMs). In case both cpuShares and nice are
+# present, cpuShares will be used.
+#
+# @cpuSys: #optional Ratio of CPU time spent by qemu on other
+# than guest time
+#
+# @cpuType: #optional The type of CPU being emulated
+# special values 'hostPassthrough' and 'hostModel'
+# are reserved for host-passthrough and host-mode cpu
+# mode
+#
+# @cpuUser: #optional Ratio of CPU time spent by the guest VM
+#
+# @custom: #optional A dictionary of custom, free-form
+# properties
+#
+# @devices: #optional An array of VM devices present
+#
+# @disks: #optional Disk bandwidth/utilization statistics
+#
+# @disksUsage: #optional Info about mounted filesystems as
+# reported by the agent
+#
+# @display: #optional The type of display
+#
+# @displayInfo: #optional Display and graphics device informations.
+#
+# @displayIp: #optional The IP address to use for accessing the
+# VM display
+#
+# @displayPort: #optional The port in use for unencrypted display
+# data
+#
+# @displaySecurePort: #optional The port in use for encrypted display
+# data
+#
+# @displayType: #optional The type of display in use
+#
+# @elapsedTime: #optional The number of seconds that the VM has
+# been running
+#
+# @emulatedMachine: #optional The machine specification being emulated
+#
+# @exitCode: #optional The exit code f the VM process has ended
+#
+# @exitMessage: #optional Explains the reason that the VM process
+# has exited
+#
+# @guestCPUCount: #optional The number of CPU cores are visible as
+# online on the guest OS. This value is -1 if not
+# supported to report
+#
+# @guestFQDN: #optional Fully qualified domain name of the guest
+# OS. (Reported by the guest agent)
+#
+# @guestIPs: #optional A space separated string of assigned IPv4
+# addresses
+#
+# @keyboardLayout: #optional The keyboard layout string (eg. 'en-us')
+#
+# @kvmEnable: #optional Indicates if KVM hardware acceleration is
+# enabled
+#
+# @maxVCpus: #optional Maximum number of CPU available for the
+# guest. It is the upper boundry for hot plug CPU
+# action
+#
+# @memGuaranteedSize: #optional The amount of memory guaranteed to the VM
+# in MB
+#
+# @memSize: #optional The amount of memory assigned to the VM
+# in MB
+#
+# @memUsage: #optional The percent of memory in use by the guest
+#
+# @memoryStats: #optional Memory statistics as reported by the
+# guest agent
+#
+# @migrationProgress: #optional Indicates the percentage progress of a
+# Migration, when there is one active.
+#
+# @monitorResponse: #optional Indicates if the qemu monitor is
+# responsive
+#
+# @netIfaces: #optional Network device address info as reported
+# by the agent
+#
+# @network: #optional Network bandwidth/utilization statistics
+#
+# @nicModel: #optional A comma-separated list of NIC models in
+# use by the VM
+#
+# @nice: #optional The host scheduling priority
+#
+# @pauseCode: #optional Indicates the reason a VM has been paused
+#
+# @pid: #optional The process ID of the underlying qemu
+# process
+#
+# @serial: #optional Serial number for the VM.
+#
+# @session: #optional The current state of user interaction
+# with the VM
+#
+# @smp: #optional The number of CPUs presented to the VM
+#
+# @smpCoresPerSocket: #optional Indicates the number of CPU cores per
+# socket
+#
+# @smpThreadsPerCore: #optional Indicates the number of CPU threads per
+# core
+#
+# @statsAge: #optional The age of these statistics in seconds
+#
+# @status: #optional The current VM status
+#
+# @timeOffset: #optional The time difference from host to the VM
+# in seconds
+#
+# @transparentHugePages: #optional Indicates if the Transparent Huge Pages
+# feature is enabled for this virtual machine
+#
+# @username: #optional The username associated with the current
+# session
+#
+# @vNodeRuntimeInfo: #optional Information about the vm numa node
+# runtime pinning to host numa node.
+#
+# @vmId: #optional The VM UUID
+#
+# @vmJobs: #optional Info about active vm jobs
+#
+# @vmName: #optional The VM name
+#
+# @vmType: #optional The type of VM
+#
+# @watchdogEvent: #optional Information about the most recent
+# watchdog event
+#
+# Since: 4.15.0
+{'type': 'VmQueryResult',
+ 'data': {
+ '*acpiEnable': 'bool', '*appsList': ['str'], '*balloonInfo': 'BalloonInfo',
+ '*boot': 'VmBootMode', '*cdrom': 'str', '*clientIp': 'str',
+ '*copyPasteEnable': 'bool', '*cpuShares': 'str', '*cpuSys': 'float',
+ '*cpuType': 'str', '*cpuUser': 'float', '*custom': 'StringMap',
+ '*devices': ['VmDevice'], '*disks': 'VmDiskStatsMap',
+ '*disksUsage': ['GuestMountInfo'], '*display': 'VmDisplayType',
+ '*displayInfo': ['VmDisplayInfo'], '*displayIp': 'str',
+ '*displayPort': 'uint', '*displaySecurePort': 'uint',
+ '*displayType': 'VmDisplayType', '*elapsedTime': 'uint',
+ '*emulatedMachine': 'str', '*exitCode': 'int', '*exitMessage': 'str',
+ '*guestCPUCount': 'int', '*guestFQDN': 'str', '*guestIPs': 'str',
+ '*keyboardLayout': 'str', '*kvmEnable': 'bool', '*maxVCpus': 'uint',
+ '*memGuaranteedSize': 'uint', '*memSize': 'uint', '*memUsage': 'uint',
+ '*memoryStats': 'GuestMemoryStats', '*migrationProgress': 'uint',
+ '*monitorResponse': 'int', '*netIfaces': ['GuestNetworkDeviceInfo'],
+ '*network': 'NetworkInterfaceStatsMap', '*nicModel': 'str', '*nice': 'int',
+ '*pauseCode': 'str', '*pid': 'uint', '*serial': 'str',
+ '*session': 'GuestSessionState', '*smp': 'uint',
+ '*smpCoresPerSocket': 'uint', '*smpThreadsPerCore': 'uint',
+ '*statsAge': 'float', '*status': 'VmStatus', '*timeOffset': 'uint',
+ '*transparentHugePages': 'bool', '*username': 'str',
+ '*vNodeRuntimeInfo': 'VmNumaNodeRuntimeInfoMap', '*vmId': 'UUID',
+ '*vmJobs': 'VmJobsMap', '*vmName': 'str', '*vmType': 'VmType',
+ '*watchdogEvent': 'WatchdogEvent'}}
+
+##
+# @VM.query:
+#
+# Get statistics about a running virtual machine.
+#
+# @vmID: The UUID of the VM
+#
+# @fields: #optional A list of strings which specify the keys which
+# should be queried. All fields will be returned if this
+# value is not specified.
+#
+# @changedSince: #optional If specified, all modifications since the given
+# change id are returned. Values for fields where the value
+# has not changed since, will not be returned.
+#
+# Returns:
+# An array containing a single VmData record
+#
+# Since: 4.10.0
+##
+{'command': {'class': 'VM', 'name': 'getStats'},
+ 'data': {'vmID': 'UUID', '*fields': ['string'], '*changedSince': 'uint'},
+ 'returns': ['VmData']}
+
+##
+# @Host.queryVms:
+#
+# Query all specified virtual machines for the specified fields.
+#
+# @vmIDs: #optional A list of VM UUIDs. If not set, all VMs are used.
+#
+# @fields: #optional A list of strings which specify the keys which
+# should be queried. All fields will be returned if this
+# value is not specified.
+#
+# @changedSince: #optional If specified, all modifications since the given
+# change id are returned. Values for fields where the value
+# has not changed since, will not be returned.
+#
+# Returns:
+# A list of query results for all VMs in vmIDs or all VMs if vmIDs not set
+#
+# Since: 4.15.0
+##
+{'command': {'class': 'Host', 'name': 'queryAllVm'},
+ 'data': {'*vmIDs': ['UUID'], '*fields': ['string'], '*changedSince': 'uint'},
+ 'returns': ['VmData']}
+
##
# @VmDefinition:
#
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 4b00c51..839f72c 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -41,6 +41,7 @@
from vdsm import libvirtconnection
from vdsm import netinfo
from vdsm import qemuimg
+from vdsm import trackable
from vdsm import utils
from vdsm.compat import pickle
from vdsm.config import config
@@ -1773,6 +1774,8 @@
self._watchdogEvent = {}
self.sdIds = []
self.arch = caps.getTargetArch()
+ self._queryCacheLock = threading.Lock()
+ self._queryCache = trackable.TrackableMapping()
if (self.arch not in ['ppc64', 'x86_64']):
raise RuntimeError('Unsupported architecture: %s' % self.arch)
@@ -2663,6 +2666,20 @@
stats["watchdogEvent"] = self._watchdogEvent
return stats
+ def query(self, fields=None, changedSince=-1, runHooks=False):
+ # First we need to update the query cache
+ stats = self.getStats()
+ with self._queryCacheLock:
+ self._queryCache.update(stats)
+ self._queryCache.update(self.conf, lambda x: x.startswith('_'))
+
+ # Now we build up the response
+ result = {}
+ for k in (fields or self._queryCache.keys()):
+ if self._queryCache[k].changed(changedSince):
+ result[k] = self._queryCache[k]
+ return result
+
def _getStatsInternal(self):
"""
used by API.Vm.getStats
--
To view, visit http://gerrit.ovirt.org/28819
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iddb4657d738ca0406950d07b84a7c85721e80b78
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
9 years, 2 months
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