[libvirt] [PATCH 0/7] qemu: block job/disk related cleanups
by Peter Krempa
I've accumulated quite a few patches in my branch to add support for allowing to
use 'detect zeroes' for the block copy job. These are pathches that make sense
to be posted separately.
Peter Krempa (7):
qemu: hotplug: Assume support for -device in qemuDomainAttachSCSIDisk
qemu: monitor: Drop qemuMonitorAttachDrive and leaves in call tree
qemu: monitor: Remove JSON impls of drive_add and drive_del
qemu: Kill qemuDiskPathToAlias
qemu: Split image access revoking from
qemuDomainPrepareDiskChainElement
qemu: Refactor qemuDomainPrepareDiskChainElement
qemu: domain: Move and export
qemuDomainDiskChainElement(Prepare|Revoke)
src/qemu/qemu_alias.c | 16 ++++
src/qemu/qemu_alias.h | 2 +
src/qemu/qemu_domain.c | 81 +++++++++++++++++++
src/qemu/qemu_domain.h | 11 +++
src/qemu/qemu_driver.c | 187 ++++++++++++-------------------------------
src/qemu/qemu_hotplug.c | 63 +++------------
src/qemu/qemu_monitor.c | 35 +++-----
src/qemu/qemu_monitor.h | 6 --
src/qemu/qemu_monitor_json.c | 29 -------
src/qemu/qemu_monitor_json.h | 6 --
src/qemu/qemu_monitor_text.c | 102 +----------------------
src/qemu/qemu_monitor_text.h | 5 --
12 files changed, 187 insertions(+), 356 deletions(-)
--
2.7.3
9 years, 3 months
[libvirt] [PATCH] test: Fix typo in testutils.h header guard
by Christophe Fergeau
This changes __VIT_TEST_UTILS_H__ to __VIR_TEST_UTILS_H__
---
tests/testutils.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/testutils.h b/tests/testutils.h
index 752fa52..058be55 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -20,8 +20,8 @@
* Karel Zak <kzak(a)redhat.com>
*/
-#ifndef __VIT_TEST_UTILS_H__
-# define __VIT_TEST_UTILS_H__
+#ifndef __VIR_TEST_UTILS_H__
+# define __VIR_TEST_UTILS_H__
# include <stdio.h>
# include "viralloc.h"
@@ -145,4 +145,4 @@ int testCompareDomXML2XMLFiles(virCapsPtr caps,
const void *opaque,
unsigned int parseFlags);
-#endif /* __VIT_TEST_UTILS_H__ */
+#endif /* __VIR_TEST_UTILS_H__ */
--
2.5.5
9 years, 3 months
[libvirt] [PATCH] storage/rbd: Use correct printf-modifier for uint64
by Christophe Fergeau
%zu is for size_t variables, not uint64 ones. This causes a warning when building on
a 32 bit linux.
---
src/storage/storage_backend_rbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 7d04b39..d895cc6 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -334,7 +334,7 @@ virStorageBackendRBDSetAllocation(virStorageVolDefPtr vol,
goto cleanup;
}
- VIR_DEBUG("Found %zu bytes allocated for RBD image %s",
+ VIR_DEBUG("Found %llu bytes allocated for RBD image %s",
allocation, vol->name);
vol->target.allocation = allocation;
--
2.5.0
9 years, 3 months
[libvirt] [PATCH] nss: FreeBSD support
by Roman Bogorodskiy
* tools/nss/libvirt_nss.[ch]: add BSD-comptabile wrappers and
register via the nss_module_register() interface
* m4/virt-nss.m4: add checks if we're building NSS for FreeBSD
* tools/Makefile.am: handle target library name differences, as
Linux needs libnss_libvirt.so.2 and FreeBSD needs
nss_libvirt.so.1. Also, different syms files have to be used
as Linux needs to export all the methods while FreeBSD
only needs to have nss_module_register()
* libvirt_nss_bsd.syms: FreeBSD syms file
---
m4/virt-nss.m4 | 12 +++-
tools/Makefile.am | 16 ++++-
tools/nss/libvirt_nss.c | 140 +++++++++++++++++++++++++++++++++++++++--
tools/nss/libvirt_nss.h | 9 +++
tools/nss/libvirt_nss_bsd.syms | 9 +++
5 files changed, 179 insertions(+), 7 deletions(-)
create mode 100644 tools/nss/libvirt_nss_bsd.syms
diff --git a/m4/virt-nss.m4 b/m4/virt-nss.m4
index 3fa4ad3..a8ed8b9 100644
--- a/m4/virt-nss.m4
+++ b/m4/virt-nss.m4
@@ -23,6 +23,7 @@ AC_DEFUN([LIBVIRT_CHECK_NSS],[
[enable Name Servie Switch plugin for resolving guest IP addresses])],
[], [with_nss_plugin=check])
+ bsd_nss=no
fail=0
if test "x$with_nss_plugin" != "xno" ; then
AC_CHECK_HEADERS([nss.h], [
@@ -39,11 +40,20 @@ AC_DEFUN([LIBVIRT_CHECK_NSS],[
if test "x$with_nss_plugin" = "xyes" ; then
AC_DEFINE_UNQUOTED([NSS], 1, [whether nss plugin is enabled])
+
+ AC_CHECK_TYPES([ns_mtab, nss_module_unregister_fn],
+ [AC_DEFINE([HAVE_BSD_NSS],
+ [1],
+ [whether using BSD style NSS])
+ bsd_nss=yes
+ ],
+ [],
+ [#include <nsswitch.h>])
fi
fi
AM_CONDITIONAL(WITH_NSS, [test "x$with_nss_plugin" = "xyes"])
-
+ AM_CONDITIONAL(WITH_BSD_NSS, [test "x$bsd_nss" = "xyes"])
])
AC_DEFUN([LIBVIRT_RESULT_NSS],[
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 4320040..6005b8b 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -417,8 +417,22 @@ CLEANFILES += wireshark/src/plugin.c
endif WITH_WIRESHARK_DISSECTOR
+if WITH_BSD_NSS
+LIBVIRT_NSS_SYMBOL_FILE = \
+ $(srcdir)/nss/libvirt_nss_bsd.syms
+NSS_SO_VER = 1
+
+install-exec-hook:
+ cd $(DESTDIR)$(libdir) && \
+ $(LN_S) libnss_libvirt.so.$(NSS_SO_VER) nss_libvirt.so.$(NSS_SO_VER)
+
+uninstall-local:
+ rm $(DESTDIR)$(libdir)/libnss_libvirt.so.$(NSS_SO_VER)
+else ! WITH_BSD_NSS
LIBVIRT_NSS_SYMBOL_FILE = \
$(srcdir)/nss/libvirt_nss.syms
+NSS_SO_VER = 2
+endif ! WITH_BSD_NSS
LIBVIRT_NSS_SOURCES = \
nss/libvirt_nss.c \
@@ -449,7 +463,7 @@ nss_libnss_libvirt_la_LDFLAGS = \
-export-dynamic \
-avoid-version \
-shared \
- -shrext .so.2
+ -shrext .so.$(NSS_SO_VER)
nss_libnss_libvirt_la_LIBADD = \
nss/libnss_libvirt_impl.la
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 218c62a..0ff1348 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -1,5 +1,4 @@
/*
- * libvirt_nss: Name Service Switch plugin
*
* The aim is to enable users and applications to translate
* domain names into IP addresses. However, this is currently
@@ -29,11 +28,16 @@
#include "libvirt_nss.h"
+#include <netinet/in.h>
#include <resolv.h>
#include <sys/types.h>
#include <dirent.h>
#include <arpa/inet.h>
+#if defined(HAVE_BSD_NSS)
+# include <nsswitch.h>
+#endif
+
#include "virlease.h"
#include "viralloc.h"
#include "virfile.h"
@@ -65,7 +69,7 @@ do { \
#define LEASEDIR LOCALSTATEDIR "/lib/libvirt/dnsmasq/"
-#define ALIGN(x) (((x) + __SIZEOF_POINTER__ - 1) & ~(__SIZEOF_POINTER__ - 1))
+#define LIBVIRT_ALIGN(x) (((x) + __SIZEOF_POINTER__ - 1) & ~(__SIZEOF_POINTER__ - 1))
#define FAMILY_ADDRESS_SIZE(family) ((family) == AF_INET6 ? 16 : 4)
typedef struct {
@@ -256,7 +260,7 @@ static inline void *
move_and_align(void *buf, size_t len, size_t *idx)
{
char *buffer = buf;
- size_t move = ALIGN(len);
+ size_t move = LIBVIRT_ALIGN(len);
if (!idx)
return buffer + move;
@@ -321,7 +325,7 @@ _nss_libvirt_gethostbyname3_r(const char *name, int af, struct hostent *result,
* b) alias
* c) addresses
* d) NULL stem */
- need = ALIGN(nameLen + 1) + naddr * ALIGN(alen) + (naddr + 2) * sizeof(char*);
+ need = LIBVIRT_ALIGN(nameLen + 1) + naddr * LIBVIRT_ALIGN(alen) + (naddr + 2) * sizeof(char*);
if (buflen < need) {
*errnop = ENOMEM;
@@ -383,6 +387,7 @@ _nss_libvirt_gethostbyname3_r(const char *name, int af, struct hostent *result,
return ret;
}
+#ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
enum nss_status
_nss_libvirt_gethostbyname4_r(const char *name, struct gaih_addrtuple **pat,
char *buffer, size_t buflen, int *errnop,
@@ -426,7 +431,7 @@ _nss_libvirt_gethostbyname4_r(const char *name, struct gaih_addrtuple **pat,
/* We need space for:
* a) name
* b) addresses */
- need = ALIGN(nameLen + 1) + naddr * ALIGN(sizeof(struct gaih_addrtuple));
+ need = LIBVIRT_ALIGN(nameLen + 1) + naddr * LIBVIRT_ALIGN(sizeof(struct gaih_addrtuple));
if (buflen < need) {
*errnop = ENOMEM;
@@ -474,3 +479,128 @@ _nss_libvirt_gethostbyname4_r(const char *name, struct gaih_addrtuple **pat,
cleanup:
return ret;
}
+#endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
+
+#if defined(HAVE_BSD_NSS)
+NSS_METHOD_PROTOTYPE(_nss_compat_getaddrinfo);
+NSS_METHOD_PROTOTYPE(_nss_compat_gethostbyname2_r);
+
+ns_mtab methods[] = {
+ { NSDB_HOSTS, "getaddrinfo", _nss_compat_getaddrinfo, NULL },
+ { NSDB_HOSTS, "gethostbyname", _nss_compat_gethostbyname2_r, NULL },
+ { NSDB_HOSTS, "gethostbyname2_r", _nss_compat_gethostbyname2_r, NULL },
+};
+
+static void
+aiforaf(const char *name, int af, struct addrinfo *pai, struct addrinfo **aip)
+{
+ int ret;
+ struct hostent resolved;
+ char buf[1024] = { 0 };
+ int err, herr;
+ struct addrinfo hints, *res0, *res;
+ char **addrList;
+
+ if ((ret = _nss_libvirt_gethostbyname2_r(name, af, &resolved,
+ buf, sizeof(buf),
+ &err, &herr)) != NS_SUCCESS)
+ return;
+
+ addrList = resolved.h_addr_list;
+ while (*addrList) {
+ virSocketAddr sa;
+ char *ipAddr = NULL;
+ void *address = *addrList;
+
+ memset(&sa, 0, sizeof(sa));
+ if (resolved.h_addrtype == AF_INET) {
+ virSocketAddrSetIPv4AddrNetOrder(&sa, *((uint32_t *) address));
+ } else {
+ virSocketAddrSetIPv6AddrNetOrder(&sa, address);
+ }
+
+ ipAddr = virSocketAddrFormat(&sa);
+
+ hints = *pai;
+ hints.ai_flags = AI_NUMERICHOST;
+ hints.ai_family = af;
+
+ if (getaddrinfo(ipAddr, NULL, &hints, &res0)) {
+ addrList++;
+ continue;
+ }
+
+ for (res = res0; res; res = res->ai_next)
+ res->ai_flags = pai->ai_flags;
+
+ (*aip)->ai_next = res0;
+ while ((*aip)->ai_next)
+ *aip = (*aip)->ai_next;
+
+ addrList++;
+ }
+}
+
+int
+_nss_compat_getaddrinfo(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list ap)
+{
+ struct addrinfo sentinel, *cur, *ai;
+ const char *name;
+
+ name = va_arg(ap, char *);
+ ai = va_arg(ap, struct addrinfo *);
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ if ((ai->ai_family == AF_UNSPEC) || (ai->ai_family == AF_INET6))
+ aiforaf(name, AF_INET6, ai, &cur);
+ if ((ai->ai_family == AF_UNSPEC) || (ai->ai_family == AF_INET))
+ aiforaf(name, AF_INET, ai, &cur);
+
+ if (sentinel.ai_next == NULL) {
+ h_errno = HOST_NOT_FOUND;
+ return NS_NOTFOUND;
+ }
+ *((struct addrinfo **)retval) = sentinel.ai_next;
+
+ return NS_SUCCESS;
+}
+
+int
+_nss_compat_gethostbyname2_r(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list ap)
+{
+ int ret;
+
+ const char *name;
+ int af;
+ struct hostent *result;
+ char *buffer;
+ size_t buflen;
+ int *errnop;
+ int *herrnop;
+
+ name = va_arg(ap, const char *);
+ af = va_arg(ap, int);
+ result = va_arg(ap, struct hostent *);
+ buffer = va_arg(ap, char *);
+ buflen = va_arg(ap, size_t);
+ errnop = va_arg(ap, int *);
+ herrnop = va_arg(ap, int *);
+
+ ret = _nss_libvirt_gethostbyname2_r(
+ name, af, result, buffer, buflen, errnop, herrnop);
+ *(struct hostent **)retval = (ret == NS_SUCCESS) ? result : NULL;
+
+ return ret;
+}
+
+ns_mtab*
+nss_module_register(const char *name ATTRIBUTE_UNUSED, unsigned int *size,
+ nss_module_unregister_fn *unregister)
+{
+ *size = sizeof(methods) / sizeof(methods[0]);
+ *unregister = NULL;
+ return methods;
+}
+#endif /* HAVE_BSD_NSS */
diff --git a/tools/nss/libvirt_nss.h b/tools/nss/libvirt_nss.h
index 589c1e6..e025e63 100644
--- a/tools/nss/libvirt_nss.h
+++ b/tools/nss/libvirt_nss.h
@@ -45,8 +45,17 @@ enum nss_status
_nss_libvirt_gethostbyname3_r(const char *name, int af, struct hostent *result,
char *buffer, size_t buflen, int *errnop,
int *herrnop, int32_t *ttlp, char **canonp);
+# ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
enum nss_status
_nss_libvirt_gethostbyname4_r(const char *name, struct gaih_addrtuple **pat,
char *buffer, size_t buflen, int *errnop,
int *herrnop, int32_t *ttlp);
+# endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
+
+# if defined(HAVE_BSD_NSS)
+ns_mtab*
+nss_module_register(const char *name, unsigned int *size,
+ nss_module_unregister_fn *unregister);
+# endif /* HAVE_BSD_NSS */
+
#endif /* __LIBVIRT_NSS_H__ */
diff --git a/tools/nss/libvirt_nss_bsd.syms b/tools/nss/libvirt_nss_bsd.syms
new file mode 100644
index 0000000..7da3926
--- /dev/null
+++ b/tools/nss/libvirt_nss_bsd.syms
@@ -0,0 +1,9 @@
+#
+# Officially exported symbols.
+#
+
+{
+global:
+ nss_module_register;
+local: *;
+};
--
2.4.6
9 years, 3 months
[libvirt] [PATCH] admin_server: Avoid accessing unallocated memory
by Michal Privoznik
In 68b726b93c11cc90 we tried to fix a mem leak. However, it
wasn't done quite well. Problem is, virNetDaemonGetServers() may
fail in which case virObjectListFreeCount() would be called with
-1 objects to free. But the number of elements is taken in
unsigned rather than signed integer.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
daemon/admin_server.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/admin_server.c b/daemon/admin_server.c
index 85cec46..1d30ea5 100644
--- a/daemon/admin_server.c
+++ b/daemon/admin_server.c
@@ -54,7 +54,8 @@ adminConnectListServers(virNetDaemonPtr dmn,
srvs = NULL;
}
cleanup:
- virObjectListFreeCount(srvs, ret);
+ if (ret > 0)
+ virObjectListFreeCount(srvs, ret);
return ret;
}
--
2.7.3
9 years, 3 months
[libvirt] [PATCH] virTestSetEnvPath: Avoid clearing out PATH
by Michal Privoznik
If the abs_builddir path already is in PATH and it's in the first
position, due to a bug in our code PATH would be cleared out.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
tests/testutils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/testutils.c b/tests/testutils.c
index d6cd193..fc4c339 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -822,7 +822,8 @@ virTestSetEnvPath(void)
goto cleanup;
}
- if (setenv("PATH", new_path, 1) < 0)
+ if (new_path &&
+ setenv("PATH", new_path, 1) < 0)
goto cleanup;
ret = 0;
--
2.7.3
9 years, 3 months
[libvirt] [PATCH] admin_server: fix memory leak
by Pavel Hrdina
If caller of adminConnectListServers() pass NULL instead of servers we
need to free the list we've received from virNetDaemonGetServers().
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
daemon/admin_server.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/daemon/admin_server.c b/daemon/admin_server.c
index 1d16bc9..2f26488 100644
--- a/daemon/admin_server.c
+++ b/daemon/admin_server.c
@@ -52,6 +52,8 @@ adminConnectListServers(virNetDaemonPtr dmn,
if (servers) {
*servers = srvs;
srvs = NULL;
+ } else {
+ virObjectListFreeCount(srvs, ret);
}
cleanup:
return ret;
--
2.7.4
9 years, 3 months
[libvirt] [PATCH v2] qemu: Replace some VIR_ERROR with vir*Error
by Jovanka Gulicoska
qemuStateInitialize uses a mix of VIR_ERROR and standard vir*Error
calls. Prefer the standard vir*Error
---
src/qemu/qemu_driver.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e5ed6b5..161a20f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -638,7 +638,6 @@ qemuStateInitialize(bool privileged,
{
char *driverConf = NULL;
virConnectPtr conn = NULL;
- char ebuf[1024];
virQEMUDriverConfigPtr cfg;
uid_t run_uid = -1;
gid_t run_gid = -1;
@@ -649,7 +648,8 @@ qemuStateInitialize(bool privileged,
return -1;
if (virMutexInit(&qemu_driver->lock) < 0) {
- VIR_ERROR(_("cannot initialize mutex"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
VIR_FREE(qemu_driver);
return -1;
}
@@ -682,44 +682,43 @@ qemuStateInitialize(bool privileged,
VIR_FREE(driverConf);
if (virFileMakePath(cfg->stateDir) < 0) {
- VIR_ERROR(_("Failed to create state dir '%s': %s"),
- cfg->stateDir, virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create state dir %s"),
+ cfg->stateDir);
goto error;
}
if (virFileMakePath(cfg->libDir) < 0) {
- VIR_ERROR(_("Failed to create lib dir '%s': %s"),
- cfg->libDir, virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create lib dir %s"),
+ cfg->libDir);
goto error;
}
if (virFileMakePath(cfg->cacheDir) < 0) {
- VIR_ERROR(_("Failed to create cache dir '%s': %s"),
- cfg->cacheDir, virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create cache dir %s"),
+ cfg->cacheDir);
goto error;
}
if (virFileMakePath(cfg->saveDir) < 0) {
- VIR_ERROR(_("Failed to create save dir '%s': %s"),
- cfg->saveDir, virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create save dir %s"),
+ cfg->saveDir);
goto error;
}
if (virFileMakePath(cfg->snapshotDir) < 0) {
- VIR_ERROR(_("Failed to create save dir '%s': %s"),
- cfg->snapshotDir, virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create save dir %s"),
+ cfg->snapshotDir);
goto error;
}
if (virFileMakePath(cfg->autoDumpPath) < 0) {
- VIR_ERROR(_("Failed to create dump dir '%s': %s"),
- cfg->autoDumpPath, virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create dump dir %s"),
+ cfg->autoDumpPath);
goto error;
}
if (virFileMakePath(cfg->channelTargetDir) < 0) {
- VIR_ERROR(_("Failed to create channel target dir '%s': %s"),
- cfg->channelTargetDir,
- virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create channel target dir %s"),
+ cfg->channelTargetDir);
goto error;
}
if (virFileMakePath(cfg->nvramDir) < 0) {
- VIR_ERROR(_("Failed to create nvram dir '%s': %s"),
- cfg->nvramDir, virStrerror(errno, ebuf, sizeof(ebuf)));
+ virReportSystemError(errno, _("Failed to create nvram dir %s"),
+ cfg->nvramDir);
goto error;
}
--
2.5.0
9 years, 3 months
[libvirt] [PATCH v2] qemu: Don't duplicate virGetLastErrorMessage
by Jovanka Gulicoska
These uses of virGetLastError message are just duplicating
virGetLastErrorMessage.
---
src/qemu/qemu_capabilities.c | 14 ++++----------
src/qemu/qemu_driver.c | 9 ++-------
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b223837..2823843 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3089,10 +3089,8 @@ virQEMUCapsInitCached(virQEMUCapsPtr qemuCaps, const char *cacheDir)
if (virQEMUCapsLoadCache(qemuCaps, capsfile, &qemuctime, &selfctime,
&selfvers) < 0) {
- virErrorPtr err = virGetLastError();
VIR_WARN("Failed to load cached caps from '%s' for '%s': %s",
- capsfile, qemuCaps->binary, err ? NULLSTR(err->message) :
- _("unknown error"));
+ capsfile, qemuCaps->binary, virGetLastErrorMessage());
virResetLastError();
ret = 0;
virQEMUCapsReset(qemuCaps);
@@ -3320,9 +3318,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
/* @mon is supposed to be locked by callee */
if (qemuMonitorSetCapabilities(mon) < 0) {
- virErrorPtr err = virGetLastError();
VIR_DEBUG("Failed to set monitor capabilities %s",
- err ? err->message : "<unknown problem>");
+ virGetLastErrorMessage());
ret = 0;
goto cleanup;
}
@@ -3330,9 +3327,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
if (qemuMonitorGetVersion(mon,
&major, &minor, µ,
&package) < 0) {
- virErrorPtr err = virGetLastError();
VIR_DEBUG("Failed to query monitor version %s",
- err ? err->message : "<unknown problem>");
+ virGetLastErrorMessage());
ret = 0;
goto cleanup;
}
@@ -3561,15 +3557,13 @@ virQEMUCapsLogProbeFailure(const char *binary)
{ .key = "LIBVIRT_QEMU_BINARY", .s = binary, .iv = 0 },
{ .key = NULL },
};
- virErrorPtr err = virGetLastError();
virLogMessage(&virLogSelf,
VIR_LOG_WARN,
__FILE__, __LINE__, __func__,
meta,
_("Failed to probe capabilities for %s: %s"),
- binary, err && err->message ? err->message :
- _("unknown failure"));
+ binary, virGetLastErrorMessage());
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 29c3bc8..6e0e19e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -277,7 +277,6 @@ qemuAutostartDomain(virDomainObjPtr vm,
void *opaque)
{
struct qemuAutostartData *data = opaque;
- virErrorPtr err;
int flags = 0;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(data->driver);
int ret = -1;
@@ -291,19 +290,15 @@ qemuAutostartDomain(virDomainObjPtr vm,
if (vm->autostart &&
!virDomainObjIsActive(vm)) {
if (qemuProcessBeginJob(data->driver, vm) < 0) {
- err = virGetLastError();
VIR_ERROR(_("Failed to start job on VM '%s': %s"),
- vm->def->name,
- err ? err->message : _("unknown error"));
+ vm->def->name, virGetLastErrorMessage());
goto cleanup;
}
if (qemuDomainObjStart(data->conn, data->driver, vm, flags,
QEMU_ASYNC_JOB_START) < 0) {
- err = virGetLastError();
VIR_ERROR(_("Failed to autostart VM '%s': %s"),
- vm->def->name,
- err ? err->message : _("unknown error"));
+ vm->def->name, virGetLastErrorMessage());
}
qemuProcessEndJob(data->driver, vm);
--
2.5.0
9 years, 3 months
[libvirt] Usability Enhancement: Import/Export VMs GUI
by bancfc@openmailbox.org
The single most important usability feature missed by our less technical
users who migrate from VirtualBox is a one click import/export of VMs
and their config settings.
I was optimistic about the Gnome Boxes effort on Govf lib but
unfortunately it was never realized and I would hesitate to recommend it
because libvirt/virt-manager has the security advantages of sVirt.
An ideal solution would work across all KVM frontends.
9 years, 3 months