Change in vdsm[ovirt-3.3]: vm: Continue to sample after errors
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: vm: Continue to sample after errors
......................................................................
vm: Continue to sample after errors
When vm is running, we monitor disk usage, and if the disk becomes too
full, we extend the disk. This avoid pausing of the vm after io errors.
However, when sampling vm with multiple disks, an error when sampling
one disk exit the sampling function and skip the next disks, making this
machnisim useless.
This patch logs exceptions raised when sampling one disk and continue to
sample others.
This patch is for ovirt-3.3.1 only - master patch must be different
because of recent refactoring in this area.
Change-Id: I8dbe60a4d3b216a5cd998d163407c09b12f2f28c
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 14 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/22575/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 90ab5a7..2d0cece 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -506,20 +506,24 @@
return
for vmDrive in self._vm._devices[DISK_DEVICES]:
- if not vmDrive.isExtendable():
- continue
+ try:
+ if not vmDrive.isExtendable():
+ continue
- capacity, alloc, physical = \
- self._vm._dom.blockInfo(vmDrive.path, 0)
+ capacity, alloc, physical = \
+ self._vm._dom.blockInfo(vmDrive.path, 0)
- if physical - alloc >= vmDrive.watermarkLimit:
- continue
+ if physical - alloc >= vmDrive.watermarkLimit:
+ continue
- self._log.info('%s/%s apparent: %s capacity: %s, alloc: %s, '
- 'phys: %s', vmDrive.domainID, vmDrive.volumeID,
- vmDrive.apparentsize, capacity, alloc, physical)
+ self._log.info('%s/%s apparent: %s capacity: %s, alloc: %s, '
+ 'phys: %s', vmDrive.domainID, vmDrive.volumeID,
+ vmDrive.apparentsize, capacity, alloc, physical)
- self._vm.extendDriveVolume(vmDrive)
+ self._vm.extendDriveVolume(vmDrive)
+ except Exception:
+ self._log.exception("%s/%s", vmDrive.domainID,
+ vmDrive.volumeID)
def _updateVolumes(self):
if not self._vm.isDisksStatsCollectionEnabled():
--
To view, visit http://gerrit.ovirt.org/22575
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dbe60a4d3b216a5cd998d163407c09b12f2f28c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 9 months
Change in vdsm[ovirt-3.3]: vm: Fix attribute error when accessing drive in sampling method
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: vm: Fix attribute error when accessing drive in sampling method
......................................................................
vm: Fix attribute error when accessing drive in sampling method
Du to race when migration is finished and monitoring, drive may not have
a format attribute when accessing it from the monitor. This patch use
getattr to log spam.
Change-Id: Ia50e8af94b9c9b54332066a3f30999ce73e7a56f
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/22518/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index bb4a7ec..7e2d220 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -506,7 +506,8 @@
return
for vmDrive in self._vm._devices[DISK_DEVICES]:
- if not vmDrive.blockDev or vmDrive.format != 'cow':
+ # Note: drive may not have a format attribute during migration
+ if not vmDrive.blockDev or getattr(vmDrive, 'format', None) != 'cow':
continue
capacity, alloc, physical = \
--
To view, visit http://gerrit.ovirt.org/22518
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia50e8af94b9c9b54332066a3f30999ce73e7a56f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: sampling: use constants for counter bounds
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: sampling: use constants for counter bounds
......................................................................
sampling: use constants for counter bounds
When we report cpu and network usage, we take two samples of Linux
counters, and divide their difference by the elapsed time. If a sampled
counter wraps around its upper bound, we might report an invalid
negative value. To avoid that, we take the modulu of the difference.
For example, assume that the first sample was (2**64 - 10) jiffies and
30 jiffies have passed until the second sample, the difference would be
the hugely negative value (30 - 2**64). Taking modulu 2**64 returns the
correct value of 30 jiffies.
JIFFIES_BOUND is taken from the size of clock_t and NETSTATS_BOUND -
from the size of the fields of struct net_device_stats. I am not aware
of any programmatic way to acquire this value, but they are both of 64
bit size on x86_64 and ppc64.
Taking modulu 2**32 works perfectly well, since two subsequent samples
are unlikly to be that far apart, and it has the benefit of working well
on a 32 bit host, too.
Change-Id: I706000106c3bc31edf8541c980bce1f49464ebf8
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/sampling.py
M vdsm/vm.py
2 files changed, 11 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/24194/1
diff --git a/vdsm/sampling.py b/vdsm/sampling.py
index 54b6381..a5492ce 100644
--- a/vdsm/sampling.py
+++ b/vdsm/sampling.py
@@ -42,6 +42,9 @@
if not os.path.exists(_THP_STATE_PATH):
_THP_STATE_PATH = '/sys/kernel/mm/redhat_transparent_hugepage/enabled'
+JIFFIES_BOUND = 2 ** 32
+NETSTATS_BOUND = 2 ** 32
+
class InterfaceSample:
"""
@@ -430,14 +433,14 @@
return stats
hs0, hs1 = self._samples[0], self._samples[-1]
interval = hs1.timestamp - hs0.timestamp
- jiffies = (hs1.pidcpu.user - hs0.pidcpu.user) % (2 ** 32)
+ jiffies = (hs1.pidcpu.user - hs0.pidcpu.user) % JIFFIES_BOUND
stats['cpuUserVdsmd'] = (jiffies / interval)
- jiffies = hs1.pidcpu.sys - hs0.pidcpu.sys % (2 ** 32)
+ jiffies = hs1.pidcpu.sys - hs0.pidcpu.sys % JIFFIES_BOUND
stats['cpuSysVdsmd'] = (jiffies / interval)
- jiffies = (hs1.totcpu.user - hs0.totcpu.user) % (2 ** 32)
+ jiffies = (hs1.totcpu.user - hs0.totcpu.user) % JIFFIES_BOUND
stats['cpuUser'] = jiffies / interval / self._ncpus
- jiffies = (hs1.totcpu.sys - hs0.totcpu.sys) % (2 ** 32)
+ jiffies = (hs1.totcpu.sys - hs0.totcpu.sys) % JIFFIES_BOUND
stats['cpuSys'] = jiffies / interval / self._ncpus
stats['cpuIdle'] = max(0.0,
100.0 - stats['cpuUser'] - stats['cpuSys'])
@@ -479,9 +482,9 @@
ifrate = ifrate or 1000
Mbps2Bps = (10 ** 6) / 8
thisRx = (hs1.interfaces[ifid].rx - hs0.interfaces[ifid].rx) % \
- (2 ** 32)
+ NETSTATS_BOUND
thisTx = (hs1.interfaces[ifid].tx - hs0.interfaces[ifid].tx) % \
- (2 ** 32)
+ NETSTATS_BOUND
rxRate = 100.0 * thisRx / interval / ifrate / Mbps2Bps
txRate = 100.0 * thisTx / interval / ifrate / Mbps2Bps
if txRate > 100 or rxRate > 100:
diff --git a/vdsm/vm.py b/vdsm/vm.py
index aae8bd6..07fb581 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -606,11 +606,11 @@
ifRxBytes = (100.0 *
(eInfo[nic.name][0] - sInfo[nic.name][0]) %
- 2 ** 32 /
+ sampling.NETSTATS_BOUND /
sampleInterval / ifSpeed / self.MBPS_TO_BPS)
ifTxBytes = (100.0 *
(eInfo[nic.name][4] - sInfo[nic.name][4]) %
- 2 ** 32 /
+ sampling.NETSTATS_BOUND /
sampleInterval / ifSpeed / self.MBPS_TO_BPS)
ifStats['rxRate'] = '%.1f' % ifRxBytes
--
To view, visit http://gerrit.ovirt.org/24194
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I706000106c3bc31edf8541c980bce1f49464ebf8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: block: use the contextmanager for mapMetaOffset
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: block: use the contextmanager for mapMetaOffset
......................................................................
block: use the contextmanager for mapMetaOffset
Change-Id: Id1496238ea4f9a1902f816b20959ce3379e87871
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/blockVolume.py
M vdsm/storage/imageRepository/formatConverter.py
3 files changed, 13 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/25988/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index cac59fa..02c7dfd 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -29,6 +29,7 @@
import time
import functools
from collections import namedtuple
+from contextlib import contextmanager
from operator import itemgetter
from vdsm.config import config
@@ -732,11 +733,15 @@
newsize = self.metaSize(self.sdUUID)
lvm.extendLV(self.sdUUID, sd.METADATA, newsize)
+ _mdSlotLock = threading.Lock()
+
+ @contextmanager
def mapMetaOffset(self, vol_name, slotSize):
- if self.getVersion() in VERS_METADATA_LV:
- return self.getVolumeMetadataOffsetFromPvMapping(vol_name)
- else:
- return self.getFreeMetadataSlot(slotSize)
+ with self._mdSlotLock:
+ if self.getVersion() in VERS_METADATA_LV:
+ yield self.getVolumeMetadataOffsetFromPvMapping(vol_name)
+ else:
+ yield self.getFreeMetadataSlot(slotSize)
def _getOccupiedMetadataSlots(self):
stripPrefix = lambda s, pfx: s[len(pfx):]
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 36bfa1f..9a7fa81 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -73,7 +73,6 @@
class BlockVolume(volume.Volume):
""" Actually represents a single volume (i.e. part of virtual disk).
"""
- _tagCreateLock = threading.Lock()
def __init__(self, repoPath, sdUUID, imgUUID, volUUID):
self.metaoff = None
@@ -169,8 +168,7 @@
imgUUID, volUUID, srcImgUUID, srcVolUUID)
volParent.clone(imgPath, volUUID, volFormat, preallocate)
- with cls._tagCreateLock:
- mdSlot = dom.mapMetaOffset(volUUID, VOLUME_MDNUMBLKS)
+ with dom.mapMetaOffset(volUUID, VOLUME_MDNUMBLKS) as mdSlot:
mdTags = ["%s%s" % (TAG_PREFIX_MD, mdSlot),
"%s%s" % (TAG_PREFIX_PARENT, srcVolUUID),
"%s%s" % (TAG_PREFIX_IMAGE, imgUUID)]
diff --git a/vdsm/storage/imageRepository/formatConverter.py b/vdsm/storage/imageRepository/formatConverter.py
index c701163..11a0039 100644
--- a/vdsm/storage/imageRepository/formatConverter.py
+++ b/vdsm/storage/imageRepository/formatConverter.py
@@ -180,9 +180,9 @@
metaOffset, vol.volUUID)
metaContent = vol.getMetadata()
- with vol._tagCreateLock:
- newMetaOffset = domain.mapMetaOffset(
- vol.volUUID, blockVolume.VOLUME_MDNUMBLKS)
+ with domain.mapMetaOffset(
+ vol.volUUID, blockVolume.VOLUME_MDNUMBLKS) \
+ as newMetaOffset:
if newMetaOffset > metaMaxSlot:
raise se.NoSpaceLeftOnDomain(domain.sdUUID)
--
To view, visit http://gerrit.ovirt.org/25988
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1496238ea4f9a1902f816b20959ce3379e87871
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
7 years, 11 months
Change in vdsm[master]: vm: per-attribute monitor response check
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: per-attribute monitor response check
......................................................................
vm: per-attribute monitor response check
the responsiveness of the monitor is reported through a single
instance variable, which is updated after each libvirt call.
If one single call goes in timeout, while the others go well,
due to interplay between timeouts and polling interval, it can
happen that reported status bounces back and forth between 'Up'
and 'Not Responding'.
This patch address this behaviour by keeping track of the
timeouts per-dom-attribute instead of per-dom, and reports
the monitor as not respondig if, and until, at least one had
a timeout in the last call.
Change-Id: I32a98d34cde91fa9dc3d07f03c47a5f2f22da620
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 12 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/23138/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 55683f4..9d7ca03 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -853,11 +853,11 @@
def f(*args, **kwargs):
try:
ret = attr(*args, **kwargs)
- self._cb(False)
+ self._cb(False, name)
return ret
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_TIMEOUT:
- self._cb(True)
+ self._cb(True, name)
toe = TimeoutError(e.get_error_message())
toe.err = e.err
raise toe
@@ -1938,6 +1938,9 @@
if (self.arch not in ['ppc64', 'x86_64']):
raise RuntimeError('Unsupported architecture: %s' % self.arch)
+
+ self._attrTimeoutLock = threading.Lock()
+ self._attrTimeoutExperienced = {} # will keep track of timeout data
def _get_lastStatus(self):
PAUSED_STATES = ('Powering down', 'RebootInProgress', 'Up')
@@ -3631,11 +3634,13 @@
def _monitorDependentInit(self, timeout=None):
self.log.warning('unsupported by libvirt vm')
- def _timeoutExperienced(self, timeout):
- if timeout:
- self._monitorResponse = -1
- else:
- self._monitorResponse = 0
+ def _timeoutExperienced(self, timeout, attrName):
+ with self._attrTimeoutLock:
+ self._attrTimeoutExperienced[attrName] = timeout
+ if any(self._attrTimeoutExperienced.itervalues()):
+ self._monitorResponse = -1
+ else:
+ self._monitorResponse = 0
def _waitForIncomingMigrationFinish(self):
if 'restoreState' in self.conf:
--
To view, visit http://gerrit.ovirt.org/23138
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I32a98d34cde91fa9dc3d07f03c47a5f2f22da620
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 11 months
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>
7 years, 11 months
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>
8 years
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>
8 years
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>
8 years
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>
8 years