Marcin Mirecki has uploaded a new change for review.
Change subject: virt: removing naming confilct in vmstats.py
......................................................................
virt: removing naming confilct in vmstats.py
variable name 'nic' confilcts with function 'nic'
renaming variable to 'vm_nic'
Change-Id: I77307af135e0f6c3d8c5554e0f3fb4093e36ed0d
Signed-off-by: Marcin Mirecki <mmirecki(a)redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/43657/1
diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index b9caeac..53a909f 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -176,17 +176,17 @@
if first_sample is None or last_sample is None:
return
- for nic in vm.getNicDevices():
- if nic.name.startswith('hostdev'):
+ for vm_nic in vm.getNicDevices():
+ if vm_nic.name.startswith('hostdev'):
continue
- first_nic = first_sample.get('net', {}).get(nic.name, {})
- last_nic = last_sample.get('net', {}).get(nic.name, {})
+ first_nic = first_sample.get('net', {}).get(vm_nic.name, {})
+ last_nic = last_sample.get('net', {}).get(vm_nic.name, {})
# may happen if nic is a new hot-plugged one
if not first_nic or not last_nic:
continue
- stats['network'][nic.name] = nic(
- nic.name, nic.nicModel, nic.macAddr,
+ stats['network'][vm_nic.name] = nic(
+ vm_nic.name, vm_nic.nicModel, vm_nic.macAddr,
first_nic, last_nic, interval)
--
To view, visit https://gerrit.ovirt.org/43657
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77307af135e0f6c3d8c5554e0f3fb4093e36ed0d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki <mmirecki(a)redhat.com>
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: netinfo: improve which ipv4 addr is reported if there are multiple primary
......................................................................
netinfo: improve which ipv4 addr is reported if there are multiple primary
The current code assumed that additional configured addresses for a
device would have the 'secondary' flag. However, this is no longer
true in recent kernels, as multiple primary addresses can be set for
a device.
The improvement is that now we will check if any of the addresses is
in the subnet of the gateway and report one of them. If there is no
default gw in the main table for the device we return the last
set primary ip and if there is a default gw but going through another
hop, we return the first set ip.
Change-Id: I8666cfef5bd8ea63edf8979e501d4785db5f4893
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/netinfo.py
1 file changed, 35 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/33375/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 6491505..816810d 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -292,25 +292,49 @@
struct.pack("!I", int('1' * prefix + '0' * (32 - prefix), 2)))
+def prefix2int(prefix):
+ if not 0 <= prefix <= 32:
+ raise ValueError('%s is not a valid prefix value. It must be between '
+ '0 and 32')
+ return (2 ** prefix - 1) << (32 - prefix)
+
+
+def addr2int(address):
+ return struct.unpack('!I', socket.inet_aton(address))[0]
+
+
def getDefaultGateway():
output = routeShowGateways('main')
return Route.fromText(output[0]) if output else None
-def getIpInfo(dev, ipaddrs=None):
+def getIpInfo(dev, ipaddrs=None, ipv4_gateway=None):
if ipaddrs is None:
ipaddrs = _getIpAddrs()
ipv4addr = ipv4netmask = ''
ipv4addrs = []
ipv6addrs = []
+ gateway_int = addr2int(ipv4_gateway) if ipv4_gateway else None
+
for addr in ipaddrs[dev]:
if addr['family'] == 'inet':
ipv4addrs.append(addr['address'])
if 'secondary' not in addr['flags']:
- ipv4addr, prefix = addr['address'].split('/')
- ipv4netmask = prefix2netmask(addr['prefixlen'])
+ address, _ = addr['address'].split('/')
+ mask = prefix2int(addr['prefixlen'])
+ if (gateway_int is None or
+ addr2int(address) & mask == gateway_int & mask):
+ ipv4addr = address
+ ipv4netmask = prefix2netmask(addr['prefixlen'])
else:
ipv6addrs.append(addr['address'])
+ if ipv4addrs and ipv4addr == '':
+ # If we didn't find an address in the gateway subnet (which is
+ # legal if there is another route that takes us to the gateway) we
+ # choose to report the first address
+ ipv4addr, prefix = ipv4addrs[0].split('/')
+ ipv4netmask = prefix2netmask(int(prefix))
+
return ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs
@@ -501,14 +525,16 @@
# comment when the version is no longer supported.
data['interface'] = iface
- ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs = getIpInfo(iface, ipaddrs)
+ gateway = _get_gateway(routes, iface)
+ ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs = getIpInfo(
+ iface, ipaddrs, gateway)
data.update({'iface': iface, 'bridged': bridged,
'addr': ipv4addr, 'netmask': ipv4netmask,
'bootproto4': ('dhcp' if ipv4addr and iface in dhcp4
else 'none'),
'ipv4addrs': ipv4addrs,
'ipv6addrs': ipv6addrs,
- 'gateway': _get_gateway(routes, iface),
+ 'gateway': gateway,
'ipv6gateway': _get_gateway(routes, iface, family=6),
'mtu': str(getMtu(iface))})
except (IOError, OSError) as e:
@@ -549,12 +575,14 @@
def _devinfo(link, routes, ipaddrs, dhcp4):
- ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs = getIpInfo(link.name, ipaddrs)
+ gateway = _get_gateway(routes, link.name)
+ ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs = getIpInfo(
+ link.name, ipaddrs, gateway)
info = {'addr': ipv4addr,
'cfg': getIfaceCfg(link.name),
'ipv4addrs': ipv4addrs,
'ipv6addrs': ipv6addrs,
- 'gateway': _get_gateway(routes, link.name),
+ 'gateway': gateway,
'ipv6gateway': _get_gateway(routes, link.name, family=6),
'bootproto4': ('dhcp' if ipv4addr and link.name in dhcp4
else 'none'),
--
To view, visit http://gerrit.ovirt.org/33375
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8666cfef5bd8ea63edf8979e501d4785db5f4893
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: v2v: Try to be nicer to other processes
......................................................................
v2v: Try to be nicer to other processes
Under the hood, virt-v2v is running qemu-img convert. We use high nice
and ionice values when running qemu-img convert, but we did not specify
such options when running virt-v2v.
According to bug 1243935, sanlock is loosing access to the storage while
v2v is importing a vm. Hopefully running virt-v2v in a nicer manner
would solve this issue.
Change-Id: Id163844a5976384ca9e9a75d58a581645f08a89f
Bug-Url: https://bugzilla.redhat.com/1243935
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/v2v.py
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/43817/1
diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index 524cbdf..cac2a0a 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -39,7 +39,7 @@
from vdsm.define import errCode, doneCode
from vdsm import libvirtconnection
from vdsm.infra import zombiereaper
-from vdsm.utils import traceback, CommandPath, execCmd
+from vdsm.utils import traceback, CommandPath, execCmd, NICENESS, IOCLASS
import caps
@@ -368,7 +368,10 @@
cmd = self._create_command()
logging.info('Job %r starting import', self._id)
+ # This is the way we run qemu-img convert jobs. virt-v2v is invoking
+ # qemu-img convert to perform the migration.
self._proc = execCmd(cmd, sync=False, deathSignal=15,
+ nice=NICENESS.HIGH, ionice=IOCLASS.IDLE,
env={'LIBGUESTFS_BACKEND': 'direct'})
self._proc.blocking = True
--
To view, visit https://gerrit.ovirt.org/43817
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id163844a5976384ca9e9a75d58a581645f08a89f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vm: make acpiShutdown more robust
......................................................................
vm: make acpiShutdown more robust
In the Vm shutdown flow, the actual 'destruction'
of the domain -in libvirt jargon- may already happen
asynchonously, e.g. if QEMU dies suddenly.
Moreover, we want to make it asynchronously even on
our own code for performance reasons.
This means that the Vm._dom attribute may become None
asyncrhonously, even inside the Vm powerdown flow
itself.
This patch address the case for the acpiShutdown,
fixing this issue:
Thread-259072::ERROR::2014-10-15 12:06:52,842::utils::1193::utils.Callback::(__call__) acpiCallback failed
Traceback (most recent call last):
File "/usr/lib64/python2.6/site-packages/vdsm/utils.py", line 1191, in __call__
result = self.func(*self.args, **self.kwargs)
File "/usr/share/vdsm/virt/vmpowerdown.py", line 91, in acpiCallback
self.vm.acpiShutdown()
File "/usr/share/vdsm/virt/vm.py", line 4942, in acpiShutdown
self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
AttributeError: 'NoneType' object has no attribute 'shutdownFlags'
Change-Id: I244f00d62ee24fb42ba3d654961a8fc22f4a6c25
Related-To: https://bugzilla.redhat.com/show_bug.cgi?id=1154389
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/34879/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9740ab3..2384aca 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4402,7 +4402,13 @@
def acpiShutdown(self):
self._shutdownReason = vmexitreason.ADMIN_SHUTDOWN
- self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
+ try:
+ self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
+ except AttributeError:
+ if not self._released:
+ raise
+ # else the VM was already shut off asynchronously,
+ # so ignore error and quickly exit
def setBalloonTarget(self, target):
--
To view, visit http://gerrit.ovirt.org/34879
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I244f00d62ee24fb42ba3d654961a8fc22f4a6c25
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Timothy Asir has uploaded a new change for review.
Change subject: gluster: fix xfs filesystem is created with wrong inode size
......................................................................
gluster: fix xfs filesystem is created with wrong inode size
Currently brick create function creates an xfs filesystem with
default value (ex 256) for the disks other then RAID6 or RAID10.
This patch fixes this issue by setting the inode size to 512 and
the directory block size to 8192.
Change-Id: If3f350d2f79172705a93a9d69fe1b7b78867861e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1244865
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin(a)redhat.com>
---
M vdsm/gluster/storagedev.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/43847/1
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index af250417..e79a4fc 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -313,6 +313,9 @@
"-f", "-K", "-i", "size=512",
"-d", "sw=%s,su=%sk" % (count, raidParams.get('stripeSize')),
"-n", "size=8192"]
+ else:
+ format._defaultFormatOptions = ["-f", "-i", "size=512",
+ "-n", "size=8192"]
blivetEnv.formatDevice(thinlv, format)
blivetEnv.doIt()
--
To view, visit https://gerrit.ovirt.org/43847
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If3f350d2f79172705a93a9d69fe1b7b78867861e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: periodic: make VmDispatcher ignore TooManyTasks
......................................................................
periodic: make VmDispatcher ignore TooManyTasks
VmDispatcher is meant to make N independent operations
from on (VM bulk sampling), being N the number of active VMs.
To fullfill this claim, we ignore TooManyTasks in the
vm dispatching loop, even though is highly likely that
once one TooManyTasks error is encountered, many subsequent
dispatch() attempt will fail.
Change-Id: Iad2d186327f8607aaeb41ca132a9a8a0806869cf
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/periodic.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/41657/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index acfe2f6..f226424 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -223,6 +223,7 @@
def __call__(self):
vms = self._get_vms()
skipped = []
+ op = None
for vm_id, vm_obj in vms.iteritems():
try:
@@ -245,8 +246,11 @@
# we want to make sure to have VM UUID logged
self._log.exception("while dispatching %s to VM '%s'",
self._create, vm_id)
- else:
+
+ try:
self._executor.dispatch(op, self._timeout)
+ except executor.TooManyTasks:
+ skipped.append(vm_id)
if skipped:
self._log.warning('could not run %s on %s',
--
To view, visit https://gerrit.ovirt.org/41657
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad2d186327f8607aaeb41ca132a9a8a0806869cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: sampling: host stats: switch to monotonic_time
......................................................................
sampling: host stats: switch to monotonic_time
Makes the time stamping function injectable,
and default to monotonic_time.
The resolution of monotonic_time is sufficient
for the task of host stats, and it is a bit more
robust.
Also, test becomes easier if the time stamping
code is injectable.
Change-Id: I4ca60654836018f040b7aa1b506b3479a0f4c996
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/sampling.py
1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/40901/1
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 2eedee1..cb5527c 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -546,9 +546,10 @@
class HostMonitor(object):
_connlog = logging.getlogger('connectivity')
- def __init__(self, log):
+ def __init__(self, log, clock=utils.monotonic_time):
self._log = log
- self._start_time = time.time()
+ self._clock = clock
+ self._start_time = self._clock()
self._samples = SampleWindow(size=5)
self._pid = os.getpid()
@@ -584,7 +585,7 @@
'txRate': 0.0, # REQUIRED_FOR: engine < 3.6
'cpuSysVdsmd': 0.0,
'cpuUserVdsmd': 0.0,
- 'elapsedTime': int(time.time() - self._start_time)
+ 'elapsedTime': int(self._clock() - self._start_time)
}
if len(self._samples) < 2:
--
To view, visit https://gerrit.ovirt.org/40901
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ca60654836018f040b7aa1b506b3479a0f4c996
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Adam Litke has uploaded a new change for review.
Change subject: StorageDomainManifest: move image and volume enumeration
......................................................................
StorageDomainManifest: move image and volume enumeration
Change-Id: I56214a7024b1f894b8e4e0b951faf0567a1606c9
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/sd.py
3 files changed, 137 insertions(+), 132 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/42269/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 273cf51..d685313 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -628,6 +628,43 @@
deleteVolumes(sdUUID, toDel)
self.rmDCImgDir(imgUUID, volsImgs)
+ def getAllVolumesImages(self):
+ """
+ Return all the images that depend on a volume.
+
+ Return dicts:
+ vols = {volUUID: ([imgUUID1, imgUUID2], parentUUID)]}
+ for complete images.
+ remnants (same) for broken imgs, orphan volumes, etc.
+ """
+ vols = {} # The "legal" volumes: not half deleted/removed volumes.
+ remnants = {} # Volumes which are part of failed image deletes.
+ allVols = getAllVolumes(self.sdUUID)
+ for volName, ip in allVols.iteritems():
+ if (volName.startswith(sd.REMOVED_IMAGE_PREFIX) or
+ ip.imgs[0].startswith(sd.REMOVED_IMAGE_PREFIX)):
+ remnants[volName] = ip
+ else:
+ # Deleted images are not dependencies of valid volumes.
+ images = [img for img in ip.imgs
+ if not img.startswith(sd.REMOVED_IMAGE_PREFIX)]
+ vols[volName] = sd.ImgsPar(images, ip.parent)
+ return vols, remnants
+
+ def getAllVolumes(self):
+ vols, rems = self.getAllVolumesImages()
+ return vols
+
+ def getAllImages(self):
+ """
+ Get the set of all images uuids in the SD.
+ """
+ vols = self.getAllVolumes() # {volName: ([imgs], parent)}
+ images = set()
+ for imgs, parent in vols.itervalues():
+ images.update(imgs)
+ return images
+
class BlockStorageDomain(sd.StorageDomain):
manifestClass = BlockStorageDomainManifest
@@ -1020,16 +1057,6 @@
mdavalid=vgMetadataStatus['mdavalid'],
mdathreshold=vgMetadataStatus['mdathreshold'])
- def getAllImages(self):
- """
- Get the set of all images uuids in the SD.
- """
- vols = self.getAllVolumes() # {volName: ([imgs], parent)}
- images = set()
- for imgs, parent in vols.itervalues():
- images.update(imgs)
- return images
-
def rmDCImgDir(self, imgUUID, volsImgs):
return self._manifest.rmDCImgDir(imgUUID, volsImgs)
@@ -1057,37 +1084,6 @@
allVols = self.getAllVolumes()
volUUIDs = self._getImgExclusiveVols(imgUUID, allVols)
lvm.deactivateLVs(self.sdUUID, volUUIDs)
-
- def getAllVolumesImages(self):
- """
- Return all the images that depend on a volume.
-
- Return dicts:
- vols = {volUUID: ([imgUUID1, imgUUID2], parentUUID)]}
- for complete images.
- remnants (same) for broken imgs, orphan volumes, etc.
- """
- vols = {} # The "legal" volumes: not half deleted/removed volumes.
- remnants = {} # Volumes which are part of failed image deletes.
- allVols = getAllVolumes(self.sdUUID)
- for volName, ip in allVols.iteritems():
- if (volName.startswith(sd.REMOVED_IMAGE_PREFIX) or
- ip.imgs[0].startswith(sd.REMOVED_IMAGE_PREFIX)):
- remnants[volName] = ip
- else:
- # Deleted images are not dependencies of valid volumes.
- images = [img for img in ip.imgs
- if not img.startswith(sd.REMOVED_IMAGE_PREFIX)]
- vols[volName] = sd.ImgsPar(images, ip.parent)
- return vols, remnants
-
- def getAllVolumes(self):
- vols, rems = self.getAllVolumesImages()
- return vols
-
- def getAllRemnants(self):
- vols, rems = self.getAllVolumesImages()
- return rems
def linkBCImage(self, imgPath, imgUUID):
dst = self.getLinkBCImagePath(imgUUID)
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 9f44342..07fc1c6 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -213,6 +213,87 @@
self.log.error("removed image dir: %s can't be removed", toDelDir)
raise se.ImageDeleteError("%s %s" % (imgUUID, str(e)))
+ def getAllVolumes(self):
+ """
+ Return dict {volUUID: ((imgUUIDs,), parentUUID)} of the domain.
+
+ (imgUUIDs,) is a tuple of all the images that contain a certain
+ volUUID. For non-templates volumes, this tuple consists of a single
+ image. For template volume it consists of all the images that are
+ based on the template volume. In that case, the first imgUUID in the
+ tuple is the self-image of the template.
+
+ The parent of a non-template volume cannot be determined in file domain
+ without reading the metadata. However, in order to have an output
+ compatible to block domain, we report parent as None.
+
+ Template volumes have no parent, and thus we report BLANK_UUID as their
+ parentUUID.
+ """
+ volMetaPattern = os.path.join(self.mountpoint, self.sdUUID,
+ sd.DOMAIN_IMAGES, "*", "*.meta")
+ volMetaPaths = self.oop.glob.glob(volMetaPattern)
+
+ # First create mapping from images to volumes
+ images = collections.defaultdict(list)
+ for metaPath in volMetaPaths:
+ head, tail = os.path.split(metaPath)
+ volUUID, volExt = os.path.splitext(tail)
+ imgUUID = os.path.basename(head)
+ images[imgUUID].append(volUUID)
+
+ # Using images to volumes mapping, we can create volumes to images
+ # mapping, detecting template volumes and template images, based on
+ # these rules:
+ #
+ # Template volumes are hard linked in every image directory
+ # which is derived from that template, therefore:
+ #
+ # 1. A template volume which is in use will appear at least twice
+ # (in the template image dir and in the derived image dir)
+ #
+ # 2. Any volume which appears more than once in the dir tree is
+ # by definition a template volume.
+ #
+ # 3. Any image which has more than 1 volume is not a template
+ # image.
+
+ volumes = {}
+ for imgUUID, volUUIDs in images.iteritems():
+ for volUUID in volUUIDs:
+ if volUUID in volumes:
+ # This must be a template volume (rule 2)
+ volumes[volUUID]['parent'] = sd.BLANK_UUID
+ if len(volUUIDs) > 1:
+ # This image is not a template (rule 3)
+ volumes[volUUID]['imgs'].append(imgUUID)
+ else:
+ # This image is a template (rule 3)
+ volumes[volUUID]['imgs'].insert(0, imgUUID)
+ else:
+ volumes[volUUID] = {'imgs': [imgUUID], 'parent': None}
+
+ return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent']))
+ for k, v in volumes.iteritems())
+
+ def getAllImages(self):
+ """
+ Fetch the set of the Image UUIDs in the SD.
+ """
+ # Get Volumes of an image
+ pattern = os.path.join(sd.storage_repository,
+ # ISO domains don't have images,
+ # we can assume single domain
+ self.getPools()[0],
+ self.sdUUID, sd.DOMAIN_IMAGES)
+ pattern = os.path.join(pattern, constants.UUID_GLOB_PATTERN)
+ files = self.oop.glob.glob(pattern)
+ images = set()
+ for i in files:
+ if self.oop.os.path.isdir(i):
+ images.add(os.path.basename(i))
+ return images
+
class FileStorageDomain(sd.StorageDomain):
manifestClass = FileStorageDomainManifest
@@ -390,24 +471,6 @@
def validateMasterMount(self):
return self.oop.fileUtils.pathExists(self.getMasterDir())
- def getAllImages(self):
- """
- Fetch the set of the Image UUIDs in the SD.
- """
- # Get Volumes of an image
- pattern = os.path.join(self.storage_repository,
- # ISO domains don't have images,
- # we can assume single domain
- self.getPools()[0],
- self.sdUUID, sd.DOMAIN_IMAGES)
- pattern = os.path.join(pattern, constants.UUID_GLOB_PATTERN)
- files = self.oop.glob.glob(pattern)
- images = set()
- for i in files:
- if self.oop.os.path.isdir(i):
- images.add(os.path.basename(i))
- return images
-
def zeroImage(self, sdUUID, imgUUID, volsImgs):
self.log.warning("image %s on a fileSD %s won't be zeroed." %
(imgUUID, sdUUID))
@@ -420,69 +483,6 @@
imgUUID: the image to be deactivated.
"""
pass
-
- def getAllVolumes(self):
- """
- Return dict {volUUID: ((imgUUIDs,), parentUUID)} of the domain.
-
- (imgUUIDs,) is a tuple of all the images that contain a certain
- volUUID. For non-templates volumes, this tuple consists of a single
- image. For template volume it consists of all the images that are
- based on the template volume. In that case, the first imgUUID in the
- tuple is the self-image of the template.
-
- The parent of a non-template volume cannot be determined in file domain
- without reading the metadata. However, in order to have an output
- compatible to block domain, we report parent as None.
-
- Template volumes have no parent, and thus we report BLANK_UUID as their
- parentUUID.
- """
- volMetaPattern = os.path.join(self.mountpoint, self.sdUUID,
- sd.DOMAIN_IMAGES, "*", "*.meta")
- volMetaPaths = self.oop.glob.glob(volMetaPattern)
-
- # First create mapping from images to volumes
- images = collections.defaultdict(list)
- for metaPath in volMetaPaths:
- head, tail = os.path.split(metaPath)
- volUUID, volExt = os.path.splitext(tail)
- imgUUID = os.path.basename(head)
- images[imgUUID].append(volUUID)
-
- # Using images to volumes mapping, we can create volumes to images
- # mapping, detecting template volumes and template images, based on
- # these rules:
- #
- # Template volumes are hard linked in every image directory
- # which is derived from that template, therefore:
- #
- # 1. A template volume which is in use will appear at least twice
- # (in the template image dir and in the derived image dir)
- #
- # 2. Any volume which appears more than once in the dir tree is
- # by definition a template volume.
- #
- # 3. Any image which has more than 1 volume is not a template
- # image.
-
- volumes = {}
- for imgUUID, volUUIDs in images.iteritems():
- for volUUID in volUUIDs:
- if volUUID in volumes:
- # This must be a template volume (rule 2)
- volumes[volUUID]['parent'] = sd.BLANK_UUID
- if len(volUUIDs) > 1:
- # This image is not a template (rule 3)
- volumes[volUUID]['imgs'].append(imgUUID)
- else:
- # This image is a template (rule 3)
- volumes[volUUID]['imgs'].insert(0, imgUUID)
- else:
- volumes[volUUID] = {'imgs': [imgUUID], 'parent': None}
-
- return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent']))
- for k, v in volumes.iteritems())
def linkBCImage(self, imgPath, imgUUID):
# Nothing to do here other than returning the path
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 873c8fa..9e81917 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -351,6 +351,18 @@
def getFormat(self):
return str(self.getVersion())
+ def getPools(self):
+ try:
+ pools = self.getMetaParam(key=DMDK_POOLS)
+ except KeyError:
+ pools = []
+ else:
+ # Old pool MD marked SDs not belonging to any pool with
+ # BLANK_UUID as the pool uuid.
+ if BLANK_UUID in pools:
+ pools.remove(BLANK_UUID)
+ return pools
+
class StorageDomain(object):
log = logging.getLogger("Storage.StorageDomain")
@@ -406,6 +418,12 @@
def deleteImage(self, sdUUID, imgUUID, volsImgs):
self._manifest.deleteImage(sdUUID, imgUUID, volsImgs)
+
+ def getAllImages(self):
+ return self._manifest.getAllImages()
+
+ def getAllVolumes(self):
+ return self._manifest.getAllVolumes()
def prepareMailbox(self):
"""
@@ -542,16 +560,7 @@
return self._manifest.getFormat()
def getPools(self):
- try:
- pools = self.getMetaParam(key=DMDK_POOLS)
- except KeyError:
- pools = []
- else:
- # Old pool MD marked SDs not belonging to any pool with
- # BLANK_UUID as the pool uuid.
- if BLANK_UUID in pools:
- pools.remove(BLANK_UUID)
- return pools
+ return self._manifest.getPools()
def getIdsFilePath(self):
return self._manifest.getIdsFilePath()
--
To view, visit https://gerrit.ovirt.org/42269
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I56214a7024b1f894b8e4e0b951faf0567a1606c9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Adam Litke has uploaded a new change for review.
Change subject: StorageDomainManifest: Move getRepoPath and other basic metadata getters
......................................................................
StorageDomainManifest: Move getRepoPath and other basic metadata getters
Change-Id: I571437a10a53d5aa20c83438350476d03111a704
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/sd.py
1 file changed, 27 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/42267/1
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 1f3ec36..c5dd224 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -306,6 +306,25 @@
def replaceMetadata(self, md):
self._metadata = md
+ def getDomainRole(self):
+ return self.getMetaParam(DMDK_ROLE)
+
+ def getDomainClass(self):
+ return self.getMetaParam(DMDK_CLASS)
+
+ def getStorageType(self):
+ return self.getMetaParam(DMDK_TYPE)
+
+ def getRepoPath(self):
+ # This is here to make sure no one tries to get a repo
+ # path from an ISO domain.
+ if self.getDomainClass() == ISO_DOMAIN:
+ raise se.ImagesNotSupportedError()
+
+ # Get the datacenter ID. When using storage pools this will be the
+ # spUUID. Else, it's just a UUID to establish a storage namespace.
+ return os.path.join(storage_repository, self.getPools()[0])
+
def getIsoDomainImagesDir(self):
"""
Get 'images' directory from Iso domain
@@ -328,6 +347,9 @@
def getVersion(self):
return self.getMetaParam(DMDK_VERSION)
+
+ def getFormat(self):
+ return str(self.getVersion())
class StorageDomain(object):
@@ -514,7 +536,7 @@
return self._manifest.getVersion()
def getFormat(self):
- return str(self.getVersion())
+ return self._manifest.getFormat()
def getPools(self):
try:
@@ -723,13 +745,7 @@
self.createMasterTree()
def _getRepoPath(self):
- # This is here to make sure no one tries to get a repo
- # path from an ISO domain.
- if self.getDomainClass() == ISO_DOMAIN:
- raise se.ImagesNotSupportedError()
-
- # If it has a repo we don't have multiple domains. Assume single pool
- return os.path.join(self.storage_repository, self.getPools()[0])
+ return self._manifest.getRepoPath()
def getLinkBCImagePath(self, imgUUID):
return image.Image(self._getRepoPath()) \
@@ -808,13 +824,13 @@
return self._manifest.getMetaParam(key)
def getStorageType(self):
- return self.getMetaParam(DMDK_TYPE)
+ return self._manifest.getStorageType()
def getDomainRole(self):
- return self.getMetaParam(DMDK_ROLE)
+ return self._manifest.getDomainRole()
def getDomainClass(self):
- return self.getMetaParam(DMDK_CLASS)
+ return self._manifest.getDomainClass()
def getRemotePath(self):
pass
--
To view, visit https://gerrit.ovirt.org/42267
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I571437a10a53d5aa20c83438350476d03111a704
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Marcin Mirecki has uploaded a new change for review.
Change subject: lib: migration: moving create of migration status to migrate.py
......................................................................
lib: migration: moving create of migration status to migrate.py
Until now the status of migration was partly composed in migrate.py
and partly in API.py. The part done in API.py had a hardcoded error
code which did not allow the code in migrate.py to return any error
code. Now the entire status is composed in migrate.py, allowing to
return any error code which is required.
Change-Id: Icbc1525f52dc5ee49647aa6d690f221f2dc96e5d
Signed-off-by: Marcin Mirecki <mmirecki(a)redhat.com>
---
M vdsm/API.py
M vdsm/virt/migration.py
M vdsm/virt/vm.py
3 files changed, 11 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/43357/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 9399445..73e4647 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -354,7 +354,7 @@
v = self._cif.vmContainer[self._UUID]
except KeyError:
return errCode['noVM']
- return {'status': doneCode, 'migrationStats': v.migrateStatus()}
+ return v.migrateStatus()
def getStats(self):
"""
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index d6994ed..e71b6e2 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -95,11 +95,13 @@
config.get('vars', 'migration_downtime')
self._autoConverge = autoConverge
self._compressed = compressed
+ self._progress = 0
self.status = {
'status': {
'code': 0,
- 'message': 'Migration in progress'}}
- self._progress = 0
+ 'message': 'Migration in progress'},
+ 'migrationStats': {
+ 'progress': self._progress}}
threading.Thread.__init__(self)
self._preparingMigrationEvt = True
self._migrationCanceledEvt = False
@@ -113,14 +115,16 @@
"""
Get the status of the migration.
"""
+ if 'migrationStats' not in self.status:
+ self.status['migrationStats'] = {}
if self._monitorThread is not None:
# fetch migration status from the monitor thread
self._progress = self._monitorThread.progress
- self.status['progress'] = self._progress
+ self.status['migrationStats']['progress'] = self._progress
stat = self._vm._dom.jobStats(libvirt.VIR_DOMAIN_JOB_STATS_COMPLETED)
if 'downtime_net' in stat:
- self.status['downtime'] = stat['downtime_net']
+ self.status['migrationStats']['downtime'] = stat['downtime_net']
return self.status
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 1ec03d4..9c05973 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1375,7 +1375,8 @@
if 'pauseCode' in self.conf:
stats['pauseCode'] = self.conf['pauseCode']
if self.isMigrating():
- stats['migrationProgress'] = self.migrateStatus()['progress']
+ migrationStats = self.migrateStatus()['migrationStats']
+ stats['migrationProgress'] = migrationStats['progress']
decStats = {}
try:
--
To view, visit https://gerrit.ovirt.org/43357
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbc1525f52dc5ee49647aa6d690f221f2dc96e5d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki <mmirecki(a)redhat.com>
Timothy Asir has uploaded a new change for review.
Change subject: gluster: fix mount point issue for snapshot thin lv
......................................................................
gluster: fix mount point issue for snapshot thin lv
Currently storage devices list provides snapshot lv's mount
point for both snapshot lv and base lv.
This patch uses blivet.utils module to fix this issue
by fetching the actual mount point.
This patch will be reverted once the issue is fixed in blivet
Change-Id: Ifadcfaedf87d325b09211c52c77a08769f57cf53
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1230669
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin(a)redhat.com>
---
M tests/glusterTestData.py
M vdsm/gluster/storagedev.py
2 files changed, 7 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/42424/1
diff --git a/tests/glusterTestData.py b/tests/glusterTestData.py
index e412349..9682ae7 100644
--- a/tests/glusterTestData.py
+++ b/tests/glusterTestData.py
@@ -846,7 +846,7 @@
'bus': '',
'fsType': 'xfs',
'model': 'Virtio Block Device (partition)',
- 'mountPoint': '/',
+ 'mountPoint': '',
'name': 'vda5',
'size': '1024.0',
'uuid': '12345-12345-12345'},
@@ -974,7 +974,7 @@
device.format = TestStorageDev()
device.format.type = 'xfs'
device.format.uuid = "12345-12345-12345"
- device.format.mountpoint = '/'
+ device.format.mountpoint = ''
devices.append(device)
# check fstype, no mountpoint attribute
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index eb8b103..df2612b 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -93,8 +93,12 @@
else:
dev = {}
info['fsType'] = device.format.type or dev.get('ID_FS_TYPE', '')
+ # device.format.mountpoint does not provide valide mount point for all
+ # the devices. Blivet.Util module used here to fix the issue as a
+ # workaround. This part will be removed once its fixed in blivet.devices
if hasattr(device.format, 'mountpoint'):
- info['mountPoint'] = device.format.mountpoint or ''
+ mountPaths = blivet.util.get_mount_paths(device.path)
+ info['mountPoint'] = mountPaths and mountPaths[0] or ''
return info
--
To view, visit https://gerrit.ovirt.org/42424
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifadcfaedf87d325b09211c52c77a08769f57cf53
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vm: remove unused 'output' value in response
......................................................................
vm: remove unused 'output' value in response
The 'output' value is not documented in schema, and apparently
Engine doesn't care about it. This patch removes it.
Change-Id: I0721885876fbe15651737aad4f3b903deb5ef4bb
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/44116/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 83d8ad8..164ca29 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1168,7 +1168,7 @@
del self.conf['pauseCode']
except KeyError:
pass
- return {'status': doneCode, 'output': ['']}
+ return response.success()
finally:
if not guestCpuLocked:
self._guestCpuLock.release()
@@ -1185,7 +1185,7 @@
guestCpuLocked=True)
self._logGuestCpuStatus('pause')
self._lastStatus = afterState
- return {'status': doneCode, 'output': ['']}
+ return response.success()
finally:
if not guestCpuLocked:
self._guestCpuLock.release()
--
To view, visit https://gerrit.ovirt.org/44116
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0721885876fbe15651737aad4f3b903deb5ef4bb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: json-rpc: export setLogLevel API
......................................................................
json-rpc: export setLogLevel API
This API was already available over XMl-RPC.
There is no reason to leave JSON-RPC behind.
Change-Id: I7481a59fb5f0598a671118394e368eab79a381b5
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/rpc/Bridge.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/38424/1
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index 1d44b90..62773df 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -415,6 +415,7 @@
'Host_getVMList': {'call': Host_getVMList_Call, 'ret': 'vmList'},
'Host_getVMFullList': {'call': Host_getVMFullList_Call, 'ret': 'vmList'},
'Host_getAllVmStats': {'ret': 'statsList'},
+ 'Host_setLogLevel': {},
'Host_setupNetworks': {'ret': 'status'},
'Image_cloneStructure': {'ret': 'uuid'},
'Image_delete': {'ret': 'uuid'},
--
To view, visit https://gerrit.ovirt.org/38424
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7481a59fb5f0598a671118394e368eab79a381b5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: netinfo: Replace misused asserts with InvalidConfiguration
......................................................................
netinfo: Replace misused asserts with InvalidConfiguration
The code was assuming that asserts are always available, and if running
with in optimized mode, the code would skip the assert and use invalid
configuration, possibly corrupting application state or failing with
unrelated errors, hiding the root cause of the error.
The asserts are replaced now with new InvalidConfiguration exception and
the error messages are improved.
Change-Id: I99ee49aa7e2364f57112e2452e3eab3940b6b00a
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/netinfo.py
1 file changed, 17 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/61/34361/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index d818249..e848abc 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -84,6 +84,10 @@
DUMMY_BRIDGE # Appease flake8 since dummy bridge should be exported from here
+class InvalidConfiguration(Exception):
+ """ Raise when getting an invalid conifguration """
+
+
def _visible_devs(predicate):
"""Returns a list of visible (vdsm manageable) links for which the
predicate is True"""
@@ -834,8 +838,9 @@
bondings = [b for (b, attrs) in self.bondings.iteritems() if
nic in attrs['slaves']]
if bondings:
- assert len(bondings) == 1, \
- "Unexpected configuration: More than one bonding per nic"
+ if len(bondings) != 1:
+ raise InvalidConfiguration(
+ "Unexpected configuration: More than one bonding per nic")
return bondings[0]
return None
@@ -853,13 +858,20 @@
for port in ports:
if port in self.vlans:
- assert vlan is None
+ if vlan is not None:
+ raise InvalidConfiguration(
+ "Unexpected vlan: %s exepected: None" % (vlan,))
nic = getVlanDevice(port)
vlan = getVlanID(port)
- assert self.vlans[port]['iface'] == nic
+ if self.vlans[port]['iface'] != nic:
+ raise InvalidConfiguration(
+ "Unexpected iface: %s expected: %s" %
+ (self.vlans[port]['iface'], nic))
port = nic
if port in self.bondings:
- assert bonding is None
+ if bonding is not None:
+ raise InvalidConfiguration(
+ "Unexpected bonding: %s expected: None" % bonding)
bonding = port
lnics += self.bondings[bonding]['slaves']
elif port in self.nics:
--
To view, visit http://gerrit.ovirt.org/34361
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99ee49aa7e2364f57112e2452e3eab3940b6b00a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: clientIF: add logs during the recovery
......................................................................
clientIF: add logs during the recovery
The recovery flow is supposed to be sporadic, but it
is nevertheless very important.
The current flow is pretty opaque, and on big setups
it may take some time, leaving the admin to guess
what's going on.
This patch adds logs during the process, to make it
obvious what is happened, what is going on and what
is left to do.
Change-Id: I31dddf0a2bc760c5ad383ff6bfee9a72adc87c4f
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/clientIF.py
1 file changed, 44 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/43770/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index ef27874..0223cb6 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -463,36 +463,55 @@
caps.CpuTopology().cores())
migration.SourceThread.setMaxOutgoingMigrations(mog)
- # Recover
- for v in getVDSMDomains():
+ # Recover stage 1: domains from libvirt
+ doms = getVDSMDomains()
+ for idx, v in enumerate(doms):
vmId = v.UUIDString()
- if not self._recoverVm(vmId):
+ if self._recoverVm(vmId):
+ self.log.info(
+ 'recovery: from libvirt got domain %d/%d: %s',
+ idx, len(doms), vmId)
+ else:
# RH qemu proc without recovery
- self.log.info('loose qemu process with id: '
- '%s found, killing it.', vmId)
+ self.log.info(
+ 'recovery: loose qemu process with id: '
+ '%s found, killing it.', vmId)
try:
v.destroy()
except libvirt.libvirtError:
- self.log.error('failed to kill loose qemu '
- 'process with id: %s',
- vmId, exc_info=True)
+ self.log.exception(
+ 'recovery: failed to kill loose qemu '
+ 'process with id: %s', vmId)
+ # Recover stage 2: domains from recovery files
# we do this to safely handle VMs which disappeared
# from the host while VDSM was down/restarting
recVms = self._getVDSMVmsFromRecovery()
if recVms:
- self.log.warning('Found %i VMs from recovery files not'
+ self.log.warning('recovery: found %i VMs from data files not'
' reported by libvirt.'
' This should not happen!'
' Will try to recover them.', len(recVms))
- for vmId in recVms:
- if not self._recoverVm(vmId):
- self.log.warning('VM %s failed to recover from recovery'
- ' file, reported as Down', vmId)
+ for idx, vmId in enumerate(recVms):
+ if self._recoverVm(vmId):
+ self.log.info(
+ 'recovery: from data file domain %d/%d: %s',
+ idx, len(recVms), vmId)
+ else:
+ self.log.warning(
+ 'recovery: VM %s failed to recover from data'
+ ' file, reported as Down', vmId)
- while (self._enabled and
- vmstatus.WAIT_FOR_LAUNCH in [v.lastStatus for v in
- self.vmContainer.values()]):
+ # recover stage 3: waiting for domains to go up
+ while self._enabled:
+ launching = sum(v.lastStatus == vmstatus.WAIT_FOR_LAUNCH
+ for v in self.vmContainer.values()])
+ if not launching:
+ break
+ else:
+ self.log.info(
+ 'recovery: waiting for %d domains to go up',
+ launching)
time.sleep(1)
self._cleanOldFiles()
self._recovery = False
@@ -503,20 +522,25 @@
# volumes manipulations
while self._enabled and self.vmContainer and \
not self.irs.getConnectedStoragePoolsList()['poollist']:
+ self.log.info('recovery: waiting for storage pool to go up')
time.sleep(5)
- for vmId, vmObj in self.vmContainer.items():
+ vmObjects = self.vmContainer.values()
+ for idx, vmObj in enumerate(vmObjects):
# Let's recover as much VMs as possible
try:
# Do not prepare volumes when system goes down
if self._enabled:
+ self.log.info(
+ 'recovery: preparing paths for vm %d/%d: %s',
+ idx, len(vmObjects), vmObj.id)
vmObj.preparePaths(
vmObj.devSpecMapFromConf()[hwclass.DISK])
except:
- self.log.error("Vm %s recovery failed",
- vmId, exc_info=True)
+ self.log.exception(
+ "recovery: failed for vm %s", vmObj.id)
except:
- self.log.error("Vm's recovery failed", exc_info=True)
+ self.log.exception("recovery: failed")
raise
def _getVDSMVmsFromRecovery(self):
--
To view, visit https://gerrit.ovirt.org/43770
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I31dddf0a2bc760c5ad383ff6bfee9a72adc87c4f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: ipwrapper: Use zombiereaper to wait for process
......................................................................
ipwrapper: Use zombiereaper to wait for process
Commit aea8aab95f eliminated ip process zombies by waiting for ip
process. This is may introduce unlimited wait if the process is not
responsive. We can avoid this issue by using zombiereaper.
Note that zombiereaper requires explicit initialization (registering
signal handler for SIGCHLD), so this make ipwrapper less useful as
generic utility.
Change-Id: I26263c5b4811d7f46f7c65d1d1b00bd96af02eb8
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/ipwrapper.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/32216/1
diff --git a/lib/vdsm/ipwrapper.py b/lib/vdsm/ipwrapper.py
index af31159..781e95b 100644
--- a/lib/vdsm/ipwrapper.py
+++ b/lib/vdsm/ipwrapper.py
@@ -27,6 +27,7 @@
import signal
import socket
import struct
+import zombiereaper
from netaddr.core import AddrFormatError
from netaddr import IPAddress
@@ -638,7 +639,7 @@
def stop(self):
self.proc.kill()
- self.proc.wait()
+ zombiereaper.autoReapPID(self.proc.pid)
@classmethod
def _parseLine(cls, line):
--
To view, visit http://gerrit.ovirt.org/32216
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I26263c5b4811d7f46f7c65d1d1b00bd96af02eb8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: schema: Fix asserts that had side effect
......................................................................
schema: Fix asserts that had side effect
Asserts should never have side effects, so optimizing them out will not
change the semantics of the code. Running with optimization would break
parsing, eliminating line.pop(0) operations. Now the only difference is
the warning if the line is not empty.
Change-Id: I59dbb1c8d3760af7d3f3049227f6ad8ceeaa402a
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/rpc/process-schema.py
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/34362/1
diff --git a/vdsm/rpc/process-schema.py b/vdsm/rpc/process-schema.py
index 4b1c3cf..8e56a1a 100755
--- a/vdsm/rpc/process-schema.py
+++ b/vdsm/rpc/process-schema.py
@@ -103,7 +103,8 @@
'xxx': []})
# Pop a blank line
- assert('' == lines.pop(0))
+ line = lines.pop(0)
+ assert line == '', "Expected empty line: %r" % line
# Grab the entity description. It might span multiple lines.
symbol['desc'] = lines.pop(0)
@@ -111,7 +112,8 @@
symbol['desc'] += lines.pop(0)
# Pop a blank line
- assert ('' == lines.pop(0))
+ line = lines.pop(0)
+ assert line == '', "Expected empty line: %r" % line
# Populate the rest of the human-readable data.
# First try to read the parameters/members information. We are finished
--
To view, visit http://gerrit.ovirt.org/34362
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59dbb1c8d3760af7d3f3049227f6ad8ceeaa402a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: misc: Replace assert with AssetionError
......................................................................
misc: Replace assert with AssetionError
The code was wrongly assumed that asserts are always available. When
running in optimized mode, the check would be skipped, leading to
disastrous results.
The assert was correct in that this is something that should never
happen, unless someone is using the barrier incorrectly, or there is
a bug in the code.
Change-Id: I68f57e393423dc4faf58763a036220849a968e70
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/misc.py
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/34363/1
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index ab2b4fd..5abcdcb 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -696,7 +696,9 @@
def exit(self):
with self._cond:
- assert self._busy, "Attempt to exit a barrier without entering"
+ if not self._busy:
+ raise AssertionError("Attempt to exit a barrier without "
+ "entering")
self._busy = False
self._cond.notifyAll()
--
To view, visit http://gerrit.ovirt.org/34363
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I68f57e393423dc4faf58763a036220849a968e70
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: Configure iscsi_session recovery_tmo for multipath devices
......................................................................
Configure iscsi_session recovery_tmo for multipath devices
This configuration is done by device-mapper-multipath in version
0.4.9-76 and later. However, device looses configuration after recovery
from network errors.
This patch adds the recovery_tmo configuration to vdsm-multipath udev
rules. Since setting the timeout requires a script, the dmsetup command
was moved into a new multipath-configure-device script.
When we require a multipath version fixing this issue, we can remove the
timeout handling code.
Change-Id: Iaaa40fa5e6dc86beef501ef4aaefa17c4c1574c1
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M .gitignore
M configure.ac
M debian/vdsm.install
M vdsm.spec.in
M vdsm/storage/Makefile.am
A vdsm/storage/multipath-configure-device.in
A vdsm/storage/vdsm-multipath.rules
D vdsm/storage/vdsm-multipath.rules.in
8 files changed, 53 insertions(+), 22 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/32582/1
diff --git a/.gitignore b/.gitignore
index fca4f2e..5890806 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,7 +61,6 @@
vdsm/storage/protect/safelease
vdsm/storage/lvm.env
vdsm/storage/vdsm-lvm.rules
-vdsm/storage/vdsm-multipath.rules
vdsm/sudoers.vdsm
vdsm/svdsm.logger.conf
vdsm/vdscli.py
diff --git a/configure.ac b/configure.ac
index f40d57a..c467c37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -335,10 +335,10 @@
vdsm/rpc/Makefile
vdsm/sos/Makefile
vdsm/storage/Makefile
+ vdsm/storage/multipath-configure-device
vdsm/storage/imageRepository/Makefile
vdsm/storage/protect/Makefile
vdsm/storage/vdsm-lvm.rules
- vdsm/storage/vdsm-multipath.rules
vdsm/virt/Makefile
vdsm_hooks/Makefile
vdsm_hooks/checkimages/Makefile
diff --git a/debian/vdsm.install b/debian/vdsm.install
index bd63c72..759383d 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -25,6 +25,7 @@
./usr/lib/python2.7/dist-packages/sos/plugins/vdsm.py
./usr/lib/python2.7/dist-packages/vdsmapi.py
./usr/libexec/vdsm/curl-img-wrap
+./usr/libexec/vdsm/multiapth-configure-device
./usr/libexec/vdsm/ovirt_functions.sh
./usr/libexec/vdsm/persist-vdsm-hooks
./usr/libexec/vdsm/safelease
diff --git a/vdsm.spec.in b/vdsm.spec.in
index a5b354c..c912150 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -993,6 +993,7 @@
%{_libexecdir}/%{vdsm_name}/persist-vdsm-hooks
%{_libexecdir}/%{vdsm_name}/unpersist-vdsm-hook
%{_libexecdir}/%{vdsm_name}/ovirt_functions.sh
+%{_libexecdir}/%{vdsm_name}/multipath-configure-device
%{_libexecdir}/%{vdsm_name}/vdsm-gencerts.sh
%{_libexecdir}/%{vdsm_name}/vdsmd_init_common.sh
%{_datadir}/%{vdsm_name}/network/__init__.py*
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index 99b1460..91c2f9c 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -72,7 +72,8 @@
volume.py
dist_vdsmexec_SCRIPTS = \
- curl-img-wrap
+ curl-img-wrap \
+ multipath-configure-device
nodist_vdsmstorage_DATA = \
lvm.env \
diff --git a/vdsm/storage/multipath-configure-device.in b/vdsm/storage/multipath-configure-device.in
new file mode 100644
index 0000000..dcdfea5
--- /dev/null
+++ b/vdsm/storage/multipath-configure-device.in
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Copyright 2014 Red Hat, Inc. and/or its affiliates.
+#
+# Licensed to you under 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. See the files README and
+# LICENSE_GPL_v2 which accompany this distribution.
+#
+
+set -e
+
+# Ensure that multipath devices use no_path_retry fail, instead of
+# no_path_retry queue, which is hardcoded in multipath configuration for many
+# devices.
+#
+# See https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/ht…
+
+@DMSETUP_PATH@ message $DM_NAME 0 fail_if_no_path
+
+# Set iscsi_session recovery_tmo. This parameter is configured by multipath on
+# startup, but after a device fail and become active again, the configuration
+# is lost and revert back to iscsid.conf default (120).
+
+timeout=5
+
+for slave in /sys${DEVPATH}/slaves/*; do
+ path=$(@UDEVADM_PATH@ info --query=path --path="$slave")
+ session=$(echo "$path" | @SED_PATH@ -rn s'|^/devices/platform/host[0-9]+/(session[0-9]+)/.+$|\1|p')
+ if [ -n "$session" ]; then
+ echo $timeout > "/sys/class/iscsi_session/${session}/recovery_tmo"
+ fi
+done
diff --git a/vdsm/storage/vdsm-multipath.rules b/vdsm/storage/vdsm-multipath.rules
new file mode 100644
index 0000000..d4d0dd7
--- /dev/null
+++ b/vdsm/storage/vdsm-multipath.rules
@@ -0,0 +1,15 @@
+#
+# Copyright 2014 Red Hat, Inc. and/or its affiliates.
+#
+# Licensed to you under 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. See the files README and
+# LICENSE_GPL_v2 which accompany this distribution.
+#
+
+# Vdsm rules for multipath devices.
+#
+# This rule runs vdsm-mutipath-configure tool to configure multiapth devices to
+# work with vdsm.
+
+ACTION=="add|change", ENV{DM_UUID}=="mpath-?*", RUN+="/usr/libexec/vdsm/multipath-configure-device"
diff --git a/vdsm/storage/vdsm-multipath.rules.in b/vdsm/storage/vdsm-multipath.rules.in
deleted file mode 100644
index cc2a878..0000000
--- a/vdsm/storage/vdsm-multipath.rules.in
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright 2014 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under 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. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-# Vdsm rules for multipath devices.
-#
-# Ensure that multipath devices use no_path_retry fail, instead of
-# no_path_retry queue, which is hardcoded in multipath configuration for many
-# devices.
-#
-# See https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/ht…
-#
-
-ACTION=="add|change", ENV{DM_UUID}=="mpath-?*", RUN+="@DMSETUP_PATH@ message $env{DM_NAME} 0 fail_if_no_path"
--
To view, visit http://gerrit.ovirt.org/32582
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaaa40fa5e6dc86beef501ef4aaefa17c4c1574c1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: vm: Require format attribute for drives
......................................................................
vm: Require format attribute for drives
We have seen sampling errors where a drive has no "format" attribute.
These errors spam the system logs, and does not help to debug the real
issue - why the required format attribute is not set?
This patch ensure that a drive cannot be created without a format
attribute, avoding log spam by sampling errors, and hopefully revealing
the real reason for this bug.
One broken test creating a drive without a format was fixed and new test
ensure that creating drive without a format raises.
Change-Id: I01ab1e071ecb76f383cc6dc7d99782e10cc90136
Relates-To: http://gerrit.ovirt.org/22551
Relates-To: https://bugzilla.redhat.com/994534
Relates-To: http://lists.ovirt.org/pipermail/users/2014-February/021007.html
Bug-Url: https://bugzilla.redhat.com/1055437
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/vmTests.py
M vdsm/vm.py
2 files changed, 28 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/24234/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 1e0a3f6..724d458 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -449,6 +449,18 @@
redir = vm.RedirDevice(self.conf, self.log, **dev)
self.assertXML(redir.getXML(), redirXML)
+ def testDriveRequiredParameters(self):
+ # TODO: It is not clear what are the other required parameters, and it
+ # the parameters depend on the type of drive. We probbaly need bigger
+ # test here that test many combinations.
+ # Currently this test only missing "format" attribute.
+ conf = {'index': '2', 'propagateErrors': 'off', 'iface': 'ide',
+ 'name': 'hdc', 'device': 'cdrom', 'path': '/tmp/fedora.iso',
+ 'type': 'disk', 'readonly': 'True', 'shared': 'none',
+ 'serial': '54-a672-23e5b495a9ea'}
+ self.assertRaises(vm.InvalidDeviceParameters, vm.Drive, {}, self.log,
+ **conf)
+
def testDriveSharedStatus(self):
sharedConfigs = [
# Backward compatibility
@@ -470,7 +482,8 @@
'exclusive', 'shared', 'none', 'transient',
]
- driveConfig = {'index': '0', 'iface': 'virtio', 'device': 'disk'}
+ driveConfig = {'index': '0', 'iface': 'virtio', 'device': 'disk',
+ 'format': 'raw'}
for driveInput, driveOutput in zip(sharedConfigs, expectedStates):
driveInput.update(driveConfig)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index aae8bd6..b7151b1 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -80,6 +80,10 @@
SMARTCARD_DEVICES = 'smartcard'
+class InvalidDeviceParameters(Exception):
+ """ Raised when creating device with invalid parameters """
+
+
def isVdsmImage(drive):
"""
Tell if drive looks like a vdsm image
@@ -1438,6 +1442,9 @@
VOLWM_CHUNK_REPLICATE_MULT = 2 # Chunk multiplier during replication
def __init__(self, conf, log, **kwargs):
+ if 'format' not in kwargs:
+ raise InvalidDeviceParameters('"format" attribute is required:'
+ ' %r' % kwargs)
if not kwargs.get('serial'):
self.serial = kwargs.get('imageID'[-20:]) or ''
VmDevice.__init__(self, conf, log, **kwargs)
@@ -3108,8 +3115,13 @@
for devType, devClass in self.DeviceMapping:
for dev in devices[devType]:
- self._devices[devType].append(devClass(self.conf, self.log,
- **dev))
+ try:
+ drive = devClass(self.conf, self.log, **dev)
+ except InvalidDeviceParameters as e:
+ self.log.error('Ignoring device with invalid parameters:'
+ ' %s', e, exc_info=True)
+ else:
+ self._devices[devType].append(drive)
# We should set this event as a last part of drives initialization
self._pathsPreparedEvent.set()
--
To view, visit http://gerrit.ovirt.org/24234
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01ab1e071ecb76f383cc6dc7d99782e10cc90136
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: vm: Prevent multiple threads blocking on same libvirt domain
......................................................................
vm: Prevent multiple threads blocking on same libvirt domain
If a libvirt call get stuck because a vm is not responding, we could
have multiple threads blocked on same vm without any limit, using
precious libvirt resources that could be used to run other vms.
This patch adds a new TimedLock lock, that raise a LockTimeout if the
lock cannot be acquired after configured timeout. Using this lock, a vm
allow now only one concurrent libvirt call. If a libvirt call get stuck,
and other threads are tyring to invoke libvirt calls on the same
vm, they will wait until the current call finish, or fail with a
timeout.
This should slow down calls for single vm, since each call is invoked
only when the previous call returns. However, when using many vms, this
creates natural round-robin scheduling, giving each vm equal chance to
make progress, and limiting the load on libvirt.
Change-Id: Ib459697b8688ebcba987cd6b9e11815826e92990
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M debian/vdsm-python.install
M lib/vdsm/Makefile.am
A lib/vdsm/locking.py
M tests/Makefile.am
A tests/lockingTests.py
M vdsm.spec.in
M vdsm/virt/vm.py
7 files changed, 172 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/30772/1
diff --git a/debian/vdsm-python.install b/debian/vdsm-python.install
index 9d6a99c..b80fd4f 100644
--- a/debian/vdsm-python.install
+++ b/debian/vdsm-python.install
@@ -8,6 +8,7 @@
./usr/lib/python2.7/dist-packages/vdsm/exception.py
./usr/lib/python2.7/dist-packages/vdsm/ipwrapper.py
./usr/lib/python2.7/dist-packages/vdsm/libvirtconnection.py
+./usr/lib/python2.7/dist-packages/vdsm/locking.py
./usr/lib/python2.7/dist-packages/vdsm/netconfpersistence.py
./usr/lib/python2.7/dist-packages/vdsm/netinfo.py
./usr/lib/python2.7/dist-packages/vdsm/netlink/__init__.py
diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am
index 8e90e6e..ffb642c 100644
--- a/lib/vdsm/Makefile.am
+++ b/lib/vdsm/Makefile.am
@@ -28,6 +28,7 @@
exception.py \
ipwrapper.py \
libvirtconnection.py \
+ locking.py \
netconfpersistence.py \
netinfo.py \
profile.py \
diff --git a/lib/vdsm/locking.py b/lib/vdsm/locking.py
new file mode 100644
index 0000000..9e92ca3
--- /dev/null
+++ b/lib/vdsm/locking.py
@@ -0,0 +1,54 @@
+#
+# 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
+#
+
+import threading
+import time
+
+
+class LockTimeout(Exception):
+ """ Timeout acquiring a TimedLock """
+
+
+class TimedLock(object):
+ """
+ A lock raising a LockTimeout if it cannot be acquired within timeout.
+ """
+
+ def __init__(self, name, timeout):
+ self._name = name
+ self._timeout = timeout
+ self._cond = threading.Condition(threading.Lock())
+ self._busy = False
+
+ def __enter__(self):
+ deadline = time.time() + self._timeout
+ with self._cond:
+ while self._busy:
+ now = time.time()
+ if now >= deadline:
+ raise LockTimeout("Timeout acquiring lock %r" % self._name)
+ self._cond.wait(deadline - now)
+ self._busy = True
+ return self
+
+ def __exit__(self, *args):
+ with self._cond:
+ self._busy = False
+ self._cond.notify()
diff --git a/tests/Makefile.am b/tests/Makefile.am
index aa4a45e..10a2727 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -44,6 +44,7 @@
jsonRpcTests.py \
ksmTests.py \
libvirtconnectionTests.py \
+ lockingTests.py \
lvmTests.py \
main.py \
miscTests.py \
diff --git a/tests/lockingTests.py b/tests/lockingTests.py
new file mode 100644
index 0000000..9ac8a05
--- /dev/null
+++ b/tests/lockingTests.py
@@ -0,0 +1,89 @@
+#
+# 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
+#
+
+import time
+import threading
+from vdsm import locking
+from testlib import VdsmTestCase
+
+
+class TimedLockTests(VdsmTestCase):
+
+ def test_free(self):
+ lock = locking.TimedLock("xxx-yyy-zzz", 0)
+ with self.assertNotRaises():
+ with lock:
+ pass
+
+ def test_busy(self):
+ lock = locking.TimedLock("xxx-yyy-zzz", 0)
+ with self.assertRaises(locking.LockTimeout):
+ with lock:
+ with lock:
+ pass
+
+ def test_serialize(self):
+ lock = locking.TimedLock("xxx-yyy-zzz", 0.4)
+ single_thread = threading.BoundedSemaphore(1)
+ passed = [0]
+ timedout = [0]
+
+ def run():
+ try:
+ with lock:
+ with single_thread:
+ time.sleep(0.1)
+ passed[0] += 1
+ except locking.LockTimeout:
+ timedout[0] += 1
+
+ self.run_threads(3, run)
+ self.assertEquals(passed[0], 3)
+ self.assertEquals(timedout[0], 0)
+
+ def test_timeout(self):
+ lock = locking.TimedLock("xxx-yyy-zzz", 0.1)
+ single_thread = threading.BoundedSemaphore(1)
+ passed = [0]
+ timedout = [0]
+
+ def run():
+ try:
+ with lock:
+ with single_thread:
+ time.sleep(0.2)
+ passed[0] += 1
+ except locking.LockTimeout:
+ timedout[0] += 1
+
+ self.run_threads(3, run)
+ self.assertEquals(passed[0], 1)
+ self.assertEquals(timedout[0], 2)
+
+ def run_threads(self, count, target):
+ threads = []
+ for i in range(count):
+ t = threading.Thread(target=target)
+ t.daemon = True
+ threads.append(t)
+ for t in threads:
+ t.start()
+ for t in threads:
+ t.join()
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 2d371b1..c7a2b0b 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1159,6 +1159,7 @@
%{python_sitearch}/%{vdsm_name}/exception.py*
%{python_sitearch}/%{vdsm_name}/ipwrapper.py*
%{python_sitearch}/%{vdsm_name}/libvirtconnection.py*
+%{python_sitearch}/%{vdsm_name}/locking.py*
%{python_sitearch}/%{vdsm_name}/netinfo.py*
%{python_sitearch}/%{vdsm_name}/netlink/__init__.py*
%{python_sitearch}/%{vdsm_name}/netlink/addr.py*
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 25eec71..9e9a844 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -37,6 +37,7 @@
# vdsm imports
from vdsm import constants
from vdsm import libvirtconnection
+from vdsm import locking
from vdsm import netinfo
from vdsm import qemuimg
from vdsm import utils
@@ -619,12 +620,24 @@
class NotifyingVirDomain:
- # virDomain wrapper that notifies vm when a method raises an exception with
- # get_error_code() = VIR_ERR_OPERATION_TIMEOUT
+ """
+ Wrap virDomain object for limiting concurrent calls and reporting timeouts.
- def __init__(self, dom, tocb):
+ The wrapper allows only one concurrent call per vm, to prevent blocking of
+ multiple threads when underlying libvirt call get stuck. Invoking a domain
+ method will block if the domain is busy with another call. If the domain is
+ not available after timeout seconds, a timeout is reported and a
+ TimeoutError is raised.
+
+ If a domain method was invoked, and the libvirt call failed with with
+ VIR_ERR_OPERATION_TIMEOUT error code, the timeout is reported, and
+ TimeoutError is raised.
+ """
+
+ def __init__(self, dom, tocb, vmid, timeout=30):
self._dom = dom
self._cb = tocb
+ self._timedlock = locking.TimedLock(vmid, timeout)
def __getattr__(self, name):
attr = getattr(self._dom, name)
@@ -633,7 +646,8 @@
def f(*args, **kwargs):
try:
- ret = attr(*args, **kwargs)
+ with self._timedlock:
+ ret = attr(*args, **kwargs)
self._cb(False)
return ret
except libvirt.libvirtError as e:
@@ -643,6 +657,9 @@
toe.err = e.err
raise toe
raise
+ except locking.LockTimeout as e:
+ self._cb(True)
+ raise TimeoutError(e)
return f
@@ -2892,7 +2909,7 @@
if self.recovering:
self._dom = NotifyingVirDomain(
self._connection.lookupByUUIDString(self.id),
- self._timeoutExperienced)
+ self._timeoutExperienced, self.id)
elif 'restoreState' in self.conf:
fromSnapshot = self.conf.get('restoreFromSnapshot', False)
srcDomXML = self.conf.pop('_srcDomXML')
@@ -2912,7 +2929,7 @@
self._dom = NotifyingVirDomain(
self._connection.lookupByUUIDString(self.id),
- self._timeoutExperienced)
+ self._timeoutExperienced, self.id)
else:
flags = libvirt.VIR_DOMAIN_NONE
if 'launchPaused' in self.conf:
@@ -2921,7 +2938,7 @@
del self.conf['launchPaused']
self._dom = NotifyingVirDomain(
self._connection.createXML(domxml, flags),
- self._timeoutExperienced)
+ self._timeoutExperienced, self.id)
hooks.after_vm_start(self._dom.XMLDesc(0), self.conf)
for dev in self._customDevices():
hooks.after_device_create(dev._deviceXML, self.conf,
@@ -3690,7 +3707,7 @@
# or restart vdsm if connection to libvirt was lost
self._dom = NotifyingVirDomain(
self._connection.lookupByUUIDString(self.id),
- self._timeoutExperienced)
+ self._timeoutExperienced, self.id)
if not self._incomingMigrationFinished.isSet():
state = self._dom.state(0)
--
To view, visit http://gerrit.ovirt.org/30772
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib459697b8688ebcba987cd6b9e11815826e92990
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: resourceManager: Keep resource state if registerResource fails
......................................................................
resourceManager: Keep resource state if registerResource fails
Previous code was increasing resource activeUsers counter, but
exceptions raised after that caused the method to fail, leaving a locked
resources that nobody can release. Such locked resource may lead to
failure of any pool operation, making the host non-operational, and
requiring a restart of vdsm.
The failure in the field was caused by Python logging bug, raising
OSError when message was logged when log file was rotated. However, such
failure can happen everywhere, and locking code must be written in such
way that failure would never leave a resource locked.
This patch ensure that resource is added and activeUsers counter is
increased only if everything else was fine.
Since simulating logging error is hard, the tests monkeypatch the
RequestRef class to simulate a failure. This is little ugly, depending
on internal implementation detail, but I could not find a cleaner way.
Change-Id: I16abf41ebc8a8a99b292d38c945074752254a34b
Relates-To: https://bugzilla.redhat.com/1065650
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/resourceManagerTests.py
M vdsm/storage/resourceManager.py
2 files changed, 50 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/25284/1
diff --git a/tests/resourceManagerTests.py b/tests/resourceManagerTests.py
index 01b0669..e2b6461 100644
--- a/tests/resourceManagerTests.py
+++ b/tests/resourceManagerTests.py
@@ -29,6 +29,7 @@
import storage.resourceManager as resourceManager
from testrunner import VdsmTestCase as TestCaseBase
from testValidation import slowtest, stresstest
+import monkeypatch
class NullResourceFactory(resourceManager.SimpleResourceFactory):
@@ -209,6 +210,32 @@
ex.__class__.__name__)
self.fail("Managed to access an attribute not exposed by wrapper")
+
+ def testRegisterResourceFailureExclusive(self):
+ # This regeisterion must fail
+ with monkeypatch.MonkeyPatchScope(
+ [(resourceManager, 'RequestRef', FakeRequestRef)]):
+ self.assertRaises(Failure, self.manager.registerResource, "string",
+ "test", resourceManager.LockType.exclusive, None)
+
+ # And it should not leave a locked resource
+ with self.manager.acquireResource("string", "test",
+ resourceManager.LockType.exclusive,
+ 0):
+ pass
+
+ def testRegisterResourceFailureShared(self):
+ # This regeisterion must fail
+ with monkeypatch.MonkeyPatchScope(
+ [(resourceManager, 'RequestRef', FakeRequestRef)]):
+ self.assertRaises(Failure, self.manager.registerResource, "string",
+ "test", resourceManager.LockType.shared, None)
+
+ # And it should not leave a locked resource
+ with self.manager.acquireResource("string", "test",
+ resourceManager.LockType.exclusive,
+ 0):
+ pass
def testAccessAttributeNotExposedByRequestRef(self):
resources = []
@@ -705,3 +732,14 @@
except:
resourceManager.ResourceManager._instance = None
raise
+
+# Helpers
+
+
+class Failure(Exception):
+ """ Unique exception for testing """
+
+
+def FakeRequestRef(*a, **kw):
+ """ Used to simulate failures when registering a resource """
+ raise Failure()
diff --git a/vdsm/storage/resourceManager.py b/vdsm/storage/resourceManager.py
index 1be1450..ce144cf 100644
--- a/vdsm/storage/resourceManager.py
+++ b/vdsm/storage/resourceManager.py
@@ -559,23 +559,25 @@
if len(resource.queue) == 0 and \
resource.currentLock == LockType.shared and \
request.lockType == LockType.shared:
- resource.activeUsers += 1
self._log.debug("Resource '%s' found in shared state "
"and queue is empty, Joining current "
"shared lock (%d active users)",
- fullName, resource.activeUsers)
+ fullName, resource.activeUsers + 1)
request.grant()
+ ref = RequestRef(request)
contextCleanup.defer(request.emit,
ResourceRef(namespace, name,
resource.realObj,
request.reqID))
- return RequestRef(request)
+ resource.activeUsers += 1
+ return ref
- resource.queue.insert(0, request)
self._log.debug("Resource '%s' is currently locked, "
"Entering queue (%d in queue)",
- fullName, len(resource.queue))
- return RequestRef(request)
+ fullName, len(resource.queue) + 1)
+ ref = RequestRef(request)
+ resource.queue.insert(0, request)
+ return ref
# TODO : Creating the object inside the namespace lock causes
# the entire namespace to lock and might cause
@@ -592,19 +594,20 @@
contextCleanup.defer(request.cancel)
return RequestRef(request)
- resource = resources[name] = ResourceManager.ResourceInfo(
- obj, namespace, name)
+ resource = ResourceManager.ResourceInfo(obj, namespace, name)
resource.currentLock = request.lockType
resource.activeUsers += 1
self._log.debug("Resource '%s' is free. Now locking as '%s' "
"(1 active user)", fullName, request.lockType)
request.grant()
+ ref = RequestRef(request)
contextCleanup.defer(request.emit,
ResourceRef(namespace, name,
resource.realObj,
request.reqID))
- return RequestRef(request)
+ resources[name] = resource
+ return ref
def releaseResource(self, namespace, name):
# WARN : unlike in resource acquire the user now has the request
--
To view, visit http://gerrit.ovirt.org/25284
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I16abf41ebc8a8a99b292d38c945074752254a34b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: virt: Fix wrong usage of apparentsize and truesize
......................................................................
virt: Fix wrong usage of apparentsize and truesize
Drive extension and live-merge code was assuming that apparentsize is
the volume allocated size, and truesize is the virtual volume size.
Looking in the schema, file-based storage implementation, and engine, it
is clear that this is wrong. The reason that this code works, is that in
block storage we do not implement apparentsize, so apparentsize is
always equal to truesize.
This patch switch the usage of apparentsize and truesize in code
handling only block stoage. Code that handle both file and block storage
is correct.
Since apparentsize and truesize are the same in block storage, this
patch does not change the behavior of the system. However, it is
required for the next patch, implementing apparentsize in block storage.
Change-Id: Ie447f40df0dae496c2400d0af9d81247ab5740a5
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/37834/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 04f1a67..88f4783 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1461,9 +1461,9 @@
for drive, volumeID, capacity, alloc, physical in extend:
self.log.info(
- "Requesting extension for volume %s on domain %s (apparent: "
+ "Requesting extension for volume %s on domain %s (truesize: "
"%s, capacity: %s, allocated: %s, physical: %s)",
- volumeID, drive.domainID, drive.apparentsize, capacity,
+ volumeID, drive.domainID, drive.truesize, capacity,
alloc, physical)
self.extendDriveVolume(drive, volumeID, physical, capacity)
@@ -1518,9 +1518,9 @@
self.log.debug("Verifying extension for volume %s, requested size %s, "
"current size %s", volInfo['volumeID'],
- volInfo['newSize'], apparentSize)
+ volInfo['newSize'], trueSize)
- if apparentSize < volInfo['newSize']:
+ if trueSize < volInfo['newSize']:
raise RuntimeError(
"Volume extension failed for %s (domainID: %s, volumeID: %s)" %
(volInfo['name'], volInfo['domainID'], volInfo['volumeID']))
@@ -3356,8 +3356,8 @@
# We need to stop the collection of the stats for two reasons, one
# is to prevent spurious libvirt errors about missing drive paths
# (since we're changing them), and also to prevent to trigger a drive
- # extension for the new volume with the apparent size of the old one
- # (the apparentsize is updated as last step in updateDriveParameters)
+ # extension for the new volume with the true size of the old one (the
+ # true is updated as last step in updateDriveParameters).
self.stopDisksStatsCollection()
try:
@@ -4740,8 +4740,8 @@
flags |= libvirt.VIR_DOMAIN_BLOCK_COMMIT_ACTIVE
# If top is the active layer, it's allocated size is stored in
- # drive.apparantsize.
- topSize = drive.apparentsize
+ # the drive.truesize.
+ topSize = drive.truesize
else:
# If top is an internal volume, we must call getVolumeInfo
res = self.cif.irs.getVolumeInfo(drive.domainID, drive.poolID,
@@ -4750,7 +4750,7 @@
self.log.error("Unable to get volume info for '%s'",
topVolUUID)
return errCode['mergeErr']
- topSize = int(res['info']['apparentsize'])
+ topSize = int(res['info']['truesize'])
# Take the jobs lock here to protect the new job we are tracking from
# being cleaned up by queryBlockJobs() since it won't exist right away
--
To view, visit http://gerrit.ovirt.org/37834
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie447f40df0dae496c2400d0af9d81247ab5740a5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: vm: Improve error handling when Vm._dom is None
......................................................................
vm: Improve error handling when Vm._dom is None
Vm._dom is initialized to None on when creating a vm, and set to None if
the underlying libvirt domain has died. Since Vm._dom is modified by
multiple threads, it is impossible to check for None before using it.
Even if it was possible, we don't want to litter the code with None
checks everywhere.
Some code was using this pattern:
try:
self._dom.doSomething()
except AttributeError:
# Oh, it was None
This code is not communicating well our intent. Worse, it hides
AttributeError in doSomthing()!
Most code never check self._dom before using it. In the rare cases it is
None, we fail with this Traceback:
Thread-460::ERROR::2015-07-04 19:53:21,977::__init__::520::jsonrpc.JsonRpcServer::(_serveRequest)
Internal server error
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/yajsonrpc/__init__.py", line 515, in _serveRequest
res = method(**params)
File "/usr/share/vdsm/rpc/Bridge.py", line 277, in _dynamicMethod
result = fn(*methodArgs)
File "/usr/share/vdsm/API.py", line 727, in freeze
return v.freeze()
File "/usr/share/vdsm/virt/vm.py", line 2882, in freeze
frozen = self._dom.fsFreeze()
AttributeError: 'NoneType' object has no attribute 'fsFreeze'
This traceback is a poor way to say "the vm is not running".
This patch introduces the DisconnectedVirDomain class. This object will
raise NotConnectedError for any attribute access. Vm._dom is initialzied
to DisconnectedVirDomain(vmid) on startup and after underlying libvirt
domain has died.
Code trying to talk with a dead vm will fail now with:
NotConnectedError: Vm '681f6b09-a9c3-4422-a7e2-2f607368718b' is not
running yet or was shut down.
Code handling disconnected state is using now:
try:
self._dom.doSomething()
except NotConnctedError:
...
This communicates our intent, and does not hide any error from the
underlying code.
Code checking for None is using now:
if self._dom.connected:
...
Change-Id: I5349ec51c7accf3b417b3bc9489c7eed5bfd8733
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/vmTests.py
M tests/vmfakelib.py
M vdsm/virt/sampling.py
M vdsm/virt/vm.py
4 files changed, 47 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/43225/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 038ffcc..5b63e89 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1056,7 +1056,6 @@
def testDomainNotRunningWithoutDomain(self):
with fake.VM() as testvm:
- self.assertEqual(testvm._dom, None)
self.assertFalse(testvm._isDomainRunning())
def testDomainNotRunningByState(self):
@@ -1087,7 +1086,6 @@
def testDomainNoneNotReadyForCommands(self):
with fake.VM() as testvm:
- testvm._dom = None
self.assertFalse(testvm.isDomainReadyForCommands())
def testReadyForCommandsRaisesLibvirtError(self):
@@ -1492,7 +1490,6 @@
def testVmWithoutDom(self):
with fake.VM() as testvm:
- self.assertTrue(testvm._dom is None)
self.assertAPIFailed(testvm.setBalloonTarget(128))
def testTargetValueNotInteger(self):
diff --git a/tests/vmfakelib.py b/tests/vmfakelib.py
index 211d647..d75198e 100644
--- a/tests/vmfakelib.py
+++ b/tests/vmfakelib.py
@@ -179,6 +179,10 @@
self._diskErrors = {}
self._downtimes = []
+ @property
+ def connected(self):
+ return True
+
def _failIfRequested(self):
if self._virtError != libvirt.VIR_ERR_OK:
raise Error(self._virtError, self._errorMessage)
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index af0910a..a14a1ef 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -546,6 +546,9 @@
elif not vm_obj.isDomainReadyForCommands():
self._skip_doms[vm_id] = True
else:
+ # TODO: This racy check may fail if the underlying libvirt
+ # domain has died just after checking isDomainReadyForCommands
+ # succeeded.
doms.append(vm_obj._dom._dom)
return doms
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 826e4e9..fa7c517 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -138,6 +138,13 @@
pass
+class NotConnectedError(Exception):
+ """
+ Raised when trying to talk with a vm that was not started yet or was shut
+ down.
+ """
+
+
VALID_STATES = (vmstatus.DOWN, vmstatus.MIGRATION_DESTINATION,
vmstatus.MIGRATION_SOURCE, vmstatus.PAUSED,
vmstatus.POWERING_DOWN, vmstatus.REBOOT_IN_PROGRESS,
@@ -188,6 +195,20 @@
pass
+class DisconnectedVirDomain(object):
+
+ def __init__(self, vmid):
+ self.vmid = vmid
+
+ @property
+ def connected(self):
+ return False
+
+ def __getattr__(self, name):
+ raise NotConnectedError("VM %r was not started yet or was shut down"
+ % self.vmid)
+
+
class NotifyingVirDomain:
# virDomain wrapper that notifies vm when a method raises an exception with
# get_error_code() = VIR_ERR_OPERATION_TIMEOUT
@@ -195,6 +216,10 @@
def __init__(self, dom, tocb):
self._dom = dom
self._cb = tocb
+
+ @property
+ def connected(self):
+ return True
def __getattr__(self, name):
attr = getattr(self._dom, name)
@@ -277,7 +302,7 @@
:param recover: Signal if the Vm is recovering;
:type recover: bool
"""
- self._dom = None
+ self._dom = DisconnectedVirDomain(params["vmId"])
self.recovering = recover
self.conf = {'pid': '0', '_blockJobs': {}, 'clientIp': ''}
self.conf.update(params)
@@ -810,7 +835,7 @@
def _onQemuDeath(self):
self.log.info('underlying process disconnected')
- self._dom = None
+ self._dom = DisconnectedVirDomain(self.id)
# Try release VM resources first, if failed stuck in 'Powering Down'
# state
result = self.releaseVm()
@@ -1555,10 +1580,8 @@
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_INVALID:
return errCode['migCancelErr']
raise
- except AttributeError:
- if self._dom is None:
- return errCode['migCancelErr']
- raise
+ except NotConnectedError:
+ return errCode['migCancelErr']
finally:
self._guestCpuLock.release()
@@ -1673,10 +1696,10 @@
def _isDomainRunning(self):
try:
status = self._dom.info()
- except AttributeError:
+ except NotConnectedError:
# Known reasons for this:
# * on migration destination, and migration not yet completed.
- # * self._dom may be set to None asynchronously (_onQemuDeath).
+ # * self._dom may be disconnected asynchronously (_onQemuDeath).
# If so, the VM is shutting down or already shut down.
return False
else:
@@ -1744,7 +1767,7 @@
pass
raise Exception('destroy() called before Vm started')
- if self._dom is None:
+ if not self._dom.connected:
raise MissingLibvirtDomainError(vmexitreason.LIBVIRT_START_FAILED)
self._updateDomainDescriptor()
@@ -1852,7 +1875,7 @@
self._connection.lookupByUUIDString(self.id),
self._timeoutExperienced)
elif 'migrationDest' in self.conf:
- pass # self._dom will be None until migration ends.
+ pass # self._dom will be disconnected until migration ends.
elif 'restoreState' in self.conf:
fromSnapshot = self.conf.get('restoreFromSnapshot', False)
srcDomXML = self.conf.pop('_srcDomXML')
@@ -2676,14 +2699,14 @@
"""
try:
state, details, stateTime = self._dom.controlInfo()
- except AttributeError:
+ except NotConnectedError:
# this method may be called asynchronously by periodic
# operations. Thus, we must use a try/except block
# to avoid racy checks.
return False
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- # same as AttributeError above: possible race on shutdown
+ # same as NotConnectedError above: possible race on shutdown
return False
else:
raise
@@ -3615,7 +3638,7 @@
# Terminate the VM's creation thread.
self._incomingMigrationFinished.set()
self.guestAgent.stop()
- if self._dom:
+ if self._dom.connected:
result = self._destroyVmGraceful()
if result['status']['code']:
return result
@@ -3707,7 +3730,7 @@
def setBalloonTarget(self, target):
- if self._dom is None:
+ if not self._dom.connected:
return self._reportError(key='balloonErr')
try:
target = int(target)
@@ -4363,11 +4386,11 @@
# Libvirt sometimes send the SUSPENDED/SUSPENDED_PAUSED event
# after RESUMED/RESUMED_MIGRATED (when VM status is PAUSED
# when migration completes, see qemuMigrationFinish function).
- # In this case self._dom is None because the function
+ # In this case self._dom is disconnected because the function
# _completeIncomingMigration didn't update it yet.
try:
domxml = self._dom.XMLDesc(0)
- except AttributeError:
+ except NotConnectedError:
pass
else:
hooks.after_vm_pause(domxml, self.conf)
@@ -4383,7 +4406,7 @@
# callback however we do not use it.
try:
domxml = self._dom.XMLDesc(0)
- except AttributeError:
+ except NotConnectedError:
pass
else:
hooks.after_vm_cont(domxml, self.conf)
--
To view, visit https://gerrit.ovirt.org/43225
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5349ec51c7accf3b417b3bc9489c7eed5bfd8733
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Idan Shaby has uploaded a new change for review.
Change subject: lvm: Update hsm.__processVGInfos() with lvm.getPV() new API
......................................................................
lvm: Update hsm.__processVGInfos() with lvm.getPV() new API
In change I9932b044c (lvm: Raise an exception if missing physical
volume), we changed lvm.getPV() to raise an InaccessiblePhysDev
exception when the device is no longer in lvm's cache.
This patch updates hsm.__processVGInfos() to log a warning in such a
case since if we called lvm.getPV() with a device that is no longer in
lvm's cache, we still want to get the information for the other PVs.
That is, we don't want to stop hsm.__processVGInfos() operation.
Note that blovkSD.getMetaDataMapping() also calls lvm.getPV(), but in
contrast to hsm.__processVGInfos(), we don't want
blovkSD.getMetaDataMapping() to handle InaccessiblePhysDev because it's
a part of a scenario that creates a storage domain, and we want to fail
the whole operation in case that the PV is no longer in lvm's cache.
Change-Id: I583c0493093d2c9c8bca8713df8ee123c415de7f
Bug-Url: https://bugzilla.redhat.com/1048696
Signed-off-by: Idan Shaby <ishaby(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/38421/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index b92349c..bbc0f84 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3000,7 +3000,11 @@
vgType != dev["devtype"]):
vgType = multipath.DEV_MIXED
- pvInfo = lvm.getPV(pv)
+ try:
+ pvInfo = lvm.getPV(pv)
+ except se.InaccessiblePhysDev:
+ self.log.error("PV %s no longer exists", pv)
+ continue
vgInfo['pvlist'].append(self.__fillPVDict(dev, pvInfo, vgType))
if vgType == multipath.DEV_FCP:
--
To view, visit https://gerrit.ovirt.org/38421
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I583c0493093d2c9c8bca8713df8ee123c415de7f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Idan Shaby <ishaby(a)redhat.com>
Petr Horáček has uploaded a new change for review.
Change subject: network: check for bridge changes only if unified persistence is used
......................................................................
network: check for bridge changes only if unified persistence is used
In _should_keep_bridge we use running configurator to check if we should
keep bridge or remove it. Running configurator is available only when we
use unified persistence.
If we use ifcfg persistence, set keep_bridge always to False.
Change-Id: I788e73a1691db5cb49ad24812b9b93c8d47b8927
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M vdsm/network/api.py
1 file changed, 12 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/41349/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 6071f8d..dd55664 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -422,7 +422,7 @@
def _delNonVdsmNetwork(network, vlan, bonding, nics, _netinfo, configurator):
if network in netinfo.bridges():
net_ent = _objectivizeNetwork(bridge=network, vlan=vlan,
- bonding=bonding, nics=nics,
+ bonding=bonding, nics=nics,
_netinfo=_netinfo,
configurator=configurator,
implicitBonding=False)
@@ -838,12 +838,17 @@
for network, attrs in networks.items():
if network in _netinfo.networks:
logger.debug("Removing network %r", network)
- running_conf = configurator.runningConfig.networks.get(network)
- keep_bridge = _should_keep_bridge(
- network_attrs=attrs,
- currently_bridged=_netinfo.networks[network]['bridged'],
- network_running_config=running_conf
- )
+ if config.get('vars', 'net_configurator') == 'unified':
+ running_conf = configurator.runningConfig.networks.get(
+ network)
+ keep_bridge = _should_keep_bridge(
+ network_attrs=attrs,
+ currently_bridged=_netinfo.networks[network][
+ 'bridged'],
+ network_running_config=running_conf
+ )
+ else:
+ keep_bridge = False
_delNetwork(network, configurator=configurator, force=force,
implicitBonding=False, _netinfo=_netinfo,
--
To view, visit https://gerrit.ovirt.org/41349
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I788e73a1691db5cb49ad24812b9b93c8d47b8927
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
Piotr Kliczewski has uploaded a new change for review.
Change subject: logging: remove log messages which give little or no value
......................................................................
logging: remove log messages which give little or no value
Some of the messages logged during jsonrpc request processing give no or
little value when diagnosing the issues but are logged quite often.
This patch removes those messages.
Change-Id: If5c6648f39b24adb1a5950c80a3883de0182b3b4
Signed-off-by: pkliczewski <piotr.kliczewski(a)gmail.com>
Bug-Url: https://bugzilla.redhat.com/1239062
---
M lib/yajsonrpc/__init__.py
M lib/yajsonrpc/stompreactor.py
2 files changed, 0 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/43720/1
diff --git a/lib/yajsonrpc/__init__.py b/lib/yajsonrpc/__init__.py
index 68af242..778b9c0 100644
--- a/lib/yajsonrpc/__init__.py
+++ b/lib/yajsonrpc/__init__.py
@@ -530,7 +530,6 @@
@traceback(on=log.name)
def serve_requests(self):
while True:
- self.log.debug("Waiting for request")
obj = self._workQueue.get()
if obj is None:
break
diff --git a/lib/yajsonrpc/stompreactor.py b/lib/yajsonrpc/stompreactor.py
index e3b71bf..3ed451d 100644
--- a/lib/yajsonrpc/stompreactor.py
+++ b/lib/yajsonrpc/stompreactor.py
@@ -232,7 +232,6 @@
self._req_dest[request.get("id")] = req_dest
def handle_frame(self, dispatcher, frame):
- self.log.debug("Handling message %s", frame)
try:
self._commands[frame.command](dispatcher, frame)
except KeyError:
--
To view, visit https://gerrit.ovirt.org/43720
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If5c6648f39b24adb1a5950c80a3883de0182b3b4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Vinzenz Feenstra has uploaded a new change for review.
Change subject: virt: Handle disconnects only if endpoints match
......................................................................
virt: Handle disconnects only if endpoints match
Until now we used to handle every disconnect event with no respect
of which remote endpoint caused it.
There are currently 3 different types of graphic events:
1. Connected event someone connected to the port
2. Initialized event - Someone had the right credentials to establish
the connection and the session has started
3. Disconnected event - Someone disconnected from the port
Now any connected event can be triggered even with no credentials and
would eventually trigger the disconnected event due to being rejected.
This means that a host on the public internet which gets scanned for
opened ports and tried to intrude them would trigger the disconnect
handling for the affected VM.
This can cause that somone connected via Spice, VNC or even RDP with
the guest agent installed on the VM gets randomly a locked screen (default
behaviour).
This patch addresses the above mentioned issue by performing a comparison
of the remote endpoint that disconnected and remembering only initiated
endpoints. In case that multiple connections are established, like in case
of spice, the last initiated channel would be remembered and when that one
disconnects, it will cause the disconnect handling to proceed.
Due to some bug in the handling of graphic events in libvirt, SPICE
connections currently do not include the port. A fix for this has been
posted upstream and should eventually become available. Therefore, the
handling has been implemented to not ignore the disconnect event when
the clientPort value is an empty string.
Change-Id: Idfb3441407aa6e7bc31d37304bce0076e12bb1a3
Bug-Url: https://bugzilla.redhat.com/1203891
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/clientIF.py
M vdsm/virt/vm.py
2 files changed, 14 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/43141/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 1769a00..803fb78 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -594,9 +594,10 @@
'authScheme %s subject %s',
phase, localAddr, remoteAddr, authScheme, subject)
if phase == libvirt.VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE:
- v.onConnect(remoteAddr['node'])
+ v.onConnect(remoteAddr['node'], remoteAddr['service'])
elif phase == libvirt.VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT:
- v.onDisconnect()
+ v.onDisconnect(clientIp=remoteAddr['node'],
+ clientPort=remoteAddr['service'])
elif eventid == libvirt.VIR_DOMAIN_EVENT_ID_WATCHDOG:
action, = args[:-1]
v._onWatchdogEvent(action)
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 826e4e9..06a7f0d 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -352,6 +352,7 @@
self._vcpuTuneInfo = {}
self._numaInfo = {}
self._vmJobs = None
+ self._clientPort = ''
def _get_lastStatus(self):
# note that we don't use _statusLock here. One of the reasons is the
@@ -892,9 +893,10 @@
except Exception:
self.log.exception("Reboot event failed")
- def onConnect(self, clientIp=''):
+ def onConnect(self, clientIp='', clientPort=''):
if clientIp:
self.conf['clientIp'] = clientIp
+ self._clientPort = clientPort
def _timedDesktopLock(self):
# This is not a definite fix, we're aware that there is still the
@@ -917,7 +919,14 @@
message='Scheduled shutdown on disconnect',
force=True)
- def onDisconnect(self, detail=None):
+ def onDisconnect(self, detail=None, clientIp='', clientPort=''):
+ if self.conf['clientIp'] != clientIp:
+ self.log.debug('Ignoring disconnect event because ip differs')
+ return
+ if self._clientPort and self._clientPort != clientPort:
+ self.log.debug('Ignoring disconnect event because ports differ')
+ return
+
self.conf['clientIp'] = ''
# This is a hack to mitigate the issue of spice-gtk not respecting the
# configured secure channels. Spice-gtk is always connecting first to
--
To view, visit https://gerrit.ovirt.org/43141
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idfb3441407aa6e7bc31d37304bce0076e12bb1a3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: nettestlib: Remove unneeded hack for improving randomness
......................................................................
nettestlib: Remove unneeded hack for improving randomness
Python seed the random number generator from os.urandom() on startup, so
different processes do not use the same seed, and produce different
sequences of pseudo random numbers by default.
Change-Id: I631ec8572bb6a69ee086011d67daf7ed000d718b
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/nettestlib.py
1 file changed, 0 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/44216/1
diff --git a/tests/nettestlib.py b/tests/nettestlib.py
index 44a831d..ab7a8d5 100644
--- a/tests/nettestlib.py
+++ b/tests/nettestlib.py
@@ -21,7 +21,6 @@
import fcntl
import os
import platform
-import random
import signal
import struct
from multiprocessing import Process
@@ -144,10 +143,6 @@
def checkDependencies():
-
- # hack to avoid name collision in concurrently-running mock-based tests
- random.jumpahead(os.getpid())
-
dev = Bridge()
try:
dev.addDevice()
--
To view, visit https://gerrit.ovirt.org/44216
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I631ec8572bb6a69ee086011d67daf7ed000d718b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Ondřej Svoboda has uploaded a new change for review.
Change subject: network: wait for a bridge to appear before disabling IPv6 on it
......................................................................
network: wait for a bridge to appear before disabling IPv6 on it
A traceback such as
File "/usr/share/vdsm/network/configurators/ifcfg.py", line 101, in configureBridge
sysctl.disable_ipv6(bridge.name)
File "/usr/lib/python2.7/site-packages/vdsm/sysctl.py", line 42, in disable_ipv6
with open('/proc/sys/net/ipv6/conf/%s/disable_ipv6' % dev, 'w') as f:
IOError: [Errno 2] No such file or directory: u'/proc/sys/net/ipv6/conf/test-network/disable_ipv6'
shows that a bridge was not yet created when _ifup in ifcfg's configureBridge
already finished.
This patch makes configureBridge wait for the bridge for up to 1s. If it is
not created by then, a standard exception is triggered.
Change-Id: Ic5292e5a297ff50a0e82ba0781333e21fd9dd7f3
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M vdsm/network/configurators/__init__.py
M vdsm/network/configurators/ifcfg.py
M vdsm/network/configurators/iproute2.py
3 files changed, 22 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/43583/1
diff --git a/vdsm/network/configurators/__init__.py b/vdsm/network/configurators/__init__.py
index e51d3ed..6a5b484 100644
--- a/vdsm/network/configurators/__init__.py
+++ b/vdsm/network/configurators/__init__.py
@@ -24,6 +24,7 @@
from vdsm import netinfo
from vdsm.config import config
from vdsm.netconfpersistence import RunningConfig
+from vdsm.netlink import monitor
from .dhclient import DhcpClient
from ..errors import ConfigNetworkError, ERR_FAILED_IFUP
@@ -178,3 +179,19 @@
if iface.blockingdhcp and rc:
raise ConfigNetworkError(ERR_FAILED_IFUP, 'dhclient%s failed',
family)
+
+
+def wait_for_bridge(name, timeout=1):
+ """
+ Wait for a bridge to appear in a given timeout. If the bridge is not
+ created by then, raise a ConfigNetworkError.
+ """
+ with monitor.Monitor(timeout=timeout, groups=('link',),
+ silent_timeout=True) as mon:
+ if name in netinfo.bridges():
+ return
+ for event in mon:
+ if event.get('name') == name and event.get('event') == 'new_link':
+ return
+ raise ConfigNetworkError(ERR_FAILED_IFUP, 'Bridge %s was not created '
+ 'during a %ss timeout.' % (name, timeout))
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index e9ef7cc..b42e9b3 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -44,7 +44,7 @@
if utils.isOvirtNode():
from ovirt.node.utils import fs as node_fs
-from . import Configurator, dhclient, getEthtoolOpts, libvirt
+from . import Configurator, dhclient, getEthtoolOpts, libvirt, wait_for_bridge
from ..errors import ConfigNetworkError, ERR_FAILED_IFUP
from ..models import Nic, Bridge, IPv4, IPv6
from ..sourceroute import StaticSourceRoute, DynamicSourceRoute
@@ -98,6 +98,7 @@
_ifup(bridge)
if not bridge.ipv6.address and not bridge.ipv6.ipv6autoconf and (
not bridge.ipv6.dhcpv6):
+ wait_for_bridge(bridge.name)
sysctl.disable_ipv6(bridge.name)
def configureVlan(self, vlan, **opts):
diff --git a/vdsm/network/configurators/iproute2.py b/vdsm/network/configurators/iproute2.py
index 0b5b73e..ef36766 100644
--- a/vdsm/network/configurators/iproute2.py
+++ b/vdsm/network/configurators/iproute2.py
@@ -29,7 +29,8 @@
from vdsm.utils import CommandPath
from vdsm.utils import execCmd
-from . import Configurator, runDhclient, getEthtoolOpts, libvirt
+from . import (Configurator, runDhclient, getEthtoolOpts, libvirt,
+ wait_for_bridge)
from .dhclient import DhcpClient
from ..errors import ConfigNetworkError, ERR_FAILED_IFUP, ERR_FAILED_IFDOWN
from ..models import Nic
@@ -75,6 +76,7 @@
self.configApplier.setIfaceConfigAndUp(bridge)
if not bridge.ipv6.address and not bridge.ipv6.ipv6autoconf and (
not bridge.ipv6.dhcpv6):
+ wait_for_bridge(bridge.name)
sysctl.disable_ipv6(bridge.name)
self._addSourceRoute(bridge)
if 'custom' in opts and 'bridge_opts' in opts['custom']:
--
To view, visit https://gerrit.ovirt.org/43583
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5292e5a297ff50a0e82ba0781333e21fd9dd7f3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
Adam Litke has uploaded a new change for review.
Change subject: Live Merge: Allow extension of non-leaf raw volumes
......................................................................
Live Merge: Allow extension of non-leaf raw volumes
volume.extendSize() is currently prohibited for any non-leaf volume.
For a very specific live merge scenario we must permit extension of an
internal raw base volume. Allow this usage and add a comment explaining
the reasoning.
The scenario:
- User begins with a raw block disk.
- User creates a snapshot.
- User enlarges the disk (diskSizeExtend)
- User performs live merge to remove the snapshot
In this case the base volume is too small to accommodate the data
from the child volume and an error is raised since libvirt cannot
enlarge a block device. The solution is to require engine to call
extendVolumeSize on the base volume before requesting the live merge
operation.
Change-Id: I82a73356a863abe39d367cdc70a9b1e914f75aee
Signed-off-by: Adam Litke <alitke(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1232481
---
M vdsm/storage/volume.py
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/43407/1
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 980b6e3..1fa1571 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -548,10 +548,16 @@
"""
Extend the size (virtual disk size seen by the guest) of the volume.
"""
- if not self.isLeaf() or self.isShared():
+ if self.isShared():
raise se.VolumeNonWritable(self.volUUID)
+ # Note: This function previously prohibited extending non-leaf volumes.
+ # If a disk is enlarged a volume may become larger than its parent. In
+ # order to support live merge of a larger volume into its raw parent we
+ # must permit extension of this raw volume prior to starting the merge.
volFormat = self.getFormat()
+ if volFormat != RAW_FORMAT and not self.isLeaf():
+ raise se.VolumeNonWritable(self.volUUID)
if volFormat == COW_FORMAT:
self.log.debug("skipping cow size extension for volume %s to "
--
To view, visit https://gerrit.ovirt.org/43407
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82a73356a863abe39d367cdc70a9b1e914f75aee
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Adam Litke has uploaded a new change for review.
Change subject: Live merge: Update base size after live merge
......................................................................
Live merge: Update base size after live merge
When performing a live merge, data is copied from a top volume into a
base volume. If the top volume is larger than the base volume (which
can happen if the drive size was extended), libvirt will change the size
of the base volume to match that of the top volume. When synchronizing
metadata after the merge, we need to update the 'capacity' field of the
base volume to reflect the new size. We do this inside the
LiveMergeCleanupThread to ensure that it gets retried in the event of
storage connection problems or vdsm restarts.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1232481
Change-Id: Iae354de36db63ae3bf4b4fc7f72df5e306035784
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 37 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/42921/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 549cd38..05ff99e 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4510,7 +4510,7 @@
def queryBlockJobs(self):
def startCleanup(job, drive, needPivot):
- t = LiveMergeCleanupThread(self, job['jobID'], drive, needPivot)
+ t = LiveMergeCleanupThread(self, job, drive, needPivot)
t.start()
self._liveMergeCleanupThreads[job['jobID']] = t
@@ -4867,6 +4867,15 @@
(domainID, volumeID))
return VolumeSize(int(res['apparentsize']), int(res['truesize']))
+ def _getVolumeCapacity(self, domainID, poolID, imageID, volumeID):
+ """Return the volume capacity by accessing storage"""
+ res = self.cif.irs.getVolumeInfo(domainID, poolID, imageID, volumeID)
+ if res['status']['code'] != 0:
+ raise StorageUnavailableError(
+ "Unable to get volume capacity for domain %s volume %s" %
+ (domainID, volumeID))
+ return int(res['info']['capacity'])
+
def _setVolumeSize(self, domainID, poolID, imageID, volumeID, size):
res = self.cif.irs.setVolumeSize(domainID, poolID, imageID, volumeID,
size)
@@ -4877,11 +4886,11 @@
class LiveMergeCleanupThread(threading.Thread):
- def __init__(self, vm, jobId, drive, doPivot):
+ def __init__(self, vm, job, drive, doPivot):
threading.Thread.__init__(self)
self.setDaemon(True)
self.vm = vm
- self.jobId = jobId
+ self.job = job
self.drive = drive
self.doPivot = doPivot
self.success = False
@@ -4905,7 +4914,7 @@
self.vm.stopDisksStatsCollection()
self.vm.log.info("Requesting pivot to complete active layer commit "
- "(job %s)", self.jobId)
+ "(job %s)", self.job['jobID'])
try:
flags = libvirt.VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT
ret = self.vm._dom.blockJobAbort(self.drive.name, flags)
@@ -4915,22 +4924,38 @@
else:
if ret != 0:
self.vm.log.error("Pivot failed for job %s (rc=%i)",
- self.jobId, ret)
+ self.job['jobID'], ret)
raise RuntimeError("pivot failed")
self._waitForXMLUpdate()
- self.vm.log.info("Pivot completed (job %s)", self.jobId)
+ self.vm.log.info("Pivot completed (job %s)", self.job['jobID'])
+
+ def update_base_size(self):
+ # If the drive size was extended just after creating the snapshot which
+ # we are removing, the size of the top volume might be larger than the
+ # size of the base volume. In that case libvirt has enlarged the base
+ # volume automatically as part of the blockCommit operation. Update
+ # our metadata to reflect this change.
+ capacity = self.vm._getVolumeCapacity(self.drive.domainID,
+ self.drive.poolID,
+ self.drive.imageID,
+ self.job['topVolume'])
+ self.vm._setVolumeSize(self.drive.domainID, self.drive.poolID,
+ self.drive.imageID, self.job['baseVolume'],
+ capacity)
@utils.traceback()
def run(self):
+ self.update_base_size()
if self.doPivot:
self.tryPivot()
self.vm.log.info("Synchronizing volume chain after live merge "
- "(job %s)", self.jobId)
+ "(job %s)", self.job['jobID'])
self.vm._syncVolumeChain(self.drive)
if self.doPivot:
self.vm.startDisksStatsCollection()
self.success = True
- self.vm.log.info("Synchronization completed (job %s)", self.jobId)
+ self.vm.log.info("Synchronization completed (job %s)",
+ self.job['jobID'])
def isSuccessful(self):
"""
@@ -4976,9 +5001,10 @@
self.vm.log.info("The XML update has been completed")
break
else:
- self.log.error("Bad volume chain found for drive %s. Previous "
- "chain: %s, Expected chain: %s, Actual chain: "
- "%s", alias, origVols, expectedVols, curVols)
+ self.vm.log.error("Bad volume chain found for drive %s. "
+ "Previous chain: %s, Expected chain: %s, "
+ "Actual chain: %s", alias, origVols,
+ expectedVols, curVols)
raise RuntimeError("Bad volume chain found")
--
To view, visit https://gerrit.ovirt.org/42921
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae354de36db63ae3bf4b4fc7f72df5e306035784
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Hello Fred Rolland,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/44011
to review the following change.
Change subject: fc-connect-server: Support FCP on connect server
......................................................................
fc-connect-server: Support FCP on connect server
Add FCP support in in hsm._connectionDict2ConnectionInfo.
Change-Id: I408d8364278a1a502fc94a2e6537cb160c716ff1
Bug-Url: https://bugzilla.redhat.com/1242200
Signed-off-by: Fred Rolland <frolland(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/44011/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index f22d8d7..a79b7ee 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -116,9 +116,7 @@
sd.LOCALFS_DOMAIN: 'localfs',
sd.NFS_DOMAIN: 'nfs',
sd.ISCSI_DOMAIN: 'iscsi',
- # FCP domain shouldn't even be on the list but VDSM use to just
- # accept this type as iscsi so we are stuck with it
- sd.FCP_DOMAIN: 'iscsi',
+ sd.FCP_DOMAIN: 'fcp',
sd.POSIXFS_DOMAIN: 'posixfs',
sd.GLUSTERFS_DOMAIN: 'glusterfs'}
@@ -241,6 +239,8 @@
cred = iscsi.ChapCredentials(username, password)
params = storageServer.IscsiConnectionParameters(target, iface, cred)
+ elif typeName == 'fcp':
+ params = storageServer.FcpConnectionParameters('fcp')
else:
raise se.StorageServerActionError()
--
To view, visit https://gerrit.ovirt.org/44011
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I408d8364278a1a502fc94a2e6537cb160c716ff1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Freddy Rolland <frolland(a)redhat.com>
Gerrit-Reviewer: Fred Rolland <frolland(a)redhat.com>
Hello Fred Rolland,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/44009
to review the following change.
Change subject: fc-connect-server: Move call to refreshStorage
......................................................................
fc-connect-server: Move call to refreshStorage
For clearer readability, move call to sdCache.refreshStorage from
__prefetchDomains to connectStorageServer.
Change-Id: If8ac84cc2bfd3490f3da41f0bc79fc372495a5a7
Bug-Url: https://bugzilla.redhat.com/1242200
Signed-off-by: Fred Rolland <frolland(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/44009/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index f68d3bb..f22d8d7 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2388,7 +2388,6 @@
uuidPatern = "????????-????-????-????-????????????"
if domType in (sd.FCP_DOMAIN, sd.ISCSI_DOMAIN):
- sdCache.refreshStorage()
uuids = tuple(blockSD.getStorageDomainsList())
elif domType is sd.NFS_DOMAIN:
lPath = conObj._mountCon._getLocalPath()
@@ -2457,6 +2456,11 @@
else:
status = 0
try:
+ # In case there were changes in devices size
+ # while the VDSM was not connected, we need to
+ # call refreshStorage.
+ if domType in (sd.FCP_DOMAIN, sd.ISCSI_DOMAIN):
+ sdCache.refreshStorage()
doms = self.__prefetchDomains(domType, conObj)
except:
self.log.debug("prefetch failed: %s",
--
To view, visit https://gerrit.ovirt.org/44009
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If8ac84cc2bfd3490f3da41f0bc79fc372495a5a7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Freddy Rolland <frolland(a)redhat.com>
Gerrit-Reviewer: Fred Rolland <frolland(a)redhat.com>
Adam Litke has uploaded a new change for review.
Change subject: Live Merge: Prevent merge when base volume is too small
......................................................................
Live Merge: Prevent merge when base volume is too small
When a disk with snapshots is resized you can end up with an image chain
containing volumes of different sizes. For example: a VM may start with
volume A, a snapshot operation causes volume B to be added to the chain,
and a resize operation enlarges volume B. This mixed-size chain
presents a special case for live merge.
Libvirt's virDomainBlockCommit behaves differently depending on whether
the base volume is on block storage or file storage and whether
the base volume is raw or qcow2:
File volume, cow format:
- Update qcow header and truncate volume file to the new size
File volume, raw format:
- Truncate volume file to the new size
Block volume, cow format:
- Update qcow header only (volume size is managed by vdsm)
Block volume, raw format:
- Fail because qemu cannot extend a raw block device
Since we know the raw block case is not possible we can detect this and
return a special error message to engine. To avoid this error, engine
should use the SPM host to extend the raw volume to the correct size
before starting the merge.
We don't _have_ to change vdsm since the current code fails gracefully
(albeit with a traceback in the logs). If engine always performs the
resize operation before calling merge we'll never see this error.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1232481
Change-Id: Ibf77a7c5108b500c6ec34653ef7570a841def1b4
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M lib/vdsm/define.py
M vdsm/virt/vm.py
2 files changed, 38 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/42836/1
diff --git a/lib/vdsm/define.py b/lib/vdsm/define.py
index 284b10f..7c5f7b0 100644
--- a/lib/vdsm/define.py
+++ b/lib/vdsm/define.py
@@ -169,6 +169,9 @@
'ksmErr': {'status': {
'code': 71,
'message': 'Failed to update KSM values'}},
+ 'destVolumeTooSmall': {'status': {
+ 'code': 72,
+ 'message': 'Destination volume is too small'}},
'recovery': {'status': {
'code': 99,
'message': 'Recovering from crash or Initializing'}},
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 4977d28..549cd38 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4570,7 +4570,30 @@
jobsRet[jobID] = entry
return jobsRet
+ def _merge_check_base_size(self, drive, base_info, top_info):
+ # If the drive waa resized the top volume could be larger than the
+ # base volume. Libvirt can handle this situation for filw-based
+ # volumes and block qcow volumes (where extension happens dynamically).
+ # Raw block volumes cannot be extended by libvirt so we require ovirt
+ # engine to extend them before calling merge. Check here.
+ if not drive.blockDev or base_info['format'] != 'RAW':
+ return True
+
+ if int(base_info['capacity']) < int(top_info['capacity']):
+ self.log.error("merge: The base volume is undersized and cannot "
+ "be extended. Aborting.")
+ return False
+ return True
+
def merge(self, driveSpec, baseVolUUID, topVolUUID, bandwidth, jobUUID):
+ def get_volume_info(drive, volUUID):
+ res = self.cif.irs.getVolumeInfo(drive.domainID, drive.poolID,
+ drive.imageID, volUUID)
+ if res['status']['code'] != 0:
+ self.log.error("Unable to get volume info for '%s'", volUUID)
+ raise LookupError(volUUID)
+ return res['info']
+
if not caps.getLiveMergeSupport():
self.log.error("Live merge is not supported on this host")
return errCode['mergeErr']
@@ -4604,14 +4627,15 @@
self.log.error("merge: top volume '%s' not found", topVolUUID)
return errCode['mergeErr']
+ try:
+ baseInfo = get_volume_info(drive, baseVolUUID)
+ topInfo = get_volume_info(drive, topVolUUID)
+ except LookupError:
+ return errCode['mergeErr']
+
# If base is a shared volume then we cannot allow a merge. Otherwise
# We'd corrupt the shared volume for other users.
- res = self.cif.irs.getVolumeInfo(drive.domainID, drive.poolID,
- drive.imageID, baseVolUUID)
- if res['status']['code'] != 0:
- self.log.error("Unable to get volume info for '%s'", baseVolUUID)
- return errCode['mergeErr']
- if res['info']['voltype'] == 'SHARED':
+ if baseInfo['voltype'] == 'SHARED':
self.log.error("merge: Refusing to merge into a shared volume")
return errCode['mergeErr']
@@ -4628,18 +4652,9 @@
# pivot to the new active layer (baseVolUUID).
flags |= libvirt.VIR_DOMAIN_BLOCK_COMMIT_ACTIVE
- # If top is the active layer, it's allocated size is stored in
- # drive.apparentsize.
- topSize = drive.apparentsize
- else:
- # If top is an internal volume, we must call getVolumeInfo
- res = self.cif.irs.getVolumeInfo(drive.domainID, drive.poolID,
- drive.imageID, topVolUUID)
- if res['status']['code'] != 0:
- self.log.error("Unable to get volume info for '%s'",
- topVolUUID)
- return errCode['mergeErr']
- topSize = int(res['info']['apparentsize'])
+ # Make sure we can merge into the base in case the drive was enlarged.
+ if not self._merge_check_base_size(drive, baseInfo, topInfo):
+ return errCode['destVolumeTooSmall']
# Take the jobs lock here to protect the new job we are tracking from
# being cleaned up by queryBlockJobs() since it won't exist right away
@@ -4672,7 +4687,8 @@
# live merge operation.
if drive.chunked:
capacity, alloc, physical = self._getExtendInfo(drive)
- self.extendDriveVolume(drive, baseVolUUID, topSize, capacity)
+ topAllocSize = int(topInfo['apparentsize'])
+ self.extendDriveVolume(drive, baseVolUUID, topAllocSize, capacity)
# Trigger the collection of stats before returning so that callers
# of getVmStats after this returns will see the new job
--
To view, visit https://gerrit.ovirt.org/42836
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf77a7c5108b500c6ec34653ef7570a841def1b4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: iscsicred: Protect sensitive return value in supervdsm log
......................................................................
iscsicred: Protect sensitive return value in supervdsm log
SuperVdsm logs all calls and return values, possibly exposive sensitive
data in its log file.
This patch allows Supervdsm methods to wrap the return value with
ProtectedPassword object, so the results are logged as ********.
Change-Id: Idcfa4ee17466f75270909587c45ee9f703e5e9f3
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/supervdsmServer
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/43178/1
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index 2a1a8f0..36c67b1 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -53,6 +53,7 @@
except ImportError:
_glusterEnabled = False
+from vdsm import password
from vdsm import utils
from vdsm import sysctl
from vdsm.tool import restore_nets
@@ -112,6 +113,8 @@
raise
callbackLogger.debug('return %s with %s',
func.__name__, res)
+ if isinstance(res, password.ProtectedPassword):
+ res = res.value
return res
return wrapper
--
To view, visit https://gerrit.ovirt.org/43178
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idcfa4ee17466f75270909587c45ee9f703e5e9f3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: iscsicred: Support per-host iscsi credentials database
......................................................................
iscsicred: Support per-host iscsi credentials database
Some users need unique host iSCSI credentials for each target, but
Engine supports only same credentials for all hosts. This series adds
support for simple per-host iSCSI credentials database.
Credentials are stored in /etc/vdsm/iscsi-cred/<target-name>
Credentials file format:
username = foo:bar
password = 12345678
This patch adds the iscsicred module, providing readonly access to
the iSCSI credentials database.
Change-Id: I8f6a838f6b8e132d6b0c1a8135f2c28ef1e7f847
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M debian/vdsm.install
M tests/Makefile.am
A tests/iscsicred_test.py
M vdsm.spec.in
M vdsm/storage/Makefile.am
A vdsm/storage/iscsicred.py
M vdsm/supervdsmServer
7 files changed, 207 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/43179/1
diff --git a/debian/vdsm.install b/debian/vdsm.install
index 35fcba7..c7cc90e 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -110,6 +110,7 @@
./usr/share/vdsm/storage/imageSharing.py
./usr/share/vdsm/storage/iscsi.py
./usr/share/vdsm/storage/iscsiadm.py
+./usr/share/vdsm/storage/iscsicred.py
./usr/share/vdsm/storage/localFsSD.py
./usr/share/vdsm/storage/lvm.env
./usr/share/vdsm/storage/lvm.py
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b9b8e72..30ee221 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -56,6 +56,7 @@
iproute2Tests.py \
ipwrapperTests.py \
iscsiTests.py \
+ iscsicred_test.py \
jsonRpcHelper.py \
jsonRpcTests.py \
libvirtconnectionTests.py \
diff --git a/tests/iscsicred_test.py b/tests/iscsicred_test.py
new file mode 100644
index 0000000..715dded
--- /dev/null
+++ b/tests/iscsicred_test.py
@@ -0,0 +1,121 @@
+#
+# Copyright 2015 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
+#
+
+from contextlib import contextmanager
+import os
+
+from testlib import VdsmTestCase
+from testlib import namedTemporaryDir
+from monkeypatch import MonkeyPatchScope, MonkeyClass
+
+from vdsm.password import ProtectedPassword
+from storage import iscsicred
+
+
+class FakeSupervdsm(object):
+
+ def getProxy(self):
+ return self
+
+ def readTargetCredfile(self, targetName):
+ return iscsicred._read_credfile(targetName)
+
+
+@MonkeyClass(iscsicred, "supervdsm", FakeSupervdsm())
+class IscsicredTests(VdsmTestCase):
+
+ TARGET = "iqn.1994-05.com.redhat:target7"
+
+ def test_not_found(self):
+ self.assertRaises(iscsicred.NotFound, iscsicred.get_credentials,
+ self.TARGET)
+
+ def test_simple(self):
+ data = "".join(["username=foo:bar\n",
+ "password=12345678\n"])
+ with credfile(self.TARGET, data):
+ d = iscsicred.get_credentials(self.TARGET)
+ self.assertEqual(d, {"username": "foo:bar",
+ "password": ProtectedPassword("12345678")})
+
+ def test_whitespace(self):
+ data = "".join([" username = foo:bar \n",
+ " password = 12345678 \n"])
+ with credfile(self.TARGET, data):
+ d = iscsicred.get_credentials(self.TARGET)
+ self.assertEqual(d, {"username": "foo:bar",
+ "password": ProtectedPassword("12345678")})
+
+ def test_any_whitespace(self):
+ data = "".join(["\t\tusername\t\t=\t\tfoo:bar\t\t\n",
+ "\t\tpassword\t\t=\t\t12345678\t\t\n"])
+ with credfile(self.TARGET, data):
+ d = iscsicred.get_credentials(self.TARGET)
+ self.assertEqual(d, {"username": "foo:bar",
+ "password": ProtectedPassword("12345678")})
+
+ def test_empty_lines(self):
+ data = "".join(["\n",
+ "username=foo:bar\n",
+ "\n",
+ "password=12345678\n",
+ "\n"])
+ with credfile(self.TARGET, data):
+ d = iscsicred.get_credentials(self.TARGET)
+ self.assertEqual(d, {"username": "foo:bar",
+ "password": ProtectedPassword("12345678")})
+
+ def test_no_eol(self):
+ data = "".join(["username=foo:bar\n",
+ "password=12345678"])
+ with credfile(self.TARGET, data):
+ d = iscsicred.get_credentials(self.TARGET)
+ self.assertEqual(d, {"username": "foo:bar",
+ "password": ProtectedPassword("12345678")})
+
+ def test_extra_key(self):
+ data = "".join(["username=foo:bar\n",
+ "password=12345678\n"
+ "extra=value\n"])
+ with credfile(self.TARGET, data):
+ d = iscsicred.get_credentials(self.TARGET)
+ self.assertEqual(d, {"username": "foo:bar",
+ "password": ProtectedPassword("12345678"),
+ "extra": "value"})
+
+ def test_empty(self):
+ with credfile(self.TARGET, ""):
+ d = iscsicred.get_credentials(self.TARGET)
+ self.assertEqual(d, {})
+
+ def test_invalid(self):
+ with credfile(self.TARGET, "invalid line\n"):
+ with self.assertRaises(iscsicred.InvalidCredfile):
+ iscsicred.get_credentials(self.TARGET)
+
+
+@contextmanager
+def credfile(target, data):
+ with namedTemporaryDir() as tmpdir:
+ with MonkeyPatchScope([(iscsicred, "DIR", tmpdir)]):
+ filename = os.path.join(tmpdir, target)
+ with open(filename, "wb") as f:
+ f.write(data)
+ yield
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 58bf5ef..844a041 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -976,6 +976,7 @@
%{_datadir}/%{vdsm_name}/storage/image.py*
%{_datadir}/%{vdsm_name}/storage/imageSharing.py*
%{_datadir}/%{vdsm_name}/storage/iscsiadm.py*
+%{_datadir}/%{vdsm_name}/storage/iscsicred.py*
%{_datadir}/%{vdsm_name}/storage/iscsi.py*
%{_datadir}/%{vdsm_name}/storage/localFsSD.py*
%{_datadir}/%{vdsm_name}/storage/lvm.env
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index 4ebe0a2..5e64c44 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -42,6 +42,7 @@
image.py \
imageSharing.py \
iscsiadm.py \
+ iscsicred.py \
iscsi.py \
localFsSD.py \
lvm.py \
diff --git a/vdsm/storage/iscsicred.py b/vdsm/storage/iscsicred.py
new file mode 100644
index 0000000..7e6bfa3
--- /dev/null
+++ b/vdsm/storage/iscsicred.py
@@ -0,0 +1,76 @@
+#
+# Copyright 2015 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
+#
+"""
+iscsicred - access iscsi credetials database
+
+This module provides readonly access to per-host iscsi credentails. Each host
+in a cluster may be configured with unique credentatils for each iscsi target.
+"""
+
+import errno
+import os
+from vdsm import password
+import supervdsm
+
+DIR = "/etc/vdsm/iscsi-cred"
+
+
+class NotFound(Exception):
+ """ Raised when getting non-existent cred file """
+
+
+class InvalidCredfile(Exception):
+ """ Raised if cred file cannot be parsed """
+
+
+def get_credentials(target_name):
+ data = supervdsm.getProxy().readTargetCredfile(target_name)
+ return _parse_credfile(data)
+
+
+def _read_credfile(target_name):
+ """
+ Read /etc/vdsm/iscsi-cred/target_name.
+
+ Called from supervdsm since credfiles are root-readonly files.
+ """
+ filename = os.path.join(DIR, target_name)
+ try:
+ with open(filename, "rb") as f:
+ return f.read()
+ except IOError as e:
+ if e.errno != errno.ENOENT:
+ raise
+ raise NotFound(target_name)
+
+
+def _parse_credfile(data):
+ cred = {}
+ for line in data.splitlines():
+ line = line.rstrip()
+ if not line:
+ continue
+ if "=" not in line:
+ raise InvalidCredfile("Invalid line: %r" % line)
+ key, value = [s.strip() for s in line.split("=", 1)]
+ if key == "password":
+ value = password.ProtectedPassword(value)
+ cred[key] = value
+ return cred
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index 36c67b1..1d2dd41 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -69,6 +69,7 @@
from storage.iscsi import readSessionInfo as _readSessionInfo
from supervdsm import _SuperVdsmManager
from storage import hba
+from storage import iscsicred
from storage import multipath
from storage.fileUtils import chown, resolveGid, resolveUid
from storage.fileUtils import validateAccess as _validateAccess
@@ -167,6 +168,11 @@
return _readSessionInfo(sessionID)
@logDecorator
+ def readTargetCredfile(self, target):
+ data = iscsicred._read_credfile(target)
+ return password.ProtectedPassword(data)
+
+ @logDecorator
def getPathsStatus(self):
return _getPathsStatus()
--
To view, visit https://gerrit.ovirt.org/43179
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f6a838f6b8e132d6b0c1a8135f2c28ef1e7f847
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: tests: Remove hack for devices with same names
......................................................................
tests: Remove hack for devices with same names
After the test isolation issues in tcTests.py and ipwrapperTests.py were
resolved, we are not expecting setup to fail because a device with same
name exists, so we can remove the hack that used to skip tests.
It is possible that slaves contains stale devices from previous run of
the broken tests, but this should be solved by cleaning the slaves, not
by hiding the error and skipping tests.
Change-Id: I675e57756859ca7ffe272607b7f528c281c65256
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/tcTests.py
1 file changed, 1 insertion(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/44166/1
diff --git a/tests/tcTests.py b/tests/tcTests.py
index dbbac95..942f63f 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -87,17 +87,7 @@
class _Bridge(_Interface):
def addDevice(self):
- try:
- check_call([EXT_BRCTL, 'addbr', self.devName])
- except ExecError as e:
- # FIXME: we do not know why we sometime see the same bridge names
- # on jenkins slaves. This is an ugly hack to mitigate the issue,
- # since it is certainly not the fault of the test case
- if "can't create bridge with the same name" in e.err:
- raise SkipTest(e.err)
- else:
- raise
-
+ check_call([EXT_BRCTL, 'addbr', self.devName])
# learning interval is different on different kernels, so set it
# explicit for 2.x kernels
if os.uname()[2].startswith("2"):
--
To view, visit https://gerrit.ovirt.org/44166
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I675e57756859ca7ffe272607b7f528c281c65256
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: tests: Fix ipwrapper tests isolation
......................................................................
tests: Fix ipwrapper tests isolation
Similar to tcTests, tests were sharing same devices, so failure to
delete a device would cause unrelated test to fail.
Even worse, the Unicode tests used *same* device name on all tests. So
running concurrent tests is not possible, and once we fail to delete a
device, all builds will fail on this slave when tyring to create the
same device again. This issue was hidden previously because we used to
skip silently such failures.
Now we use Unicode prefix with random suffix, so stale devices are
unlikely to cause failures in other builds.
To simplify cleanup, the Unicode tests was moved to its own test case
class. To make it easier to work with the Unicode bridge name, we use
plain ASCII ("\xd7\x90\xd7\x91\xd7\x92") instead of raw utf-8 ("אבג").
Change-Id: Ic02b3945a029476f17601608555430dc2fb710de
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/ipwrapperTests.py
1 file changed, 24 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/44165/1
diff --git a/tests/ipwrapperTests.py b/tests/ipwrapperTests.py
index d75a537..bd3007d 100644
--- a/tests/ipwrapperTests.py
+++ b/tests/ipwrapperTests.py
@@ -92,11 +92,11 @@
class TestLinks(TestCaseBase):
- _bridge = tcTests._Bridge()
@ValidateRunningAsRoot
def setUp(self):
tcTests._checkDependencies()
+ self._bridge = tcTests._Bridge()
self._bridge.addDevice()
def tearDown(self):
@@ -110,34 +110,46 @@
class TestDrvinfo(TestCaseBase):
- _bridge = tcTests._Bridge()
- _unicode_bridge = tcTests._Bridge()
@ValidateRunningAsRoot
def setUp(self):
tcTests._checkDependencies()
+ self._bridge = tcTests._Bridge()
self._bridge.addDevice()
- self._unicode_bridge.devName = 'test-トトロ'
- self._unicode_bridge.addDevice()
def tearDown(self):
self._bridge.delDevice()
- self._unicode_bridge.delDevice()
def testBridgeEthtoolDrvinfo(self):
self.assertEqual(ipwrapper.drv_name(self._bridge.devName),
ipwrapper.LinkType.BRIDGE)
- def testUtf8BridgeEthtoolDrvinfo(self):
- self.assertEqual(
- ipwrapper.drv_name(self._unicode_bridge.devName.decode('utf8')),
- ipwrapper.LinkType.BRIDGE)
-
- def testTogglePromisc(self):
+ def testEnablePromisc(self):
ipwrapper.getLink(self._bridge.devName).promisc = True
self.assertTrue(ipwrapper.getLink(self._bridge.devName).promisc,
"Could not enable promiscuous mode.")
+ def testDisablePromisc(self):
+ ipwrapper.getLink(self._bridge.devName).promisc = True
ipwrapper.getLink(self._bridge.devName).promisc = False
self.assertFalse(ipwrapper.getLink(self._bridge.devName).promisc,
"Could not disable promiscuous mode.")
+
+
+class TestUnicodeDrvinfo(TestCaseBase):
+
+ @ValidateRunningAsRoot
+ def setUp(self):
+ tcTests._checkDependencies()
+ # First 3 Hebrew letters
+ # See http://unicode.org/charts/PDF/U0590.pdf
+ self._bridge = tcTests._Bridge("\xd7\x90\xd7\x91\xd7\x92")
+ self._bridge.addDevice()
+
+ def tearDown(self):
+ self._bridge.delDevice()
+
+ def testUtf8BridgeEthtoolDrvinfo(self):
+ self.assertEqual(
+ ipwrapper.drv_name(self._bridge.devName.decode('utf8')),
+ ipwrapper.LinkType.BRIDGE)
--
To view, visit https://gerrit.ovirt.org/44165
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic02b3945a029476f17601608555430dc2fb710de
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Dan Kenigsberg has uploaded a new change for review.
Change subject: call stop_event_loop upon exit
......................................................................
call stop_event_loop upon exit
For cleanliness, whomever starts a thread should stop it when it is no
longer needed.
Change-Id: I9ab0d9b7be976e37a89a96d2f09a353186008731
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/vdsm
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/26532/1
diff --git a/vdsm/vdsm b/vdsm/vdsm
index 652797c..fd9b3f8 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -81,6 +81,7 @@
signal.pause()
finally:
cif.prepareForShutdown()
+ libvirtconnection.stop_event_loop()
def run(pidfile=None):
--
To view, visit http://gerrit.ovirt.org/26532
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ab0d9b7be976e37a89a96d2f09a353186008731
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: drop cluster version < 3.6 for ppc64le
......................................................................
vdsm: drop cluster version < 3.6 for ppc64le
Due to moving from powerKVM to ppc64le, we should not support older
cluster levels in newest VDSM for POWER8 platform.
I5c55f66aa526a6b9498f557c964ee18888f72885
Change-Id: Ibda0fc1b3716fa9be361a0f60e3639395bb9a174
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M vdsm/dsaversion.py.in
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/43892/1
diff --git a/vdsm/dsaversion.py.in b/vdsm/dsaversion.py.in
index 374580d..41f6266 100644
--- a/vdsm/dsaversion.py.in
+++ b/vdsm/dsaversion.py.in
@@ -18,6 +18,8 @@
# Refer to the README and COPYING files for full details of the license
#
+import platform
+
"""
This module provides DSA software versioning information for
python based components
@@ -36,3 +38,6 @@
'supportedENGINEs': ['3.4', '3.5', '3.6'],
'clusterLevels': ['3.4', '3.5', '3.6'],
}
+
+if platform.machine() == 'ppc64le':
+ version_info['clusterLevels'] = ['3.6']
--
To view, visit https://gerrit.ovirt.org/43892
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibda0fc1b3716fa9be361a0f60e3639395bb9a174
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Shahar Havivi has uploaded a new change for review.
Change subject: v2v: handle exception on probing external VMs
......................................................................
v2v: handle exception on probing external VMs
XMLDesc of libvirt domain can throw error,
We don't want to fail all the process of fetching external VMs if we
fail to read one VM xml.
Change-Id: Ie3203dde4878a80c65fe3185cadaef2fe00e6a02
Signed-off-by: Shahar Havivi <shaharh(a)redhat.com>
---
M vdsm/v2v.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/43259/1
diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index b6763da..307c005 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -139,7 +139,11 @@
with closing(conn):
vms = []
for vm in conn.listAllDomains():
- root = ET.fromstring(vm.XMLDesc(0))
+ try:
+ root = ET.fromstring(vm.XMLDesc(0))
+ except libvirt.libvirtError as e:
+ logging.error('error reading domain xml, msg: %s', e.message)
+ continue
params = {}
_add_vm_info(vm, params)
try:
--
To view, visit https://gerrit.ovirt.org/43259
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3203dde4878a80c65fe3185cadaef2fe00e6a02
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi(a)redhat.com>
Dan Kenigsberg has uploaded a new change for review.
Change subject: pep8 again
......................................................................
pep8 again
Too bad that my pep8-correcting patch was written and verified before
commit 14e2c07 was merged.
Change-Id: I82a181388ce36f8db2e71bfcde3d2eea36c05274
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/functional/networkTests.py
1 file changed, 0 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/44246/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index a908877..d369bde 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -1773,7 +1773,6 @@
self.assertEquals(status, SUCCESS, msg)
self.assertNetworkDoesntExist(NETWORK_NAME)
-
@cleanupNet
@permutations([[True], [False]])
@RequireDummyMod
--
To view, visit https://gerrit.ovirt.org/44246
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82a181388ce36f8db2e71bfcde3d2eea36c05274
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Ido Barkan has uploaded a new change for review.
Change subject: net: always persist owned ifcfg files on ovirt node
......................................................................
net: always persist owned ifcfg files on ovirt node
Change-Id: Ibc717b86194a32c050d346e235a5c35fd318e1ff
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
Buh-Url: https://bugzilla.redhat.com/1203422
---
M vdsm/vdsm-store-net-config.in
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/44133/1
diff --git a/vdsm/vdsm-store-net-config.in b/vdsm/vdsm-store-net-config.in
index c19d5e0..98b5776 100755
--- a/vdsm/vdsm-store-net-config.in
+++ b/vdsm/vdsm-store-net-config.in
@@ -37,8 +37,19 @@
rm -rf "$NET_CONF_BACK_DIR"/*
}
+node_persist_owned_ifcfgs() {
+ for f in $(find "$NET_CONF_DIR" -type f); do
+ if grep -q "# Generated by VDSM version" "$f"; then
+ ovirt_store_config "$f"
+ fi
+ done
+}
+
unified_node_persist() {
unified_nonnode_persist
+ # we need to persist ifcfg files as well so that they are available earlier
+ # on boot time
+ node_persist_owned_ifcfgs
# oVirt node ovirt_store_config puts the dir in persistent storage and
# bind mounts it in the original place. So that's all we really need to do.
--
To view, visit https://gerrit.ovirt.org/44133
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc717b86194a32c050d346e235a5c35fd318e1ff
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Ido Barkan has uploaded a new change for review.
Change subject: net: ignore pass through ifcfg parameters for selective restoration
......................................................................
net: ignore pass through ifcfg parameters for selective restoration
Ignore keys in persisted networks that might originate from vdsm-reg.
these might be a result of calling setupNetworks with ifcfg values
that come from the original interface that is serving the management
network. for 3.5, VDSM still supports passing arbitrary values
directly to the ifcfg files, e.g. 'IPV6_AUTOCONF=no'. we filter them
out here since kernelConfig will never report them.
Change-Id: Ib1525f7b0238aaa5eb82eedb9ad6f41154c2c29f
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/1203422
---
M lib/vdsm/netconfpersistence.py
M tests/functional/networkTests.py
2 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/44153/1
diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py
index cc24228..f5916f6 100644
--- a/lib/vdsm/netconfpersistence.py
+++ b/lib/vdsm/netconfpersistence.py
@@ -24,6 +24,7 @@
import logging
import netaddr
import os
+import string
from .config import config
from .tool.restore_nets import restore
@@ -316,6 +317,7 @@
self._normalize_bonding_opts(config_copy)
self._normalize_bonding_nics(config_copy)
self._normalize_address(config_copy)
+ self._normalize_ifcfg_keys(config_copy)
return config_copy
@@ -387,6 +389,23 @@
if 'defaultRoute' not in net_attr:
net_attr['defaultRoute'] = False
+ def _normalize_ifcfg_keys(self, config_copy):
+ # ignore keys in persisted networks that might originate from vdsm-reg.
+ # these might be a result of calling setupNetworks with ifcfg values
+ # that come from the original interface that is serving the management
+ # network. for 3.5, VDSM still supports passing arbitrary values
+ # directly to the ifcfg files, e.g. 'IPV6_AUTOCONF=no'. we filter them
+ # out here since kernelConfig will never report them.
+ # TODO: remove when 3.5 is unsupported.
+ def unsupported(key):
+ return set(key) <= set(
+ string.ascii_uppercase + string.digits + '_')
+
+ for net_attr in config_copy.networks.itervalues():
+ for k in net_attr.keys():
+ if unsupported(k):
+ net_attr.pop(k)
+
def _parse_bond_options(self, opts):
if not opts:
return {}
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index c5da1f2..9462b60 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -1753,6 +1753,28 @@
self.assertBondDoesntExist(BOND_UNCHANGED, [nic_a])
@cleanupNet
+ def testSelectiveRestoreIgnoresVdsmRegParams(self):
+ if vdsm.config.config.get('vars', 'net_persistence') == 'ifcfg':
+ raise SkipTest(
+ "with ifcfg persistence, vdsm-restore-net-config selective"
+ "restoration is not supported")
+
+ with dummyIf(1) as nics:
+ nic, = nics
+ # let _assert_kernel_config_matches_running_config do the job
+ status, msg = self.setupNetworks(
+ {NETWORK_NAME: {'nic': nic, 'IPV6_AUTOCONF': 'no',
+ 'PEERNTP': 'yes', 'IPV6INIT': 'no'}},
+ {}, NOCHK)
+ self.assertEquals(status, SUCCESS, msg)
+ self.assertNetworkExists(NETWORK_NAME)
+ status, msg = self.setupNetworks(
+ {NETWORK_NAME: {'remove': True}}, {}, NOCHK)
+ self.assertEquals(status, SUCCESS, msg)
+ self.assertNetworkDoesntExist(NETWORK_NAME)
+
+
+ @cleanupNet
@permutations([[True], [False]])
@RequireDummyMod
@ValidateRunningAsRoot
--
To view, visit https://gerrit.ovirt.org/44153
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1525f7b0238aaa5eb82eedb9ad6f41154c2c29f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Hello Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/44199
to review the following change.
Change subject: restore-net-config: set main thread name
......................................................................
restore-net-config: set main thread name
restore-net-config's log flow to supervdsm.log, and are a bit hard to
discern.
Change-Id: I7a92962e488e78e57697b6313463c41f63408502
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/37419
Reviewed-by: Ido Barkan <ibarkan(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/1203422
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M vdsm/vdsm-restore-net-config
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/44199/1
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index c879442..078cf6b 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -24,6 +24,7 @@
import logging.config
import os
import re
+import threading
import time
import errno
@@ -318,6 +319,7 @@
if __name__ == '__main__':
+ threading.current_thread().setName('restore-net')
try:
logging.config.fileConfig('/etc/vdsm/svdsm.logger.conf',
disable_existing_loggers=False)
--
To view, visit https://gerrit.ovirt.org/44199
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a92962e488e78e57697b6313463c41f63408502
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: janitorial: vm: switch to response.error()
......................................................................
janitorial: vm: switch to response.error()
response.error() offers a nicer and cleaner
way to report error responses instead of the bare
errCode['something'], even when we are fine with
the default generic message.
This patch makes use of response.error() all across
vm.py.
Change-Id: I3825faf7a144ef8973dee3cb9f9f0e52fabfc039
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 62 insertions(+), 62 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/38268/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e7fbcf2..cd392c7 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1589,7 +1589,7 @@
if self.lastStatus in (vmstatus.MIGRATION_SOURCE,
vmstatus.SAVING_STATE, vmstatus.DOWN):
self.log.error('cannot cont while %s', self.lastStatus)
- return errCode['unexpected']
+ return response.error('unexpected')
self._underlyingCont()
self._setGuestCpuRunning(self._isDomainRunning(),
guestCpuLocked=True)
@@ -1638,7 +1638,7 @@
def shutdown(self, delay, message, reboot, timeout, force):
if self.lastStatus == vmstatus.DOWN:
- return errCode['noVM']
+ return response.error('noVM')
delay = int(delay)
@@ -1913,13 +1913,13 @@
try:
if self.isMigrating():
self.log.warning('vm already migrating')
- return errCode['exist']
+ return response.error('exist')
if self.hasTransientDisks():
- return errCode['transientErr']
+ return response.error('transientErr')
# while we were blocking, another migrationSourceThread could have
# taken self Down
if self._lastStatus == vmstatus.DOWN:
- return errCode['noVM']
+ return response.error('noVM')
self._migrationSourceThread = migration.SourceThread(
self, **params)
self._migrationSourceThread.start()
@@ -1940,11 +1940,11 @@
return self._migrationSourceThread.status
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_INVALID:
- return errCode['migCancelErr']
+ return response.error('migCancelErr')
raise
except AttributeError:
if self._dom is None:
- return errCode['migCancelErr']
+ return response.error('migCancelErr')
raise
finally:
self._guestCpuLock.release()
@@ -2317,7 +2317,7 @@
def hotplugNic(self, params):
if self.isMigrating():
- return errCode['migInProgress']
+ return response.error('migInProgress')
nicParams = params['nic']
nic = vmdevices.network.Interface(self.conf, self.log, **nicParams)
@@ -2336,7 +2336,7 @@
nicXml = hooks.after_nic_hotplug_fail(
nicXml, self.conf, params=nic.custom)
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- return errCode['noVM']
+ return response.error('noVM')
return response.error('hotplugNic', e.message)
else:
# FIXME! We may have a problem here if vdsm dies right after
@@ -2524,7 +2524,7 @@
response['vmList'] = self.status()
return response
else:
- return errCode['updateDevice']
+ return response.error('updateDevice')
def updateDevice(self, params):
if params.get('deviceType') == hwclass.NIC:
@@ -2532,11 +2532,11 @@
elif params.get('deviceType') == hwclass.GRAPHICS:
return self._updateGraphicsDevice(params)
else:
- return errCode['noimpl']
+ return response.error('noimpl')
def hotunplugNic(self, params):
if self.isMigrating():
- return errCode['migInProgress']
+ return response.error('migInProgress')
nicParams = params['nic']
@@ -2583,7 +2583,7 @@
except libvirt.libvirtError as e:
self.log.exception("Hotunplug failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- return errCode['noVM']
+ return response.error('noVM')
# Restore NIC device in vm's conf and _devices
if nicDev:
with self._confLock:
@@ -2602,7 +2602,7 @@
def setNumberOfCpus(self, numberOfCpus):
if self.isMigrating():
- return errCode['migInProgress']
+ return response.error('migInProgress')
self.log.debug("Setting number of cpus to : %s", numberOfCpus)
hooks.before_set_num_of_cpus()
@@ -2612,7 +2612,7 @@
except libvirt.libvirtError as e:
self.log.exception("setNumberOfCpus failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- return errCode['noVM']
+ return response.error('noVM')
return response.error('setNumberOfCpusErr', e.message)
self.conf['smp'] = str(numberOfCpus)
@@ -2646,7 +2646,7 @@
"""
if self.isMigrating():
- return errCode['migInProgress']
+ return response.error('migInProgress')
if not params:
self.log.error("updateVmPolicy got an empty policy.")
@@ -2710,7 +2710,7 @@
except libvirt.libvirtError as e:
self.log.exception("updateVmPolicy failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- return errCode['noVM']
+ return response.error('noVM')
else:
return self._reportError(key='updateVmPolicyErr',
msg=e.message)
@@ -2797,7 +2797,7 @@
except libvirt.libvirtError as e:
self.log.exception("setVmIoTune failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- return errCode['noVM']
+ return response.error('noVM')
else:
return self._reportError(key='updateIoTuneErr',
msg=e.message)
@@ -2860,7 +2860,7 @@
def hotplugDisk(self, params):
if self.isMigrating():
- return errCode['migInProgress']
+ return response.error('migInProgress')
diskParams = params.get('drive', {})
diskParams['path'] = self.cif.prepareVolumePath(diskParams)
@@ -2873,7 +2873,7 @@
drive = vmdevices.storage.Drive(self.conf, self.log, **diskParams)
if drive.hasVolumeLeases:
- return errCode['noimpl']
+ return response.error('noimpl')
driveXml = drive.getXML().toprettyxml(encoding='utf-8')
# TODO: this is debug information. For 3.6.x we still need to
@@ -2889,7 +2889,7 @@
self.log.exception("Hotplug failed")
self.cif.teardownVolumePath(diskParams)
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- return errCode['noVM']
+ return response.error('noVM')
return response.error('hotplugDisk', e.message)
else:
# FIXME! We may have a problem here if vdsm dies right after
@@ -2909,7 +2909,7 @@
def hotunplugDisk(self, params):
if self.isMigrating():
- return errCode['migInProgress']
+ return response.error('migInProgress')
diskParams = params.get('drive', {})
diskParams['path'] = self.cif.prepareVolumePath(diskParams)
@@ -2922,7 +2922,7 @@
return response.error('hotunplugDisk', "Disk not found")
if drive.hasVolumeLeases:
- return errCode['noimpl']
+ return response.error('noimpl')
driveXml = drive.getXML().toprettyxml(encoding='utf-8')
# TODO: this is debug information. For 3.6.x we still need to
@@ -2949,7 +2949,7 @@
except libvirt.libvirtError as e:
self.log.exception("Hotunplug failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- return errCode['noVM']
+ return response.error('noVM')
self._devices[hwclass.DISK].append(drive)
# Restore disk device in vm's conf and _devices
if diskDev:
@@ -3239,7 +3239,7 @@
vmDrives = {}
if self.isMigrating():
- return errCode['migInProgress']
+ return response.error('migInProgress')
for drive in snapDrives:
baseDrv, tgetDrv = _normSnapDriveParams(drive)
@@ -3260,15 +3260,15 @@
except LookupError:
# The volume we want to snapshot doesn't exist
self.log.error("The base volume doesn't exist: %s", baseDrv)
- return errCode['snapshotErr']
+ return response.error('snapshotErr')
if vmDrive.hasVolumeLeases:
self.log.error('disk %s has volume leases', vmDrive.name)
- return errCode['noimpl']
+ return response.error('noimpl')
if vmDrive.transientDisk:
self.log.error('disk %s is a transient disk', vmDrive.name)
- return errCode['transientErr']
+ return response.error('transientErr')
vmDevName = vmDrive.name
@@ -3300,7 +3300,7 @@
self.log.exception('unable to prepare the volume path for '
'disk %s', vmDevName)
_rollbackDrives(preparedDrives)
- return errCode['snapshotErr']
+ return response.error('snapshotErr')
snapType = 'block' if vmDrives[vmDevName].blockDev else 'file'
snapelem = _diskSnapshot(vmDevName, newDrives[vmDevName]["path"],
@@ -3364,7 +3364,7 @@
self.log.exception("Unable to take snapshot")
if memoryParams:
self.cif.teardownVolumePath(memoryVol)
- return errCode['snapshotErr']
+ return response.error('snapshotErr')
# We are padding the memory volume with block size of zeroes
# because qemu-img truncates files such that their size is
@@ -3439,20 +3439,20 @@
srcDrive = self._findDriveByUUIDs(srcDisk)
except LookupError:
self.log.error("Unable to find the disk for '%s'", srcDisk)
- return errCode['imageErr']
+ return response.error('imageErr')
if srcDrive.hasVolumeLeases:
- return errCode['noimpl']
+ return response.error('noimpl')
if srcDrive.transientDisk:
- return errCode['transientErr']
+ return response.error('transientErr')
try:
self._setDiskReplica(srcDrive, dstDisk)
except Exception:
self.log.error("Unable to set the replication for disk '%s' with "
"destination '%s'", srcDrive.name, dstDisk)
- return errCode['replicaErr']
+ return response.error('replicaErr')
dstDiskCopy = dstDisk.copy()
@@ -3484,7 +3484,7 @@
except Exception:
self.log.exception("Cannot complete the disk replication process")
self._delDiskReplica(srcDrive)
- return errCode['replicaErr']
+ return response.error('replicaErr')
if srcDrive.chunked:
try:
@@ -3502,16 +3502,16 @@
try:
srcDrive = self._findDriveByUUIDs(srcDisk)
except LookupError:
- return errCode['imageErr']
+ return response.error('imageErr')
if srcDrive.hasVolumeLeases:
- return errCode['noimpl']
+ return response.error('noimpl')
if srcDrive.transientDisk:
- return errCode['transientErr']
+ return response.error('transientErr')
if not srcDrive.isDiskReplicationInProgress():
- return errCode['replicaErr']
+ return response.error('replicaErr')
# Looking for the replication blockJob info (checking its presence)
blkJobInfo = self._dom.blockJobInfo(srcDrive.name, 0)
@@ -3523,12 +3523,12 @@
# Making sure that we don't have any stale information
self._delDiskReplica(srcDrive)
- return errCode['replicaErr']
+ return response.error('replicaErr')
# Checking if we reached the replication mode ("mirroring" in libvirt
# and qemu terms)
if blkJobInfo['cur'] != blkJobInfo['end']:
- return errCode['unavail']
+ return response.error('unavail')
dstDiskCopy = dstDisk.copy()
@@ -3567,7 +3567,7 @@
# There is nothing we can do at this point other than logging
self.log.exception("Unable to teardown the replication "
"destination disk")
- return errCode['changeDisk'] # Finally is evaluated
+ return response.error('changeDisk') # Finally is evaluated
else:
try:
self.cif.teardownVolumePath(diskToTeardown)
@@ -3595,7 +3595,7 @@
"Requested extension size %s for disk %s is smaller "
"than the current size %s", newSizeBytes, drive.name,
currentSize)
- return errCode['resizeErr']
+ return response.error('resizeErr')
# Uncommit the current volume size (mark as in transaction)
self.cif.irs.setVolumeSize(drive.domainID, drive.poolID,
@@ -3608,7 +3608,7 @@
self.log.exception(
"An error occurred while trying to extend the disk %s "
"to size %s", drive.name, newSizeBytes)
- return errCode['updateDevice']
+ return response.error('updateDevice')
finally:
# In all cases we want to try and fix the size in the metadata.
# Same as above, this is what libvirt would do, see BZ#963881
@@ -3650,7 +3650,7 @@
"Libvirt failed to notify the new size %s to the "
"running VM, the change will be available at the ",
"reboot", sizeRoundedBytes, exc_info=True)
- return errCode['updateDevice']
+ return response.error('updateDevice')
return {'status': doneCode, 'size': str(sizeRoundedBytes)}
@@ -3658,12 +3658,12 @@
try:
newSizeBytes = int(newSizeBytes)
except ValueError:
- return errCode['resizeErr']
+ return response.error('resizeErr')
try:
drive = self._findDriveByUUIDs(driveSpecs)
except LookupError:
- return errCode['imageErr']
+ return response.error('imageErr')
try:
if drive.format == "cow":
@@ -3673,7 +3673,7 @@
except Exception:
self.log.exception("Unable to extend disk %s to size %s",
drive.name, newSizeBytes)
- return errCode['updateDevice']
+ return response.error('updateDevice')
def _onWatchdogEvent(self, action):
def actionToString(action):
@@ -3714,7 +3714,7 @@
try:
path = self.cif.prepareVolumePath(drivespec)
except VolumeError:
- return errCode['imageErr']
+ return response.error('imageErr')
diskelem = vmxml.Element('disk', type='file', device=vmDev)
diskelem.appendChildWithArgs('source', file=path)
diskelem.appendChildWithArgs('target', dev=blockdev)
@@ -3725,7 +3725,7 @@
except Exception:
self.log.debug("updateDeviceFlags failed", exc_info=True)
self.cif.teardownVolumePath(drivespec)
- return errCode['changeDisk']
+ return response.error('changeDisk')
if vmDev in self.conf:
self.cif.teardownVolumePath(self.conf[vmDev])
@@ -3902,7 +3902,7 @@
self.conf['vmId'], exc_info=True)
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_FAILED:
return self._destroyVmForceful()
- return errCode['destroyErr']
+ return response.error('destroyErr')
return {'status': doneCode}
def _destroyVmForceful(self):
@@ -3911,7 +3911,7 @@
except libvirt.libvirtError:
self.log.warning("Failed to destroy VM '%s'",
self.conf['vmId'], exc_info=True)
- return errCode['destroyErr']
+ return response.error('destroyErr')
return {'status': doneCode}
def deleteVm(self):
@@ -4673,7 +4673,7 @@
def merge(self, driveSpec, baseVolUUID, topVolUUID, bandwidth, jobUUID):
if not caps.getLiveMergeSupport():
self.log.error("Live merge is not supported on this host")
- return errCode['mergeErr']
+ return response.error('mergeErr')
bandwidth = int(bandwidth)
if jobUUID is None:
@@ -4682,14 +4682,14 @@
try:
drive = self._findDriveByUUIDs(driveSpec)
except LookupError:
- return errCode['imageErr']
+ return response.error('imageErr')
# Check that libvirt exposes full volume chain information
chains = self._driveGetActualVolumeChain([drive])
if drive['alias'] not in chains:
self.log.error("merge: libvirt does not support volume chain "
"monitoring. Unable to perform live merge.")
- return errCode['mergeErr']
+ return response.error('mergeErr')
base = top = None
for v in drive.volumeChain:
@@ -4699,10 +4699,10 @@
top = v['path']
if base is None:
self.log.error("merge: base volume '%s' not found", baseVolUUID)
- return errCode['mergeErr']
+ return response.error('mergeErr')
if top is None:
self.log.error("merge: top volume '%s' not found", topVolUUID)
- return errCode['mergeErr']
+ return response.error('mergeErr')
# If base is a shared volume then we cannot allow a merge. Otherwise
# We'd corrupt the shared volume for other users.
@@ -4710,10 +4710,10 @@
drive.imageID, baseVolUUID)
if res['status']['code'] != 0:
self.log.error("Unable to get volume info for '%s'", baseVolUUID)
- return errCode['mergeErr']
+ return response.error('mergeErr')
if res['info']['voltype'] == 'SHARED':
self.log.error("merge: Refusing to merge into a shared volume")
- return errCode['mergeErr']
+ return response.error('mergeErr')
# Indicate that we expect libvirt to maintain the relative paths of
# backing files. This is necessary to ensure that a volume chain is
@@ -4738,7 +4738,7 @@
if res['status']['code'] != 0:
self.log.error("Unable to get volume info for '%s'",
topVolUUID)
- return errCode['mergeErr']
+ return response.error('mergeErr')
topSize = int(res['info']['apparentsize'])
# Take the jobs lock here to protect the new job we are tracking from
@@ -4749,7 +4749,7 @@
'commit')
except BlockJobExistsError:
self.log.error("A block job is already active on this disk")
- return errCode['mergeErr']
+ return response.error('mergeErr')
self.log.info("Starting merge with jobUUID='%s'", jobUUID)
try:
@@ -4760,7 +4760,7 @@
except (RuntimeError, libvirt.libvirtError):
self.log.exception("Live merge failed (job: %s)", jobUUID)
self.untrackBlockJob(jobUUID)
- return errCode['mergeErr']
+ return response.error('mergeErr')
# blockCommit will cause data to be written into the base volume.
# Perform an initial extension to ensure there is enough space to
--
To view, visit https://gerrit.ovirt.org/38268
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3825faf7a144ef8973dee3cb9f9f0e52fabfc039
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
automation(a)ovirt.org has posted comments on this change.
Change subject: vdsm-reg: remove the sub-project
......................................................................
Patch Set 4:
* Update tracker::#1231379::OK
* Set MODIFIED::bug 1231379::::#1231379::::IGNORE, not oVirt prod but Red Hat Enterprise Virtualization Manager
--
To view, visit https://gerrit.ovirt.org/43254
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5d19ddb0e65657515e2dc0eb9eeae320d8d6bf71
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Dan Kenigsberg has submitted this change and it was merged.
Change subject: vdsm-reg: remove the sub-project
......................................................................
vdsm-reg: remove the sub-project
As vdsm-reg is deprecated. At moment vdsm-tool has
register verb which executes the registration
and there is ovirt-register project.
oVirt Node doesn't pull vdsm-reg anymore.
Based on that, this patch removes vdsm-reg subproject
to avoid dead code inside vdsm tree.
Change-Id: I5d19ddb0e65657515e2dc0eb9eeae320d8d6bf71
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1231379
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/43254
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Continuous-Integration: Dan Kenigsberg <danken(a)redhat.com>
---
M .gitignore
M Makefile.am
M configure.ac
M debian/vdsm.install
M vdsm.spec.in
M vdsm/Makefile.am
D vdsm/addNetwork
D vdsm/delNetwork
D vdsm_reg/Makefile.am
D vdsm_reg/config.py.in
D vdsm_reg/createDaemon.py
D vdsm_reg/deployUtil.py.in
D vdsm_reg/logger.conf
D vdsm_reg/register-to-engine.py
D vdsm_reg/save-config
D vdsm_reg/vdsm-complete
D vdsm_reg/vdsm-config
D vdsm_reg/vdsm-gen-cert
D vdsm_reg/vdsm-reg-cmdline
D vdsm_reg/vdsm-reg-logrotate
D vdsm_reg/vdsm-reg-logrotate.conf
D vdsm_reg/vdsm-reg-setup.in
D vdsm_reg/vdsm-reg.8
D vdsm_reg/vdsm-reg.conf.in
D vdsm_reg/vdsm-reg.init
D vdsm_reg/vdsm-reg.service
D vdsm_reg/vdsm-upgrade
27 files changed, 0 insertions(+), 3,665 deletions(-)
Approvals:
Douglas Schilling Landgraf: Verified
Dan Kenigsberg: Looks good to me, approved; Passed CI tests
Objections:
Douglas Schilling Landgraf: I would prefer that you didn't submit this
--
To view, visit https://gerrit.ovirt.org/43254
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5d19ddb0e65657515e2dc0eb9eeae320d8d6bf71
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Dan Kenigsberg has posted comments on this change.
Change subject: vdsm-reg: remove the sub-project
......................................................................
Patch Set 3: Code-Review+2
vdsm-store-net-config is still much needed. Do not drop it.
--
To view, visit https://gerrit.ovirt.org/43254
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5d19ddb0e65657515e2dc0eb9eeae320d8d6bf71
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Roman Mohr has uploaded a new change for review.
Change subject: tcTests: Fix problem of left over bridges
......................................................................
tcTests: Fix problem of left over bridges
For unknown reason the command which should shut down the bridge fails
to do so, but reports back that it successfully shut down the bridge.
Therefore the following attempt to delete the bridge can just fail.
It appears to be enough to just retry the shutdown and deletion command
to work around that problem.
Change-Id: Icd0d8f20283fdf80977bd1f78f5b2ac62f7e83c8
Signed-off-by: Roman Mohr <rmohr(a)redhat.com>
---
M tests/tcTests.py
1 file changed, 9 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/44028/1
diff --git a/tests/tcTests.py b/tests/tcTests.py
index 6f0c37e..94f0d05 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -104,8 +104,15 @@
self._ifUp()
def delDevice(self):
- self._ifDown()
- check_call([EXT_BRCTL, 'delbr', self.devName])
+ try:
+ self._ifDown()
+ check_call([EXT_BRCTL, 'delbr', self.devName])
+ except ExecError:
+ # Sometimes the bridge is not shut down, although ip reports so.
+ # Just retrying the shutdown and the removal once is enough to
+ # work around that.
+ self._ifDown()
+ check_call([EXT_BRCTL, 'delbr', self.devName])
def addIf(self, dev):
check_call([EXT_BRCTL, 'addif', self.devName, dev])
--
To view, visit https://gerrit.ovirt.org/44028
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd0d8f20283fdf80977bd1f78f5b2ac62f7e83c8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Roman Mohr <rmohr(a)redhat.com>
Dan Kenigsberg has uploaded a new change for review.
Change subject: virt: let Engine start a VM on an UNKOWN OS
......................................................................
virt: let Engine start a VM on an UNKOWN OS
This superflouse validation was introduced as a "bandage" to avoid
https://bugzilla.redhat.com/716705, where Vdsm failed to recognize
VMs with "UNKOWN" os injected to their bios.
Now that we recognize VMs based on guest channels existence, we can let
Engine start a VM on whatever host it deems valid.
Backward compatibility caveat: if a VM is started on an UNKOWN os, and
then migrated to an old Vdsm (pre ovirt-3.4.2), it would be killed when
that old Vdsm is to be restarted. It's not probable that someone would
start a long-running VM on an UNKOWN platform, we may want to wait with
this patch until ovirt-3.3 is deprecated.
Change-Id: Iee7b3913e76923043daab8fb85854c3290208237
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/API.py
1 file changed, 0 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/32459/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 8d1bca6..d6f318f 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -237,11 +237,6 @@
vmParams['vmId'])
vmParams['volatileFloppy'] = True
- if caps.osversion()['name'] == caps.OSName.UNKNOWN:
- return {'status': {'code': errCode['createErr']
- ['status']['code'],
- 'message': 'Unknown host operating system'}}
-
if 'sysprepInf' in vmParams:
if not self._createSysprepFloppyFromInf(vmParams['sysprepInf'],
vmParams['floppy']):
--
To view, visit http://gerrit.ovirt.org/32459
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee7b3913e76923043daab8fb85854c3290208237
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: caps: report capabilities on UNKNOWN OS
......................................................................
caps: report capabilities on UNKNOWN OS
The capabilities reporting (getCapabilities API) does
logic on libvirt version to report, or not, the RNG source
availability.
The libvirt version is found using the package version,
but VDSM knows only how to interact with RPM and APT based
system, so it is clueless when it runs on UNKNOWN OS.
While it is still OK (from a VDSM PoV) to pass incomplete
information about available packages to Engine, this
makes the aforementioned RNG check logic fail.
Effects of this failure:
- Engine cannot connect to the VDS
- stacktrace in the VDSM logs (excerpt follows):
File "/usr/share/vdsm/API.py", line 1314, in getCapabilities
c = caps.get()
File "/usr/share/vdsm/caps.py", line 665, in get
'-'.join((caps['packages2']['libvirt']['version'],
KeyError: 'libvirt'
Thread-14::DEBUG::2015-07-31
11:16:52,699::stompreactor::305::yajsonrpc.StompServer::(send) Sending
response
This patch makes the getCapabilities API work again on
UNKNOWN OS. To be conservative, if we don't know about libvirt,
we report no RNG sources.
Please note that this prevents UNKONWN OS host to join cluster
with RNG sources configured.
Change-Id: Iaacb20dfd9b3850f477d8b45f221dc2ec186d0c2
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/caps.py
1 file changed, 11 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/44232/1
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 0c97a96..b443fab 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -660,16 +660,21 @@
caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')
# Verify that our libvirt supports virtio RNG (since 10.0.2-31)
- libvirtVer = LooseVersion(
- '-'.join((caps['packages2']['libvirt']['version'],
- caps['packages2']['libvirt']['release'])))
requiredVer = LooseVersion('0.10.2-31')
-
- if libvirtVer >= requiredVer:
- caps['rngSources'] = _getRngSources()
+ if 'libvirt' not in caps['packages2']:
+ libvirtVer = None
else:
+ libvirtVer = LooseVersion(
+ '-'.join((caps['packages2']['libvirt']['version'],
+ caps['packages2']['libvirt']['release'])))
+
+ if libvirtVer is None:
+ logging.debug('VirtioRNG DISABLED: unknown libvirt version')
+ elif libvirtVer < requiredVer:
logging.debug('VirtioRNG DISABLED: libvirt version %s required >= %s',
libvirtVer, requiredVer)
+ else:
+ caps['rngSources'] = _getRngSources()
caps['numaNodes'] = getNumaTopology()
caps['numaNodeDistance'] = getNumaNodeDistance()
--
To view, visit https://gerrit.ovirt.org/44232
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaacb20dfd9b3850f477d8b45f221dc2ec186d0c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: change downloaded ca pem filename
......................................................................
change downloaded ca pem filename
To avoid conflicts with ovirt-engine
ca.pem name.
Change-Id: I74669f9eb3a166af36fc4568881902688d28f8b3
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M lib/vdsm/tool/register.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/42837/1
diff --git a/lib/vdsm/tool/register.py b/lib/vdsm/tool/register.py
index 3ac3fc6..7c6f7ed 100644
--- a/lib/vdsm/tool/register.py
+++ b/lib/vdsm/tool/register.py
@@ -118,7 +118,7 @@
self.logger.debug("VDSM Port: {sp}".format(sp=self.vdsm_port))
self.ca_dir = "/etc/pki/ovirt-engine/"
- self.ca_engine = "{d}{f}".format(d=self.ca_dir, f="ca.pem")
+ self.ca_engine = "{d}{f}".format(d=self.ca_dir, f="cert_ca_engine.pem")
self.logger.debug("Engine CA: {ca}".format(ca=self.ca_engine))
def get_protocol(self):
@@ -292,7 +292,7 @@
Download CA from Engine and save self.ca_engine
"""
self.logger.info("Collecting CA data from Engine...")
- # If engine CA dir doesnt exist create it and download the ca.pem
+ # If engine CA dir doesnt exist create and download cert_ca_engine.pem
temp_ca_file = None
if os.path.exists(self.ca_engine):
calculated_fprint = self._calculate_fingerprint(self.ca_engine)
--
To view, visit https://gerrit.ovirt.org/42837
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I74669f9eb3a166af36fc4568881902688d28f8b3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: virt: avoid spam logs if sampling hollow VMs
......................................................................
virt: avoid spam logs if sampling hollow VMs
If the recover of a VM fails, the VM may end up being detected
as existing by VDSM, while it is actually down.
This is of course bad, and it is not something that periodic operations
or sampling can fix.
However, they can help in making not things worse by spamming the
logs with
File "/usr/lib64/python2.7/site-packages/libvirt.py", line 938, in
controlInfo
if ret is None: raise libvirtError ('virDomainGetControlInfo()
failed', dom=self)
libvirtError: Requested operation is not valid: domain is not running
To prevent this spam, we add another libvirt exception to
the whitelist of "known unharmful" error codes in
Vm.isDomainReadyForCommands().
Change-Id: If130a4b31016e971ac9972b67ba5d3fd70de5b7d
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/41406/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 8983965..815f1a7 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2595,8 +2595,10 @@
# to avoid racy checks.
return False
except libvirt.libvirtError as e:
- if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
- # same as AttributeError above: possible race on shutdown
+ if e.get_error_code() in (
+ libvirt.VIR_ERR_NO_DOMAIN, # possible race on shutdown
+ libvirt.VIR_ERR_OPERATION_INVALID, # dom misdetected up
+ ):
return False
else:
raise
--
To view, visit https://gerrit.ovirt.org/41406
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If130a4b31016e971ac9972b67ba5d3fd70de5b7d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: executor: allow caller to resize TaskQueue
......................................................................
executor: allow caller to resize TaskQueue
To prevent having an excessive amount of pending work
items, executor._TaskQueue has an hard limit of
tasks to accept, which is enforced at every put().
This limit is arbitrary, and it is set only at startup.
We want to be able to tune this value at runtime,
so this patch exports a simple resize() operation
to change the threshold inside _TaskQueue.
Change-Id: I8df4d8bbc599fa2de1dc17de8fbd2726809f5de3
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/executor.py
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/41658/1
diff --git a/lib/vdsm/executor.py b/lib/vdsm/executor.py
index fc7880e..b3574f2 100644
--- a/lib/vdsm/executor.py
+++ b/lib/vdsm/executor.py
@@ -97,6 +97,9 @@
raise NotRunning()
self._tasks.put((callable, timeout))
+ def resize(self, max_tasks):
+ self._tasks.resize(max_tasks)
+
# Serving workers
def _worker_discarded(self, worker):
@@ -253,3 +256,8 @@
def clear(self):
self._tasks.clear()
+
+ def resize(self, max_tasks):
+ if max_tasks < 1:
+ raise ValueError
+ self._max_tasks = max_tasks
--
To view, visit https://gerrit.ovirt.org/41658
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8df4d8bbc599fa2de1dc17de8fbd2726809f5de3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: periodic: virt: do not poll storage in migrations
......................................................................
periodic: virt: do not poll storage in migrations
If we monitor storage during migrations, we
get harmless but scary warning in the logs.
This patch avoids to monitor storage during
migrations to silence logs.
No functionality is lost since monitoring
doesn't do its proper job anyway.
Change-Id: I43ec1e64700020b7d143e22c4c3d8bdceb57fb18
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/periodic.py
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/40507/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index 8cc5a21..7354926 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -264,7 +264,8 @@
@property
def required(self):
# Avoid queries from storage during recovery process
- return self._vm.isDisksStatsCollectionEnabled()
+ return (not self._vm.isMigrating() and
+ self._vm.isDisksStatsCollectionEnabled())
@property
def runnable(self):
@@ -322,7 +323,8 @@
@property
def required(self):
# Avoid queries from storage during recovery process
- return self._vm.isDisksStatsCollectionEnabled()
+ return (not self._vm.isMigrating() and
+ self._vm.isDisksStatsCollectionEnabled())
@property
def runnable(self):
--
To view, visit https://gerrit.ovirt.org/40507
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I43ec1e64700020b7d143e22c4c3d8bdceb57fb18
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: virt: avoid spam logs with periodic false negative
......................................................................
virt: avoid spam logs with periodic false negative
Consolidate the periodic.Operation.required checks
in a VM helper function, and make it a bit more paranoid,
adding check to ensure that Vm._dom is not None.
If we get that far and Vm._dom is None, proably
something strange already happened (and no chance
to recover), so adding this check here skips some
annoying log spam.
Change-Id: I3f0f5a46bcb8ed1197fe389a0b2904fa6939659d
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/periodic.py
M vdsm/virt/vm.py
2 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/41659/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index f226424..efc1d4b 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -267,7 +267,7 @@
@property
def required(self):
# Avoid queries from storage during recovery process
- return (not self._vm.isMigrating() and
+ return (self._vm.isDomainQueryable() and
self._vm.isDisksStatsCollectionEnabled())
@property
@@ -326,7 +326,7 @@
@property
def required(self):
# Avoid queries from storage during recovery process
- return (not self._vm.isMigrating() and
+ return (self._vm.isDomainQueryable() and
self._vm.isDisksStatsCollectionEnabled())
@property
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 0b6773b..894194c 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2580,6 +2580,10 @@
return 'NOERR'
+ def isDomainQueryable(self):
+ # TODO: need better name
+ return (self._dom is not None and not self.isMigrating())
+
def isDomainReadyForCommands(self):
"""
Returns True if the domain is reported to be in the safest condition
--
To view, visit https://gerrit.ovirt.org/41659
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f0f5a46bcb8ed1197fe389a0b2904fa6939659d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Ido Barkan has uploaded a new change for review.
Change subject: net: ignore pass through ifcfg parameters for selective restoration
......................................................................
net: ignore pass through ifcfg parameters for selective restoration
Ignore keys in persisted networks that might originate from vdsm-reg.
these might be a result of calling setupNetworks with ifcfg values
that come from the original interface that is serving the management
network. for 3.5, VDSM still supports passing arbitrary values
directly to the ifcfg files, e.g. 'IPV6_AUTOCONF=no'. we filter them
out here since kernelConfig will never report them.
Change-Id: Ib1525f7b0238aaa5eb82eedb9ad6f41154c2c29f
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M lib/vdsm/netconfpersistence.py
M tests/functional/networkTests.py
2 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/44152/1
diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py
index c3fbda8..b5c3f14 100644
--- a/lib/vdsm/netconfpersistence.py
+++ b/lib/vdsm/netconfpersistence.py
@@ -25,6 +25,7 @@
import logging
import netaddr
import os
+import string
from .config import config
from .tool.restore_nets import restore
@@ -319,6 +320,7 @@
self._normalize_bonding_opts(config_copy)
self._normalize_bonding_nics(config_copy)
self._normalize_address(config_copy)
+ self._normalize_ifcfg_keys(config_copy)
return config_copy
@@ -391,6 +393,23 @@
if 'defaultRoute' not in net_attr:
net_attr['defaultRoute'] = False
+ def _normalize_ifcfg_keys(self, config_copy):
+ # ignore keys in persisted networks that might originate from vdsm-reg.
+ # these might be a result of calling setupNetworks with ifcfg values
+ # that come from the original interface that is serving the management
+ # network. for 3.5, VDSM still supports passing arbitrary values
+ # directly to the ifcfg files, e.g. 'IPV6_AUTOCONF=no'. we filter them
+ # out here since kernelConfig will never report them.
+ # TODO: remove when 3.5 is unsupported.
+ def unsupported(key):
+ return set(key) <= set(
+ string.ascii_uppercase + string.digits + '_')
+
+ for net_attr in config_copy.networks.itervalues():
+ for k in net_attr.keys():
+ if unsupported(k):
+ net_attr.pop(k)
+
def _parse_bond_options(self, opts):
if not opts:
return {}
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index ce532bb..bec3372 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -1744,6 +1744,28 @@
self.assertBondDoesntExist(BOND_UNCHANGED, [nic_a])
@cleanupNet
+ def testSelectiveRestoreIgnoresVdsmRegParams(self):
+ if vdsm.config.config.get('vars', 'net_persistence') == 'ifcfg':
+ raise SkipTest(
+ "with ifcfg persistence, vdsm-restore-net-config selective"
+ "restoration is not supported")
+
+ with dummyIf(1) as nics:
+ nic, = nics
+ # let _assert_kernel_config_matches_running_config do the job
+ status, msg = self.setupNetworks(
+ {NETWORK_NAME: {'nic': nic, 'IPV6_AUTOCONF': 'no',
+ 'PEERNTP': 'yes', 'IPV6INIT': 'no'}},
+ {}, NOCHK)
+ self.assertEquals(status, SUCCESS, msg)
+ self.assertNetworkExists(NETWORK_NAME)
+ status, msg = self.setupNetworks(
+ {NETWORK_NAME: {'remove': True}}, {}, NOCHK)
+ self.assertEquals(status, SUCCESS, msg)
+ self.assertNetworkDoesntExist(NETWORK_NAME)
+
+
+ @cleanupNet
@permutations([[True], [False]])
def testVolatileConfig(self, bridged):
"""
--
To view, visit https://gerrit.ovirt.org/44152
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1525f7b0238aaa5eb82eedb9ad6f41154c2c29f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vmstats: avoid explicit string conversion
......................................................................
vmstats: avoid explicit string conversion
Now that we streamlined the reporting of disk stats,
we can get rid of explicit conversion loop and simplify
the code.
Change-Id: I99c0353828f3690411faf25edda40e6ddac8641e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 0 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/43718/1
diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index 891c137..17f44fb 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -65,16 +65,6 @@
value = vm_stats[var]
if value:
stats[var] = value
- else:
- if 'disks' not in stats:
- stats['disks'] = {}
- try:
- stats['disks'][var] = {}
- for value in vm_stats[var]:
- stats['disks'][var][value] = \
- convertToStr(vm_stats[var][value])
- except Exception:
- logging.exception("Error setting vm disk stats")
return stats
--
To view, visit https://gerrit.ovirt.org/43718
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99c0353828f3690411faf25edda40e6ddac8641e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vmstats: report disks stats only if present
......................................................................
vmstats: report disks stats only if present
avoid to report empty values for disks stats,
as this may confuse Engine and let it to believe
there is no disks at all.
Change-Id: I7f1a2553114e3d78f98f978f599497d2ef5750f0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/43717/1
diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index caa2fc2..891c137 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -61,7 +61,7 @@
stats[var] = vm_stats[var]
elif type(vm_stats[var]) is not dict:
stats[var] = convertToStr(vm_stats[var])
- elif var in ('network', 'balloonInfo'):
+ elif var in ('disks', 'network', 'balloonInfo'):
value = vm_stats[var]
if value:
stats[var] = value
@@ -230,8 +230,11 @@
def disks(vm, stats, first_sample, last_sample, interval):
+
if first_sample is None or last_sample is None:
return
+
+ disk_stats = {}
for vm_drive in vm.getDiskDevices():
drive_stats = {}
@@ -272,7 +275,10 @@
logging.exception("Disk %s stats not available",
vm_drive.name)
- stats[vm_drive.name] = drive_stats
+ disk_stats[vm_drive.name] = drive_stats
+
+ if disk_stats:
+ stats['disks'] = disk_stats
def _disk_rate(first_sample, last_sample, interval):
--
To view, visit https://gerrit.ovirt.org/43717
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f1a2553114e3d78f98f978f599497d2ef5750f0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vmstats: do not report empty ioTune
......................................................................
vmstats: do not report empty ioTune
Do not report empty value for 'ioTune'
stats, much like we do for balloonInfo, disks and networks
In general, we should avoid to report empty values
if the emptiness carries no meaning (noteworthy counterexample:
vmJobs for live merge).
Change-Id: I1c34e2ffb1ebeb500be22d6db5f5a8ea2c1bb19f
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 9 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/43596/1
diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index c7c6bb4..f6636cf 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -50,12 +50,15 @@
for var in vm_stats:
if var == "ioTune":
- # Convert ioTune numbers to strings to avoid xml-rpc issue
- # with numbers bigger than int32_t
- for ioTune in vm_stats["ioTune"]:
- ioTune["ioTune"] = dict((k, convertToStr(v)) for k, v
- in ioTune["ioTune"].iteritems())
- stats[var] = vm_stats[var]
+ value = vm_stats[var]
+ if value:
+ # Convert ioTune numbers to strings to avoid xml-rpc issue
+ # with numbers bigger than int32_t
+ for ioTune in value:
+ ioTune["ioTune"] = dict(
+ (k, convertToStr(v)) for k, v
+ in ioTune["ioTune"].iteritems())
+ stats[var] = vm_stats[var]
elif type(vm_stats[var]) is not dict:
stats[var] = convertToStr(vm_stats[var])
elif var in ('network', 'balloonInfo'):
--
To view, visit https://gerrit.ovirt.org/43596
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c34e2ffb1ebeb500be22d6db5f5a8ea2c1bb19f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vmstats: do not report empty balloonInfo
......................................................................
vmstats: do not report empty balloonInfo
Do not report empty value for 'balloonInfo'
stats, much like we do for disks and networks
In general, we should avoid to report empty values
if the emptiness carries no meaning (noteworthy counterexample:
vmJobs for live merge).
Change-Id: I146e1f476434f023281f475ffaaa808f4cdf862b
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/43539/1
diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index eed10e8..0b02a1e 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -59,7 +59,9 @@
elif type(vm_stats[var]) is not dict:
stats[var] = convertToStr(vm_stats[var])
elif var in ('network', 'balloonInfo'):
- stats[var] = vm_stats[var]
+ value = vm_stats[var]
+ if value:
+ stats[var] = value
else:
try:
stats['disks'][var] = {}
--
To view, visit https://gerrit.ovirt.org/43539
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I146e1f476434f023281f475ffaaa808f4cdf862b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vm: event: send status event on pause and resume
......................................................................
vm: event: send status event on pause and resume
Make sure to send to Engine the events when
VM is paused and resumed.
Change-Id: I8da5e2c8e183e05a7a795ee129984b214fff60ac
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/43376/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 7ab953f..0e8a64d 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1182,6 +1182,7 @@
del self.conf['pauseCode']
except KeyError:
pass
+ self.send_status_event()
return {'status': doneCode, 'output': ['']}
finally:
if not guestCpuLocked:
@@ -1199,6 +1200,7 @@
guestCpuLocked=True)
self._logGuestCpuStatus('pause')
self._lastStatus = afterState
+ self.send_status_event()
return {'status': doneCode, 'output': ['']}
finally:
if not guestCpuLocked:
--
To view, visit https://gerrit.ovirt.org/43376
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8da5e2c8e183e05a7a795ee129984b214fff60ac
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
automation(a)ovirt.org has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 23:
* Update tracker::IGNORE, no Bug-Url found
* Set MODIFIED::IGNORE, no Bug-Url found.
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 23
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Dan Kenigsberg has submitted this change and it was merged.
Change subject: vm: event: send status event on IO Error
......................................................................
vm: event: send status event on IO Error
Explicitely send back to Engine a status
Event after an IO Error reported by libvirt.
Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/43312
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/vmTests.py
M vdsm/virt/vm.py
2 files changed, 18 insertions(+), 3 deletions(-)
Approvals:
Jenkins CI: Passed CI tests
Dan Kenigsberg: Looks good to me, approved
Francesco Romani: Verified
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 23
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Dan Kenigsberg has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 22: Code-Review+2
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 22
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Francesco Romani has uploaded a new change for review.
Change subject: vm: make up pauseCode if libvirt is omitting it
......................................................................
vm: make up pauseCode if libvirt is omitting it
When VDSM receives one IOError notification from libvirt,
it can override the VM pauseCode. The same pauseCode will
be reported to Engine through Events or through the
VM.getStats() API.
For historical reasons, libvirt reliably reports only the
'enospc' reason. In the other cases, the reason is an
empty string, and this resets the pauseCode to empty string.
Engine is not (anymore) expecting that.
To make Engine happy(er), and to improve the quality of data
VDSM reports in general, it is safe to report EOTHER
if the pauseCode is not given onIOError.
This patch does that.
Change-Id: I0bde0561cae20971effcf01c8a57159edcc4c42e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/44115/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 71a74b3..83d8ad8 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3591,22 +3591,26 @@
:param err: one of "eperm", "eio", "enospc" or "eother"
Note the different API from that of Vm._onAbnormalStop
"""
+ # libvirt <= 1.2.18 sends either reason="enospc" or reason="".
+ # Engine doesn't like disappearing pauseCode, so we fill the gap
+ reason = err.upper() if err else "EOTHER"
+
if action == libvirt.VIR_DOMAIN_EVENT_IO_ERROR_PAUSE:
self.log.info('abnormal vm stop device %s error %s',
blockDevAlias, err)
- self.conf['pauseCode'] = err.upper()
+ self.conf['pauseCode'] = reason
self._setGuestCpuRunning(False)
self._logGuestCpuStatus('onIOError')
- if err.upper() == 'ENOSPC':
+ if reason == 'ENOSPC':
if not self.extendDrivesIfNeeded():
self.log.info("No VM drives were extended")
elif action == libvirt.VIR_DOMAIN_EVENT_IO_ERROR_REPORT:
self.log.info('I/O error %s device %s reported to guest OS',
- err, blockDevAlias)
+ reason, blockDevAlias)
else:
# we do not support and do not expect other values
self.log.warning('unexpected action %i on device %s error %s',
- action, blockDevAlias, err)
+ action, blockDevAlias, reason)
@property
def hasSpice(self):
--
To view, visit https://gerrit.ovirt.org/44115
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bde0561cae20971effcf01c8a57159edcc4c42e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: periodic: Use thread names that can be used as system thread names
......................................................................
periodic: Use thread names that can be used as system thread names
Using new executor naming scheme, creating executor named "periodic"
will create workers named "periodic/0", "periodic/1", ...
Change also periodic scheduler thread to match this style.
Change-Id: I50d76e0b8c08070c2f34fc4eba439b9decd4990d
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/virt/periodic.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/43819/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index b023976..632674f 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -41,10 +41,10 @@
_TASKS = _WORKERS * _TASK_PER_WORKER
-_scheduler = schedule.Scheduler(name="periodic.Scheduler",
+_scheduler = schedule.Scheduler(name="periodic-sched",
clock=monotonic_time)
-_executor = executor.Executor(name="periodic.Executor",
+_executor = executor.Executor(name="periodic",
workers_count=_WORKERS,
max_tasks=_TASKS,
scheduler=_scheduler)
--
To view, visit https://gerrit.ovirt.org/43819
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I50d76e0b8c08070c2f34fc4eba439b9decd4990d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: executor: Set worker system name
......................................................................
executor: Set worker system name
Previously we used to rename the workers using long name such as
"periodic-executor-worker-3". These names are too long for setting
thread system name (using pthread.setname()), and little too long in
general.
Since we managed worker ids in the Worker class, when creating multiple
executors, workers ids did not much the number of workers in the
executor.
This patch changes the naming scheme to "executor-name/<worker-id>",
similar to the way kernel threads are named.
For example, when creating executor named "periodic" with 4 workers, the
workers will use these names:
periodic/0
periodic/1
periodic/2
periodic/3
If we create another executor such as "jsonrpc", it will create these
worker names:
jsonrpc/0
jsonrpc/1
jsonrpc/2
jsonrpc/3
jsonrpc/4
jsonrpc/5
jsonrpc/6
jsonrpc/7
If the executor name is too long, the system thread name will be
truncated, as system thread names are limited to 15 characters.
Change-Id: Ia6a6b289daff2456213615355d6d6b51fd04b500
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/executor.py
M tests/executorTests.py
2 files changed, 50 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/43788/1
diff --git a/lib/vdsm/executor.py b/lib/vdsm/executor.py
index 2639b26..4447115 100644
--- a/lib/vdsm/executor.py
+++ b/lib/vdsm/executor.py
@@ -27,6 +27,7 @@
import logging
import threading
+from . import pthread
from . import utils
@@ -53,6 +54,7 @@
def __init__(self, name, workers_count, max_tasks, scheduler):
self._name = name
self._workers_count = workers_count
+ self._worker_id = 0
self._tasks = TaskQueue(max_tasks)
self._scheduler = scheduler
self._workers = set()
@@ -129,7 +131,9 @@
# Private
def _add_worker(self):
- worker = _Worker(self, self._scheduler)
+ name = "%s/%d" % (self.name, self._worker_id)
+ self._worker_id += 1
+ worker = _Worker(self, self._scheduler, name)
self._workers.add(worker)
@@ -143,14 +147,11 @@
class _Worker(object):
_log = logging.getLogger('Executor')
- _id = 0
- def __init__(self, executor, scheduler):
+ def __init__(self, executor, scheduler, name):
self._executor = executor
self._scheduler = scheduler
self._discarded = False
- _Worker._id += 1
- name = "%s-worker-%d" % (self._executor.name, _Worker._id)
self._thread = threading.Thread(target=self._run, name=name)
self._thread.daemon = True
self._log.debug('Starting worker %s' % name)
@@ -166,6 +167,7 @@
@utils.traceback(on=_log.name)
def _run(self):
+ pthread.setname(self.name[:15])
self._log.debug('Worker started')
try:
while True:
diff --git a/tests/executorTests.py b/tests/executorTests.py
index 1f58d4d..e2d093e 100644
--- a/tests/executorTests.py
+++ b/tests/executorTests.py
@@ -21,8 +21,11 @@
import threading
import time
+from vdsm import concurrent
from vdsm import executor
+from vdsm import pthread
from vdsm import schedule
+from vdsm import utils
from testValidation import slowtest
from testlib import VdsmTestCase as TestCaseBase
@@ -130,6 +133,46 @@
self.assertTrue(task.executed.is_set())
+class TestWorkerSystemNames(TestCaseBase):
+
+ def test_worker_thread_system_name(self):
+ names = []
+ workers = 2
+ done = concurrent.Barrier(workers + 1)
+
+ def get_worker_name():
+ names.append(pthread.getname())
+ done.wait()
+
+ foo = executor.Executor('foo', workers, workers, None)
+ with utils.running(foo):
+ for i in range(workers):
+ foo.dispatch(get_worker_name)
+ done.wait()
+
+ self.assertEqual(sorted(names), ["foo/0", "foo/1"])
+
+ def test_multiple_executors(self):
+ names = []
+ workers = 2
+ done = concurrent.Barrier(2 * workers + 1)
+
+ def get_worker_name():
+ names.append(pthread.getname())
+ done.wait()
+
+ foo = executor.Executor('foo', workers, workers, None)
+ bar = executor.Executor('bar', workers, workers, None)
+ with utils.running(foo), utils.running(bar):
+ for i in range(workers):
+ foo.dispatch(get_worker_name)
+ bar.dispatch(get_worker_name)
+ done.wait()
+
+ self.assertEqual(sorted(names),
+ ["bar/0", "bar/1", "foo/0", "foo/1"])
+
+
class Task(object):
def __init__(self, wait=None, error=None):
--
To view, visit https://gerrit.ovirt.org/43788
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6a6b289daff2456213615355d6d6b51fd04b500
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
automation(a)ovirt.org has posted comments on this change.
Change subject: tests: Isolate tcTests test properly
......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/44144
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I3861ccfb432541b63d7ba5814f7e3ae339ec8105
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Roman Mohr <rmohr(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
automation(a)ovirt.org has posted comments on this change.
Change subject: tests: Isolate tcTests test properly
......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/44144
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I3861ccfb432541b63d7ba5814f7e3ae339ec8105
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Roman Mohr <rmohr(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Adam Litke has uploaded a new change for review.
Change subject: tests: Fix expandPermutations use with Mixins
......................................................................
tests: Fix expandPermutations use with Mixins
When using the expandPermutations decorator on Mixin classes or in
classes which will be inherited from it is important to remove the
PERMUTATION_ATTR from functions that have been processed. Otherwise we
will attempt to expand already expanded permutations when subclassing or
mixing this class.
Change-Id: Idcc0805ce2e77bfa4987142ccfd76b4003222471
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/testlib.py
M tests/testlibTests.py
2 files changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/44151/1
diff --git a/tests/testlib.py b/tests/testlib.py
index e6bf427..e015269 100644
--- a/tests/testlib.py
+++ b/tests/testlib.py
@@ -79,9 +79,9 @@
permName = "%s(%s)" % (f.__name__, argsString)
wrapper = _getPermutation(f, args)
wrapper.__name__ = permName
+ delattr(wrapper, PERMUTATION_ATTR)
setattr(cls, permName, wrapper)
-
delattr(cls, f.__name__)
return cls
diff --git a/tests/testlibTests.py b/tests/testlibTests.py
index c0961b8..4dc8368 100644
--- a/tests/testlibTests.py
+++ b/tests/testlibTests.py
@@ -21,6 +21,7 @@
from testlib import AssertingLock
from testlib import VdsmTestCase
from testlib import recorded
+from testlib import permutations, expandPermutations
class AssertNotRaisesTests(VdsmTestCase):
@@ -127,3 +128,15 @@
@recorded
def no_args(self):
pass
+
+
+@expandPermutations
+class PermutationsMixin(object):
+ @permutations([['True']])
+ def test_mixin_permutations(self, param):
+ self.assertTrue(param)
+
+
+@expandPermutations
+class TestPermutationsMixin(PermutationsMixin, VdsmTestCase):
+ pass
--
To view, visit https://gerrit.ovirt.org/44151
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idcc0805ce2e77bfa4987142ccfd76b4003222471
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
automation(a)ovirt.org has posted comments on this change.
Change subject: tests: Isolate tcTests test properly
......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/44144
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I3861ccfb432541b63d7ba5814f7e3ae339ec8105
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Roman Mohr <rmohr(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Nir Soffer has uploaded a new change for review.
Change subject: tests: Abusing permutations to run tests multiple times
......................................................................
tests: Abusing permutations to run tests multiple times
Run random failing test 1000 times to check if the previous patch is
making a difference.
Change-Id: Iebdd83cdce82abb618efc9805156e3554166092c
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/tcTests.py
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/44109/1
diff --git a/tests/tcTests.py b/tests/tcTests.py
index c5f35cb..5a8b8d1 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -33,6 +33,7 @@
import struct
from testlib import VdsmTestCase as TestCaseBase
+from testlib import expandPermutations, permutations
from testValidation import ValidateRunningAsRoot
from vdsm.constants import EXT_BRCTL, EXT_TC
@@ -397,6 +398,7 @@
self.assertEqual(parsed, correct)
+@expandPermutations
class TestPortMirror(TestCaseBase):
"""
@@ -491,7 +493,8 @@
self.assertFalse(self._sendPing(), "Bridge received mirrored ping "
"requests, but mirroring is unset.")
- def testMirroringWithDistraction(self):
+ @permutations([["%03d" % i] for i in range(1000)])
+ def testMirroringWithDistraction(self, _):
"setting another mirror action should not obstract the first one"
tc.setPortMirroring(self._bridge0.devName, self._bridge2.devName)
self.testMirroring()
--
To view, visit https://gerrit.ovirt.org/44109
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebdd83cdce82abb618efc9805156e3554166092c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: tests: Wait until an interface is up
......................................................................
tests: Wait until an interface is up
We are waiting until a device is down in ifdown, but we still get this
error in the tests from time to time:
00:03:53 root: DEBUG: /usr/sbin/brctl addbr vdsmtest-aijc4 (cwd None)
00:03:53 root: DEBUG: SUCCESS: <err> = ''; <rc> = 0
00:03:53 root: DEBUG: /sbin/ip link set vdsmtest-aijc4 up (cwd None)
00:03:53 root: DEBUG: SUCCESS: <err> = ''; <rc> = 0
00:03:53 root: DEBUG: /usr/sbin/tc qdisc add dev vdsmtest-aijc4 ingress (cwd None)
00:03:53 root: DEBUG: SUCCESS: <err> = ''; <rc> = 0
00:03:53 root: DEBUG: /sbin/ip link set vdsmtest-aijc4 down (cwd None)
00:03:53 root: DEBUG: SUCCESS: <err> = ''; <rc> = 0
00:03:53 root: DEBUG: /usr/sbin/brctl delbr vdsmtest-aijc4 (cwd None)
00:03:53 root: DEBUG: FAILED: <err> = "bridge vdsmtest-aijc4 is still up; can't delete it\n"; <rc> = 1
Since all the logs are in the same second, I suspect that ifdown times
out since we send it too early, leading to failure when removing the
bridge.
Trying to wait until ifup is done.
Change-Id: I39192d1e07a8a8b5ba8ed5a7a76b6441146dc91b
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/tcTests.py
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/44108/1
diff --git a/tests/tcTests.py b/tests/tcTests.py
index 6f0c37e..c5f35cb 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -71,7 +71,12 @@
return prefix + ''.join(random.sample(char_set, 5))
def _ifUp(self):
- check_call([EXT_IP, "link", "set", self.devName, "up"])
+ with monitor.Monitor(groups=('link',), timeout=2) as mon:
+ check_call([EXT_IP, "link", "set", self.devName, "up"])
+ for event in mon:
+ if (event.get('name') == self.devName and
+ event.get('state') == 'up'):
+ return
def _ifDown(self):
with monitor.Monitor(groups=('link',), timeout=2) as mon:
--
To view, visit https://gerrit.ovirt.org/44108
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I39192d1e07a8a8b5ba8ed5a7a76b6441146dc91b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
automation(a)ovirt.org has posted comments on this change.
Change subject: tests: Isolate tcTests test properly
......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/44144
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I3861ccfb432541b63d7ba5814f7e3ae339ec8105
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Roman Mohr <rmohr(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
automation(a)ovirt.org has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 22:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 22
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Nir Soffer has uploaded a new change for review.
Change subject: mount: Better and simpler __hash__
......................................................................
mount: Better and simpler __hash__
Mixing type(self) in a hash is not a good idea, all instance of old
style class have the same type. It is better to use the __class__
attribute to get the hash of the class.
The hash values were mixed in a poor way. There is no need to implement
when we can use the hash function of the tuple object, which does a
better job.
Change-Id: I6030c441c7137d65f4038d86e9813719429250c0
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/mount.py
1 file changed, 1 insertion(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/43978/1
diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index e818fd1..1626a26 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -206,10 +206,7 @@
return not self == other
def __hash__(self):
- hsh = hash(type(self))
- hsh ^= hash(self.fs_spec)
- hsh ^= hash(self.fs_file)
- return hsh
+ return hash((self.__class__, self.fs_spec, self.fs_file))
def mount(self, mntOpts=None, vfstype=None, timeout=None, cgroup=None):
cmd = [constants.EXT_MOUNT]
--
To view, visit https://gerrit.ovirt.org/43978
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6030c441c7137d65f4038d86e9813719429250c0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Michal Skrivanek has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 21:
(1 comment)
https://gerrit.ovirt.org/#/c/43312/21/vdsm/virt/vm.py
File vdsm/virt/vm.py:
Line 3622: else:
Line 3623: io_error_info['name'] = drive.name
Line 3624: io_error_info['path'] = drive.path
Line 3625:
Line 3626: self.send_status_event(pauseCode=reason, ioerror=io_error_info)
> we should document the data sent back in events - at least the minimal key
I asked Piotr&Oved the same question...we need to have some documentation guidelines before it's a complete mess.
I don't think we have anything yet:(
Line 3627:
Line 3628: @property
Line 3629: def hasSpice(self):
Line 3630: return (self.conf.get('display') == 'qxl' or
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 21
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes
automation(a)ovirt.org has posted comments on this change.
Change subject: tests: Isolate tcTests test properly
......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/44144
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I3861ccfb432541b63d7ba5814f7e3ae339ec8105
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Nir Soffer has uploaded a new change for review.
Change subject: tests: Silence momPolicyTests
......................................................................
tests: Silence momPolicyTests
The code triggered by these tests log to stderr, polluting test
progress. We now redirect stderr to stdout during these tests, so log
output is displayed only if a test failed.
Change-Id: Ice082d703ac36e17a8f3ed3cc3b4e4b144265c27
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/momPolicyTests.py
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/43621/1
diff --git a/tests/momPolicyTests.py b/tests/momPolicyTests.py
index 81a5969..c4800c5 100644
--- a/tests/momPolicyTests.py
+++ b/tests/momPolicyTests.py
@@ -1,10 +1,12 @@
import os.path
import ConfigParser
+import sys
from mom.Policy.Policy import Policy
from mom.Entity import Entity
from mom.Monitor import Monitor
from unittest import TestCase
+import monkeypatch
# This is a very hacky way of implementing the test scenario
# we should update MOM to offer test capability and use it here.
@@ -46,6 +48,7 @@
return ent
+ @monkeypatch.MonkeyPatch(sys, 'stderr', sys.stdout)
def testCpuTuneBasicTest(self):
p = Policy()
@@ -69,6 +72,7 @@
self.assertEqual(vm.controls["vcpu_quota"], 50000)
self.assertEqual(vm.controls["vcpu_period"], 100000)
+ @monkeypatch.MonkeyPatch(sys, 'stderr', sys.stdout)
def testCpuTuneHundredCpus(self):
p = Policy()
@@ -92,6 +96,7 @@
self.assertEqual(vm.controls["vcpu_quota"], 60000)
self.assertEqual(vm.controls["vcpu_period"], 100000)
+ @monkeypatch.MonkeyPatch(sys, 'stderr', sys.stdout)
def testCpuTuneNoLimit(self):
p = Policy()
@@ -115,6 +120,7 @@
self.assertEqual(vm.controls["vcpu_quota"], -1)
self.assertEqual(vm.controls["vcpu_period"], 100000)
+ @monkeypatch.MonkeyPatch(sys, 'stderr', sys.stdout)
def testCpuTuneTooSmall(self):
p = Policy()
--
To view, visit https://gerrit.ovirt.org/43621
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice082d703ac36e17a8f3ed3cc3b4e4b144265c27
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: lib: executor: get and show TID alongside name
......................................................................
lib: executor: get and show TID alongside name
For debug purposes, it is useful to map python
threads to linux TIDs. Most prominent example
is to understand when an executor Worker thread
is replaced, and what happens afterwards.
A previous attempt to set system names for threads
may have solved this issue, but it stalled on the
problem of shrkinking long python names to 15 character
most, to fit the linux threads implementation.
For the short -and maybe even long- term, a cheap,
easy but still useful solution is to grab and log
the Linux Task Identifier (TID) alongside
the python thread name.
Since TIDs are basically PIDs for threads, this
make easier to find a python thread froma system tool,
like gdk (or pstack).
To implement this, we add a trivial wrapper in lib/vdsm/pthread.py,
inspired by
https://code.google.com/p/psutil/issues/detail?id=186
and we extend lib/vdsm/executor.py to make use of it.
Change-Id: Ibb4e4974ef29dad5f764450d4ed29c61cae31d21
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/executor.py
M lib/vdsm/pthread.py
2 files changed, 15 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/43771/1
diff --git a/lib/vdsm/executor.py b/lib/vdsm/executor.py
index 2639b26..065dbb5 100644
--- a/lib/vdsm/executor.py
+++ b/lib/vdsm/executor.py
@@ -27,6 +27,7 @@
import logging
import threading
+from . import pthread
from . import utils
@@ -149,12 +150,17 @@
self._executor = executor
self._scheduler = scheduler
self._discarded = False
+ self._tid = None
_Worker._id += 1
name = "%s-worker-%d" % (self._executor.name, _Worker._id)
self._thread = threading.Thread(target=self._run, name=name)
self._thread.daemon = True
self._log.debug('Starting worker %s' % name)
self._thread.start()
+
+ @property
+ def tid(self):
+ return self._tid
@property
def name(self):
@@ -166,14 +172,15 @@
@utils.traceback(on=_log.name)
def _run(self):
- self._log.debug('Worker started')
+ self._tid = pthread.gettid()
+ self._log.debug('Worker started (tid=%d)', self._tid)
try:
while True:
self._execute_task()
except NotRunning:
self._log.debug('Worker stopped')
except _WorkerDiscarded:
- self._log.debug('Worker was discarded')
+ self._log.debug('Worker was discarded (tid=%d)', self._tid)
finally:
self._executor._worker_stopped(self)
diff --git a/lib/vdsm/pthread.py b/lib/vdsm/pthread.py
index 851afd1..1433fdb 100644
--- a/lib/vdsm/pthread.py
+++ b/lib/vdsm/pthread.py
@@ -26,7 +26,9 @@
NAME_MAX_LENGTH = 15
+_SYS_GETTID = 186
+_LIBC = ctypes.CDLL('libc.so.6')
_LIBPTHREAD = ctypes.CDLL("libpthread.so.0", use_errno=True)
_pthread_setname_np_proto = ctypes.CFUNCTYPE(
@@ -88,3 +90,7 @@
thread = threading.current_thread()
_pthread_getname_np(thread.ident, buf, bufsize)
return buf.value
+
+
+def gettid():
+ return _LIBC.syscall(_SYS_GETTID)
--
To view, visit https://gerrit.ovirt.org/43771
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb4e4974ef29dad5f764450d4ed29c61cae31d21
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Ido Barkan has uploaded a new change for review.
Change subject: net: always persist owned ifcfg files on ovirt node
......................................................................
net: always persist owned ifcfg files on ovirt node
Change-Id: Ibc717b86194a32c050d346e235a5c35fd318e1ff
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M vdsm/network/configurators/ifcfg.py
M vdsm/vdsm-store-net-config.in
2 files changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/44112/1
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index f2dbd5e..83b95f9 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -479,10 +479,6 @@
self._backup(fileName)
configuration = self.CONFFILE_HEADER + '\n' + configuration
- # make sure that ifcfg files are never persisted by the node
- if self.unifiedPersistence and utils.isOvirtNode():
- node_fs.Config().unpersist(fileName)
-
logging.debug('Writing to file %s configuration:\n%s', fileName,
configuration)
with open(fileName, 'w') as confFile:
diff --git a/vdsm/vdsm-store-net-config.in b/vdsm/vdsm-store-net-config.in
index c19d5e0..4e84fb7 100755
--- a/vdsm/vdsm-store-net-config.in
+++ b/vdsm/vdsm-store-net-config.in
@@ -37,8 +37,17 @@
rm -rf "$NET_CONF_BACK_DIR"/*
}
+node_persist_owned_ifcfgs() {
+ for f in $(find "$NET_CONF_DIR" -type f); do
+ if grep -q "# Generated by VDSM version" $f; then
+ ovirt_store_config "$f"
+ fi
+ done
+}
+
unified_node_persist() {
unified_nonnode_persist
+ node_persist_owned_ifcfgs
# oVirt node ovirt_store_config puts the dir in persistent storage and
# bind mounts it in the original place. So that's all we really need to do.
--
To view, visit https://gerrit.ovirt.org/44112
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc717b86194a32c050d346e235a5c35fd318e1ff
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Michal Skrivanek has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 21: Code-Review+1
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 21
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Francesco Romani has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 21:
(1 comment)
https://gerrit.ovirt.org/#/c/43312/21/vdsm/virt/vm.py
File vdsm/virt/vm.py:
Line 3622: else:
Line 3623: io_error_info['name'] = drive.name
Line 3624: io_error_info['path'] = drive.path
Line 3625:
Line 3626: self.send_status_event(pauseCode=reason, ioerror=io_error_info)
we should document the data sent back in events - at least the minimal key set we ensure to always send back ('status'?)
where should this documentation be put? vdsmapi-schema.json?
different schema for events only?
Line 3627:
Line 3628: @property
Line 3629: def hasSpice(self):
Line 3630: return (self.conf.get('display') == 'qxl' or
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 21
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes
automation(a)ovirt.org has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 21:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 21
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
automation(a)ovirt.org has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 20:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 20
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Francesco Romani has uploaded a new change for review.
Change subject: vmstats: report network stats only if present
......................................................................
vmstats: report network stats only if present
avoid to report empty values for network stats,
as this may confuse Engine and let it to believe
there is no networks at all.
Change-Id: I8b3fd2fe7913c3a7b80b5d2c7ffe55e8fb5f8976
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/43716/1
diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index 10d0776..caa2fc2 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -206,10 +206,11 @@
def networks(vm, stats, first_sample, last_sample, interval):
- stats['network'] = {}
if first_sample is None or last_sample is None:
return
+
+ net_stats = {}
for nic in vm.getNicDevices():
if nic.name.startswith('hostdev'):
@@ -220,10 +221,13 @@
# may happen if nic is a new hot-plugged one
if not first_nic or not last_nic:
continue
- stats['network'][nic.name] = nic(
+ net_stats[nic.name] = nic(
nic.name, nic.nicModel, nic.macAddr,
first_nic, last_nic, interval)
+ if net_stats:
+ stats['network'] = net_stats
+
def disks(vm, stats, first_sample, last_sample, interval):
if first_sample is None or last_sample is None:
--
To view, visit https://gerrit.ovirt.org/43716
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b3fd2fe7913c3a7b80b5d2c7ffe55e8fb5f8976
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Ido Barkan has uploaded a new change for review.
Change subject: net: fix tSetupNetworksDeletesTheBridgeOnlyWhenItIsReconfigured
......................................................................
net: fix tSetupNetworksDeletesTheBridgeOnlyWhenItIsReconfigured
since the tap object itself went out of scope, the kernel removed
the device during the test since the file descriptor held by the
Tap object was closed. The test was also fixed to remove the device
before calling setupNetworks that would attempt to delete the bridge.
Change-Id: I52d0c04ffd3c047c1e66cec3d1a9646717d90a21
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M tests/functional/networkTests.py
1 file changed, 4 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/43995/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 7f5ab37..d930214 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -1005,15 +1005,11 @@
return link.index
def add_tap_to_bridge():
- tap = Tap()
+ tap = Tap(prefix='vnet')
tap.addDevice()
rc, _, _ = execCmd([EXT_BRCTL, 'addif', NETWORK_NAME, tap.devName])
self.assertEquals(rc, 0, 'brctl addif failed: rc=%s' % (rc,))
- return tap.devName
-
- def remove_tap_from_bridge(tap_name):
- rc, _, _ = execCmd([EXT_BRCTL, 'delif', NETWORK_NAME, tap_name])
- self.assertEquals(rc, 0, 'brctl delif failed: rc=%s' % (rc,))
+ return tap
STANDARD, BIG = 1500, 2000
with dummyIf(2) as nics:
@@ -1025,7 +1021,7 @@
self.assertMtu(STANDARD, NETWORK_NAME, first)
bridge_index = get_bridge_index()
# simulate a vm connected to the bridge
- tap_name = add_tap_to_bridge()
+ tap = add_tap_to_bridge()
second_net = {NETWORK_NAME: dict(bridged=True, nic=second,
mtu=BIG, vlan=VLAN_ID)}
@@ -1033,6 +1029,7 @@
self.assertEquals(status, SUCCESS, msg)
second_bridge_index = get_bridge_index()
self.assertEquals(bridge_index, second_bridge_index)
+ tap.delDevice()
# the kernel bridge driver automatically updates the bridge to the
# new minimum MTU of all of its connected interfaces
self.assertMtu(BIG, NETWORK_NAME, second)
@@ -1054,7 +1051,6 @@
self.assertEquals(status, SUCCESS, msg)
self.assertNotEqual(second_bridge_index, get_bridge_index())
- remove_tap_from_bridge(tap_name)
status, msg = self.setupNetworks({NETWORK_NAME: {'remove': True}},
{}, NOCHK)
self.assertEquals(status, SUCCESS, msg)
--
To view, visit https://gerrit.ovirt.org/43995
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I52d0c04ffd3c047c1e66cec3d1a9646717d90a21
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: tests: Fix error handling when checking dependencies
......................................................................
tests: Fix error handling when checking dependencies
We used to hide *all* exceptions and skip the tests with possible bogus
message.
When trying brctl, we skip the test only if we cannot run it, since this
is the only error that can cause by missing bridge-utils. Any other
error should fail the tests.
When trying tc, we show the failure in the error message.
Also removed pointless code opening and closing /dev/null.
Change-Id: I180ba6449009dc986d2df58958039e2324d2191f
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/tcTests.py
1 file changed, 9 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/10/44110/1
diff --git a/tests/tcTests.py b/tests/tcTests.py
index c5f35cb..92bf4d7 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -19,6 +19,7 @@
# Refer to the README and COPYING files for full details of the license
#
+import errno
import random
import time
import string
@@ -178,18 +179,18 @@
dev = _Bridge()
try:
dev.addDevice()
- except:
- raise SkipTest("'brctl' has failed. Do you have bridge-utils "
- "installed?")
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ raise SkipTest("Cannot run %r: %s\nDo you have bridge-utils "
+ "installed?" % (EXT_BRCTL, e))
+ raise
- null = open("/dev/null", "a")
try:
check_call([EXT_TC, 'qdisc', 'add', 'dev', dev.devName, 'ingress'])
- except:
- raise SkipTest("'tc' has failed. Do you have Traffic Control kernel "
- "modules installed?")
+ except ExecError as e:
+ raise SkipTest("%r has failed: %s\nDo you have Traffic Control kernel "
+ "modules installed?" % (EXT_TC, e.err))
finally:
- null.close()
dev.delDevice()
--
To view, visit https://gerrit.ovirt.org/44110
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I180ba6449009dc986d2df58958039e2324d2191f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: mount: Implement __ne__
......................................................................
mount: Implement __ne__
There are no implied relationships among the comparison operators. The
truth of x==y does not imply that x!=y is false. Accordingly, when
defining __eq__(), one should also define __ne__() so that the operators
will behave as expected.
See https://docs.python.org/2/reference/datamodel.html#object.__eq__
Change-Id: I9b08fe7ee472c3582ee9816988db66e92c2542ea
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/mount.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/43977/1
diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index becd541..e818fd1 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -202,6 +202,9 @@
self.fs_spec == other.fs_spec and
self.fs_file == other.fs_file)
+ def __ne__(self, other):
+ return not self == other
+
def __hash__(self):
hsh = hash(type(self))
hsh ^= hash(self.fs_spec)
--
To view, visit https://gerrit.ovirt.org/43977
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b08fe7ee472c3582ee9816988db66e92c2542ea
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Nir Soffer has uploaded a new change for review.
Change subject: mount: More correct and simpler __eq__
......................................................................
mount: More correct and simpler __eq__
Instance of different classes should not be considered equal, as
subclass may add new state not in the superclass.
If an instance is missing an attribute it should have, we don't want to
hide this error, and we certainly do not want to swallow *any* Exception
during the check.
Change-Id: Ib7b182fcd2ae95d2e0c310795a794f9e48d8d13f
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/mount.py
1 file changed, 3 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/43976/1
diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index 4786ccb..becd541 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -198,14 +198,9 @@
self.fs_file = normpath(fs_file)
def __eq__(self, other):
- if not isinstance(other, Mount):
- return False
-
- try:
- return (other.fs_spec == self.fs_spec and
- other.fs_file == self.fs_file)
- except Exception:
- return False
+ return (self.__class__ == other.__class__ and
+ self.fs_spec == other.fs_spec and
+ self.fs_file == other.fs_file)
def __hash__(self):
hsh = hash(type(self))
--
To view, visit https://gerrit.ovirt.org/43976
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7b182fcd2ae95d2e0c310795a794f9e48d8d13f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Dan Kenigsberg has uploaded a new change for review.
Change subject: test jenkins, please delete
......................................................................
test jenkins, please delete
Change-Id: I88e0fccfe52b23d675a74e44e6da06c2b74bfbeb
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/netinfo.py
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/43566/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 01f25c7..129c0d7 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -781,7 +781,10 @@
def getIpAddresses():
"Return a list of the host's IP addresses"
- return filter(None, [getaddr(i) for i in ethtool.get_active_devices()])
+ try:
+ return filter(None, [getaddr(i) for i in ethtool.get_active_devices()])
+ except UnicodeDecodeError:
+ raise RuntimeError(unicode(ethtool.get_active_devices()))
def IPv4toMapped(ip):
--
To view, visit https://gerrit.ovirt.org/43566
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I88e0fccfe52b23d675a74e44e6da06c2b74bfbeb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
automation(a)ovirt.org has posted comments on this change.
Change subject: vm: event: document event on reboot
......................................................................
Patch Set 19:
* Update tracker::IGNORE, no Bug-Url found
* Set MODIFIED::IGNORE, no Bug-Url found.
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 19
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Dan Kenigsberg has submitted this change and it was merged.
Change subject: vm: event: document event on reboot
......................................................................
vm: event: document event on reboot
The guest agent onStatusChange callback
automatically delivers RebootInProgess event
when VM reboots: we don't need anything extra here,
but it is worth to explicitely document this
behaviour.
Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/43309
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Continuous-Integration: Jenkins CI
---
M vdsm/virt/vm.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Jenkins CI: Passed CI tests
Dan Kenigsberg: Looks good to me, approved
Francesco Romani: Verified
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 19
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Francesco Romani has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 19:
NON-SPM VDSM
- works, but sends the bare miniumum information. We can and should do better.
SPM VDSM
- VDSM SIGTERMS itself to death, on recovery onIOError is delivered;
Event "WaitForLaunch" is sent (useless) onIOError; later, at the end of domDependentInit, "Paused" with pauseCode "EOTHER" is sent.
Needs more work.
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 19
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Adam Litke has uploaded a new change for review.
Change subject: tests: Create storagetestutils module
......................................................................
tests: Create storagetestutils module
The tests for VolumeMetadata want to reuse many of the functions that
were implemented in manifest_tests.py. Move these into a helper module
that can be shared by all storage tests.
Change-Id: I713e19473b45bc05da5a1c888a034306144228c5
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/Makefile.am
A tests/storagetestutils.py
2 files changed, 101 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/43547/1
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 12ccfc2..df3b335 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -188,6 +188,7 @@
hookValidation.py \
monkeypatch.py \
storagefakelib.py \
+ storagetestutils.py \
testlib.py \
testrunner.py \
testValidation.py \
diff --git a/tests/storagetestutils.py b/tests/storagetestutils.py
new file mode 100644
index 0000000..a04ab58
--- /dev/null
+++ b/tests/storagetestutils.py
@@ -0,0 +1,100 @@
+# Copyright 2015 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
+#
+import os
+import uuid
+from contextlib import contextmanager
+
+from storage import sd, blockSD, fileSD
+
+
+NR_PVS = 5 # The number of fake PVs we use to make a fake VG
+MDSIZE = 524288 # The size (in bytes) of fake metadata files
+
+
+class FakeMetadata(dict):
+ @contextmanager
+ def transaction(self):
+ yield
+
+
+def make_blocksd_manifest(metadata=None, tmpdir=None):
+ sduuid = str(uuid.uuid4())
+ if metadata is None:
+ metadata = FakeMetadata()
+ manifest = blockSD.BlockStorageDomainManifest(sduuid, metadata)
+ if tmpdir is not None:
+ manifest.domaindir = tmpdir
+ os.makedirs(os.path.join(manifest.domaindir, sduuid, sd.DOMAIN_IMAGES))
+ return manifest
+
+
+def get_device_list(count):
+ return ['/dev/mapper/{0}'.format(os.urandom(16).encode('hex'))
+ for _ in range(count)]
+
+
+def make_vg(fake_lvm, manifest, devices=None):
+ vg_name = manifest.sdUUID
+ if devices is None:
+ devices = get_device_list(NR_PVS)
+ fake_lvm.createVG(vg_name, devices, blockSD.STORAGE_UNREADY_DOMAIN_TAG,
+ blockSD.VG_METADATASIZE)
+ fake_lvm.createLV(vg_name, sd.METADATA, blockSD.SD_METADATA_SIZE)
+
+ # Fake the PV information for our metadata LV
+ fake_lvm.lvmd[vg_name][sd.METADATA]['devices'] = \
+ '{0}(0)'.format(devices[0])
+ return vg_name
+
+
+def get_metafile_path(domaindir):
+ return os.path.join(domaindir, sd.DOMAIN_META_DATA, sd.METADATA)
+
+
+def make_filesd_manifest(tmpdir, metadata=None):
+ sduuid = str(uuid.uuid4())
+ domain_path = os.path.join(tmpdir, sduuid)
+ make_fake_metafile(get_metafile_path(domain_path))
+ if metadata is None:
+ metadata = dict()
+ manifest = fileSD.FileStorageDomainManifest(domain_path, metadata)
+ os.makedirs(os.path.join(manifest.domaindir, sduuid, sd.DOMAIN_IMAGES))
+ return manifest
+
+
+def make_fake_metafile(metafile):
+ os.makedirs(os.path.dirname(metafile))
+ with open(metafile, "w") as f:
+ f.truncate(0)
+
+
+def make_file_volume(domaindir, size, imguuid=None, voluuid=None):
+ imguuid = imguuid or str(uuid.uuid4())
+ voluuid = voluuid or str(uuid.uuid4())
+ imgpath = os.path.join(domaindir, "images", imguuid)
+ volpath = os.path.join(imgpath, voluuid)
+ mdfiles = [volpath + '.meta', volpath + '.lease']
+ if not os.path.exists(imgpath):
+ os.makedirs(imgpath)
+ with open(volpath, "w") as f:
+ f.truncate(size)
+ for mdfile in mdfiles:
+ with open(mdfile, "w") as f:
+ f.truncate(0)
+ return imguuid, voluuid
\ No newline at end of file
--
To view, visit https://gerrit.ovirt.org/43547
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I713e19473b45bc05da5a1c888a034306144228c5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Francesco Romani has uploaded a new change for review.
Change subject: vmstats: make sure values are all strings
......................................................................
vmstats: make sure values are all strings
Until we drop support of XML-RPC, we need
to make sure that possibly large integers are
reported as strings.
This patch converts directly the values to strings,
avoiding the need for a later conversion step.
Change-Id: I8326c284c412cb392619b33a3bd869b12add1206
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/43715/1
diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index f6636cf..10d0776 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -273,10 +273,10 @@
def _disk_rate(first_sample, last_sample, interval):
return {
- 'readRate': (
+ 'readRate': str(
(last_sample['rd.bytes'] - first_sample['rd.bytes'])
/ interval),
- 'writeRate': (
+ 'writeRate': str(
(last_sample['wr.bytes'] - first_sample['wr.bytes'])
/ interval)}
--
To view, visit https://gerrit.ovirt.org/43715
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8326c284c412cb392619b33a3bd869b12add1206
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Douglas Schilling Landgraf has posted comments on this change.
Change subject: vdsm-reg: remove the sub-project
......................................................................
Patch Set 3:
I could build vdsm rpms and vdsm_reg is not generated.
--
To view, visit https://gerrit.ovirt.org/43254
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5d19ddb0e65657515e2dc0eb9eeae320d8d6bf71
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Douglas Schilling Landgraf has posted comments on this change.
Change subject: vdsm-reg: remove the sub-project
......................................................................
Patch Set 3: Verified+1 Code-Review-1
-1 as pending the official test for new reg approach.
--
To view, visit https://gerrit.ovirt.org/43254
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5d19ddb0e65657515e2dc0eb9eeae320d8d6bf71
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Douglas Schilling Landgraf has posted comments on this change.
Change subject: vdsm-reg: remove the sub-project
......................................................................
Patch Set 2:
Can we drop vdsm-store-net-config too ?
--
To view, visit https://gerrit.ovirt.org/43254
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5d19ddb0e65657515e2dc0eb9eeae320d8d6bf71
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Dan Kenigsberg has posted comments on this change.
Change subject: vm: event: document event on reboot
......................................................................
Patch Set 18: Code-Review+2
If you find it helpful, let it be.
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 18
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Francesco Romani has posted comments on this change.
Change subject: vm: event: document event on reboot
......................................................................
Patch Set 18: Verified+1
v18 is the one actually verified
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 18
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
automation(a)ovirt.org has posted comments on this change.
Change subject: vm: event: send status event on IO Error
......................................................................
Patch Set 19:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/43312
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa4be90f1267e82b8af2abb36c06cfd9a70fb558
Gerrit-PatchSet: 19
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
automation(a)ovirt.org has posted comments on this change.
Change subject: vm: event: document event on reboot
......................................................................
Patch Set 18:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 18
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Francesco Romani has posted comments on this change.
Change subject: vm: event: send status event on reboot
......................................................................
Patch Set 17: -Verified
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 17
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Francesco Romani has posted comments on this change.
Change subject: vm: event: send status event on reboot
......................................................................
Patch Set 17: Verified+1
now event is sent only once
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 17
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Francesco Romani has posted comments on this change.
Change subject: vm: event: send status event on reboot
......................................................................
Patch Set 17:
Michal's thought is correct, verified on the field.
Thinking about the best way to fix this. We may just want to drop this patch entirely.
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 17
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
Michal Skrivanek has posted comments on this change.
Change subject: vm: event: send status event on reboot
......................................................................
Patch Set 17: -Code-Review
all 3 are from libvirtEventLoop context...so perhaps libvirt is emitting multiple times?
I'd guess setting self.guestStatus = vmstatus.REBOOT_IN_PROGRESS only when it's not already set would resolve this
(and also the @guestStatus.setter would take care of sendign the event)
--
To view, visit https://gerrit.ovirt.org/43309
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I748b187228a39e55982c1b7d05ab47681481801c
Gerrit-PatchSet: 17
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No