[libvirt] [PATCH python] Remove unused variables for event callbacks
by Daniel P. Berrange
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-override.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index c04ce2e..a3a0508 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -5182,19 +5182,11 @@ libvirt_virConnectDomainEventDeregister(PyObject *self ATTRIBUTE_UNUSED,
* Event Impl
*******************************************/
static PyObject *addHandleObj;
-static char *addHandleName;
static PyObject *updateHandleObj;
-static char *updateHandleName;
static PyObject *removeHandleObj;
-static char *removeHandleName;
static PyObject *addTimeoutObj;
-static char *addTimeoutName;
static PyObject *updateTimeoutObj;
-static char *updateTimeoutName;
static PyObject *removeTimeoutObj;
-static char *removeTimeoutName;
-
-#define NAME(fn) ( fn ## Name ? fn ## Name : # fn )
static int
libvirt_virEventAddHandleFunc(int fd,
@@ -5442,12 +5434,6 @@ libvirt_virEventRegisterImpl(PyObject *self ATTRIBUTE_UNUSED,
Py_XDECREF(addTimeoutObj);
Py_XDECREF(updateTimeoutObj);
Py_XDECREF(removeTimeoutObj);
- VIR_FREE(addHandleName);
- VIR_FREE(updateHandleName);
- VIR_FREE(removeHandleName);
- VIR_FREE(addTimeoutName);
- VIR_FREE(updateTimeoutName);
- VIR_FREE(removeTimeoutName);
/* Parse and check arguments */
if (!PyArg_ParseTuple(args, (char *) "OOOOOO:virEventRegisterImpl",
@@ -5462,14 +5448,6 @@ libvirt_virEventRegisterImpl(PyObject *self ATTRIBUTE_UNUSED,
!PyCallable_Check(removeTimeoutObj))
return NULL;
- /* Get argument string representations (for error reporting) */
- addHandleName = py_str(addHandleObj);
- updateHandleName = py_str(updateHandleObj);
- removeHandleName = py_str(removeHandleObj);
- addTimeoutName = py_str(addTimeoutObj);
- updateTimeoutName = py_str(updateTimeoutObj);
- removeTimeoutName = py_str(removeTimeoutObj);
-
/* Inc refs since we're holding on to these objects until
* the next call (if any) to this function.
*/
--
2.13.5
7 years, 1 month
[libvirt] [PATCH python] Report an error if registering an event loop twice
by Daniel P. Berrange
The C library will now ignore an attempt to register an event
loop twice. It is unable to report an error in this case though
due to the C API returning 'void'. To improve this we must
manually report an error at the python level.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-override.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index a3a0508..9eba4ed 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -5427,13 +5427,12 @@ static PyObject *
libvirt_virEventRegisterImpl(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
{
- /* Unref the previously-registered impl (if any) */
- Py_XDECREF(addHandleObj);
- Py_XDECREF(updateHandleObj);
- Py_XDECREF(removeHandleObj);
- Py_XDECREF(addTimeoutObj);
- Py_XDECREF(updateTimeoutObj);
- Py_XDECREF(removeTimeoutObj);
+ if (addHandleObj || updateHandleObj || removeHandleObj ||
+ addTimeoutObj || updateTimeoutObj || removeTimeoutObj) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Event loop is already registered");
+ return NULL;
+ }
/* Parse and check arguments */
if (!PyArg_ParseTuple(args, (char *) "OOOOOO:virEventRegisterImpl",
--
2.13.5
7 years, 1 month
[libvirt] [PATCH] maint: Fix incorrect parenthesis placement causing true/false assignment
by Erik Skultety
There were a few places in our code where the following pattern in 'if'
condition occurred:
if ((foo = bar() < 0))
do something;
This patch adjusts the conditions to the expected format:
if ((foo = bar()) < 0)
do something;
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1488192
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
This can be especially "fun" if you try to assign multiple RNG devices to a
domain and then try to hot-unplug any of them but the first. Anyhow I used the
regex below to find these, I haven't spent much time tuning in, so in case
you can come up with a better one that yields more results like these I'm all
ears :).
[[:alnum:]_]+ = [[:print:]]+[^)]) < 0))
daemon/admin.c | 2 +-
src/locking/lock_daemon.c | 2 +-
src/locking/lock_driver_sanlock.c | 2 +-
src/qemu/qemu_hotplug.c | 2 +-
tests/virnettlshelpers.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/daemon/admin.c b/daemon/admin.c
index c5678bb99..baf310c7b 100644
--- a/daemon/admin.c
+++ b/daemon/admin.c
@@ -446,7 +446,7 @@ adminDispatchConnectGetLoggingOutputs(virNetServerPtr server ATTRIBUTE_UNUSED,
char *outputs = NULL;
int noutputs = 0;
- if ((noutputs = adminConnectGetLoggingOutputs(&outputs, args->flags) < 0)) {
+ if ((noutputs = adminConnectGetLoggingOutputs(&outputs, args->flags)) < 0) {
virNetMessageSaveError(rerr);
return -1;
}
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 6fbbf4b3d..fe3eaf903 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -1310,7 +1310,7 @@ int main(int argc, char **argv) {
}
srv = virNetDaemonGetServer(lockDaemon->dmn, "virtlockd");
- if ((rv = virLockDaemonSetupNetworkingSystemD(srv) < 0)) {
+ if ((rv = virLockDaemonSetupNetworkingSystemD(srv)) < 0) {
ret = VIR_LOCK_DAEMON_ERR_NETWORK;
goto cleanup;
}
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index b5e69c472..7513df4d7 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -313,7 +313,7 @@ virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver)
goto error_unlink;
}
- if ((rv = virLockManagerSanlockInitLockspace(driver, &ls) < 0)) {
+ if ((rv = virLockManagerSanlockInitLockspace(driver, &ls)) < 0) {
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 9611df517..b365078ec 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5270,7 +5270,7 @@ qemuDomainDetachRNGDevice(virQEMUDriverPtr driver,
int rc;
int ret = -1;
- if ((idx = virDomainRNGFind(vm->def, rng) < 0)) {
+ if ((idx = virDomainRNGFind(vm->def, rng)) < 0) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("device not present in domain configuration"));
return -1;
diff --git a/tests/virnettlshelpers.c b/tests/virnettlshelpers.c
index b735c4e2f..f66205ef7 100644
--- a/tests/virnettlshelpers.c
+++ b/tests/virnettlshelpers.c
@@ -424,7 +424,7 @@ void testTLSWriteCertChain(const char *filename,
for (i = 0; i < ncerts; i++) {
size = sizeof(buffer);
- if ((err = gnutls_x509_crt_export(certs[i], GNUTLS_X509_FMT_PEM, buffer, &size) < 0)) {
+ if ((err = gnutls_x509_crt_export(certs[i], GNUTLS_X509_FMT_PEM, buffer, &size)) < 0) {
VIR_WARN("Failed to export certificate %s", gnutls_strerror(err));
unlink(filename);
abort();
--
2.13.3
7 years, 1 month
[libvirt] [PATCH] Makefile.nonreentrant: Rebuild against Fedora 26
by Andrea Bolognani
According to the comments in the file and the git history, the
list of forbidden symbols was originally built against Fedora 9
in 2009 (!) and pretty much never refreshed afterwards.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
I didn't put too much thought into this, but the results looks
sane enough as we are only *adding* to the list.
Makefile.nonreentrant | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile.nonreentrant b/Makefile.nonreentrant
index 5cc64c0d5..a83298322 100644
--- a/Makefile.nonreentrant
+++ b/Makefile.nonreentrant
@@ -15,9 +15,9 @@
## <http://www.gnu.org/licenses/>.
#
-# Generated by running the following on Fedora 9:
+# Generated by running the following on Fedora 26:
#
-# nm -D --defined-only /lib/libc.so.6 \
+# nm -D --defined-only /lib64/libc.so.6 \
# | grep '_r$' \
# | awk '{print $3}' \
# | grep -v __ \
@@ -43,6 +43,7 @@ NON_REENTRANT += ether_ntoa
NON_REENTRANT += fcvt
NON_REENTRANT += fgetgrent
NON_REENTRANT += fgetpwent
+NON_REENTRANT += fgetsgent
NON_REENTRANT += fgetspent
NON_REENTRANT += getaliasbyname
NON_REENTRANT += getaliasent
@@ -72,6 +73,8 @@ NON_REENTRANT += getrpcent
NON_REENTRANT += getservbyname
NON_REENTRANT += getservbyport
NON_REENTRANT += getservent
+NON_REENTRANT += getsgent
+NON_REENTRANT += getsgnam
NON_REENTRANT += getspent
NON_REENTRANT += getspnam
NON_REENTRANT += getutent
@@ -95,6 +98,7 @@ NON_REENTRANT += random
NON_REENTRANT += rand
NON_REENTRANT += seed48
NON_REENTRANT += setstate
+NON_REENTRANT += sgetsgent
NON_REENTRANT += sgetspent
NON_REENTRANT += srand48
NON_REENTRANT += srandom
--
2.13.5
7 years, 1 month
[libvirt] [PATCH] docs: Fix typo deamon -> daemon
by Andrea Bolognani
Suggested-by: Martin Kletzander <mkletzan(a)redhat.com>
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
I would push this as trivial, but I feel like someone might not be
okay with touching the release notes for libvirt versions that are
already out. I think in this case it's perfectly justified, but if
you disagree this is your chance to point it out :)
docs/internals/rpc.html.in | 2 +-
docs/news.xml | 2 +-
src/libxl/libxl.conf | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/internals/rpc.html.in b/docs/internals/rpc.html.in
index 45c07cb61..fca9cb784 100644
--- a/docs/internals/rpc.html.in
+++ b/docs/internals/rpc.html.in
@@ -534,7 +534,7 @@ C <-- |32| 8 | 1 | 3 | 1 | 1 | 0 | .o.oOo | <-- S (reply)
<dt><code>virNetDaemonPtr</code> (virnetdaemon.h)</dt>
<dd>The virNetDaemon APIs are used to manage a daemon process. A
- deamon is a process that might expose one or more servers. It
+ daemon is a process that might expose one or more servers. It
handles most process-related details, network-related should
be part of the underlying server.
</dd>
diff --git a/docs/news.xml b/docs/news.xml
index 452711717..483f9d6d1 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -195,7 +195,7 @@
Fix --verbose option for all daemons
</summary>
<description>
- Since v3.0.0, the option had been ignored by all libvirt deamons
+ Since v3.0.0, the option had been ignored by all libvirt daemons
(<code>libvirtd</code>, <code>virtlogd</code> and
<code>virtlockd</code>); it's now working as intended once again.
</description>
diff --git a/src/libxl/libxl.conf b/src/libxl/libxl.conf
index 5c9bdaac2..264af7cf9 100644
--- a/src/libxl/libxl.conf
+++ b/src/libxl/libxl.conf
@@ -28,7 +28,7 @@
# is sent to the daemon after keepalive_interval seconds of inactivity
# to check if the daemon is still responding; keepalive_count is a
# maximum number of keepalive messages that are allowed to be sent to
-# the deamon without getting any response before the connection is
+# the daemon without getting any response before the connection is
# considered broken. In other words, the connection is automatically
# closed after approximately keepalive_interval * (keepalive_count + 1)
# seconds since the last message was received from the daemon. If
--
2.13.5
7 years, 1 month
[libvirt] [PATCH v2 0/2] dac: relabel spice rendernode
by Cole Robinson
This fixes the last issue preventing qemu:///system spice GL from working
out of the box: chown'ing the rendernode path so we have permissions
to open it.
We skip this if mount namespaces are disabled, so the chown'ing won't
interfere with other rendernode users on the host.
https://bugzilla.redhat.com/show_bug.cgi?id=1460804
v2:
Add the MOUNT_NAMESPACE handling
Drop DAC restore of rendernode
Cole Robinson (2):
security: add MANAGER_MOUNT_NAMESPACE flag
security: dac: relabel spice rendernode
src/qemu/qemu_driver.c | 2 ++
src/security/security_dac.c | 68 +++++++++++++++++++++++++++++++++++++++++
src/security/security_dac.h | 3 ++
src/security/security_manager.c | 4 ++-
src/security/security_manager.h | 1 +
5 files changed, 77 insertions(+), 1 deletion(-)
--
2.13.5
7 years, 1 month
[libvirt] [PATCH] Add libxslt as build requires for mingw RPMs
by Daniel P. Berrange
The libxslt package is needed since:
commit 94d2d6429d686c5af95115d09c01f3c6bd5ea7c6
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Wed Jul 26 17:40:44 2017 +0100
docs: make xmllint & xsltproc compulsory
The native RPM had it already, but mingw build was missing it.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushed as a build breaker & trivial fix
mingw-libvirt.spec.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index 6b0ce0bf5..dc18d055b 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -60,6 +60,7 @@ BuildRequires: mingw64-dlfcn
BuildRequires: pkgconfig
# Need native version for msgfmt
BuildRequires: gettext
+BuildRequires: libxslt
BuildRequires: python
%if 0%{?fedora} >= 27
BuildRequires: perl-interpreter
--
2.13.5
7 years, 1 month
[libvirt] Availability of libvirt 3.7.0
by Daniel Veillard
I pushed the final version earlier today, it is tagged in git and
I made available sigend tarball and rpms at the usual place:
ftp://libvirt.org/libvirt/
I also rolled out the 3.7.0 version of libvirt-python bindings, those are
available from:
ftp://libvirt.org/libvirt/python/
This is a balanced release with new features available from virsh command
line and API, as well a general improvements and a fair amount of bug fixes:
* New features
- qemu: Add managedsave-edit commands
Using managedsave-dumpxml, managedsave-define and managedsave-edit
commands, now we can dump and edit the XML configuration of domain
which has managedsave image.
- qemu: Add migrate-getmaxdowntime command
Currently, the maximum tolerable downtime for a domain being migrated
is write-only from libvirt, via migrate-setmaxdowntime. This implements
a complementary migrate-getmaxdowntime command
- bhyve: Support autoport for VNC ports
It's no longer necessary to explicitly specify VNC port for the bhyve
guests. With the autoport feature it will be allocated automatically.
Please refer to the bhyve driver documentation for examples.
- qemu: Added support for setting heads of virtio GPU
- qemu: Added support to configure reconnect timeout for chardev devices
When you have a TCP or UNIX chardev device and it's connected somewhere
you can configure reconnect timeout if the connection is closed.
* Improvements
- qemu: Report a clear error when dropping a VM during startup
"Failed to load config for domain 'DOMNAME'" is now reported if a VM
config can't be parsed for some reason, and thus provides a clear
indication for users (and devs).
- apparmor: Update for QEMU 2.10 compatibility
Starting with QEMU 2.10, disk images and NVRAM files get automatically
locked to prevent them from being corrupted; however, file locking
needs to be explicitly allowed through virt-aa-helper or AppArmor will
reject the requests and the guest will not be able to run.
- virsh: List Unix sockets in 'domdisplay' output
VNC and SPICE graphics can use Unix sockets instead of TCP/IP sockets
as connection endpoints, but such a configuration was not handled
correctly by virsh domdisplay, causing the respective endpoints to be
missing from the output.
- qemu: Don't check whether offline migration is safe
Since offline migration only copies the guest definition to the
destination host, data corruption is not a concern and the operation
can always be performed safely.
- virt-host-validate: Fix IOMMU detection on ppc64
* Bug fixes
- qemu: Better support for international domain names (with wide
characters)
There were some issues with multi-byte domains getting lost on daemon
restart due to truncation, so the code now handles multi-byte names a
bit better.
- qemu: Support long domain names with namespaces
Domains with extremely long names would fail to start due to temporary
namespace paths being created with the whole name. The path is now
generated with shortened name instead.
- qemu: Tolerate missing emulator binary during libvirtd restart
For some time libvirt required qemu capabilities being present when
parsing VM configs during startup. As a side effect VM configs would
fail to parse and thus vanish, if the emulator binary would be
uninstalled or broken. Libvirt now tolerates when capabilities are
missing during startup.
- qemu: Prevent pSeries guests from disappearing in some situations
pSeries guest would disappear if any of the host devices they were
configured to use was not available during libvirtd startup, which
could easily happen for SR-IOV Virtual Functions. This scenario is now
handled correctly.
- qemu: Honor <on_reboot/> setting
The setting was accepted by the parser, but not actually implemented.
- Fix --verbose option for all daemons
Since v3.0.0, the option had been ignored by all libvirt deamons
(libvirtd, virtlogd and virtlockd); it's now working as intended once
again.
Thanks everybody for your help with this release, be it with code, patches,
review, documentation, but reports, etc ...
Enjoy this release !
Daniel
--
Daniel Veillard | Red Hat Developers Tools http://developer.redhat.com/
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
7 years, 1 month
[libvirt] [PATCH] event: ignore attempts to replace the event loop impl
by Daniel P. Berrange
Although not previously explicitly documented, the expectation for
the libvirt event loop is that an implementation is registered early
in application startup, before calling any libvirt APIs and then
run forever after. Replacing a previously registered event loop is
not safe & subject to races even if virConnectClose has been called
on open handles, due to delayed deregistration of callbacks during
conenction close.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util/virevent.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/util/virevent.c b/src/util/virevent.c
index e0fd35e41..51d8714df 100644
--- a/src/util/virevent.c
+++ b/src/util/virevent.c
@@ -220,6 +220,13 @@ virEventRemoveTimeout(int timer)
* existing event loop implementation, then the
* virEventRegisterDefaultImpl() method can be used to setup
* the generic libvirt implementation.
+ *
+ * Once registered, the event loop implementation cannot be
+ * changed, and must be run continuously. Note that callbacks
+ * may remain registered for a short time even after calling
+ * virConnectClose on all open connections, so it is not safe
+ * to stop running the event loop immediately after closing
+ * the connection.
*/
void virEventRegisterImpl(virEventAddHandleFunc addHandle,
virEventUpdateHandleFunc updateHandle,
@@ -233,6 +240,12 @@ void virEventRegisterImpl(virEventAddHandleFunc addHandle,
addHandle, updateHandle, removeHandle,
addTimeout, updateTimeout, removeTimeout);
+ if (addHandleImpl || updateHandleImpl || removeHandleImpl ||
+ addTimeoutImpl || updateTimeoutImpl || removeHandleImpl) {
+ VIR_WARN("Ignoring attempt to replace registered event loop");
+ return;
+ }
+
addHandleImpl = addHandle;
updateHandleImpl = updateHandle;
removeHandleImpl = removeHandle;
--
2.13.5
7 years, 1 month