Change in vdsm[master]: cleanup: Networking code logging and docstring fixes
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: cleanup: Networking code logging and docstring fixes
......................................................................
cleanup: Networking code logging and docstring fixes
Change-Id: Ia50c60e6cd4aab0a4ef49d1d9a2d43b52b187ce2
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm/netmodels.py
M vdsm/sourceRoute.py
2 files changed, 19 insertions(+), 21 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/20553/1
diff --git a/vdsm/netmodels.py b/vdsm/netmodels.py
index 554ce4b..e6feeb5 100644
--- a/vdsm/netmodels.py
+++ b/vdsm/netmodels.py
@@ -139,7 +139,7 @@
class Bridge(NetDevice):
- '''This class represents traditional kernel bridges.'''
+ """This class represents traditional kernel bridges."""
MAX_NAME_LEN = 15
ILLEGAL_CHARS = frozenset(':. \t')
@@ -270,7 +270,7 @@
@classmethod
def validateOptions(cls, bonding, bondingOptions):
- 'Example: BONDING_OPTS="mode=802.3ad miimon=150"'
+ """Example: BONDING_OPTS="mode=802.3ad miimon=150\""""
with cls._validationBond(bonding) as bond:
try:
for option in bondingOptions.split():
@@ -348,7 +348,7 @@
@classmethod
def validateGateway(cls, gateway):
- '''Validates the gateway form.'''
+ """Validates the gateway form."""
try:
cls.validateAddress(gateway)
except ConfigNetworkError as cne:
diff --git a/vdsm/sourceRoute.py b/vdsm/sourceRoute.py
index 73fe075..72519d9 100644
--- a/vdsm/sourceRoute.py
+++ b/vdsm/sourceRoute.py
@@ -65,7 +65,7 @@
def configure(self, ipaddr, mask, gateway):
if gateway in (None, '0.0.0.0') or not ipaddr or not mask:
- logging.error("ipaddr, mask or gateway not received")
+ logging.error('ipaddr, mask or gateway not received')
return
self.ipaddr = ipaddr
@@ -75,10 +75,10 @@
network = netaddr.IPNetwork(str(self.ipaddr) + '/' + str(self.mask))
self.network = "%s/%s" % (network.network, network.prefixlen)
- logging.info(("Configuring gateway - ip: %s, network: %s, " +
- "subnet: %s, gateway: %s, table: %s, device: %s") %
- (self.ipaddr, self.network, self.mask, self.gateway,
- self.table, self.device))
+ logging.info('Configuring gateway - ip: %s, network: %s, subnet: %s, '
+ 'gateway: %s, table: %s, device: %s', self.ipaddr,
+ self.network, self.mask, self.gateway, self.table,
+ self.device)
self.routes = self._buildRoutes()
self.rules = self._buildRules()
@@ -87,8 +87,8 @@
self.configurator.configureSourceRoute(self.routes, self.rules,
self.device)
except IPRoute2Error as e:
- logging.error('ip binary failed during source route configuration',
- ': %s' % e.message)
+ logging.error('ip binary failed during source route configuration'
+ ': %s', e.message)
def remove(self):
self.configurator.removeSourceRoute(None, None, self.device)
@@ -116,13 +116,11 @@
try:
route = Route.fromText(entry)
except ValueError:
- logging.debug("Could not parse route %s" % entry)
+ logging.debug('Could not parse route %s', entry)
else:
if route.device == device:
- """
- When displaying routes from a table, the table is omitted,
- so add it back again
- """
+ # When displaying routes from a table, the table is
+ # omitted, so add it back again
route.table = table
routes.append(route)
@@ -133,7 +131,7 @@
if rules:
return rules[0].table
else:
- logging.error("Table not found")
+ logging.error('Table not found')
return None
@staticmethod
@@ -151,7 +149,7 @@
try:
rule = Rule.fromText(entry)
except ValueError:
- logging.debug("Could not parse rule %s" % entry)
+ logging.debug('Could not parse rule %s', entry)
else:
allRules.append(rule)
@@ -159,7 +157,7 @@
rules = [rule for rule in allRules if rule.srcDevice == device]
if not rules:
- logging.error("Routing rules not found for device %s" % device)
+ logging.error('Routing rules not found for device %s', device)
return
# Extract its destination network
@@ -172,7 +170,7 @@
return rules
def remove(self):
- logging.info("Removing gateway - device: %s" % self.device)
+ logging.info('Removing gateway - device: %s', self.device)
rules = self._getRules(self.device)
if rules:
@@ -184,7 +182,7 @@
self.device)
except IPRoute2Error as e:
logging.error('ip binary failed during source route '
- 'removal: %s' % e.message)
+ 'removal: %s', e.message)
def _isLibvirtInterfaceFallback(self):
"""
@@ -209,7 +207,7 @@
except libvirtError: # libvirt might not be started or it just fails
logging.error('Libvirt failed to answer. It might be the case that'
' this script is being run before libvirt startup. '
- ' Thus, check if vdsm owns %s an alternative way' %
+ ' Thus, check if vdsm owns %s an alternative way',
self.device)
return self._isLibvirtInterfaceFallback()
trackedInterfaces = [network.get('bridge') or network.get('iface')
--
To view, visit http://gerrit.ovirt.org/20553
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia50c60e6cd4aab0a4ef49d1d9a2d43b52b187ce2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: Move fencing logic out of API.py
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Move fencing logic out of API.py
......................................................................
Move fencing logic out of API.py
API.py should not contain logic.
In this patch I also:
- Separate the `status` action to a different function because it does
something completely different from the other action and has different
logic.
- Refactor for better code reusability readability.
- Use real exception internally and have the API layer translate them to
actual exceptions.
- Don't support port strings in methods, just in the interface.
- Don't support string booleans in the methods, just in the interface.
- Added shutdownEvent to ClientIF so there is a public standard way of
inspecting vdsm shutdown.
- Make the fencing logic use betterPopen
Change-Id: I944c6548a42612f705a410fb4290215451bca035
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm.spec.in
M vdsm/API.py
M vdsm/Makefile.am
M vdsm/clientIF.py
4 files changed, 25 insertions(+), 72 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/7190/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 23afd6b..f122cb5 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -558,6 +558,7 @@
%{_datadir}/%{vdsm_name}/caps.py*
%{_datadir}/%{vdsm_name}/clientIF.py*
%{_datadir}/%{vdsm_name}/API.py*
+%{_datadir}/%{vdsm_name}/fenceAgent.py*
%{_datadir}/%{vdsm_name}/hooking.py*
%{_datadir}/%{vdsm_name}/hooks.py*
%{_datadir}/%{vdsm_name}/libvirtev.py*
diff --git a/vdsm/API.py b/vdsm/API.py
index ae04e01..5826d81 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -19,12 +19,9 @@
#
import os
-import signal
import copy
-import subprocess
import pickle
import time
-import threading
import logging
from vdsm import utils
@@ -40,6 +37,7 @@
from vdsm.define import doneCode, errCode, Kbytes, Mbytes
import caps
from vdsm.config import config
+import fenceAgent
import supervdsm
@@ -981,82 +979,32 @@
agent is one of (rsa, ilo, drac5, ipmilan, etc)
action can be one of (status, on, off, reboot)."""
- def waitForPid(p, inp):
- """ Wait until p.pid exits. Kill it if vdsm exists before. """
- try:
- p.stdin.write(inp)
- p.stdin.close()
- while p.poll() is None:
- if not self._cif._enabled:
- self.log.debug('killing fence script pid %s', p.pid)
- os.kill(p.pid, signal.SIGTERM)
- time.sleep(1)
- try:
- # improbable race: p.pid may now belong to another
- # process
- os.kill(p.pid, signal.SIGKILL)
- except:
- pass
- return
- time.sleep(1)
- self.log.debug('rc %s inp %s out %s err %s', p.returncode,
- hidePasswd(inp),
- p.stdout.read(), p.stderr.read())
- except:
- self.log.error("Error killing fence script", exc_info=True)
-
- def hidePasswd(text):
- cleantext = ''
- for line in text.splitlines(True):
- if line.startswith('passwd='):
- line = 'passwd=XXXX\n'
- cleantext += line
- return cleantext
-
self.log.debug('fenceNode(addr=%s,port=%s,agent=%s,user=%s,' +
'passwd=%s,action=%s,secure=%s,options=%s)', addr, port, agent,
username, 'XXXX', action, secure, options)
- if action not in ('status', 'on', 'off', 'reboot'):
- raise ValueError('illegal action ' + action)
+ secure = utils.tobool(secure)
+ port = int(port)
- script = constants.EXT_FENCE_PREFIX + agent
+ if action == "status":
+ try:
+ power = fenceAgent.getFenceStatus(addr, port, agent, username,
+ password, secure, options)
+
+ return {'status': doneCode,
+ 'power': power}
+
+ except fenceAgent.FenceStatusCheckError as e:
+ return {'status': {'code': 1, 'message': str(e)}}
try:
- p = subprocess.Popen([script], stdin=subprocess.PIPE,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- close_fds=True)
- except OSError, e:
- if e.errno == os.errno.ENOENT:
- return errCode['fenceAgent']
- raise
+ fenceAgent.fenceNode(addr, port, agent, username, password, secure,
+ options, self._cif.shutdownEvent)
- inp = ('agent=fence_%s\nipaddr=%s\nlogin=%s\noption=%s\n' +
- 'passwd=%s\n') % (agent, addr, username, action, password)
- if port != '':
- inp += 'port=%s\n' % (port,)
- if utils.tobool(secure):
- inp += 'secure=yes\n'
- inp += options
- if action == 'status':
- out, err = p.communicate(inp)
- self.log.debug('rc %s in %s out %s err %s', p.returncode,
- hidePasswd(inp), out, err)
- if not 0 <= p.returncode <= 2:
- return {'status': {'code': 1,
- 'message': out + err}}
- message = doneCode['message']
- if p.returncode == 0:
- power = 'on'
- elif p.returncode == 2:
- power = 'off'
- else:
- power = 'unknown'
- message = out + err
- return {'status': {'code': 0, 'message': message},
- 'power': power}
- threading.Thread(target=waitForPid, args=(p, inp)).start()
- return {'status': doneCode}
+ return {'status': doneCode}
+
+ except fenceAgent.UnsupportedFencingAgentError:
+ return errCode['fenceAgent']
def ping(self):
"Ping the server. Useful for tests"
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 62ba982..4a7bc57 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -32,6 +32,7 @@
clientIF.py \
configNetwork.py \
debugPluginClient.py \
+ fenceAgent.py \
guestIF.py \
hooking.py \
hooks.py \
@@ -52,7 +53,8 @@
tc.py \
vdsmDebugPlugin.py \
vmChannels.py \
- vm.py
+ vm.py \
+ $(NULL)
dist_vdsmpylib_PYTHON = \
__init__.py \
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 8ba25a7..8760437 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -96,6 +96,7 @@
self.lastRemoteAccess = 0
self._memLock = threading.Lock()
self._enabled = True
+ self.shutdownEvent = threading.Event()
self._netConfigDirty = False
self._prepareMOM()
threading.Thread(target=self._recoverExistingVms,
@@ -219,6 +220,7 @@
for binding in self.bindings.values():
binding.prepareForShutdown()
self._enabled = False
+ self.shutdownEvent.set()
self.channelListener.stop()
self._hostStats.stop()
if self.mom:
--
To view, visit http://gerrit.ovirt.org/7190
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I944c6548a42612f705a410fb4290215451bca035
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: Use more fine lock for hsm.deleteImage().
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Use more fine lock for hsm.deleteImage().
......................................................................
Use more fine lock for hsm.deleteImage().
When removing an image from a specific SD, lock the image in this
SD exclusively.
Related to: BZ#960952.
Change-Id: Iab04d548610cd86eb70e1fd13a29a3508778cc1d
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/16413/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 5639c13..09c5404 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1437,7 +1437,8 @@
self.getPool(spUUID) # Validates that the pool is connected. WHY?
dom = self.validateSdUUID(sdUUID)
- vars.task.getExclusiveLock(STORAGE, imgUUID)
+ imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
+ vars.task.getExclusiveLock(imageResourcesNamespace, imgUUID)
vars.task.getSharedLock(STORAGE, sdUUID)
allVols = dom.getAllVolumes()
volsByImg = sd.getVolsOfImage(allVols, imgUUID)
--
To view, visit http://gerrit.ovirt.org/16413
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab04d548610cd86eb70e1fd13a29a3508778cc1d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: [WIP] metaSize calculation as a module function.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: [WIP] metaSize calculation as a module function.
......................................................................
[WIP] metaSize calculation as a module function.
Change-Id: If90ba75d11c4962f2e52150e5f381cd93d0e8f35
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/blockSD.py
1 file changed, 23 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/11690/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 9b9674e..aa4059a 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -269,6 +269,27 @@
return
+def metaSize(vgName):
+ ''' Calc the minimal meta volume size in MB'''
+ # In any case the metadata volume cannot be less than 512MB for the
+ # case of 512 bytes per volume metadata, 2K for domain metadata and
+ # extent size of 128MB. In any case we compute the right size on line.
+ vg = lvm.getVG(vgName)
+ minmetasize = (SD_METADATA_SIZE / sd.METASIZE * int(vg.extent_size) +
+ (1024 * 1024 - 1)) / (1024 * 1024)
+ metaratio = int(vg.extent_size) / sd.METASIZE
+ metasize = (int(vg.extent_count) * sd.METASIZE +
+ (1024 * 1024 - 1)) / (1024 * 1024)
+ metasize = max(minmetasize, metasize)
+ if metasize > int(vg.free) / (1024 * 1024):
+ raise se.VolumeGroupSizeError("volume group has not enough extents %s"
+ " (Minimum %s), VG may be too small" %
+ (vg.extent_count,
+ (1024 * 1024) / sd.METASIZE))
+ log.info("size %s MB (metaratio %s)" % (metasize, metaratio))
+ return metasize
+
+
class VGTagMetadataRW(object):
log = logging.getLogger("storage.Metadata.VGTagMetadataRW")
METADATA_TAG_PREFIX = "MDT_"
@@ -449,27 +470,6 @@
lvmActivationNamespace)
@classmethod
- def metaSize(cls, vgroup):
- ''' Calc the minimal meta volume size in MB'''
- # In any case the metadata volume cannot be less than 512MB for the
- # case of 512 bytes per volume metadata, 2K for domain metadata and
- # extent size of 128MB. In any case we compute the right size on line.
- vg = lvm.getVG(vgroup)
- minmetasize = (SD_METADATA_SIZE / sd.METASIZE * int(vg.extent_size) +
- (1024 * 1024 - 1)) / (1024 * 1024)
- metaratio = int(vg.extent_size) / sd.METASIZE
- metasize = (int(vg.extent_count) * sd.METASIZE +
- (1024 * 1024 - 1)) / (1024 * 1024)
- metasize = max(minmetasize, metasize)
- if metasize > int(vg.free) / (1024 * 1024):
- raise se.VolumeGroupSizeError(
- "volume group has not enough extents %s (Minimum %s), VG may "
- "be too small" % (vg.extent_count,
- (1024 * 1024) / sd.METASIZE))
- cls.log.info("size %s MB (metaratio %s)" % (metasize, metaratio))
- return metasize
-
- @classmethod
def create(cls, sdUUID, domainName, domClass, vgUUID, storageType,
version):
""" Create new storage domain
@@ -509,7 +509,7 @@
raise se.StorageDomainIsMadeFromTooManyPVs()
# Create metadata service volume
- metasize = cls.metaSize(vgName)
+ metasize = metaSize(vgName)
lvm.createLV(vgName, sd.METADATA, "%s" % (metasize))
# Create the mapping right now so the index 0 is guaranteed
# to belong to the metadata volume. Since the metadata is at
@@ -721,7 +721,7 @@
lvm.extendVG(self.sdUUID, devices, force)
self.updateMapping()
- newsize = self.metaSize(self.sdUUID)
+ newsize = metaSize(self.sdUUID)
lvm.extendLV(self.sdUUID, sd.METADATA, newsize)
def mapMetaOffset(self, vol_name, slotSize):
--
To view, visit http://gerrit.ovirt.org/11690
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If90ba75d11c4962f2e52150e5f381cd93d0e8f35
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: [WIP]add createVm support of cputune
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]add createVm support of cputune
......................................................................
[WIP]add createVm support of cputune
allow engine to pass other cputune params through vm create,
createVm now uses nice to config vm share value,
this patch uses 'shares' in vmdef directly (1024 by default)
Change-Id: I76e9b9d291d4801965163774ba45d15b39a77471
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 13 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/8445/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index fd80c69..9b38a36 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -737,10 +737,13 @@
self.dom.appendChild(cpu)
def appendTunable(self):
- #CPU-pinning support
- # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning
+ cputune = self.doc.createElement('cputune')
+ cputuneParams = {'shares':1024}
+ if 'cputune' in self.conf:
+ cputuneParam = self.conf['cputune']
if 'cpuPinning' in self.conf:
- cputune = self.doc.createElement('cputune')
+ #CPU-pinning support
+ # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning
cpuPinning = self.conf.get('cpuPinning')
try:
emulatorset = cpuPinning.pop('emulator')
@@ -754,7 +757,13 @@
vcpupin.setAttribute('vcpu', cpuPin)
vcpupin.setAttribute('cpuset', cpuPinning[cpuPin])
cputune.appendChild(vcpupin)
- self.dom.appendChild(cputune)
+
+ for item in cputuneParams.keys():
+ m = self.doc.createElement(item)
+ m.appendChild(self.doc.createTextNode(cputuneParams[item]))
+ cputune.appendChild(m)
+
+ self.dom.appendChild(cputune)
def _appendAgentDevice(self, path, name):
"""
@@ -1338,13 +1347,6 @@
if self._initTimePauseCode == 'ENOSPC':
self.cont()
self.conf['pid'] = self._getPid()
-
- nice = int(self.conf.get('nice', '0'))
- nice = max(min(nice, 19), 0)
- try:
- self._dom.setSchedulerParameters({'cpu_shares': (20 - nice) * 51})
- except:
- self.log.warning('failed to set Vm niceness', exc_info=True)
def _run(self):
self.log.info("VM wrapper has started")
--
To view, visit http://gerrit.ovirt.org/8445
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I76e9b9d291d4801965163774ba45d15b39a77471
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
8 years, 11 months
Change in vdsm[master]: [WIP] VDSM <=> Engine data optimization
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: [WIP] VDSM <=> Engine data optimization
......................................................................
[WIP] VDSM <=> Engine data optimization
Change-Id: Ifa0a7a86a351a8c2d891f22802a95d1fe1bc1df4
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
4 files changed, 499 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/14541/1
diff --git a/vdsm/API.py b/vdsm/API.py
index ee72116..ebf331d 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -334,6 +334,66 @@
return errCode['noVM']
return v.migrateStatus()
+ def getRuntimeStats(self):
+ """
+ Retrieve runtime statistics for the specific VM
+ """
+ v = self._cif.vmContainer.get(self._UUID)
+ if not v:
+ return errCode['noVM']
+ return {
+ 'status': doneCode,
+ 'runtimeStats': {
+ self._UUID: v.getRuntimeStats().copy()}}
+
+ def getStatus(self):
+ """
+ Retrieve VM status information for the specific VM
+ """
+ v = self._cif.vmContainer.get(self._UUID)
+ if not v:
+ return errCode['noVM']
+ return {
+ 'status': doneCode,
+ 'vmStatus': {
+ self._UUID: v.getStatus().copy()}}
+
+ def getDeviceStats(self):
+ """
+ Retrieve device statistics for the specific VM
+ """
+ v = self._cif.vmcontainer.get(self._uuid)
+ if not v:
+ return errCode['noVM']
+ return {
+ 'status': doneCode,
+ 'deviceStats': {
+ self._UUID: v.getDeviceStats().copy()}}
+
+ def getConfInfo(self):
+ """
+ Retrieve configuration information for the specific VM
+ """
+ v = self._cif.vmcontainer.get(self._uuid)
+ if not v:
+ return errCode['noVM']
+ return {
+ 'status': doneCode,
+ 'info': {
+ self._UUID: v.getInfo().copy()}}
+
+ def getGuestDetails(self):
+ """
+ Retrieve guest information for the specific VM
+ """
+ v = self._cif.vmcontainer.get(self._uuid)
+ if not v:
+ return errCode['noVM']
+ return {
+ 'status': doneCode,
+ 'guestDetails': {
+ self._UUID: v.getGuestDetails().copy()}}
+
def getStats(self):
"""
Obtain statistics of the specified VM
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 9a4db12..912018c 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -314,6 +314,52 @@
vm = API.VM(vmId)
return vm.getStats()
+ def vmGetRuntimeStats(self, vmIds):
+ result = {}
+ for vmId in vmIds:
+ vm = API.VM(vmId)
+ result.update(vm.getRuntimeStats()['runtimeStats'])
+ return {
+ 'status': doneCode,
+ 'runtimeStats': result}
+
+ def vmGetStatus(self, vmIds):
+ result = {}
+ for vmId in vmIds:
+ vm = API.VM(vmId)
+ result.update(vm.getStatus()['vmStatus'])
+ return {
+ 'status': doneCode,
+ 'vmStatus': result}
+
+ def vmGetAllDeviceStats(self):
+ vms = self.getVMList()
+ result = {}
+ for vm in vms['vmList']:
+ v = API.VM(vm['vmId'])
+ result.update(v.getDeviceStats()['deviceStats'])
+ return {
+ 'status': doneCode,
+ 'deviceStats': result}
+
+ def vmGetConfInfo(self, vmIds):
+ result = {}
+ for vmId in vmIds:
+ vm = API.VM(vmId)
+ result.update(vm.getConfInfo()['vmConfInfo'])
+ return {
+ 'status': doneCode,
+ 'vmConfInfo': result}
+
+ def vmGetGuestDetails(self, vmIds):
+ result = {}
+ for vmId in vmIds:
+ vm = API.VM(vmId)
+ result.update(vm.getGuestDetails()['guestDetails'])
+ return {
+ 'status': doneCode,
+ 'guestDetails': result}
+
def getAllVmStats(self):
"""
Get statistics of all running VMs.
diff --git a/vdsm/vm.py b/vdsm/vm.py
index ddb09c8..6d57649 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -26,6 +26,7 @@
import tempfile
import pickle
from copy import deepcopy
+import json
from vdsm import utils
from vdsm.define import NORMAL, ERROR, doneCode, errCode
@@ -1115,6 +1116,65 @@
self.conf['status'] = self.lastStatus
return self.conf
+ def _hashObject(self, o):
+ return str(hash(json.dumps(o)))
+
+ def _getHashes(self, stats):
+ return {
+ 'info': self._hashObject(self._getInfo(stats)),
+ 'status': self._hashObject(self._getStatus(stats)),
+ 'guestDetals': self._hashObject(self._getGuestDetails(stats))}
+
+ def _extractKeys(self, dictObject, keys):
+ extracted = {}
+ for k in keys:
+ v = dictObject.get(k)
+ if v:
+ extracted[k] = v
+ return extracted
+
+ def getRuntimeStats(self):
+ allStats = self.getStats()
+ USED_KEYS = ('cpuSys', 'cpuUser', 'memUsage', 'elapsedTime', 'status',
+ 'statsAge')
+ stats = self._extractKeys(allStats, USED_KEYS)
+ stats['hashes'] = self._getHashes(allStats)
+ if 'hash' in allStats:
+ stats['hashes']['config'] = allStats['hash']
+ return stats
+
+ def _getStatus(self, stats):
+ USED_KEYS = ('timeOffset', 'monitorResponse', 'clientIp', 'lastLogin',
+ 'username', 'session', 'guestIPs')
+ return self._extractKeys(stats, USED_KEYS)
+
+ def getStatus(self):
+ return self._getStatus(self.getStats())
+
+ def _getDeviceStats(self, stats):
+ USED_KEYS = ('network', 'disks', 'disksUsage', 'balloonInfo',
+ 'memoryStats')
+ return self._extractKeys(stats, USED_KEYS)
+
+ def getDeviceStats(self):
+ return self._getDeviceStats(self.getStats())
+
+ def _getInfo(self, stats):
+ USED_KEYS = ('acpiEnable', 'vmType', 'guestName', 'guestOS',
+ 'kvmEnable', 'pauseCode', 'displayIp', 'displayPort',
+ 'displaySecurePort', 'pid')
+ return self._extractKeys(stats, USED_KEYS)
+
+ def getInfo(self):
+ return self._getInfo(self.getStats())
+
+ def _getGuestDetails(self, stats):
+ USED_KEYS = ('appList', 'netIfaces')
+ return self._extractKeys(stats, USED_KEYS)
+
+ def getGuestDetails(self):
+ return self._getGuestDetails(self.getStats())
+
def getStats(self):
# used by API.Vm.getStats
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 4ff8c7a..33be905 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -4850,6 +4850,339 @@
'data': {'vmID': 'UUID'},
'returns': 'VmDefinition'}
+##
+# @VmRuntimeStatsHashes:
+#
+# Hashes of several statistics and information around VMs
+#
+# @info: Hash for VmConfInfo data
+#
+# @config: Hash of the VM configuration XML
+#
+# @status: Hash of the VmStatusInfo data
+#
+# @guestDetails: Hash of the VmGuestDetails data
+#
+# Since: 4.10.3
+##
+{ 'type': 'VmRuntimeStatsHashes',
+ 'data': { 'info': 'str', 'config': 'str', 'status': 'str',
+ 'guestDetails': 'str'}}
+
+##
+# @VmRuntimeStats:
+#
+# Frequently changed and required data around VMs
+#
+# @cpuSys: Ratio of CPU time spent by qemu on other than guest time
+#
+# @cpuUser: Ratio of CPU time spent by the guest VM
+#
+# @memUsage: The percent of memory in use by the guest
+#
+# @elapsedTime: The number of seconds that the VM has been running
+#
+# @status: The current status of the given VM
+#
+# @statsAge: The age of these statistics in seconds
+#
+# @hashes: Hashes of several statistics and information around VMs
+#
+# Since: 4.10.3
+##
+{ 'type': 'VmRuntimeStats',
+ 'data': { 'cpuSys': 'float', 'cpuUser': 'float', 'memUsage': 'uint',
+ 'elapsedTime': 'uint', 'status': 'VmStatus', 'statsAge': 'float',
+ 'hashes': 'VmRuntimeStatsHashes'}}
+
+##
+# @VmRuntimeStatsResult:
+#
+# Union result of VmRuntimeStats or ExitedVmStats
+#
+# @exited: Indicates if the result is VmRuntimeStats or ExitedVmStats
+#
+# Since: 4.10.3
+##
+{'type': 'VmRuntimeStatsResult',
+ 'data': { 'exited': 'bool' },
+ 'union': ['VmRuntimeStats', 'ExitedVmStats']}
+
+##
+# @VmRuntimeStatsMap:
+#
+# A mapping of VM runtime statistics indexed by vm id (UUID).
+#
+# Since: 4.10.3
+##
+{'map': 'VmRuntimeStatsMap',
+ 'key': 'UUID', 'value': 'VmRuntimeStatsResult' }}
+
+
+##
+# @VM.getRuntimeStats:
+#
+# Get runtime information about a list of VMs
+#
+# @vmIDs: a list of UUIDs for VMs to query
+#
+# Returns:
+# VmRuntimeStatsMap
+#
+# Since: 4.10.3
+##
+{'command': {'class': 'VM', 'name': 'getRuntimeStats'},
+ 'data': {'vmIDs': ['UUID']},
+ 'returns': 'VmRuntimeStatsMap'}
+
+##
+# @VmStatusInfo:
+#
+# Information to the status of a VM and less frequently changed information
+#
+# @timeOffset: The time difference from host to the VM in seconds
+#
+# @monitorResponse: Indicates if the qemu monitor is responsive
+#
+# @clientIp: The IP address of the client connected to the display
+#
+# @username: the username associated with the current session
+#
+# @session: The current state of user interaction with the VM
+#
+# @guestIPs: A space separated string of assigned IPv4 addresses
+#
+# @pauseCode: Indicates the reason a VM has been paused
+#
+# Since: 4.10.3
+##
+{ 'type': 'VmStatusInfo',
+ 'data': { 'timeOffset': 'uint', 'monitorResponse': 'int', 'clientIp': 'str',
+ 'username': 'str', 'session': 'GuestSessionState',
+ 'guestIPs': 'str', 'pauseCode': 'str'}}
+
+##
+# @VmStatusInfoResult:
+#
+# Union result of VmStatusInfo or ExitedVmStats
+#
+# @exited: Indicates if the result is VmStatusInfo or ExitedVmStats
+#
+# Since: 4.10.3
+##
+{'type': 'VmStatusInfoResult',
+ 'data': { 'exited': 'bool' },
+ 'union': ['VmStatusInfo', 'ExitedVmStats']}
+
+##
+# @VmStatusInfoMap:
+#
+# A mapping of VM status information indexed by vm id (UUID).
+#
+# Since: 4.10.3
+##
+{'map': 'VmStatusInfoMap',
+ 'key': 'UUID', 'value': 'VmStatusInfoResult'}
+
+##
+# @VM.getStatus:
+#
+# Get status information about a list of VMs
+#
+# @vmIDs: a list of UUIDs for VMs to query
+#
+# Returns:
+# VmStatusMap
+#
+# Since: 4.10.3
+##
+{'command': {'class': 'VM', 'name': 'getStatus'},
+ 'data': {'vmIDs': ['UUID']},
+ 'returns': 'VmStatusInfoMap'}
+
+##
+# @VmConfInfo:
+#
+# VM configuration information
+#
+# @acpiEnable: Indicates if ACPI is enabled inside the VM
+#
+# @displayPort: The port in use for unencrypted display data
+#
+# @displaySecurePort: The port in use for encrypted display data
+#
+# @displayType: The type of display in use
+#
+# @displayIp: The IP address to use for accessing the VM display
+#
+# @pid: The process ID of the underlying qemu process
+#
+# @vmType: The type of VM
+#
+# @kvmEnable: Indicates if KVM hardware acceleration is enabled
+#
+# @cdrom: #optional The path to an ISO image used in the VM's CD-ROM device
+#
+# @boot: #optional An alias for the type of device used to boot the VM
+#
+# Since: 4.10.3
+##
+{ 'type': 'VmConfInfo',
+ 'data': { 'acpiEnable': 'bool', 'vmType': 'VmType',
+ 'kvmEnable': 'bool', 'displayIp': 'str', 'displayPort': 'uint',
+ 'displaySecurePort': 'uint', 'displayType': 'VmDisplayType',
+ 'pid': 'uint', '*boot': 'VmBootMode', '*cdrom': 'str'}}
+
+##
+# @VmConfInfoResult:
+#
+# Union result of VmConfInfo or ExitedVmStats
+#
+# @exited: Indicates if the result is VmConfInfo or ExitedVmStats
+#
+# Since: 4.10.3
+##
+{'type': 'VmConfInfoResult',
+ 'data': { 'exited': 'bool' },
+ 'union': ['VmConfInfo', 'ExitedVmStats']}
+
+##
+# @VmConfInfoMap:
+#
+# A mapping of VM config information indexed by vm id (UUID).
+#
+# Since: 4.10.3
+##
+{'map': 'VmConfInfoMap',
+ 'key': 'UUID', 'value': 'VmConfInfoResult' }}
+
+##
+# @VM.getConfInfo:
+#
+# Get configuration information about a list of VMs
+#
+# @vmIDs: a list of UUIDs for VMs to query
+#
+# Returns:
+# VmConfInfoMap
+#
+# Since: 4.10.3
+##
+{'command': {'class': 'VM', 'name': 'getConfInfo'},
+ 'data': {'vmIDs': ['UUID']},
+ 'returns': 'VmConfInfoMap'}
+
+##
+# @VmDeviceStats:
+#
+# VM device statistics containing information for getting statistics and SLA
+# information.
+#
+# @memoryStats: Memory statistics as reported by the guest agent
+#
+# @balloonInfo: Guest memory balloon information
+#
+# @disksUsage: Info about mounted filesystems as reported by the agent
+#
+# @network: Network bandwidth/utilization statistics
+#
+# @disks: Disk bandwidth/utilization statistics
+#
+# Since: 4.10.3
+##
+{ 'type': 'VmDeviceStats',
+ 'data': { 'network': 'NetworkInterfaceStatsMap', 'disks': 'VmDiskStatsMap',
+ 'disksUsage': ['GuestMountInfo'], 'balloonInfo': 'BalloonInfo',
+ 'memoryStats': 'GuestMemoryStats' }}
+
+##
+# @VmDeviceStatsResult:
+#
+# Union result of VmDeviceStats or ExitedVmStats
+#
+# @exited: Indicates if the result is VmDeviceStats or ExitedVmStats
+#
+# Since: 4.10.3
+##
+{'type': 'VmDeviceStatsResult',
+ 'data': { 'exited': 'bool' },
+ 'union': ['VmDeviceStats', 'ExitedVmStats']}
+
+##
+# @VmDeviceStatsMap:
+#
+# A mapping of VM device statistics indexed by vm id (UUID).
+#
+# Since: 4.10.3
+##
+{'map': 'VmDeviceStatsMap',
+ 'key': 'UUID', 'value': 'VmDeviceStatsResult' }}
+
+##
+# @VM.getAllDeviceStats:
+#
+# Get device statistics from all VMs
+#
+# Returns:
+# VmDeviceStatsMap
+#
+# Since: 4.10.3
+##
+{'command': {'class': 'VM', 'name': 'getAllDeviceStats'},
+ 'returns': 'VmDeviceStatsMap'}
+
+##
+# @VmGuestDetails:
+#
+# Non-frequent changed details from guest OSes
+#
+# @appsList: A list of installed applications with their versions
+#
+# @netIfaces: Network device address info as reported by the agent
+#
+# Since: 4.10.3
+##
+{ 'type': 'VmGuestDetails',
+ 'data': { 'appsList': ['str'], 'netIfaces': ['GuestNetworkDeviceInfo'] }}
+
+##
+# @VmGuestDetailsResult:
+#
+# Union result of VmDeviceStats or ExitedVmStats
+#
+# @exited: Indicates if the result is VmGuestDetails or ExitedVmStats
+#
+# Since: 4.10.3
+##
+{'type': 'VmGuestDetailsResult',
+ 'data': { 'exited': 'bool' },
+ 'union': ['VmGuestDetails', 'ExitedVmStats']}
+
+##
+# @VmGuestDetailsMap:
+#
+# A mapping of detailed information of guests indexed by vm id (UUID).
+#
+# Since: 4.10.3
+##
+{'map': 'VmGuestDetailsMap',
+ 'key': 'UUID', 'value': 'VmGuestDetailsResult' }}
+
+##
+# @VM.getGuestDetails:
+#
+# Get details from the guest OS from a list of VMs
+#
+# @vmIDs: a list of UUIDs for VMs to query
+#
+# Returns:
+# VmGuestDetailsMap
+#
+# Since: 4.10.3
+##
+{'command': {'class': 'VM', 'name': 'getGuestDetails'},
+ 'data': {'vmIDs': ['UUID']},
+ 'returns': 'VmGuestDetailsMap'}
##
# @VM.getMigrationStatus:
--
To view, visit http://gerrit.ovirt.org/14541
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa0a7a86a351a8c2d891f22802a95d1fe1bc1df4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: utils: add ovirt-node persistence functions
by Alon Bar-Lev
Alon Bar-Lev has uploaded a new change for review.
Change subject: utils: add ovirt-node persistence functions
......................................................................
utils: add ovirt-node persistence functions
Change-Id: Ib93af61a44a52c37faf92d6f6081babefa3a09aa
Signed-off-by: Alon Bar-Lev <alonbl(a)redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 24 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/20811/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 78d055e..acb284c 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -877,3 +877,27 @@
logging.error("Panic: %s", msg, exc_info=True)
os.killpg(0, 9)
sys.exit(-3)
+
+
+@memoized
+def isOvirtNode():
+ return (
+ os.path.exists('/etc/rhev-hypervisor-release') or
+ glob.glob('/etc/ovirt-node-*-release')
+ )
+
+
+def ovirtNodePersist(files):
+ if isOvirtNode():
+ from ovirtnode import ovirtfunctions
+ ovirtfunctions.ovirt_store_config(files)
+
+
+def ovirtNodeUnpersist(files):
+ if isOvirtNode():
+ from ovirtnode import ovirtfunctions
+ todo = []
+ for f in files:
+ if ovirtfunctions.is_persisted(f):
+ todo.append(f)
+ ovirtfunctions.remove_config([todo])
--
To view, visit http://gerrit.ovirt.org/20811
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib93af61a44a52c37faf92d6f6081babefa3a09aa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl(a)redhat.com>
9 years
Change in vdsm[master]: drop ominous log for libvirt errors
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: drop ominous log for libvirt errors
......................................................................
drop ominous log for libvirt errors
Patch http://gerrit.ovirt.org/13990 has introduced a log line whenever a
libvirt exception flows through our libvirtconnection.
E.g. Unknown libvirterror: ecode: 9 edom: 19 level: 2 message: operation
failed: network 'vdsm-ovirtmgmt' already exists...
The log line appears out of context and is repeated once its traceback
is properly caught.
Change-Id: Icd2a53ffee7fb78cb1c8d171093e93e233ed5ad4
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/libvirtconnection.py
1 file changed, 0 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/17324/1
diff --git a/lib/vdsm/libvirtconnection.py b/lib/vdsm/libvirtconnection.py
index cdba57c..9891691 100644
--- a/lib/vdsm/libvirtconnection.py
+++ b/lib/vdsm/libvirtconnection.py
@@ -95,10 +95,6 @@
if killOnFailure:
log.error('taking calling process down.')
os.kill(os.getpid(), signal.SIGTERM)
- else:
- log.debug('Unknown libvirterror: ecode: %d edom: %d '
- 'level: %d message: %s', ecode, edom,
- e.get_error_level(), e.get_error_message())
raise
wrapper.__name__ = f.__name__
wrapper.__doc__ = f.__doc__
--
To view, visit http://gerrit.ovirt.org/17324
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd2a53ffee7fb78cb1c8d171093e93e233ed5ad4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years
Change in vdsm[master]: spec: update sanlock dependencies
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: spec: update sanlock dependencies
......................................................................
spec: update sanlock dependencies
Forcing some old fedora installations to update sanlock to the latest
version. This is mostly to address:
- wdmd: dynamically select working watchdog device
which makes it possible to run sanlock on hardware (generally laptops)
with multiple watchdogs.
Change-Id: Ia9a28d7bf23ab93781bdf3d8cf5769fe149fdeb4
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/12292/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 38838ea..89da7af 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -107,7 +107,7 @@
Requires: device-mapper-multipath >= 0.4.9-52
Requires: e2fsprogs >= 1.41.12-11
Requires: kernel >= 2.6.32-279.9.1
-Requires: sanlock >= 2.3-4, sanlock-python
+Requires: sanlock >= 2.3-4
Requires: initscripts >= 9.03.31-2.el6_3.1
Requires: mom >= 0.3.0
Requires: selinux-policy-targeted >= 3.7.19-155
@@ -125,7 +125,7 @@
Requires: e2fsprogs >= 1.41.14
Requires: kernel >= 3.6
Requires: mom >= 0.3.0
-Requires: sanlock >= 2.4-2, sanlock-python
+Requires: sanlock >= 2.6-4
Requires: sed >= 4.2.1-10
Requires: selinux-policy-targeted >= 3.10.0-149
Requires: lvm2 >= 2.02.95
@@ -151,6 +151,7 @@
Requires: libselinux-python
Requires: %{name}-python = %{version}-%{release}
Requires: pyparted
+Requires: sanlock-python
Requires(post): /usr/sbin/saslpasswd2
Requires(post): /bin/hostname
--
To view, visit http://gerrit.ovirt.org/12292
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9a28d7bf23ab93781bdf3d8cf5769fe149fdeb4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years
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>
9 years