[libvirt] [PATCH v4 0/3] Per-guest S3/S4 configuration
by Martin Kletzander
There is a way to tell qemu how (not) to advertise S3/S4 ACPI sleep
state capability to the guest OS. This series includes the capability
to set this in the XML and also covers all the handling from qemu
point of view including checking for the support, parameter parsing,
command building, checking before sending the signals through guest
agent and also tests and documentation.
--
Even though the patches were half-acked, I rather send them again with
the changes made after Michal's suggestions.
v4:
- Changed the XML config to subelements
- Minor fixes and optimalizations
v3:
- Option names are change according to Eric and Doug
- Added docs (formatdomain)
v2:
- Modified the patch to reflect danpb's notes (according to qemu
people the setting the disable_s[34] parameter to 0/1 ensures that
the states will be enabled/disabled respectively)
Martin Kletzander (3):
Add per-guest S3/S4 state configuration
qemu: Add support for S3/S4 state configuration
tests: Add tests for qemu S3/S4 state configuration
docs/formatdomain.html.in | 24 +++++++++
docs/schemas/domaincommon.rng | 39 ++++++++++++++
src/conf/domain_conf.c | 50 +++++++++++++++++
src/conf/domain_conf.h | 15 ++++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_capabilities.c | 7 +++
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 62 ++++++++++++++++++++++
src/qemu/qemu_driver.c | 17 ++++++
tests/qemuargv2xmltest.c | 3 ++
.../qemuxml2argv-misc-disable-s3.args | 4 ++
.../qemuxml2argv-misc-disable-s3.xml | 29 ++++++++++
.../qemuxml2argv-misc-disable-suspends.args | 4 ++
.../qemuxml2argv-misc-disable-suspends.xml | 30 +++++++++++
.../qemuxml2argv-misc-enable-s4.args | 4 ++
.../qemuxml2argv-misc-enable-s4.xml | 29 ++++++++++
tests/qemuxml2argvtest.c | 4 ++
tests/qemuxml2xmltest.c | 3 ++
18 files changed, 328 insertions(+)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-s3.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-s3.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-suspends.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-disable-suspends.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-enable-s4.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-misc-enable-s4.xml
--
1.7.12
12 years, 2 months
[libvirt] [libvirt-perl PATCH v2] Virt.xs: fix flag issue on set_scheduler_parameters
by Alex Jia
From: Alex Jia <Alex Jia ajia(a)redhat.com>
The default flags are inconsistent on both qemuSetSchedulerParameters()
and qemuGetSchedulerParameters() in libvirt, the qemuGetSchedulerParameters()
always passes 'VIR_DOMAIN_AFFECT_CURRENT' flag to the qemuGetSchedulerParametersFlags(),
it should be a expected behavior, but the qemuSetSchedulerParameters() always passes
'VIR_DOMAIN_AFFECT_LIVE' flag to the qemuSetSchedulerParametersFlags(), if users use
default flag=0 or explicitly give a 'VIR_DOMAIN_AFFECT_CURRENT' flag to the
set_scheduler_parameters() in perl-Sys-Virt, because the flag value is 0, the result is
the virDomainSetSchedulerParameters() is called incorrectly.
In fact, it's enough to call the qemuSetSchedulerParametersFlags() regardless of what flag is
like 'virsh schedinfo' command.
How to reproduce?
# cat test.pl
#!/usr/bin/env perl
use warnings;
use strict;
use Sys::Virt;
my $uri = "qemu:///system";
my $domname = "foo"; # change your guest name
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
my %sched_param = (Sys::Virt::Domain::SCHEDULER_CPU_SHARES=>1);
$dom->set_scheduler_parameters(\%sched_param, Sys::Virt::Domain::AFFECT_CURRENT);
# perl test.pl
libvirt error code: 55, message: Requested operation is not valid: domain is not running
Signed-off-by: Alex Jia <Alex Jia ajia(a)redhat.com>
---
Virt.xs | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/Virt.xs b/Virt.xs
index 2b8d74c..fa58cc6 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -2833,13 +2833,9 @@ set_scheduler_parameters(dom, newparams, flags=0)
}
}
vir_typed_param_from_hv(newparams, params, nparams);
- if (flags) {
- if (virDomainSetSchedulerParametersFlags(dom, params, nparams, flags) < 0)
- _croak_error();
- } else {
- if (virDomainSetSchedulerParameters(dom, params, nparams) < 0)
- _croak_error();
- }
+
+ if (virDomainSetSchedulerParametersFlags(dom, params, nparams, flags) < 0)
+ _croak_error();
Safefree(params);
--
1.7.1
12 years, 2 months
[libvirt] Release of libvirt-0.10.1
by Daniel Veillard
As promised there is a fixup release since 0.10.0 is catastrophic,
and I should probably wear a brown paper bag ...
The tarball is being pushed as I write this and should be available
soon at the usual place:
ftp://libvirt.org/libvirt/
There are still known issues, count 2 weeks of developments and
a new week of freeze before 0.10.2, hopefully we will get those fixed
by then !
Without surprize it's a nearly only bug fixes release:
Bug Fixes:
- conf: Avoid formatting auto-generated DAC labels (Marcelo Cerri)
- conf: Fix parsing of seclabels without model (Marcelo Cerri)
- virsh: fixed incorrect timing report (Viktor Mihajlovski)
- qemu: Don't ignore CPU tuning config if required cgroups are missing (Jiri Denemark)
- cgroup: fix libvirtd crash caused by messed memory (Guannan Ren)
- cgroup: fix a typo on extracting data from vcpu cgroup (Guannan Ren)
- cgroup: read more data from cgroup cpuacct.usage_percpu (Guannan Ren)
- nwfilter: adapt IP learning for broadcasted DHCP replies (Stefan Berger)
- nwfilter: accept broadcasted DHCP replies in DHCP snooping code (Stefan Berger)
- Fix adding ports to OVS bridges without VLAN tags (Kyle Mestery)
- Fix xen driver following changes to make it stateful (Jim Fehlig)
- Fix issue of PF brought down if VF is 8021.Qbh and pci passthrough (Nishank Trivedi)
- nwfilter: loop generated too many rules (Stefan Berger)
- security: Re-apply commit ce53382ba28179d3a504b29b4f888b6e130d53f0 (Peter Krempa)
- vcpupin: Fix returning of arrays from virDomainVcpuPinAdd (Peter Krempa)
- qemu: Fix possible infinite loop and segfault on error path. (Peter Krempa)
- qemu: Clean up security driver initialisation and config file (Peter Krempa)
- qemu: Revert to blocking behavior of qemuAgentCommand (Jiri Denemark)
- qemu: Remove redundant parameter from qemuAgentSend (Jiri Denemark)
- network: get vlan info for Open vSwitch interfaces from proper source (Laine Stump)
- Small cleanup on previous patch (Daniel Veillard)
- Fix a crash when using Open vSwitch virtual ports (Kyle Mestery)
- qemu: Sort the numa params only when it affects the live config (Osier Yang)
- Fix configuration of QEMU security drivers (Daniel P. Berrange)
- qemu: Refactor initialisation of security drivers. (Peter Krempa)
- Revert "security: Add DAC to security_drivers" (Peter Krempa)
- qemu: Fix starting domains with no cpu cgroup (Jiri Denemark)
Documentation:
- virsh: Document subdriver option of attach-disk (Jiri Denemark)
- update option force to subcommand change-media (Guannan Ren)
- Fix typo in CPU tuning (Jiri Denemark)
- Fix emulator pinning example in formatdomain.html (Peter Krempa)
Improvement:
- Implement virMacAddrIsBroadcastRaw (Stefan Berger)
Cleanup:
- security: remove dead code from virSecurityDACGenLabel (Alex Jia)
Thanks to everybody for those 2 days frenetically chasing bugs and
trying to fix them !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
12 years, 2 months
[libvirt] [PATCH] python: don't mask libvirt errors
by Eric Blake
A user reported this crash when using python bindings:
File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 134, in trigger
hook.trigger(event)
File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 33, in trigger
self.handlers[event]()
File "/home/nox/workspace/NOX/hooks/volatility.py", line 81, in memory_dump
for block in Memory(self.ctx):
File "/home/see/workspace/NOX/src/NOX/lib/libtools.py", line 179, in next
libvirt.VIR_MEMORY_PHYSICAL)
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1759, in memoryPeek
ret = libvirtmod.virDomainMemoryPeek(self._o, start, size, flags)
SystemError: error return without exception set
In the python bindings, returning NULL makes python think an
exception was thrown, while returning the None object lets the
wrappers know that a libvirt error exists.
Reported by Nox DaFox, fix suggested by Dan Berrange.
* python/libvirt-override.c (libvirt_virDomainBlockPeek)
(libvirt_virDomainMemoryPeek): Return python's None object, so
wrapper knows to check libvirt error.
---
python/libvirt-override.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 8b41dff..65e8c69 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -5763,8 +5763,10 @@ libvirt_virDomainBlockPeek(PyObject *self ATTRIBUTE_UNUSED,
c_retval = virDomainBlockPeek(domain, disk, offset, size, buf, flags);
LIBVIRT_END_ALLOW_THREADS;
- if (c_retval < 0)
+ if (c_retval < 0) {
+ py_retval = VIR_PY_NONE;
goto cleanup;
+ }
py_retval = PyString_FromStringAndSize(buf, size);
@@ -5798,8 +5800,10 @@ libvirt_virDomainMemoryPeek(PyObject *self ATTRIBUTE_UNUSED,
c_retval = virDomainMemoryPeek(domain, start, size, buf, flags);
LIBVIRT_END_ALLOW_THREADS;
- if (c_retval < 0)
+ if (c_retval < 0) {
+ py_retval = VIR_PY_NONE;
goto cleanup;
+ }
py_retval = PyString_FromStringAndSize(buf, size);
--
1.7.11.4
12 years, 2 months
[libvirt] [PATCH] build: define WITH_INTERFACE for the driver
by Doug Goldstein
<not part of the commit>
Really just looking for feedback if this an acceptable update to the previous work. My plan is to add a 'udev' backend that will provide just some basic read-only host interface information. Basically I've been seeing postings to libvirt-users and virt-tools where people are on distros that don't support netcf and are noticing that virt-manager uses HAL or they use libvir APIs and can configure everything for the virtual machine respecting the host except for the network.
</not part of the commit>
Based exclusively on work by Eric Blake in a patch posted with the same
subject. However some modifications related to comments and my plans to
add another backend.
Added WITH_INTERFACE as the only automake variable deciding whether to
build the driver and using WITH_NETCF to identify that we're wanting to
use the netcf library as the backend.
* configure.ac: Added with_interface and enhanced with_netcf to respect
with_interface.
* src/interface/netcf_driver.c: Renamed..
* src/interface/interface_backend_netcf.c: ..to this to match storage.
* src/interface/netcf_driver.h: Renamed..
* src/interface/interface_driver.h: ..to this.
* daemon/Makefile.am: Respect WITH_INTERFACE and WITH_NETCF.
---
configure.ac | 44 ++-
daemon/Makefile.am | 2 +-
daemon/libvirtd.c | 8 +-
src/Makefile.am | 24 +-
src/interface/interface_backend_netcf.c | 663 +++++++++++++++++++++++++++++++
src/interface/interface_driver.h | 29 ++
src/interface/netcf_driver.c | 663 -------------------------------
src/interface/netcf_driver.h | 29 --
src/util/util.c | 21 +-
tests/virdrivermoduletest.c | 2 +-
tools/virsh.c | 4 +-
11 files changed, 776 insertions(+), 713 deletions(-)
create mode 100644 src/interface/interface_backend_netcf.c
create mode 100644 src/interface/interface_driver.h
delete mode 100644 src/interface/netcf_driver.c
delete mode 100644 src/interface/netcf_driver.h
diff --git a/configure.ac b/configure.ac
index df39df2..2d7a55e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1963,9 +1963,6 @@ if test "$with_netcf" = "yes" || test "$with_netcf" = "check"; then
fi
fi
fi
-AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = "yes"])
-AC_SUBST([NETCF_CFLAGS])
-AC_SUBST([NETCF_LIBS])
AC_ARG_WITH([secrets],
@@ -2806,6 +2803,46 @@ if test "$with_nwfilter" = "yes" ; then
fi
AM_CONDITIONAL([WITH_NWFILTER], [test "$with_nwfilter" = "yes"])
+dnl check if the interface driver should be compiled
+AC_ARG_WITH([interface],
+ AC_HELP_STRING([--with-interface],
+ [with host interface driver @<:@default=check@:>@]), [],
+ [with_interface=check])
+
+dnl Don't compile the interface driver without libvirtd
+if test "$with_libvirtd" = "no" ; then
+ with_interface=no
+fi
+
+dnl The interface driver depends on the netcf library
+if test "$with_interface:$with_netcf" = "check:yes" ; then
+ with_interface=yes
+fi
+
+if test "$with_interface:$with_netcf" = "check:no" ; then
+ with_interface=no
+fi
+
+if test "$with_interface:$with_netcf" = "yes:no" ; then
+ AC_MSG_ERROR([Requested the Interface driver without netcf support])
+fi
+
+if test "$with_interface" = "yes" ; then
+ AC_DEFINE_UNQUOTED([WITH_INTERFACE], [1],
+ [whether the interface driver is enabled])
+fi
+AM_CONDITIONAL([WITH_INTERFACE], [test "$with_interface" = "yes"])
+
+dnl If the interface driver is off disable netcf
+if test "$with_interface" = "no" ; then
+ with_netcf=no
+fi
+
+dnl We only use netcf for the interface driver so only enable it then
+AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = "yes"])
+AC_SUBST([NETCF_CFLAGS])
+AC_SUBST([NETCF_LIBS])
+
dnl libblkid is used by several storage drivers; therefore we probe
dnl for it unconditionally.
AC_ARG_WITH([libblkid],
@@ -3018,6 +3055,7 @@ AC_MSG_NOTICE([ Remote: $with_remote])
AC_MSG_NOTICE([ Network: $with_network])
AC_MSG_NOTICE([ Libvirtd: $with_libvirtd])
AC_MSG_NOTICE([ netcf: $with_netcf])
+AC_MSG_NOTICE([Interface: $with_interface])
AC_MSG_NOTICE([ macvtap: $with_macvtap])
AC_MSG_NOTICE([ virtport: $with_virtualport])
AC_MSG_NOTICE([])
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index b00fc13..fbd5a5e 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -147,7 +147,7 @@ if WITH_NETWORK
libvirtd_LDADD += ../src/libvirt_driver_network.la
endif
-if WITH_NETCF
+if WITH_INTERFACE
libvirtd_LDADD += ../src/libvirt_driver_interface.la
endif
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 19dd26b..c2923d5 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -75,8 +75,8 @@
# ifdef WITH_NETWORK
# include "network/bridge_driver.h"
# endif
-# ifdef WITH_NETCF
-# include "interface/netcf_driver.h"
+# ifdef WITH_INTERFACE
+# include "interface/interface_driver.h"
# endif
# ifdef WITH_STORAGE
# include "storage/storage_driver.h"
@@ -379,7 +379,7 @@ static void daemonInitialize(void)
# ifdef WITH_NWFILTER
virDriverLoadModule("nwfilter");
# endif
-# ifdef WITH_NETCF
+# ifdef WITH_INTERFACE
virDriverLoadModule("interface");
# endif
# ifdef WITH_QEMU
@@ -401,7 +401,7 @@ static void daemonInitialize(void)
# ifdef WITH_NETWORK
networkRegister();
# endif
-# ifdef WITH_NETCF
+# ifdef WITH_INTERFACE
interfaceRegister();
# endif
# ifdef WITH_STORAGE
diff --git a/src/Makefile.am b/src/Makefile.am
index 95e1bea..72c4d6c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -548,8 +548,17 @@ PARALLELS_DRIVER_SOURCES = \
NETWORK_DRIVER_SOURCES = \
network/bridge_driver.h network/bridge_driver.c
-INTERFACE_DRIVER_SOURCES = \
- interface/netcf_driver.h interface/netcf_driver.c
+INTERFACE_DRIVER_SOURCES =
+
+if WITH_INTERFACE
+INTERFACE_DRIVER_SOURCES += \
+ interface/interface_driver.h
+endif
+
+if WITH_NETCF
+INTERFACE_DRIVER_SOURCES += \
+ interface/interface_backend_netcf.c
+endif
SECRET_DRIVER_SOURCES = \
secret/secret_driver.h secret/secret_driver.c
@@ -1017,7 +1026,7 @@ endif
EXTRA_DIST += network/default.xml
-if WITH_NETCF
+if WITH_INTERFACE
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_interface.la
else
@@ -1025,10 +1034,13 @@ noinst_LTLIBRARIES += libvirt_driver_interface.la
# Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la
endif
-libvirt_driver_interface_la_CFLAGS = $(NETCF_CFLAGS) \
- -I$(top_srcdir)/src/conf $(AM_CFLAGS)
+libvirt_driver_interface_la_CFLAGS = -I$(top_srcdir)/src/conf $(AM_CFLAGS)
libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_interface_la_LIBADD = $(NETCF_LIBS)
+libvirt_driver_interface_la_LIBADD =
+if WITH_NETCF
+libvirt_driver_interface_la_CFLAGS += $(NETCF_CFLAGS)
+libvirt_driver_interface_la_LIBADD += $(NETCF_LIBS)
+endif
if WITH_DRIVER_MODULES
libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_interface_la_LDFLAGS += -module -avoid-version
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
new file mode 100644
index 0000000..9285b08
--- /dev/null
+++ b/src/interface/interface_backend_netcf.c
@@ -0,0 +1,663 @@
+/*
+ * interface_driver.c: backend driver methods to handle physical
+ * interface configuration using the netcf library.
+ *
+ * Copyright (C) 2006-2011 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Laine Stump <laine(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include <netcf.h>
+
+#include "virterror_internal.h"
+#include "datatypes.h"
+#include "interface_driver.h"
+#include "interface_conf.h"
+#include "memory.h"
+
+#define VIR_FROM_THIS VIR_FROM_INTERFACE
+
+/* Main driver state */
+struct interface_driver
+{
+ virMutex lock;
+ struct netcf *netcf;
+};
+
+
+static void interfaceDriverLock(struct interface_driver *driver)
+{
+ virMutexLock(&driver->lock);
+}
+
+static void interfaceDriverUnlock(struct interface_driver *driver)
+{
+ virMutexUnlock(&driver->lock);
+}
+
+static int netcf_to_vir_err(int netcf_errcode)
+{
+ switch (netcf_errcode)
+ {
+ case NETCF_NOERROR:
+ /* no error, everything ok */
+ return VIR_ERR_OK;
+ case NETCF_EINTERNAL:
+ /* internal error, aka bug */
+ return VIR_ERR_INTERNAL_ERROR;
+ case NETCF_EOTHER:
+ /* other error, copout for being more specific */
+ return VIR_ERR_INTERNAL_ERROR;
+ case NETCF_ENOMEM:
+ /*
+ * allocation failed return VIR ERR NO MEMORY
+ * though it should not be used now.
+ */
+ return 2;
+ case NETCF_EXMLPARSER:
+ /* XML parser choked */
+ return VIR_ERR_XML_ERROR;
+ case NETCF_EXMLINVALID:
+ /* XML invalid in some form */
+ return VIR_ERR_XML_ERROR;
+ case NETCF_ENOENT:
+ /* Required entry in a tree is missing */
+ return VIR_ERR_INTERNAL_ERROR;
+ case NETCF_EEXEC:
+ /* external program execution failed or returned non-0 */
+ return VIR_ERR_INTERNAL_ERROR;
+#ifdef NETCF_EINVALIDOP
+ case NETCF_EINVALIDOP:
+ /* attempted operation is invalid while the system is in the current state. */
+ return VIR_ERR_OPERATION_INVALID;
+#endif
+ default:
+ return VIR_ERR_INTERNAL_ERROR;
+ }
+}
+
+static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfacePtr ifinfo)
+{
+ /* 1) caller already has lock,
+ * 2) caller cleans up iface on return
+ */
+ struct netcf_if *iface = ncf_lookup_by_name(ncf, ifinfo->name);
+ if (!iface) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(ncf, &errmsg, &details);
+ if (errcode != NETCF_NOERROR) {
+ virReportError(netcf_to_vir_err(errcode),
+ _("couldn't find interface named '%s': %s%s%s"),
+ ifinfo->name, errmsg, details ? " - " : "",
+ details ? details : "");
+ } else {
+ virReportError(VIR_ERR_NO_INTERFACE,
+ _("couldn't find interface named '%s'"),
+ ifinfo->name);
+ }
+ }
+ return iface;
+}
+
+static virDrvOpenStatus interfaceOpenInterface(virConnectPtr conn,
+ virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ struct interface_driver *driverState;
+
+ virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
+ if (VIR_ALLOC(driverState) < 0)
+ {
+ virReportOOMError();
+ goto alloc_error;
+ }
+
+ /* initialize non-0 stuff in driverState */
+ if (virMutexInit(&driverState->lock) < 0)
+ {
+ /* what error to report? */
+ goto mutex_error;
+ }
+
+ /* open netcf */
+ if (ncf_init(&driverState->netcf, NULL) != 0)
+ {
+ /* what error to report? */
+ goto netcf_error;
+ }
+
+ conn->interfacePrivateData = driverState;
+ return VIR_DRV_OPEN_SUCCESS;
+
+netcf_error:
+ if (driverState->netcf)
+ {
+ ncf_close(driverState->netcf);
+ }
+ virMutexDestroy (&driverState->lock);
+mutex_error:
+ VIR_FREE(driverState);
+alloc_error:
+ return VIR_DRV_OPEN_ERROR;
+}
+
+static int interfaceCloseInterface(virConnectPtr conn)
+{
+
+ if (conn->interfacePrivateData != NULL)
+ {
+ struct interface_driver *driver = conn->interfacePrivateData;
+
+ /* close netcf instance */
+ ncf_close(driver->netcf);
+ /* destroy lock */
+ virMutexDestroy(&driver->lock);
+ /* free driver state */
+ VIR_FREE(driver);
+ }
+ conn->interfacePrivateData = NULL;
+ return 0;
+}
+
+static int interfaceNumOfInterfaces(virConnectPtr conn)
+{
+ int count;
+ struct interface_driver *driver = conn->interfacePrivateData;
+
+ interfaceDriverLock(driver);
+ count = ncf_num_of_interfaces(driver->netcf, NETCF_IFACE_ACTIVE);
+ if (count < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to get number of interfaces on host: %s%s%s"),
+ errmsg, details ? " - " : "", details ? details : "");
+ }
+
+ interfaceDriverUnlock(driver);
+ return count;
+}
+
+static int interfaceListInterfaces(virConnectPtr conn, char **const names, int nnames)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ int count;
+
+ interfaceDriverLock(driver);
+
+ count = ncf_list_interfaces(driver->netcf, nnames, names, NETCF_IFACE_ACTIVE);
+ if (count < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to list host interfaces: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ }
+
+ interfaceDriverUnlock(driver);
+ return count;
+
+}
+
+static int interfaceNumOfDefinedInterfaces(virConnectPtr conn)
+{
+ int count;
+ struct interface_driver *driver = conn->interfacePrivateData;
+
+ interfaceDriverLock(driver);
+ count = ncf_num_of_interfaces(driver->netcf, NETCF_IFACE_INACTIVE);
+ if (count < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to get number of defined interfaces on host: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ }
+
+ interfaceDriverUnlock(driver);
+ return count;
+}
+
+static int interfaceListDefinedInterfaces(virConnectPtr conn, char **const names, int nnames)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ int count;
+
+ interfaceDriverLock(driver);
+
+ count = ncf_list_interfaces(driver->netcf, nnames, names, NETCF_IFACE_INACTIVE);
+ if (count < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to list host defined interfaces: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ }
+
+ interfaceDriverUnlock(driver);
+ return count;
+
+}
+
+static virInterfacePtr interfaceLookupByName(virConnectPtr conn,
+ const char *name)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ struct netcf_if *iface;
+ virInterfacePtr ret = NULL;
+
+ interfaceDriverLock(driver);
+ iface = ncf_lookup_by_name(driver->netcf, name);
+ if (!iface) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ if (errcode != NETCF_NOERROR) {
+ virReportError(netcf_to_vir_err(errcode),
+ _("couldn't find interface named '%s': %s%s%s"),
+ name, errmsg,
+ details ? " - " : "", details ? details : "");
+ } else {
+ virReportError(VIR_ERR_NO_INTERFACE,
+ _("couldn't find interface named '%s'"), name);
+ }
+ goto cleanup;
+ }
+
+ ret = virGetInterface(conn, ncf_if_name(iface), ncf_if_mac_string(iface));
+
+cleanup:
+ ncf_if_free(iface);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static virInterfacePtr interfaceLookupByMACString(virConnectPtr conn,
+ const char *macstr)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ struct netcf_if *iface;
+ int niface;
+ virInterfacePtr ret = NULL;
+
+ interfaceDriverLock(driver);
+ niface = ncf_lookup_by_mac_string(driver->netcf, macstr, 1, &iface);
+
+ if (niface < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("couldn't find interface with MAC address '%s': %s%s%s"),
+ macstr, errmsg, details ? " - " : "",
+ details ? details : "");
+ goto cleanup;
+ }
+ if (niface == 0) {
+ virReportError(VIR_ERR_NO_INTERFACE,
+ _("couldn't find interface with MAC address '%s'"),
+ macstr);
+ goto cleanup;
+ }
+ if (niface > 1) {
+ virReportError(VIR_ERR_MULTIPLE_INTERFACES,
+ "%s", _("multiple interfaces with matching MAC address"));
+ goto cleanup;
+ }
+
+ ret = virGetInterface(conn, ncf_if_name(iface), ncf_if_mac_string(iface));
+
+cleanup:
+ ncf_if_free(iface);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static char *interfaceGetXMLDesc(virInterfacePtr ifinfo,
+ unsigned int flags)
+{
+ struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
+ struct netcf_if *iface = NULL;
+ char *xmlstr = NULL;
+ virInterfaceDefPtr ifacedef = NULL;
+ char *ret = NULL;
+
+ virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
+
+ interfaceDriverLock(driver);
+
+ iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
+ if (!iface) {
+ /* helper already reported error */
+ goto cleanup;
+ }
+
+ if ((flags & VIR_INTERFACE_XML_INACTIVE)) {
+ xmlstr = ncf_if_xml_desc(iface);
+ } else {
+ xmlstr = ncf_if_xml_state(iface);
+ }
+ if (!xmlstr) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("could not get interface XML description: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ goto cleanup;
+ }
+
+ ifacedef = virInterfaceDefParseString(xmlstr);
+ if (!ifacedef) {
+ /* error was already reported */
+ goto cleanup;
+ }
+
+ ret = virInterfaceDefFormat(ifacedef);
+ if (!ret) {
+ /* error was already reported */
+ goto cleanup;
+ }
+
+cleanup:
+ ncf_if_free(iface);
+ VIR_FREE(xmlstr);
+ virInterfaceDefFree(ifacedef);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static virInterfacePtr interfaceDefineXML(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ struct netcf_if *iface = NULL;
+ char *xmlstr = NULL;
+ virInterfaceDefPtr ifacedef = NULL;
+ virInterfacePtr ret = NULL;
+
+ virCheckFlags(0, NULL);
+
+ interfaceDriverLock(driver);
+
+ ifacedef = virInterfaceDefParseString(xml);
+ if (!ifacedef) {
+ /* error was already reported */
+ goto cleanup;
+ }
+
+ xmlstr = virInterfaceDefFormat(ifacedef);
+ if (!xmlstr) {
+ /* error was already reported */
+ goto cleanup;
+ }
+
+ iface = ncf_define(driver->netcf, xmlstr);
+ if (!iface) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("could not get interface XML description: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ goto cleanup;
+ }
+
+ ret = virGetInterface(conn, ncf_if_name(iface), ncf_if_mac_string(iface));
+
+cleanup:
+ ncf_if_free(iface);
+ VIR_FREE(xmlstr);
+ virInterfaceDefFree(ifacedef);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static int interfaceUndefine(virInterfacePtr ifinfo) {
+ struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
+ struct netcf_if *iface = NULL;
+ int ret = -1;
+
+ interfaceDriverLock(driver);
+
+ iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
+ if (!iface) {
+ /* helper already reported error */
+ goto cleanup;
+ }
+
+ ret = ncf_if_undefine(iface);
+ if (ret < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to undefine interface %s: %s%s%s"),
+ ifinfo->name, errmsg, details ? " - " : "",
+ details ? details : "");
+ goto cleanup;
+ }
+
+cleanup:
+ ncf_if_free(iface);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static int interfaceCreate(virInterfacePtr ifinfo,
+ unsigned int flags)
+{
+ struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
+ struct netcf_if *iface = NULL;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ interfaceDriverLock(driver);
+
+ iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
+ if (!iface) {
+ /* helper already reported error */
+ goto cleanup;
+ }
+
+ ret = ncf_if_up(iface);
+ if (ret < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to create (start) interface %s: %s%s%s"),
+ ifinfo->name, errmsg, details ? " - " : "",
+ details ? details : "");
+ goto cleanup;
+ }
+
+cleanup:
+ ncf_if_free(iface);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static int interfaceDestroy(virInterfacePtr ifinfo,
+ unsigned int flags)
+{
+ struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
+ struct netcf_if *iface = NULL;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ interfaceDriverLock(driver);
+
+ iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
+ if (!iface) {
+ /* helper already reported error */
+ goto cleanup;
+ }
+
+ ret = ncf_if_down(iface);
+ if (ret < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to destroy (stop) interface %s: %s%s%s"),
+ ifinfo->name, errmsg, details ? " - " : "",
+ details ? details : "");
+ goto cleanup;
+ }
+
+cleanup:
+ ncf_if_free(iface);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static int interfaceIsActive(virInterfacePtr ifinfo)
+{
+ struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
+ struct netcf_if *iface = NULL;
+ unsigned int flags = 0;
+ int ret = -1;
+
+ interfaceDriverLock(driver);
+
+ iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
+ if (!iface) {
+ /* helper already reported error */
+ goto cleanup;
+ }
+
+ if (ncf_if_status(iface, &flags) < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to get status of interface %s: %s%s%s"),
+ ifinfo->name, errmsg, details ? " - " : "",
+ details ? details : "");
+ goto cleanup;
+ }
+
+ ret = flags & NETCF_IFACE_ACTIVE ? 1 : 0;
+
+cleanup:
+ ncf_if_free(iface);
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+#ifdef HAVE_NETCF_TRANSACTIONS
+static int interfaceChangeBegin(virConnectPtr conn, unsigned int flags)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ int ret;
+
+ virCheckFlags(0, -1); /* currently flags must be 0 */
+
+ interfaceDriverLock(driver);
+
+ ret = ncf_change_begin(driver->netcf, 0);
+ if (ret < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to begin transaction: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ }
+
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static int interfaceChangeCommit(virConnectPtr conn, unsigned int flags)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ int ret;
+
+ virCheckFlags(0, -1); /* currently flags must be 0 */
+
+ interfaceDriverLock(driver);
+
+ ret = ncf_change_commit(driver->netcf, 0);
+ if (ret < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to commit transaction: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ }
+
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+
+static int interfaceChangeRollback(virConnectPtr conn, unsigned int flags)
+{
+ struct interface_driver *driver = conn->interfacePrivateData;
+ int ret;
+
+ virCheckFlags(0, -1); /* currently flags must be 0 */
+
+ interfaceDriverLock(driver);
+
+ ret = ncf_change_rollback(driver->netcf, 0);
+ if (ret < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to rollback transaction: %s%s%s"),
+ errmsg, details ? " - " : "",
+ details ? details : "");
+ }
+
+ interfaceDriverUnlock(driver);
+ return ret;
+}
+#endif /* HAVE_NETCF_TRANSACTIONS */
+
+static virInterfaceDriver interfaceDriver = {
+ "Interface",
+ .open = interfaceOpenInterface, /* 0.7.0 */
+ .close = interfaceCloseInterface, /* 0.7.0 */
+ .numOfInterfaces = interfaceNumOfInterfaces, /* 0.7.0 */
+ .listInterfaces = interfaceListInterfaces, /* 0.7.0 */
+ .numOfDefinedInterfaces = interfaceNumOfDefinedInterfaces, /* 0.7.0 */
+ .listDefinedInterfaces = interfaceListDefinedInterfaces, /* 0.7.0 */
+ .interfaceLookupByName = interfaceLookupByName, /* 0.7.0 */
+ .interfaceLookupByMACString = interfaceLookupByMACString, /* 0.7.0 */
+ .interfaceGetXMLDesc = interfaceGetXMLDesc, /* 0.7.0 */
+ .interfaceDefineXML = interfaceDefineXML, /* 0.7.0 */
+ .interfaceUndefine = interfaceUndefine, /* 0.7.0 */
+ .interfaceCreate = interfaceCreate, /* 0.7.0 */
+ .interfaceDestroy = interfaceDestroy, /* 0.7.0 */
+ .interfaceIsActive = interfaceIsActive, /* 0.7.3 */
+#ifdef HAVE_NETCF_TRANSACTIONS
+ .interfaceChangeBegin = interfaceChangeBegin, /* 0.9.2 */
+ .interfaceChangeCommit = interfaceChangeCommit, /* 0.9.2 */
+ .interfaceChangeRollback = interfaceChangeRollback, /* 0.9.2 */
+#endif /* HAVE_NETCF_TRANSACTIONS */
+};
+
+int interfaceRegister(void) {
+ virRegisterInterfaceDriver(&interfaceDriver);
+ return 0;
+}
diff --git a/src/interface/interface_driver.h b/src/interface/interface_driver.h
new file mode 100644
index 0000000..38fbc77
--- /dev/null
+++ b/src/interface/interface_driver.h
@@ -0,0 +1,29 @@
+/*
+ * interface_driver.h: core driver methods for managing physical host interfaces
+ *
+ * Copyright (C) 2006, 2007 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Laine Stump <laine(a)redhat.com>
+ */
+
+
+#ifndef __VIR_INTERFACE__DRIVER_H
+# define __VIR_INTERFACE__DRIVER_H
+
+int interfaceRegister(void);
+
+#endif /* __VIR_INTERFACE__DRIVER_H */
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
deleted file mode 100644
index 935be66..0000000
--- a/src/interface/netcf_driver.c
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
- * interface_driver.c: backend driver methods to handle physical
- * interface configuration using the netcf library.
- *
- * Copyright (C) 2006-2011 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
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Author: Laine Stump <laine(a)redhat.com>
- */
-
-#include <config.h>
-
-#include <netcf.h>
-
-#include "virterror_internal.h"
-#include "datatypes.h"
-#include "netcf_driver.h"
-#include "interface_conf.h"
-#include "memory.h"
-
-#define VIR_FROM_THIS VIR_FROM_INTERFACE
-
-/* Main driver state */
-struct interface_driver
-{
- virMutex lock;
- struct netcf *netcf;
-};
-
-
-static void interfaceDriverLock(struct interface_driver *driver)
-{
- virMutexLock(&driver->lock);
-}
-
-static void interfaceDriverUnlock(struct interface_driver *driver)
-{
- virMutexUnlock(&driver->lock);
-}
-
-static int netcf_to_vir_err(int netcf_errcode)
-{
- switch (netcf_errcode)
- {
- case NETCF_NOERROR:
- /* no error, everything ok */
- return VIR_ERR_OK;
- case NETCF_EINTERNAL:
- /* internal error, aka bug */
- return VIR_ERR_INTERNAL_ERROR;
- case NETCF_EOTHER:
- /* other error, copout for being more specific */
- return VIR_ERR_INTERNAL_ERROR;
- case NETCF_ENOMEM:
- /*
- * allocation failed return VIR ERR NO MEMORY
- * though it should not be used now.
- */
- return 2;
- case NETCF_EXMLPARSER:
- /* XML parser choked */
- return VIR_ERR_XML_ERROR;
- case NETCF_EXMLINVALID:
- /* XML invalid in some form */
- return VIR_ERR_XML_ERROR;
- case NETCF_ENOENT:
- /* Required entry in a tree is missing */
- return VIR_ERR_INTERNAL_ERROR;
- case NETCF_EEXEC:
- /* external program execution failed or returned non-0 */
- return VIR_ERR_INTERNAL_ERROR;
-#ifdef NETCF_EINVALIDOP
- case NETCF_EINVALIDOP:
- /* attempted operation is invalid while the system is in the current state. */
- return VIR_ERR_OPERATION_INVALID;
-#endif
- default:
- return VIR_ERR_INTERNAL_ERROR;
- }
-}
-
-static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfacePtr ifinfo)
-{
- /* 1) caller already has lock,
- * 2) caller cleans up iface on return
- */
- struct netcf_if *iface = ncf_lookup_by_name(ncf, ifinfo->name);
- if (!iface) {
- const char *errmsg, *details;
- int errcode = ncf_error(ncf, &errmsg, &details);
- if (errcode != NETCF_NOERROR) {
- virReportError(netcf_to_vir_err(errcode),
- _("couldn't find interface named '%s': %s%s%s"),
- ifinfo->name, errmsg, details ? " - " : "",
- details ? details : "");
- } else {
- virReportError(VIR_ERR_NO_INTERFACE,
- _("couldn't find interface named '%s'"),
- ifinfo->name);
- }
- }
- return iface;
-}
-
-static virDrvOpenStatus interfaceOpenInterface(virConnectPtr conn,
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
- unsigned int flags)
-{
- struct interface_driver *driverState;
-
- virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
-
- if (VIR_ALLOC(driverState) < 0)
- {
- virReportOOMError();
- goto alloc_error;
- }
-
- /* initialize non-0 stuff in driverState */
- if (virMutexInit(&driverState->lock) < 0)
- {
- /* what error to report? */
- goto mutex_error;
- }
-
- /* open netcf */
- if (ncf_init(&driverState->netcf, NULL) != 0)
- {
- /* what error to report? */
- goto netcf_error;
- }
-
- conn->interfacePrivateData = driverState;
- return VIR_DRV_OPEN_SUCCESS;
-
-netcf_error:
- if (driverState->netcf)
- {
- ncf_close(driverState->netcf);
- }
- virMutexDestroy (&driverState->lock);
-mutex_error:
- VIR_FREE(driverState);
-alloc_error:
- return VIR_DRV_OPEN_ERROR;
-}
-
-static int interfaceCloseInterface(virConnectPtr conn)
-{
-
- if (conn->interfacePrivateData != NULL)
- {
- struct interface_driver *driver = conn->interfacePrivateData;
-
- /* close netcf instance */
- ncf_close(driver->netcf);
- /* destroy lock */
- virMutexDestroy(&driver->lock);
- /* free driver state */
- VIR_FREE(driver);
- }
- conn->interfacePrivateData = NULL;
- return 0;
-}
-
-static int interfaceNumOfInterfaces(virConnectPtr conn)
-{
- int count;
- struct interface_driver *driver = conn->interfacePrivateData;
-
- interfaceDriverLock(driver);
- count = ncf_num_of_interfaces(driver->netcf, NETCF_IFACE_ACTIVE);
- if (count < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to get number of interfaces on host: %s%s%s"),
- errmsg, details ? " - " : "", details ? details : "");
- }
-
- interfaceDriverUnlock(driver);
- return count;
-}
-
-static int interfaceListInterfaces(virConnectPtr conn, char **const names, int nnames)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- int count;
-
- interfaceDriverLock(driver);
-
- count = ncf_list_interfaces(driver->netcf, nnames, names, NETCF_IFACE_ACTIVE);
- if (count < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to list host interfaces: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- }
-
- interfaceDriverUnlock(driver);
- return count;
-
-}
-
-static int interfaceNumOfDefinedInterfaces(virConnectPtr conn)
-{
- int count;
- struct interface_driver *driver = conn->interfacePrivateData;
-
- interfaceDriverLock(driver);
- count = ncf_num_of_interfaces(driver->netcf, NETCF_IFACE_INACTIVE);
- if (count < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to get number of defined interfaces on host: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- }
-
- interfaceDriverUnlock(driver);
- return count;
-}
-
-static int interfaceListDefinedInterfaces(virConnectPtr conn, char **const names, int nnames)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- int count;
-
- interfaceDriverLock(driver);
-
- count = ncf_list_interfaces(driver->netcf, nnames, names, NETCF_IFACE_INACTIVE);
- if (count < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to list host defined interfaces: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- }
-
- interfaceDriverUnlock(driver);
- return count;
-
-}
-
-static virInterfacePtr interfaceLookupByName(virConnectPtr conn,
- const char *name)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- struct netcf_if *iface;
- virInterfacePtr ret = NULL;
-
- interfaceDriverLock(driver);
- iface = ncf_lookup_by_name(driver->netcf, name);
- if (!iface) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- if (errcode != NETCF_NOERROR) {
- virReportError(netcf_to_vir_err(errcode),
- _("couldn't find interface named '%s': %s%s%s"),
- name, errmsg,
- details ? " - " : "", details ? details : "");
- } else {
- virReportError(VIR_ERR_NO_INTERFACE,
- _("couldn't find interface named '%s'"), name);
- }
- goto cleanup;
- }
-
- ret = virGetInterface(conn, ncf_if_name(iface), ncf_if_mac_string(iface));
-
-cleanup:
- ncf_if_free(iface);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static virInterfacePtr interfaceLookupByMACString(virConnectPtr conn,
- const char *macstr)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- struct netcf_if *iface;
- int niface;
- virInterfacePtr ret = NULL;
-
- interfaceDriverLock(driver);
- niface = ncf_lookup_by_mac_string(driver->netcf, macstr, 1, &iface);
-
- if (niface < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("couldn't find interface with MAC address '%s': %s%s%s"),
- macstr, errmsg, details ? " - " : "",
- details ? details : "");
- goto cleanup;
- }
- if (niface == 0) {
- virReportError(VIR_ERR_NO_INTERFACE,
- _("couldn't find interface with MAC address '%s'"),
- macstr);
- goto cleanup;
- }
- if (niface > 1) {
- virReportError(VIR_ERR_MULTIPLE_INTERFACES,
- "%s", _("multiple interfaces with matching MAC address"));
- goto cleanup;
- }
-
- ret = virGetInterface(conn, ncf_if_name(iface), ncf_if_mac_string(iface));
-
-cleanup:
- ncf_if_free(iface);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static char *interfaceGetXMLDesc(virInterfacePtr ifinfo,
- unsigned int flags)
-{
- struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
- struct netcf_if *iface = NULL;
- char *xmlstr = NULL;
- virInterfaceDefPtr ifacedef = NULL;
- char *ret = NULL;
-
- virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
-
- interfaceDriverLock(driver);
-
- iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
- if (!iface) {
- /* helper already reported error */
- goto cleanup;
- }
-
- if ((flags & VIR_INTERFACE_XML_INACTIVE)) {
- xmlstr = ncf_if_xml_desc(iface);
- } else {
- xmlstr = ncf_if_xml_state(iface);
- }
- if (!xmlstr) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("could not get interface XML description: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- goto cleanup;
- }
-
- ifacedef = virInterfaceDefParseString(xmlstr);
- if (!ifacedef) {
- /* error was already reported */
- goto cleanup;
- }
-
- ret = virInterfaceDefFormat(ifacedef);
- if (!ret) {
- /* error was already reported */
- goto cleanup;
- }
-
-cleanup:
- ncf_if_free(iface);
- VIR_FREE(xmlstr);
- virInterfaceDefFree(ifacedef);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static virInterfacePtr interfaceDefineXML(virConnectPtr conn,
- const char *xml,
- unsigned int flags)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- struct netcf_if *iface = NULL;
- char *xmlstr = NULL;
- virInterfaceDefPtr ifacedef = NULL;
- virInterfacePtr ret = NULL;
-
- virCheckFlags(0, NULL);
-
- interfaceDriverLock(driver);
-
- ifacedef = virInterfaceDefParseString(xml);
- if (!ifacedef) {
- /* error was already reported */
- goto cleanup;
- }
-
- xmlstr = virInterfaceDefFormat(ifacedef);
- if (!xmlstr) {
- /* error was already reported */
- goto cleanup;
- }
-
- iface = ncf_define(driver->netcf, xmlstr);
- if (!iface) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("could not get interface XML description: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- goto cleanup;
- }
-
- ret = virGetInterface(conn, ncf_if_name(iface), ncf_if_mac_string(iface));
-
-cleanup:
- ncf_if_free(iface);
- VIR_FREE(xmlstr);
- virInterfaceDefFree(ifacedef);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static int interfaceUndefine(virInterfacePtr ifinfo) {
- struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
- struct netcf_if *iface = NULL;
- int ret = -1;
-
- interfaceDriverLock(driver);
-
- iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
- if (!iface) {
- /* helper already reported error */
- goto cleanup;
- }
-
- ret = ncf_if_undefine(iface);
- if (ret < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to undefine interface %s: %s%s%s"),
- ifinfo->name, errmsg, details ? " - " : "",
- details ? details : "");
- goto cleanup;
- }
-
-cleanup:
- ncf_if_free(iface);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static int interfaceCreate(virInterfacePtr ifinfo,
- unsigned int flags)
-{
- struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
- struct netcf_if *iface = NULL;
- int ret = -1;
-
- virCheckFlags(0, -1);
-
- interfaceDriverLock(driver);
-
- iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
- if (!iface) {
- /* helper already reported error */
- goto cleanup;
- }
-
- ret = ncf_if_up(iface);
- if (ret < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to create (start) interface %s: %s%s%s"),
- ifinfo->name, errmsg, details ? " - " : "",
- details ? details : "");
- goto cleanup;
- }
-
-cleanup:
- ncf_if_free(iface);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static int interfaceDestroy(virInterfacePtr ifinfo,
- unsigned int flags)
-{
- struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
- struct netcf_if *iface = NULL;
- int ret = -1;
-
- virCheckFlags(0, -1);
-
- interfaceDriverLock(driver);
-
- iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
- if (!iface) {
- /* helper already reported error */
- goto cleanup;
- }
-
- ret = ncf_if_down(iface);
- if (ret < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to destroy (stop) interface %s: %s%s%s"),
- ifinfo->name, errmsg, details ? " - " : "",
- details ? details : "");
- goto cleanup;
- }
-
-cleanup:
- ncf_if_free(iface);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static int interfaceIsActive(virInterfacePtr ifinfo)
-{
- struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
- struct netcf_if *iface = NULL;
- unsigned int flags = 0;
- int ret = -1;
-
- interfaceDriverLock(driver);
-
- iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
- if (!iface) {
- /* helper already reported error */
- goto cleanup;
- }
-
- if (ncf_if_status(iface, &flags) < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to get status of interface %s: %s%s%s"),
- ifinfo->name, errmsg, details ? " - " : "",
- details ? details : "");
- goto cleanup;
- }
-
- ret = flags & NETCF_IFACE_ACTIVE ? 1 : 0;
-
-cleanup:
- ncf_if_free(iface);
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-#ifdef HAVE_NETCF_TRANSACTIONS
-static int interfaceChangeBegin(virConnectPtr conn, unsigned int flags)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- int ret;
-
- virCheckFlags(0, -1); /* currently flags must be 0 */
-
- interfaceDriverLock(driver);
-
- ret = ncf_change_begin(driver->netcf, 0);
- if (ret < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to begin transaction: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- }
-
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static int interfaceChangeCommit(virConnectPtr conn, unsigned int flags)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- int ret;
-
- virCheckFlags(0, -1); /* currently flags must be 0 */
-
- interfaceDriverLock(driver);
-
- ret = ncf_change_commit(driver->netcf, 0);
- if (ret < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to commit transaction: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- }
-
- interfaceDriverUnlock(driver);
- return ret;
-}
-
-static int interfaceChangeRollback(virConnectPtr conn, unsigned int flags)
-{
- struct interface_driver *driver = conn->interfacePrivateData;
- int ret;
-
- virCheckFlags(0, -1); /* currently flags must be 0 */
-
- interfaceDriverLock(driver);
-
- ret = ncf_change_rollback(driver->netcf, 0);
- if (ret < 0) {
- const char *errmsg, *details;
- int errcode = ncf_error(driver->netcf, &errmsg, &details);
- virReportError(netcf_to_vir_err(errcode),
- _("failed to rollback transaction: %s%s%s"),
- errmsg, details ? " - " : "",
- details ? details : "");
- }
-
- interfaceDriverUnlock(driver);
- return ret;
-}
-#endif /* HAVE_NETCF_TRANSACTIONS */
-
-static virInterfaceDriver interfaceDriver = {
- "Interface",
- .open = interfaceOpenInterface, /* 0.7.0 */
- .close = interfaceCloseInterface, /* 0.7.0 */
- .numOfInterfaces = interfaceNumOfInterfaces, /* 0.7.0 */
- .listInterfaces = interfaceListInterfaces, /* 0.7.0 */
- .numOfDefinedInterfaces = interfaceNumOfDefinedInterfaces, /* 0.7.0 */
- .listDefinedInterfaces = interfaceListDefinedInterfaces, /* 0.7.0 */
- .interfaceLookupByName = interfaceLookupByName, /* 0.7.0 */
- .interfaceLookupByMACString = interfaceLookupByMACString, /* 0.7.0 */
- .interfaceGetXMLDesc = interfaceGetXMLDesc, /* 0.7.0 */
- .interfaceDefineXML = interfaceDefineXML, /* 0.7.0 */
- .interfaceUndefine = interfaceUndefine, /* 0.7.0 */
- .interfaceCreate = interfaceCreate, /* 0.7.0 */
- .interfaceDestroy = interfaceDestroy, /* 0.7.0 */
- .interfaceIsActive = interfaceIsActive, /* 0.7.3 */
-#ifdef HAVE_NETCF_TRANSACTIONS
- .interfaceChangeBegin = interfaceChangeBegin, /* 0.9.2 */
- .interfaceChangeCommit = interfaceChangeCommit, /* 0.9.2 */
- .interfaceChangeRollback = interfaceChangeRollback, /* 0.9.2 */
-#endif /* HAVE_NETCF_TRANSACTIONS */
-};
-
-int interfaceRegister(void) {
- virRegisterInterfaceDriver(&interfaceDriver);
- return 0;
-}
diff --git a/src/interface/netcf_driver.h b/src/interface/netcf_driver.h
deleted file mode 100644
index 38fbc77..0000000
--- a/src/interface/netcf_driver.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * interface_driver.h: core driver methods for managing physical host interfaces
- *
- * Copyright (C) 2006, 2007 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
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Author: Laine Stump <laine(a)redhat.com>
- */
-
-
-#ifndef __VIR_INTERFACE__DRIVER_H
-# define __VIR_INTERFACE__DRIVER_H
-
-int interfaceRegister(void);
-
-#endif /* __VIR_INTERFACE__DRIVER_H */
diff --git a/src/util/util.c b/src/util/util.c
index 9068e0f..793f803 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1251,39 +1251,52 @@ int virDirCreate(const char *path ATTRIBUTE_UNUSED,
}
#endif /* WIN32 */
+#define here fprintf(stderr, "%s:%d %s\n", __func__, __LINE__, path)
+
static int virFileMakePathHelper(char *path, mode_t mode)
{
struct stat st;
char *p;
if (stat(path, &st) >= 0) {
- if (S_ISDIR(st.st_mode))
+ if (S_ISDIR(st.st_mode)) {
+ here;
return 0;
+ }
errno = ENOTDIR;
+ here;
return -1;
}
- if (errno != ENOENT)
+ if (errno != ENOENT) {
+ here;
return -1;
+ }
if ((p = strrchr(path, '/')) == NULL) {
errno = EINVAL;
+ here;
return -1;
}
if (p != path) {
*p = '\0';
- if (virFileMakePathHelper(path, mode) < 0)
+ if (virFileMakePathHelper(path, mode) < 0) {
+ here;
return -1;
+ }
*p = '/';
}
- if (mkdir(path, mode) < 0 && errno != EEXIST)
+ if (mkdir(path, mode) < 0 && errno != EEXIST) {
+ here;
return -1;
+ }
+ here;
return 0;
}
diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c
index 4d6e91e..8762de4 100644
--- a/tests/virdrivermoduletest.c
+++ b/tests/virdrivermoduletest.c
@@ -79,7 +79,7 @@ mymain(void)
#ifdef WITH_NWFILTER
TEST("nwfilter", NULL);
#endif
-#ifdef WITH_NETCF
+#ifdef WITH_INTERFACE
TEST("interface", NULL);
#endif
#ifdef WITH_QEMU
diff --git a/tools/virsh.c b/tools/virsh.c
index 7a5b92c..b8ec663 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2643,8 +2643,8 @@ vshShowVersion(vshControl *ctl ATTRIBUTE_UNUSED)
#ifdef WITH_BRIDGE
vshPrint(ctl, " Bridging");
#endif
-#ifdef WITH_NETCF
- vshPrint(ctl, " Interface");
+#if defined(WITH_INTERFACE) && defined(WITH_NETCF)
+ vshPrint(ctl, " Interface (netcf)");
#endif
#ifdef WITH_NWFILTER
vshPrint(ctl, " Nwfilter");
--
1.7.8.6
12 years, 2 months
[libvirt] [PATCH 0/1] Migrate per-port data during Qemu Live Migration
by Kyle Mestery
Open vSwitch controllers may store per-port data in the OVS DB on a host. This is
an opaque data blob utilized by a controller to store information relevant to the
port itself. This patch provides a mechanism for this to migrate with the virtual
machine during live migration by adding code to the V3 migration protocol.
Tested migration with "virtualport type='openvswitch'", both with and without this
per-port data. Also tested migration with non-OVS bridges.
Kyle Mestery (1):
Add the ability to migrate per-port data on Open vSwitch ports
during qemu live migration. A controller can use this to store
data relating to each port, and have it migrated with the virtual
machine and populated on the destination host.
src/qemu/qemu_migration.c | 248 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 246 insertions(+), 2 deletions(-)
--
1.7.11.4
12 years, 2 months
[libvirt] Libvirt 0.10.0-rc1 segfaults when daemon run as root
by Shawn Furrow
Hi all,
For some reason when I run "libvirtd -d" as root it seems to not start. I
investigate by running "libvirtd -v" as root and I get a segfault. Here is
the output:
2012-08-23 19:01:23.237+0000: 27464: info : libvirt version: 0.10.0
> 2012-08-23 19:01:23.237+0000: 27464: error : virDriverLoadModule:78 :
> failed to load module
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so: undefined
> symbol: virSecurityManagerGetProcessLabel
> 2012-08-23 19:01:23.238+0000: 27464: error : virDriverLoadModule:78 :
> failed to load module
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_lxc.so
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_lxc.so: undefined
> symbol: virSecurityManagerGetProcessLabel
> Caught Segmentation violation dumping internal log buffer:
>
> ====== start of log =====
> 2012-08-23 19:01:23.235+000027464: debug : main:1120 : Decided on pid file
> path '/usr/local/var/run/libvirtd.pid'
> 2012-08-23 19:01:23.235+000027464: debug : main:1130 : Decided on socket
> paths '/usr/local/var/run/libvirt/libvirt-sock' and
> '/usr/local/var/run/libvirt/libvirt-sock-ro'
> 2012-08-23 19:01:23.235+000027464: debug : main:1168 : Ensuring run dir
> '/usr/local/var/run/libvirt' exists
> 2012-08-23 19:01:23.235+000027464: debug : virEventRegisterDefaultImpl:204
> : registering default event implementation
> 2012-08-23 19:01:23.235+000027464: debug : virEventPollAddHandle:111 :
> Used 0 handle slots, adding at least 10 more
> 2012-08-23 19:01:23.235+000027464: debug : virEventPollInterruptLocked:697
> : Skip interrupt, 0 0
> 2012-08-23 19:01:23.236+000027464: debug : virEventPollAddHandle:136 :
> EVENT_POLL_ADD_HANDLE: watch=1 fd=5 events=1 cb=0x7f323cd415a0 opaque=(nil)
> ff=(nil)
> 2012-08-23 19:01:23.236+000027464: debug : virEventRegisterImpl:177 :
> addHandle=0x7f323cd423d0 updateHandle=0x7f323cd414a0
> removeHandle=0x7f323cd41360 addTimeout=0x7f323cd42220
> updateTimeout=0x7f323cd415e0 removeTimeout=0x7f323cd41260
> 2012-08-23 19:01:23.236+000027464: debug : virNetServerNew:407 :
> srv=0xdd8890 refs=1
> 2012-08-23 19:01:23.236+000027464: debug : main:1206 : Dropping privileges
> (if required)
> 2012-08-23 19:01:23.236+000027464: debug : virDriverModuleInitialize:53 :
> Module dir /usr/local/lib/libvirt/connection-driver
> 2012-08-23 19:01:23.236+000027464: debug : virDriverLoadModule:66 : Module
> load network
> 2012-08-23 19:01:23.236+000027464: debug : virRegisterNetworkDriver:564 :
> registering Network as network driver 4
> 2012-08-23 19:01:23.236+000027464: debug : virDriverLoadModule:66 : Module
> load storage
> 2012-08-23 19:01:23.236+000027464: debug : virRegisterStorageDriver:624 :
> registering storage as storage driver 4
> 2012-08-23 19:01:23.236+000027464: debug : virDriverLoadModule:66 : Module
> load secret
> 2012-08-23 19:01:23.237+000027464: debug : virRegisterSecretDriver:684 :
> registering secret as secret driver 3
> 2012-08-23 19:01:23.237+000027464: debug : virDriverLoadModule:66 : Module
> load nwfilter
> 2012-08-23 19:01:23.237+000027464: debug : virRegisterNWFilterDriver:714 :
> registering nwfilter as network filter driver 3
> 2012-08-23 19:01:23.237+000027464: debug : virDriverLoadModule:66 : Module
> load qemu
> 2012-08-23 19:01:23.237+000027464: error : virDriverLoadModule:78 : failed
> to load module
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so: undefined
> symbol: virSecurityManagerGetProcessLabel
> 2012-08-23 19:01:23.238+000027464: debug : virDriverLoadModule:66 : Module
> load lxc
> 2012-08-23 19:01:23.238+000027464: error : virDriverLoadModule:78 : failed
> to load module
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_lxc.so
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_lxc.so: undefined
> symbol: virSecurityManagerGetProcessLabel
> 2012-08-23 19:01:23.238+000027464: debug : virDriverLoadModule:66 : Module
> load uml
> 2012-08-23 19:01:23.238+000027464: debug : virRegisterDriver:732 :
> driver=0x7f3232ec7760 name=UML
> 2012-08-23 19:01:23.238+000027464: debug : virRegisterDriver:747 :
> registering UML as driver 6
> 2012-08-23 19:01:23.238+000027464: debug : virDriverLoadModule:66 : Module
> load xen
> 2012-08-23 19:01:23.239+000027464: debug : virRegisterDriver:732 :
> driver=0x7f3232caad00 name=Xen
> 2012-08-23 19:01:23.239+000027464: debug : virRegisterDriver:747 :
> registering Xen as driver 7
> 2012-08-23 19:01:23.239+000027464: debug : virNetServerProgramNew:63 :
> prog=0xddca40 refs=1
> 2012-08-23 19:01:23.239+000027464: debug : virNetServerProgramRef:84 :
> prog=0xddca40 refs=2
> 2012-08-23 19:01:23.239+000027464: debug : virNetServerProgramNew:63 :
> prog=0xddcbc0 refs=1
> 2012-08-23 19:01:23.239+000027464: debug : virNetServerProgramRef:84 :
> prog=0xddcbc0 refs=2
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollInterruptLocked:697
> : Skip interrupt, 0 0
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollAddHandle:136 :
> EVENT_POLL_ADD_HANDLE: watch=2 fd=7 events=1 cb=0x7f323ce241e0
> opaque=0xdd8890 ff=(nil)
> 2012-08-23 19:01:23.239+000027464: debug : main:1257 : Attempting to
> configure auditing subsystem
> 2012-08-23 19:01:23.239+000027464: debug : main:1263 : Proceeding without
> auditing
> 2012-08-23 19:01:23.239+000027464: debug : virHookCheck:119 : No hook
> script /usr/local/etc/libvirt/hooks/daemon
> 2012-08-23 19:01:23.239+000027464: debug : virHookCheck:119 : No hook
> script /usr/local/etc/libvirt/hooks/qemu
> 2012-08-23 19:01:23.239+000027464: debug : virHookCheck:119 : No hook
> script /usr/local/etc/libvirt/hooks/lxc
> 2012-08-23 19:01:23.239+000027464: debug : daemonSetupNetworking:464 :
> Registering unix socket /usr/local/var/run/libvirt/libvirt-sock
> 2012-08-23 19:01:23.239+000027464: debug : virNetSocketNew:119 :
> localAddr=0x7fff419bf530 remoteAddr=(nil) fd=9 errfd=-1 pid=0
> 2012-08-23 19:01:23.239+000027464: debug : virNetSocketNew:179 :
> RPC_SOCKET_NEW: sock=0xddcbf0 refs=1 fd=9 errfd=-1 pid=0
> localAddr=127.0.0.1;0, remoteAddr=(null)
> 2012-08-23 19:01:23.239+000027464: debug : virNetSocketRef:713 :
> RPC_SOCKET_REF: sock=0xddcbf0 refs=2
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollInterruptLocked:697
> : Skip interrupt, 0 0
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollAddHandle:136 :
> EVENT_POLL_ADD_HANDLE: watch=3 fd=9 events=0 cb=0x7f323ce2ab10
> opaque=0xddcbf0 ff=0x7f323ce2ba60
> 2012-08-23 19:01:23.239+000027464: debug : daemonSetupNetworking:474 :
> Registering unix socket /usr/local/var/run/libvirt/libvirt-sock-ro
> 2012-08-23 19:01:23.239+000027464: debug : virNetSocketNew:119 :
> localAddr=0x7fff419bf530 remoteAddr=(nil) fd=10 errfd=-1 pid=0
> 2012-08-23 19:01:23.239+000027464: debug : virNetSocketNew:179 :
> RPC_SOCKET_NEW: sock=0xddd430 refs=1 fd=10 errfd=-1 pid=0
> localAddr=127.0.0.1;0, remoteAddr=(null)
> 2012-08-23 19:01:23.239+000027464: debug : virNetSocketRef:713 :
> RPC_SOCKET_REF: sock=0xddd430 refs=2
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollInterruptLocked:697
> : Skip interrupt, 0 0
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollAddHandle:136 :
> EVENT_POLL_ADD_HANDLE: watch=4 fd=10 events=0 cb=0x7f323ce2ab10
> opaque=0xddd430 ff=0x7f323ce2ba60
> 2012-08-23 19:01:23.239+000027464: debug : virNetServerRef:420 :
> srv=0xdd8890 refs=2
> 2012-08-23 19:01:23.239+000027464: debug : virNetlinkEventServiceStart:656
> : libnl was not available at build time
> 2012-08-23 19:01:23.239+000027464: debug : virNetServerRun:714 :
> srv=0xdd8890 quit=0
> 2012-08-23 19:01:23.239+000027464: debug : virEventRunDefaultImpl:244 :
> running default event implementation
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollCleanupTimeouts:501
> : Cleanup 0
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollCleanupTimeouts:537
> : Found 0 out of 0 timeout slots used, releasing 0
> 2012-08-23 19:01:23.239+000027464: debug : virEventPollCleanupHandles:549
> : Cleanup 4
> 2012-08-23 19:01:23.240+000027464: debug : virEventPollMakePollFDs:378 :
> Prepare n=0 w=1, f=5 e=1 d=0
> 2012-08-23 19:01:23.240+000027475: debug : virStateInitialize:798 :
> Running global init for Remote state driver
> 2012-08-23 19:01:23.240+000027475: debug : virStateInitialize:798 :
> Running global init for Network state driver
> 2012-08-23 19:01:23.240+000027464: debug : virEventPollMakePollFDs:378 :
> Prepare n=1 w=2, f=7 e=1 d=0
> 2012-08-23 19:01:23.240+000027464: debug : virEventPollMakePollFDs:378 :
> Prepare n=2 w=3, f=9 e=0 d=0
> 2012-08-23 19:01:23.240+000027464: debug : virEventPollMakePollFDs:378 :
> Prepare n=3 w=4, f=10 e=0 d=0
> 2012-08-23 19:01:23.240+000027464: debug :
> virEventPollCalculateTimeout:320 : Calculate expiry of 0 timers
> 2012-08-23 19:01:23.240+000027464: debug :
> virEventPollCalculateTimeout:346 : Timeout at 0 due in -1 ms
> 2012-08-23 19:01:23.240+000027464: debug : virEventPollRunOnce:614 :
> EVENT_POLL_RUN: nhandles=2 timeout=-1
>
> ====== end of log =====
> Segmentation fault/
However, when I run "libvirtd -d" as me, it does not segfault and continues
running. However I cannot connect to the libvirt-sock because it gets
created at "$HOME/.cache/libvirt/libvirt-sock" but virsh looks for it at
"/usr/local/var/run/libvirt-sock".
Here is what I get when I run "libvirtd -v" as me:
2012-08-23 19:02:15.145+0000: 27483: info : libvirt version: 0.10.0
> 2012-08-23 19:02:15.145+0000: 27483: error : virDriverLoadModule:78 :
> failed to load module
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so: undefined
> symbol: virSecurityManagerGetProcessLabel
> 2012-08-23 19:02:15.145+0000: 27483: error : virDriverLoadModule:78 :
> failed to load module
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_lxc.so
> /usr/local/lib/libvirt/connection-driver/libvirt_driver_lxc.so: undefined
> symbol: virSecurityManagerGetProcessLabel
Any ideas why this is happening? I am on Ubuntu 10.04 running libvirt
0.10.0 with qemu-kvm 1.1
Thanks,
Shawn
--
Virginia Tech
Bradley Department of Electrical and Computer Engineering
B.S. Electrical Engineering
B.S. Computer Engineering
12 years, 2 months
[libvirt] [perl-Sys-Virt][PATCH] Virt.xs: fix flag issue on set_scheduler_parameters
by Alex Jia
From: Alex Jia <Alex Jia ajia(a)redhat.com>
The default flags are inconsistent on both qemuSetSchedulerParameters()
and qemuGetSchedulerParameters() in libvirt, the qemuGetSchedulerParameters()
always passes 'VIR_DOMAIN_AFFECT_CURRENT' flag to the qemuGetSchedulerParametersFlags(),
it should be a expected behavior, but the qemuSetSchedulerParameters() always passes
'VIR_DOMAIN_AFFECT_LIVE' flag to the qemuSetSchedulerParametersFlags(), if users use
default flag=0 or explicitly give a 'VIR_DOMAIN_AFFECT_CURRENT' flag to the
set_scheduler_parameters() in perl-Sys-Virt, because the flag value is 0, the result is
the virDomainSetSchedulerParameters() is called incorrectly.
How to reproduce?
# cat test.pl
#!/usr/bin/env perl
use warnings;
use strict;
use Sys::Virt;
my $uri = "qemu:///system";
my $domname = "foo"; # change your guest name
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
my %sched_param = (Sys::Virt::Domain::SCHEDULER_CPU_SHARES=>1);
$dom->set_scheduler_parameters(\%sched_param, Sys::Virt::Domain::AFFECT_CURRENT);
# perl test.pl
libvirt error code: 55, message: Requested operation is not valid: domain is not running
Signed-off-by: Alex Jia <Alex Jia ajia(a)redhat.com>
---
Virt.xs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Virt.xs b/Virt.xs
index 2b8d74c..0ebf95d 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -2833,7 +2833,7 @@ set_scheduler_parameters(dom, newparams, flags=0)
}
}
vir_typed_param_from_hv(newparams, params, nparams);
- if (flags) {
+ if (flags != 1) {
if (virDomainSetSchedulerParametersFlags(dom, params, nparams, flags) < 0)
_croak_error();
} else {
--
1.7.1
12 years, 2 months
[libvirt] [PATCH][TCK] add script to test storage and vol get commands
by Kyla Zhang
including
pool->get_uuid
pool->get_name
pool->refresh
pool->get_volume_by_name
vol->get_name
vol->get_key
vol->get_path
vol->get_info
vmm->get_storage_pool_by_uuid
---
scripts/storage/120-get-ops.t | 116 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 116 insertions(+), 0 deletions(-)
create mode 100644 scripts/storage/120-get-ops.t
diff --git a/scripts/storage/120-get-ops.t b/scripts/storage/120-get-ops.t
new file mode 100644
index 0000000..bf1f279
--- /dev/null
+++ b/scripts/storage/120-get-ops.t
@@ -0,0 +1,116 @@
+# -*- perl -*-
+#
+# Copyright (C) 2012 Red Hat, Inc.
+# Copyright (C) 2012 Kyla Zhang <weizhan(a)redhat.com>
+#
+# This program is free software; You can redistribute it and/or modify
+# it under the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any
+# later version
+#
+# The file "LICENSE" distributed along with this file provides full
+# details of the terms and conditions
+#
+
+=pod
+
+=head1 NAME
+
+storage/120-get-opts.t - Get command testing for pool and vol including
+pool->get_uuid
+pool->get_name
+pool->refresh
+pool->get_volume_by_name
+vol->get_name
+vol->get_key
+vol->get_path
+vol->get_info
+
+=head1 DESCRIPTION
+
+The test case validates the get commands for pool and vol works well
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 15;
+
+use Sys::Virt::TCK;
+use Test::Exception;
+
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END { $tck->cleanup if $tck; }
+
+my $name = "tck1";
+my $xml = $tck->generic_pool("dir", $name)->as_xml;
+my $dir = $tck->create_empty_dir("storage-fs", $name);
+my $vol1_name = "tck_vol1";
+my $vol2_name = "tck_vol2";
+
+
+diag "Creating a new transient pool";
+my $pool;
+ok_pool(sub { $pool = $conn->create_storage_pool($xml) }, "created transient pool object");
+
+
+diag "Get pool uuid";
+my $pool_uuid=$pool->get_uuid();
+is ($conn->get_storage_pool_by_uuid($pool_uuid)->get_name(), $name, "Get pool uuid succeed");
+
+
+diag "Get pool name";
+is($pool->get_name(), $name, "Get pool name $name");
+
+
+diag "Get volume by name";
+my $vol1_xml = $tck->generic_volume($vol1_name, "raw", 1024*1024*50)->allocation(0)->as_xml;
+my $vol1 = $pool->create_volume($vol1_xml);
+is($pool->get_volume_by_name($vol1_name)->get_name(), $vol1_name, "Get volume $vol1_name");
+
+
+diag "Get volume without refresh after creating image with dd";
+system("dd if=/dev/zero of=$dir/$vol2_name count=7 bs=1048576");
+ok_error(sub { $pool->get_volume_by_name($vol2_name) },
+ "Can't get volume $vol2_name without refresh", Sys::Virt::Error::ERR_NO_STORAGE_VOL);
+
+
+diag "Refresh pool and get volume again";
+lives_ok(sub { $pool->refresh() }, "Pool refresh succeed");
+my $vol2=$pool->get_volume_by_name($vol2_name);
+is($vol2->get_name(), $vol2_name, "Get volume $vol2_name");
+
+
+diag "get vol key";
+my $vol2_key=xpath($vol2, "string(/volume/key)");
+is($vol2->get_key(), $vol2_key, "Get vol key $vol2_key");
+
+
+diag "Get vol path";
+my $vol2_path=xpath($vol2, "string(/volume/target/path)");
+is($vol2->get_path(), $vol2_path, "Get vol path $vol2_path");
+
+
+diag "Get vol info";
+is($vol2->get_info()->{type}, Sys::Virt::StorageVol::TYPE_FILE, "Get vol type file");
+my $vol2_capacity=xpath($vol2, "string(/volume/capacity)");
+is($vol2->get_info()->{capacity}, $vol2_capacity, "Get vol capacity $vol2_capacity");
+my $vol2_allocation=xpath($vol2, "string(/volume/allocation)");
+is($vol2->get_info()->{allocation}, $vol2_allocation, "Get vol allocation $vol2_allocation");
+
+
+diag "Destroy volume";
+lives_ok(sub { $vol1->delete(0) }, "deleted volume 1");
+lives_ok(sub { $vol2->delete(0) }, "deleted volume 2");
+
+diag "Destroying the transient pool";
+$pool->destroy;
+
+diag "Checking that transient pool has gone away";
+ok_error(sub { $conn->get_storage_pool_by_name("tck") }, "NO_POOL error raised from missing pool",
+ Sys::Virt::Error::ERR_NO_STORAGE_POOL);
+
+# end
--
1.7.1
12 years, 2 months
[libvirt] [PATCH] command: shell-quote when logging commands
by Eric Blake
Without this patch, logged command executions can be ambiguous if
the command contained any shell metacharacters. This has caused
more than one person to attempt to patch clients to add unnecessary
quoting, without realizing that the command itself was run with
correct args, and only the logged output was ambiguous.
* src/util/command.c (virCommandToString): Add shell escapes.
* tests/commandtest.c (test16): Test new behavior.
* tests/commanddata/test16.log: Update expected output.
* tests/qemuxml2argvdata/qemuxml2argv-*.args: Likewise.
* tests/networkxml2argvdata/*.argv: Likewise.
---
src/util/command.c | 25 ++++++++++++++++------
tests/commanddata/test16.log | 2 +-
tests/commandtest.c | 6 ++++--
.../nat-network-dns-txt-record.argv | 2 +-
.../qemuxml2argv-disk-drive-network-rbd-auth.args | 7 +++---
.../qemuxml2argv-disk-drive-network-rbd.args | 7 +++---
.../qemuxml2argv-graphics-vnc.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-qemu-ns.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-smbios.args | 6 +++---
9 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c
index 49ec178..418b198 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -1614,9 +1614,10 @@ virCommandWriteArgLog(virCommandPtr cmd, int logfd)
* virCommandToString:
* @cmd: the command to convert
*
- * Call after adding all arguments and environment settings, but before
- * Run/RunAsync, to return a string representation of the environment and
- * arguments of cmd. If virCommandRun cannot succeed (because of an
+ * Call after adding all arguments and environment settings, but
+ * before Run/RunAsync, to return a string representation of the
+ * environment and arguments of cmd, suitably quoted for pasting into
+ * a shell. If virCommandRun cannot succeed (because of an
* out-of-memory condition while building cmd), NULL will be returned.
* Caller is responsible for freeing the resulting string.
*/
@@ -1639,13 +1640,25 @@ virCommandToString(virCommandPtr cmd)
}
for (i = 0; i < cmd->nenv; i++) {
- virBufferAdd(&buf, cmd->env[i], strlen(cmd->env[i]));
+ /* In shell, a='b c' has a different meaning than 'a=b c', so
+ * we must determine where the '=' lives. */
+ char *eq = strchr(cmd->env[i], '=');
+
+ if (!eq) {
+ virBufferFreeAndReset(&buf);
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
+ return NULL;
+ }
+ eq++;
+ virBufferAdd(&buf, cmd->env[i], eq - cmd->env[i]);
+ virBufferEscapeShell(&buf, eq);
virBufferAddChar(&buf, ' ');
}
- virBufferAdd(&buf, cmd->args[0], strlen(cmd->args[0]));
+ virBufferEscapeShell(&buf, cmd->args[0]);
for (i = 1; i < cmd->nargs; i++) {
virBufferAddChar(&buf, ' ');
- virBufferAdd(&buf, cmd->args[i], strlen(cmd->args[i]));
+ virBufferEscapeShell(&buf, cmd->args[i]);
}
if (virBufferError(&buf)) {
diff --git a/tests/commanddata/test16.log b/tests/commanddata/test16.log
index 7088165..119dd29 100644
--- a/tests/commanddata/test16.log
+++ b/tests/commanddata/test16.log
@@ -1 +1 @@
-A=B true C
+A=B C=D E true F G H
diff --git a/tests/commandtest.c b/tests/commandtest.c
index b1c7523..c005153 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -607,12 +607,14 @@ static int test16(const void *unused ATTRIBUTE_UNUSED)
{
virCommandPtr cmd = virCommandNew("true");
char *outactual = NULL;
- const char *outexpect = "A=B true C";
+ const char *outexpect = "A=B C='D E' true F 'G H'";
int ret = -1;
int fd = -1;
virCommandAddEnvPair(cmd, "A", "B");
- virCommandAddArg(cmd, "C");
+ virCommandAddEnvPair(cmd, "C", "D E");
+ virCommandAddArg(cmd, "F");
+ virCommandAddArg(cmd, "G H");
if ((outactual = virCommandToString(cmd)) == NULL) {
virErrorPtr err = virGetLastError();
diff --git a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
index 1b31871..2a6c799 100644
--- a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
@@ -1,6 +1,6 @@
@DNSMASQ@ --strict-order --bind-interfaces \
--local=// --domain-needed --filterwin2k --conf-file= \
---except-interface lo --txt-record=example,example value \
+--except-interface lo '--txt-record=example,example value' \
--listen-address 192.168.122.1 --listen-address 192.168.123.1 \
--listen-address 2001:db8:ac10:fe01::1 \
--listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args
index b323e91..02a9869 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args
@@ -2,9 +2,10 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -drive \
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 -drive \
-file=rbd:pool/image:\
+'file=rbd:pool/image:\
id=myname:\
key=QVFDVm41aE82SHpGQWhBQXEwTkN2OGp0SmNJY0UrSE9CbE1RMUE=:\
auth_supported=cephx\;none:\
-mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;mon3.example.org\:6322,\
-if=virtio,format=raw -net none -serial none -parallel none -usb
+mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;\
+mon3.example.org\:6322,\
+if=virtio,format=raw' -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args
index 69cf7c7..61c8f7d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args
@@ -2,6 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -drive \
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 -drive \
-file=rbd:pool/image:auth_supported=none:\
-mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;mon3.example.org\:6322,\
-if=virtio,format=raw -net none -serial none -parallel none -usb
+'file=rbd:pool/image:auth_supported=none:\
+mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;\
+mon3.example.org\:6322,\
+if=virtio,format=raw' -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args
index 2af1540..af99225 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args
@@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor unix:/tmp/test-monitor,server,\
nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none \
--parallel none -usb -vnc [2001:1:2:3:4:5:1234:1234]:3
+-parallel none -usb -vnc '[2001:1:2:3:4:5:1234:1234]:3'
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns.args b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns.args
index 19450a1..88bdd13 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns.args
@@ -1,4 +1,4 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test NS=ns BAR= \
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test NS=ns BAR='' \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -unknown \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smbios.args b/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
index 3f6cb81..ac28bad 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
@@ -1,7 +1,7 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
-pc -m 214 -smp 1 -smbios type=0,vendor=LENOVO,version=6FET82WW (3.12 ) -smbios \
-type=1,manufacturer=Fedora,product=Virt-Manager,version=0.8.2-3.fc14,\
+pc -m 214 -smp 1 -smbios 'type=0,vendor=LENOVO,version=6FET82WW (3.12 )' \
+-smbios 'type=1,manufacturer=Fedora,product=Virt-Manager,version=0.8.2-3.fc14,\
serial=32dfcb37-5af1-552b-357c-be8c3aa38310,\
-uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809,sku=1234567890,family=Red Hat \
+uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809,sku=1234567890,family=Red Hat' \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
--
1.7.11.4
12 years, 2 months