Yoav Kleinberger has uploaded a new change for review.
Change subject: tests: use 'localhost' explicitly in test
......................................................................
tests: use 'localhost' explicitly in test
Previously tests could on some machines (in case the machine has a
non-default hostname). Now, since we use 'localhost' explicitly, this
will not happen.
Change-Id: I89990cff46e64120262e250eee9238b49c4edee4
Signed-off-by: Yoav Kleinberger <ykleinbe(a)redhat.com>
---
M tests/functional/storageTests.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/28107/1
diff --git a/tests/functional/storageTests.py b/tests/functional/storageTests.py
index 80ba312..76ca91d 100644
--- a/tests/functional/storageTests.py
+++ b/tests/functional/storageTests.py
@@ -79,7 +79,8 @@
isSSL = config.getboolean('vars', 'ssl')
if isSSL and os.geteuid() != 0:
raise SkipTest("Must be root to use SSL connection to server")
- self.s = vdscli.connect(useSSL=isSSL)
+ address = 'localhost:%s' % config.get('addresses', 'management_port')
+ self.s = vdscli.connect(hostPort=address, useSSL=isSSL)
def assertVdsOK(self, vdsResult):
# code == 0 means OK
--
To view, visit http://gerrit.ovirt.org/28107
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I89990cff46e64120262e250eee9238b49c4edee4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yoav Kleinberger <ykleinbe(a)redhat.com>
Ondřej Svoboda has uploaded a new change for review.
Change subject: network: Inexistence of a network in libvirt should not be fatal to us
......................................................................
network: Inexistence of a network in libvirt should not be fatal to us
vdsm-restore-net-config (with unified persistence) is called often during
functional network tests. This is a rollback scenario and connectivity
is at stake.
A network missing in libvirt is a sign of a different failure
(and we are after you, traffic control!) but it must not harm the restoration
of networking (not only) after failed tests.
Change-Id: Ia6ae4b359d543b6e3ee560a5cb021e31d037c035
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M vdsm/network/api.py
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/34988/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 1b09c6c..4a2b0c5 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -691,9 +691,9 @@
del libvirt_nets[network]
_netinfo.updateDevices()
elif 'remove' in networkAttrs:
- raise ConfigNetworkError(ne.ERR_BAD_BRIDGE, "Cannot delete "
- "network %r: It doesn't exist in the "
- "system" % network)
+ logger.warning("Not deleting network {0!r}: it is unknown to "
+ "libvirtd".format(network))
+ del networks[network]
else:
networksAdded.add(network)
--
To view, visit http://gerrit.ovirt.org/34988
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6ae4b359d543b6e3ee560a5cb021e31d037c035
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
Saggi Mizrahi has uploaded a new change for review.
Change subject: zombiereaper: Add ability to wait on process
......................................................................
zombiereaper: Add ability to wait on process
This adds the ability to wait on a process with timeout in an efficient
manner.
When the process receives SIGCHLD in addition to clearing the tracked
pids it will now call poll() on requested C\Popen objects. This will
allow the called to synchronously wait for a process to exit with
timeout.
Change-Id: Idcd69b6187bc1c412c11f6cba9af431557ea7077
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M lib/vdsm/infra/zombiereaper/__init__.py
M lib/vdsm/infra/zombiereaper/tests.py
2 files changed, 79 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/35055/1
diff --git a/lib/vdsm/infra/zombiereaper/__init__.py b/lib/vdsm/infra/zombiereaper/__init__.py
index f85ec30..2169ffa 100644
--- a/lib/vdsm/infra/zombiereaper/__init__.py
+++ b/lib/vdsm/infra/zombiereaper/__init__.py
@@ -28,8 +28,10 @@
import os
import signal
+from threading import Condition
_trackedPids = set()
+_waited_on_procs = {}
def autoReapPID(pid):
@@ -46,6 +48,7 @@
pid, rv = os.waitpid(pid, os.WNOHANG)
if pid != 0:
_trackedPids.discard(pid)
+
except OSError:
_trackedPids.discard(pid)
@@ -54,6 +57,52 @@
for pid in _trackedPids.copy():
_tryReap(pid)
+ for proc in _waited_on_procs.keys():
+ _tryWait(proc)
+
+
+def _tryWait(proc):
+ res = None
+ err = None
+ try:
+ res = proc.poll()
+ except Exception as e:
+ err = e
+ finally:
+ try:
+ c = _waited_on_procs[proc]
+ except KeyError:
+ pass
+ else:
+ with c:
+ if c == _waited_on_procs[proc]:
+ _waited_on_procs[proc] = (res, err)
+ c.notify_all()
+
+
+def waitproc(proc, timeout=None):
+ """Wait until a process exits
+
+ Will block until the process exists or timeout (in seconds) has passed.
+ Passing None as timeout (the default) will block forever but in that case
+ it's recommended to just use the built in wait() functionality.
+ """
+ c = Condition()
+ with c:
+ if c != _waited_on_procs.setdefault(proc, c):
+ raise ValueError("proc already being tracked")
+
+ c.wait(timeout)
+ res = _waited_on_procs.pop(proc)
+ if res == c:
+ return None
+ else:
+ rv, err = res
+ if err is not None:
+ raise err
+
+ return rv
+
def registerSignalHandler():
"""
diff --git a/lib/vdsm/infra/zombiereaper/tests.py b/lib/vdsm/infra/zombiereaper/tests.py
index ee4fb02..817aa13 100644
--- a/lib/vdsm/infra/zombiereaper/tests.py
+++ b/lib/vdsm/infra/zombiereaper/tests.py
@@ -19,16 +19,17 @@
#
from time import sleep
import os
+from threading import Thread
+
+import nose.tools as nt
from .. import zombiereaper
from cpopen import CPopen
-from unittest import TestCase
-
zombiereaper.registerSignalHandler()
-class zombieReaperTests(TestCase):
+class TestZombieReaper(object):
def testProcessDiesAfterBeingTracked(self):
p = CPopen(["sleep", "1"])
zombiereaper.autoReapPID(p.pid)
@@ -36,7 +37,7 @@
sleep(4)
# Throws error because pid is not found or is not child
- self.assertRaises(OSError, os.waitpid, p.pid, os.WNOHANG)
+ nt.assert_raises(OSError, os.waitpid, p.pid, os.WNOHANG)
def testProcessDiedBeforeBeingTracked(self):
p = CPopen(["sleep", "0"])
@@ -46,4 +47,28 @@
zombiereaper.autoReapPID(p.pid)
# Throws error because pid is not found or is not child
- self.assertRaises(OSError, os.waitpid, p.pid, os.WNOHANG)
+ nt.assert_raises(OSError, os.waitpid, p.pid, os.WNOHANG)
+
+ def testWaitProc(self):
+ p = CPopen(["sleep", "1"])
+ nt.assert_is_not_none(zombiereaper.waitproc(p, 2))
+ nt.assert_is_not_none(p.returncode)
+
+ def testWaitProcCallTwice(self):
+ p = CPopen(["sleep", "3"])
+ nt.assert_is_none(zombiereaper.waitproc(p, 1))
+ nt.assert_is_not_none(zombiereaper.waitproc(p, 3))
+ nt.assert_is_not_none(p.returncode)
+
+ def testWaitProcRegisterTwice(self):
+ p = CPopen(["sleep", "2"])
+ t = Thread(
+ name="waiter",
+ target=zombiereaper.waitproc,
+ args=(p, 4),
+ )
+ t.setDaemon(True)
+ t.start()
+ sleep(1)
+ nt.assert_raises(ValueError, zombiereaper.waitproc, p, 1)
+ t.join()
--
To view, visit http://gerrit.ovirt.org/35055
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idcd69b6187bc1c412c11f6cba9af431557ea7077
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Vitor de Lima has uploaded a new change for review.
Change subject: vmxml.py, vm.py: Remove QEMU passthrough hack in ppc64
......................................................................
vmxml.py, vm.py: Remove QEMU passthrough hack in ppc64
Recent libvirt versions already include a virtual USB keyboard and
mouse in guests with graphical consoles. This patch does not include
any information about input devices in the domain XML in order to
libvirt handle the creation of these devices automatically.
Change-Id: I64d660bf7534203d5d5cdbc318ffd1429a16f954
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1122627
Signed-off-by: Vitor de Lima <vdelima(a)redhat.com>
---
M vdsm/virt/vm.py
M vdsm/virt/vmxml.py
2 files changed, 3 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/33871/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 1eebb69..5b39752 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2679,7 +2679,9 @@
_VMCHANNEL_DEVICE_NAME)
domxml._appendAgentDevice(self._qemuguestSocketFile.decode('utf-8'),
_QEMU_GA_DEVICE_NAME)
- domxml.appendInput()
+
+ if self.arch == caps.Architecture.X86_64:
+ domxml.appendInput()
if self.arch == caps.Architecture.PPC64:
domxml.appendEmulator()
@@ -2694,9 +2696,6 @@
for drive in self._devices[DISK_DEVICES][:]:
for leaseElement in drive.getLeasesXML():
domxml._devices.appendChild(leaseElement)
-
- if self.arch == caps.Architecture.PPC64:
- domxml.appendKeyboardDevice()
return domxml.toxml()
diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py
index eb07ba9..a83adb1 100644
--- a/vdsm/virt/vmxml.py
+++ b/vdsm/virt/vmxml.py
@@ -165,14 +165,6 @@
domainAttrs = {'type': domainType}
- # Hack around libvirt issue BZ#988070, this is going to be removed as
- # soon as the domain XML format supports the specification of USB
- # keyboards
-
- if self.arch == caps.Architecture.PPC64:
- domainAttrs['xmlns:qemu'] = \
- 'http://libvirt.org/schemas/domain/qemu/1.0'
-
self.dom = Element('domain', **domainAttrs)
self.doc.appendChild(self.dom)
@@ -444,21 +436,6 @@
inputAttrs = {'type': 'mouse', 'bus': mouseBus}
self._devices.appendChildWithArgs('input', **inputAttrs)
-
- def appendKeyboardDevice(self):
- """
- Add keyboard device for ppc64 using a QEMU argument directly.
- This is a workaround to the issue BZ#988070 in libvirt
-
- <qemu:commandline>
- <qemu:arg value='-usbdevice'/>
- <qemu:arg value='keyboard'/>
- </qemu:commandline>
- """
- commandLine = Element('qemu:commandline')
- commandLine.appendChildWithArgs('qemu:arg', value='-usbdevice')
- commandLine.appendChildWithArgs('qemu:arg', value='keyboard')
- self.dom.appendChild(commandLine)
def appendEmulator(self):
emulatorPath = '/usr/bin/qemu-system-' + self.arch
--
To view, visit http://gerrit.ovirt.org/33871
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I64d660bf7534203d5d5cdbc318ffd1429a16f954
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vitor de Lima <vdelima(a)redhat.com>