[libvirt] [PATCH] virNetSocketNewConnectUNIX: Use flocks when spawning a daemon
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1200149
Even though we have a mutex mechanism so that two clients don't spawn
two daemons, it's not strong enough. It can happen that while one
client is spawning the daemon, the other one fails to connect.
Basically two possible errors can happen:
error: Failed to connect socket to '/home/mprivozn/.cache/libvirt/libvirt-sock': Connection refused
or:
error: Failed to connect socket to '/home/mprivozn/.cache/libvirt/libvirt-sock': No such file or directory
The problem in both cases is, the daemon is only starting up, while we
are trying to connect (and fail). We should postpone the connecting
phase until the daemon is started (by the other thread that is
spawning it). In order to do that, create a file lock 'libvirt-lock'
in the directory where session daemon would create its socket. So even
when called from multiple processes, spawning a daemon will serialize
on the file lock. So only the first to come will spawn the daemon.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
-hopefully this one is race free
src/rpc/virnetsocket.c | 148 ++++++++++++-------------------------------------
1 file changed, 36 insertions(+), 112 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 6b019cc..2b891ae 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -123,7 +123,7 @@ VIR_ONCE_GLOBAL_INIT(virNetSocket)
#ifndef WIN32
-static int virNetSocketForkDaemon(const char *binary, int passfd)
+static int virNetSocketForkDaemon(const char *binary)
{
int ret;
virCommandPtr cmd = virCommandNewArgList(binary,
@@ -136,10 +136,6 @@ static int virNetSocketForkDaemon(const char *binary, int passfd)
virCommandAddEnvPassBlockSUID(cmd, "XDG_RUNTIME_DIR", NULL);
virCommandClearCaps(cmd);
virCommandDaemonize(cmd);
- if (passfd) {
- virCommandPassFD(cmd, passfd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);
- virCommandPassListenFDs(cmd);
- }
ret = virCommandRun(cmd, NULL);
virCommandFree(cmd);
return ret;
@@ -543,10 +539,10 @@ int virNetSocketNewConnectUNIX(const char *path,
const char *binary,
virNetSocketPtr *retsock)
{
- char *binname = NULL;
- char *pidpath = NULL;
- int fd, passfd = -1;
- int pidfd = -1;
+ char *lockpath = NULL;
+ int lockfd = -1;
+ int fd = -1;
+ int retries = 100;
virSocketAddr localAddr;
virSocketAddr remoteAddr;
@@ -561,6 +557,22 @@ int virNetSocketNewConnectUNIX(const char *path,
return -1;
}
+ if (spawnDaemon) {
+ if (virPidFileConstructPath(false, NULL, "libvirt-lock", &lockpath) < 0)
+ goto error;
+
+ if ((lockfd = open(lockpath, O_RDWR | O_CREAT, 0600)) < 0 ||
+ virSetCloseExec(lockfd) < 0) {
+ virReportSystemError(errno, _("Unable to create lock '%s'"), lockpath);
+ goto error;
+ }
+
+ if (virFileLock(lockfd, false, 0, 1, true) < 0) {
+ virReportSystemError(errno, _("Unable to lock '%s'"), lockpath);
+ goto error;
+ }
+ }
+
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
virReportSystemError(errno, "%s", _("Failed to create socket"));
goto error;
@@ -574,108 +586,25 @@ int virNetSocketNewConnectUNIX(const char *path,
if (remoteAddr.data.un.sun_path[0] == '@')
remoteAddr.data.un.sun_path[0] = '\0';
- retry:
- if (connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
- int status = 0;
- pid_t pid = 0;
-
- if (!spawnDaemon) {
+ while (retries &&
+ connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
+ if (!(spawnDaemon && errno == ENOENT)) {
virReportSystemError(errno, _("Failed to connect socket to '%s'"),
path);
goto error;
}
- if (!(binname = last_component(binary)) || binname[0] == '\0') {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Cannot determine basename for binary '%s'"),
- binary);
- goto error;
- }
-
- if (virPidFileConstructPath(false, NULL, binname, &pidpath) < 0)
- goto error;
-
- pidfd = virPidFileAcquirePath(pidpath, false, getpid());
- if (pidfd < 0) {
- /*
- * This can happen in a very rare case of two clients spawning two
- * daemons at the same time, and the error in the logs that gets
- * reset here can be a clue to some future debugging.
- */
- virResetLastError();
- spawnDaemon = false;
- goto retry;
- }
-
- if ((passfd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- virReportSystemError(errno, "%s", _("Failed to create socket"));
+ if (virNetSocketForkDaemon(binary) < 0)
goto error;
- }
- /*
- * We already even acquired the pidfile, so no one else should be using
- * @path right now. So we're OK to unlink it and paying attention to
- * the return value makes no real sense here. Only if it's not an
- * abstract socket, of course.
- */
- if (path[0] != '@')
- unlink(path);
-
- /*
- * We have to fork() here, because umask() is set per-process, chmod()
- * is racy and fchmod() has undefined behaviour on sockets according to
- * POSIX, so it doesn't work outside Linux.
- */
- if ((pid = virFork()) < 0)
- goto error;
-
- if (pid == 0) {
- umask(0077);
- if (bind(passfd, &remoteAddr.data.sa, remoteAddr.len) < 0)
- _exit(EXIT_FAILURE);
-
- _exit(EXIT_SUCCESS);
- }
+ retries--;
+ usleep(5000);
+ }
- if (virProcessWait(pid, &status, false) < 0)
- goto error;
-
- if (status != EXIT_SUCCESS) {
- /*
- * OK, so the child failed to bind() the socket. This may mean that
- * another daemon was starting at the same time and succeeded with
- * its bind() (even though it should not happen because we using a
- * pidfile for the race). So we'll try connecting again, but this
- * time without spawning the daemon.
- */
- spawnDaemon = false;
- virPidFileDeletePath(pidpath);
- VIR_FORCE_CLOSE(pidfd);
- VIR_FORCE_CLOSE(passfd);
- goto retry;
- }
-
- if (listen(passfd, 0) < 0) {
- virReportSystemError(errno, "%s",
- _("Failed to listen on socket that's about "
- "to be passed to the daemon"));
- goto error;
- }
-
- if (connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
- virReportSystemError(errno, _("Failed to connect socket to '%s'"),
- path);
- goto error;
- }
-
- /*
- * Do we need to eliminate the super-rare race here any more? It would
- * need incorporating the following VIR_FORCE_CLOSE() into a
- * virCommandHook inside a virNetSocketForkDaemon().
- */
- VIR_FORCE_CLOSE(pidfd);
- if (virNetSocketForkDaemon(binary, passfd) < 0)
- goto error;
+ if (lockfd) {
+ unlink(lockpath);
+ VIR_FORCE_CLOSE(lockfd);
+ VIR_FREE(lockpath);
}
localAddr.len = sizeof(localAddr.data);
@@ -687,19 +616,14 @@ int virNetSocketNewConnectUNIX(const char *path,
if (!(*retsock = virNetSocketNew(&localAddr, &remoteAddr, true, fd, -1, 0)))
goto error;
- VIR_FREE(pidpath);
-
return 0;
error:
- if (pidfd >= 0)
- virPidFileDeletePath(pidpath);
- VIR_FREE(pidpath);
+ if (lockfd)
+ unlink(lockpath);
+ VIR_FREE(lockpath);
VIR_FORCE_CLOSE(fd);
- VIR_FORCE_CLOSE(passfd);
- VIR_FORCE_CLOSE(pidfd);
- if (spawnDaemon)
- unlink(path);
+ VIR_FORCE_CLOSE(lockfd);
return -1;
}
#else
--
2.0.5
9 years, 8 months
[libvirt] [PATCH 0/2] Couple of virnetdevtest cleanups
by Michal Privoznik
*** BLURB HERE ***
Michal Privoznik (2):
tests: Add virnetdevtestdata to EXTRA_DIST
Cleanup "/sys/class/net" usage
src/Makefile.am | 4 ++--
src/parallels/parallels_network.c | 3 +--
src/util/virnetdev.c | 5 ++---
src/util/virnetdev.h | 2 ++
src/util/virnetdevbridge.c | 1 -
src/util/virnetdevmacvlan.c | 28 ++++++++++++++--------------
tests/Makefile.am | 1 +
7 files changed, 22 insertions(+), 22 deletions(-)
--
2.0.5
9 years, 8 months
[libvirt] [PATCH v2] Link libvirt_util with datatypes
by Martin Kletzander
Most of the types in datatypes.[hc] depend on virObject and virClass,
but they were specified separatedly from that. We were lucky enough for
this to work because wherever the datatypes files were used, that
file (binary/shared object) was linked to libvirt_util as well.
Fixing this comes up as a pretty nice cleanup.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/Makefile.am | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 91a4c17..84f489f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-## Copyright (C) 2005-2014 Red Hat, Inc.
+## Copyright (C) 2005-2015 Red Hat, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
@@ -86,9 +86,12 @@ augeas_DATA =
augeastestdir = $(datadir)/augeas/lenses/tests
augeastest_DATA =
+DATATYPES_SOURCES = datatypes.h datatypes.c
+
# These files are not related to driver APIs. Simply generic
# helper APIs for various purposes
UTIL_SOURCES = \
+ $(DATATYPES_SOURCES) \
util/viralloc.c util/viralloc.h \
util/virarch.h util/virarch.c \
util/viratomic.h util/viratomic.c \
@@ -185,7 +188,6 @@ util/virkeymaps.h: $(srcdir)/util/keymaps.csv \
# Internal generic driver infrastructure
NODE_INFO_SOURCES = nodeinfo.h nodeinfo.c nodeinfopriv.h
-DATATYPES_SOURCES = datatypes.h datatypes.c
DRIVER_SOURCES = \
driver.c driver.h \
driver-hypervisor.h \
@@ -198,7 +200,6 @@ DRIVER_SOURCES = \
driver-storage.h \
driver-stream.h \
internal.h \
- $(DATATYPES_SOURCES) \
fdstream.c fdstream.h \
$(NODE_INFO_SOURCES) \
libvirt.c libvirt_internal.h \
@@ -671,10 +672,6 @@ LXC_CONTROLLER_SOURCES = \
lxc/lxc_fuse.c lxc/lxc_fuse.h \
lxc/lxc_controller.c
-SECURITY_DRIVER_APPARMOR_HELPER_SOURCES = \
- $(DATATYPES_SOURCES) \
- security/virt-aa-helper.c
-
PHYP_DRIVER_SOURCES = \
phyp/phyp_driver.c phyp/phyp_driver.h
@@ -2604,8 +2601,7 @@ libexec_PROGRAMS += libvirt_lxc
libvirt_lxc_SOURCES = \
$(LXC_CONTROLLER_SOURCES) \
- $(NODE_INFO_SOURCES) \
- $(DATATYPES_SOURCES)
+ $(NODE_INFO_SOURCES)
libvirt_lxc_LDFLAGS = \
$(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
@@ -2643,7 +2639,7 @@ if WITH_SECDRIVER_APPARMOR
if WITH_LIBVIRTD
libexec_PROGRAMS += virt-aa-helper
-virt_aa_helper_SOURCES = $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)
+virt_aa_helper_SOURCES = security/virt-aa-helper.c
virt_aa_helper_LDFLAGS = \
$(AM_LDFLAGS) \
@@ -2666,7 +2662,7 @@ virt_aa_helper_CFLAGS = \
$(NULL)
endif WITH_LIBVIRTD
endif WITH_SECDRIVER_APPARMOR
-EXTRA_DIST += $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)
+EXTRA_DIST += security/virt-aa-helper.c
install-data-local: install-init install-systemd
if WITH_LIBVIRTD
--
2.3.5
9 years, 8 months
[libvirt] [PATCH] tests: Resolve Coverity RESOURCE_LEAK
by John Ferlan
Commit id 'b77ce18a2' added a new bitmap, but neglected to virBitmapFree it
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tests/virbitmaptest.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c
index 9a84e4c..a6e9a38 100644
--- a/tests/virbitmaptest.c
+++ b/tests/virbitmaptest.c
@@ -548,6 +548,7 @@ test10(const void *opaque ATTRIBUTE_UNUSED)
virBitmapFree(b1);
virBitmapFree(b2);
virBitmapFree(b3);
+ virBitmapFree(b4);
return ret;
}
--
2.1.0
9 years, 8 months
[libvirt] [PATCH] virsh: fix regression in 'virsh event' by domain
by Eric Blake
Commit a0670ae caused a regression in 'virsh event' and
'virsh qemu-monitor-event' - if a user tries to filter the
command to a specific domain, an error message is printed:
$ virsh event dom --loop
error: internal error: virsh qemu-monitor-event: no domain VSH_OT_DATA option
and then the command continues as though no domain had been
supplied (giving events for ALL domains, instead of the
requested one). This is because the code was incorrectly
assuming that all "domain" options would be supplied via a
mandatory VSH_OT_DATA, even though "domain" is optional for
these two commands, so we had changed them to VSH_OT_STRING
to quit failing for other reasons (ever since it was decided
that VSH_OT_DATA and VSH_OT_STRING should no longer be
synonyms).
In looking at the situation, though, the code for looking up
a domain was making a pointless check for whether the option
exists prior to finding the option's string value, as
vshCommandOptStringReq does just fine at reporting any errors
when looking up a string whether or not the option was present.
So this is a case of regression fixing by pure code deletion :)
* tools/virsh-domain.c (vshCommandOptDomainBy): Drop useless filter.
* tools/virsh-interface.c (vshCommandOptInterfaceBy): Likewise.
* tools/virsh-network.c (vshCommandOptNetworkBy): Likewise.
* tools/virsh-nwfilter.c (vshCommandOptNWFilterBy): Likewise.
* tools/virsh-secret.c (vshCommandOptSecret): Likewise.
* tools/virsh.h (vshCmdHasOption): Drop unused function.
* tools/virsh.c (vshCmdHasOption): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tools/virsh-domain.c | 3 ---
tools/virsh-interface.c | 2 --
tools/virsh-network.c | 3 ---
tools/virsh-nwfilter.c | 5 +----
tools/virsh-secret.c | 5 +----
tools/virsh.c | 23 -----------------------
tools/virsh.h | 2 --
7 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index bc6054a..2fe3924 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -119,9 +119,6 @@ vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd,
const char *n = NULL;
const char *optname = "domain";
- if (!vshCmdHasOption(ctl, cmd, optname))
- return NULL;
-
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
return NULL;
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 3251e01..b9c60c5 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -53,8 +53,6 @@ vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
if (!optname)
optname = "interface";
- if (!vshCmdHasOption(ctl, cmd, optname))
- return NULL;
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
return NULL;
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 09ee11a..b859b49 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -42,9 +42,6 @@ vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
const char *optname = "network";
virCheckFlags(VSH_BYUUID | VSH_BYNAME, NULL);
- if (!vshCmdHasOption(ctl, cmd, optname))
- return NULL;
-
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
return NULL;
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index e6bef08..63c1c7e 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -1,7 +1,7 @@
/*
* virsh-nwfilter.c: Commands to manage network filters
*
- * Copyright (C) 2005, 2007-2014 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -41,9 +41,6 @@ vshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd,
const char *optname = "nwfilter";
virCheckFlags(VSH_BYUUID | VSH_BYNAME, NULL);
- if (!vshCmdHasOption(ctl, cmd, optname))
- return NULL;
-
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
return NULL;
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 5065c6f..c6ceabd 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -1,7 +1,7 @@
/*
* virsh-secret.c: Commands to manage secret
*
- * Copyright (C) 2005, 2007-2014 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -41,9 +41,6 @@ vshCommandOptSecret(vshControl *ctl, const vshCmd *cmd, const char **name)
const char *n = NULL;
const char *optname = "secret";
- if (!vshCmdHasOption(ctl, cmd, optname))
- return NULL;
-
if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
return NULL;
diff --git a/tools/virsh.c b/tools/virsh.c
index 889a561..4425774 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1860,29 +1860,6 @@ vshCommandOptArgv(const vshCmd *cmd, const vshCmdOpt *opt)
return NULL;
}
-/* Determine whether CMD->opts includes an option with name OPTNAME.
- If not, give a diagnostic and return false.
- If so, return true. */
-bool
-vshCmdHasOption(vshControl *ctl, const vshCmd *cmd, const char *optname)
-{
- /* Iterate through cmd->opts, to ensure that there is an entry
- with name OPTNAME and type VSH_OT_DATA. */
- bool found = false;
- const vshCmdOpt *opt;
- for (opt = cmd->opts; opt; opt = opt->next) {
- if (STREQ(opt->def->name, optname) && opt->def->type == VSH_OT_DATA) {
- found = true;
- break;
- }
- }
-
- if (!found)
- vshError(ctl, _("internal error: virsh %s: no %s VSH_OT_DATA option"),
- cmd->def->name, optname);
- return found;
-}
-
/* Parse an optional --timeout parameter in seconds, but store the
* value of the timeout in milliseconds. Return -1 on error, 0 if
* no timeout was requested, and 1 if timeout was set. */
diff --git a/tools/virsh.h b/tools/virsh.h
index e89d315..44a5cd8 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -316,8 +316,6 @@ int vshCommandOptScaledInt(const vshCmd *cmd, const char *name,
bool vshCommandOptBool(const vshCmd *cmd, const char *name);
const vshCmdOpt *vshCommandOptArgv(const vshCmd *cmd,
const vshCmdOpt *opt);
-bool vshCmdHasOption(vshControl *ctl, const vshCmd *cmd, const char *optname);
-
int vshCommandOptTimeoutToMs(vshControl *ctl, const vshCmd *cmd, int *timeout);
/* Filter flags for various vshCommandOpt*By() functions */
--
2.1.0
9 years, 8 months
[libvirt] [PATCH] node: udev: Remove some redundant error reports
by Peter Krempa
All the called functions already report an error.
---
src/node_device/node_device_udev.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 8c39e5f..1025e80 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -128,9 +128,6 @@ static int udevGetDeviceProperty(struct udev_device *udev_device,
/* If this allocation is changed, the comment at the beginning
* of the function must also be changed. */
if (VIR_STRDUP(*property_value, udev_value) < 0) {
- VIR_ERROR(_("Failed to allocate memory for property value for "
- "property key '%s' on device with sysname '%s'"),
- property_key, udev_device_get_sysname(udev_device));
ret = PROPERTY_ERROR;
goto out;
}
@@ -213,9 +210,6 @@ static int udevGetDeviceSysfsAttr(struct udev_device *udev_device,
/* If this allocation is changed, the comment at the beginning
* of the function must also be changed. */
if (VIR_STRDUP(*attr_value, udev_value) < 0) {
- VIR_ERROR(_("Failed to allocate memory for sysfs attribute value for "
- "sysfs attribute '%s' on device with sysname '%s'"),
- attr_name, udev_device_get_sysname(udev_device));
ret = PROPERTY_ERROR;
goto out;
}
@@ -1428,11 +1422,8 @@ static int udevAddOneDevice(struct udev_device *device)
/* If this is a device change, the old definition will be freed
* and the current definition will take its place. */
dev = virNodeDeviceAssignDef(&driver->devs, def);
-
- if (dev == NULL) {
- VIR_ERROR(_("Failed to create device for '%s'"), def->name);
+ if (dev == NULL)
goto out;
- }
virNodeDeviceObjUnlock(dev);
@@ -1686,10 +1677,8 @@ static int udevSetupSystemDev(void)
#endif
dev = virNodeDeviceAssignDef(&driver->devs, def);
- if (dev == NULL) {
- VIR_ERROR(_("Failed to create device for '%s'"), def->name);
+ if (dev == NULL)
goto out;
- }
virNodeDeviceObjUnlock(dev);
--
2.3.5
9 years, 8 months
[libvirt] [PATCH] virPidFileConstructPath: Drop useless VIR_FREE()
by Michal Privoznik
If a virAsprintf() within the function fails, we call VIR_FREE()
over @rundir variable and jump onto cleanup label, where it is
freed again. It doesn't hurt, but not make much sense too.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed as trivial.
src/util/virpidfile.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index a77a326..8144ff9 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -556,11 +556,8 @@ virPidFileConstructPath(bool privileged,
goto cleanup;
}
- if (virAsprintf(pidfile, "%s/%s.pid", rundir, progname) < 0) {
- VIR_FREE(rundir);
+ if (virAsprintf(pidfile, "%s/%s.pid", rundir, progname) < 0)
goto cleanup;
- }
-
}
ret = 0;
--
2.0.5
9 years, 8 months
[libvirt] [PATCHv2 0/7] Fix checking of NULL monitor and clean up code
by Peter Krempa
This is a v2 to https://www.redhat.com/archives/libvir-list/2015-April/msg00416.html
This fixes all commands and cleans up the code in the process.
Peter Krempa (7):
qemu: monitor: Clean up coding style
qemu: monitor: Sanitize control flow in qemuMonitorSetCapabilities
qemu: monitor: Ensure that qemuMonitorSetLink is called with non-null
name
qemu: monitor: Don't use 'ret' variable where not necessary
qemu: monitor: @running in qemuMonitorGetStatus is always non-NULL
qemu: monitor: Fix qemuMonitorGetAllBlockStatsInfo with HMP
qemu: monitor: Refactor and fix monitor checking
src/qemu/qemu_monitor.c | 2166 +++++++++++++++++------------------------------
src/qemu/qemu_monitor.h | 24 +-
src/qemu/qemu_process.c | 6 +
3 files changed, 810 insertions(+), 1386 deletions(-)
--
2.3.5
9 years, 8 months
[libvirt] [PATCH] schema: Allow multiple machines for sparc VMs
by Martin Kletzander
Use the same pattern as there is for x86 machines.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
docs/schemas/domaincommon.rng | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 03fd541..80b30df 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -384,7 +384,9 @@
</optional>
<optional>
<attribute name="machine">
- <value>sun4m</value>
+ <data type="string">
+ <param name="pattern">[a-zA-Z0-9_\.\-]+</param>
+ </data>
</attribute>
</optional>
</group>
--
2.3.5
9 years, 8 months