[libvirt] Supporting vhost-net and macvtap in libvirt for QEMU
by Anthony Liguori
Disclaimer: I am neither an SR-IOV nor a vhost-net expert, but I've CC'd
people that are who can throw tomatoes at me for getting bits wrong :-)
I wanted to start a discussion about supporting vhost-net in libvirt.
vhost-net has not yet been merged into qemu but I expect it will be soon
so it's a good time to start this discussion.
There are two modes worth supporting for vhost-net in libvirt. The
first mode is where vhost-net backs to a tun/tap device. This is
behaves in very much the same way that -net tap behaves in qemu today.
Basically, the difference is that the virtio backend is in the kernel
instead of in qemu so there should be some performance improvement.
Current, libvirt invokes qemu with -net tap,fd=X where X is an already
open fd to a tun/tap device. I suspect that after we merge vhost-net,
libvirt could support vhost-net in this mode by just doing -net
vhost,fd=X. I think the only real question for libvirt is whether to
provide a user visible switch to use vhost or to just always use vhost
when it's available and it makes sense. Personally, I think the later
makes sense.
The more interesting invocation of vhost-net though is one where the
vhost-net device backs directly to a physical network card. In this
mode, vhost should get considerably better performance than the current
implementation. I don't know the syntax yet, but I think it's
reasonable to assume that it will look something like -net
tap,dev=eth0. The effect will be that eth0 is dedicated to the guest.
On most modern systems, there is a small number of network devices so
this model is not all that useful except when dealing with SR-IOV
adapters. In that case, each physical device can be exposed as many
virtual devices (VFs). There are a few restrictions here though. The
biggest is that currently, you can only change the number of VFs by
reloading a kernel module so it's really a parameter that must be set at
startup time.
I think there are a few ways libvirt could support vhost-net in this
second mode. The simplest would be to introduce a new tag similar to
<source network='br0'>. In fact, if you probed the device type for the
network parameter, you could probably do something like <source
network='eth0'> and have it Just Work.
Another model would be to have libvirt see an SR-IOV adapter as a
network pool whereas it handled all of the VF management. Considering
how inflexible SR-IOV is today, I'm not sure whether this is the best model.
Has anyone put any more thought into this problem or how this should be
modeled in libvirt? Michael, could you share your current thinking for
-net syntax?
--
Regards,
Anthony Liguori
1 year
[libvirt] [PATCH] qemu: add PCI-multibus support for ppc
by Olivia Yin
Signed-off-by: Olivia Yin <hong-hua.yin(a)freescale.com>
---
src/qemu/qemu_capabilities.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7bc1ebc..7d7791d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2209,6 +2209,11 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid)
virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI);
}
+ /* ppc support PCI-multibus */
+ if (qemuCaps->arch == VIR_ARCH_PPC) {
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
+ }
+
/* virQEMUCapsExtractDeviceStr will only set additional caps if qemu
* understands the 0.13.0+ notion of "-device driver,". */
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
@@ -2450,6 +2455,11 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
}
+ /* ppc support PCI-multibus */
+ if (qemuCaps->arch == VIR_ARCH_PPC) {
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
+ }
+
if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
goto cleanup;
if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0)
--
1.6.4
10 years, 8 months
[libvirt] JNA Error Callback could cause core dump.
by Benjamin Wang (gendwang)
Hi,
When I changed code as following:
public class Connect {
// Load the native part
static {
Libvirt.INSTANCE.virInitialize();
try {
ErrorHandler.processError(Libvirt.INSTANCE);
} catch (Exception e) {
e.printStackTrace();
}
+ Libvirt.INSTANCE.virSetErrorFunc(null, new ErrorCallback());
}
The server will generate the following core dump:
Program terminated with signal 6, Aborted.
#0 0x0000003f9b030265 in raise () from /lib64/libc.so.6
(gdb) where
#0 0x0000003f9b030265 in raise () from /lib64/libc.so.6
#1 0x0000003f9b031d10 in abort () from /lib64/libc.so.6
#2 0x0000003f9b06a84b in __libc_message () from /lib64/libc.so.6
#3 0x0000003f9b07230f in _int_free () from /lib64/libc.so.6
#4 0x0000003f9b07276b in free () from /lib64/libc.so.6
#5 0x00002aaaacf46868 in ?? ()
#6 0x0000000000000000 in ?? ()
The problem was caused that when JNA call setErrorFunc, it will create ErrorCallback object. But when GC is executed, the object is GCed. But even I change code as following.
When GC is excuted, the callback object will be moved. Then C can't find this object. Both of scenarios will cause core dump. It seems that JNA mustn't provide ErrorCallback Class,
Because nobody can use this.
Please correct me.
public class Connect {
+ private static final ErrorCallback callback = new ErrorCallback();
// Load the native part
static {
Libvirt.INSTANCE.virInitialize();
try {
ErrorHandler.processError(Libvirt.INSTANCE);
} catch (Exception e) {
e.printStackTrace();
}
+ Libvirt.INSTANCE.virSetErrorFunc(null, callback);
}
B.R.
Benjamin Wang
10 years, 11 months
[libvirt] [PATCH] libxl: allow an <emulator> to be selected in the domain config XML
by David Scott
The emulator path supplied can be any valid path on the system.
Note that when setting a device_model, libxl needs us to set the
device_model_version too. The device_model_version can be either
...QEMU_XEN: meaning "upstream qemu", the default in xen-4.3 onwards
...QEMU_XEN_TRADITIONAL: the old xen-specific fork
We detect the device_model_version by examining the qemu filename:
if it is "qemu-dm" then it's the old xen-specific fork. If anything
else then we assume "upstream qemu" (whose filename may change
in future). Note that if you are using a wrapper script to (eg)
adjust the arguments of the old qemu during development, you will
have to ensure the wrapper script also has the name "qemu-dm", by
placing it in a separate directory.
Signed-off-by: David Scott <dave.scott(a)eu.citrix.com>
---
src/libxl/libxl_conf.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 7e0753a..2aa5a62 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -788,6 +788,46 @@ libxlMakeCapabilities(libxl_ctx *ctx)
}
int
+libxlMakeEmulator(virDomainDefPtr def, libxl_domain_config *d_config)
+{
+ /* No explicit override means use the default */
+ if (!def->emulator) {
+ return 0;
+ }
+
+ if (!virFileExists(def->emulator)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("emulator '%s' not found"),
+ def->emulator);
+ return -1;
+ }
+
+ VIR_FREE(d_config->b_info.device_model);
+ if ((d_config->b_info.device_model = strdup(def->emulator)) == NULL) {
+ virReportOOMError();
+ return -1;
+ }
+
+ /* N.B. from xen/tools/libxl/libxl_types.idl:
+ * "If setting device_model you must set device_model_version too."
+ *
+ * The xen-4.3 and later default is "upstream qemu" (QEMU_XEN)
+ * so we make that the default and special-case the old-style
+ * "traditional qemu" (QEMU_XEN_TRADITIONAL)
+ */
+
+ d_config->b_info.device_model_version =
+ LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
+
+ if (STREQ(basename(def->emulator), "qemu-dm"))
+ d_config->b_info.device_model_version =
+ LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+
+ return 0;
+}
+
+
+int
libxlBuildDomainConfig(libxlDriverPrivatePtr driver,
virDomainDefPtr def, libxl_domain_config *d_config)
{
@@ -811,6 +851,10 @@ libxlBuildDomainConfig(libxlDriverPrivatePtr driver,
goto error;
}
+ if (libxlMakeEmulator(def, d_config) < 0) {
+ goto error;
+ }
+
d_config->on_reboot = def->onReboot;
d_config->on_poweroff = def->onPoweroff;
d_config->on_crash = def->onCrash;
--
1.7.1
11 years, 5 months
[libvirt] [PATCH 00/12] A bunch of extensions to libxl driver
by Marek Marczykowski
This are some additional features to libxl driver. Some of them require change
in domain config structures/syntax. Details described with each patch.
The last two patches are bugfix for deadlock during daemon startup.
Marek Marczykowski (12):
libxl: allow script for any network interface, not only bridge
libxl: PCI passthrough support
libxl: nodeDevice* support for PCI devices
libxl: populate xenstore memory entries at startup
conf: add 'script' attribute to disk specification
libxl: use disk 'script' attribute
conf: support backend domain name in disk and network devices
libxl: support backend domain setting for disk and net devices
libxl: fill HVM SDL and VNC settings based on <graphics/> entries
RFC: libxl: special 'stubdom-dm' emulator to use qemu in stub domain
conf: virDomainObjListRemoveLocked function
libxl: fix deadlock in libxlReconnectDomain
docs/schemas/domaincommon.rng | 14 ++
src/conf/domain_conf.c | 54 ++++++++
src/conf/domain_conf.h | 5 +
src/libvirt_private.syms | 1 +
src/libxl/libxl_conf.c | 297 +++++++++++++++++++++++++++++++++---------
src/libxl/libxl_conf.h | 6 +-
src/libxl/libxl_driver.c | 253 +++++++++++++++++++++++++++++++----
7 files changed, 545 insertions(+), 85 deletions(-)
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH] nwfilter: Remove error report in virNWFilterDHCPSnoopEnd
by Stefan Berger
Remove error reporting when calling the virNWFilterDHCPSnoopEnd
function with an interface for which no thread is snooping traffic.
Document the usage of this function.
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
---
src/nwfilter/nwfilter_dhcpsnoop.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
Index: libvirt/src/nwfilter/nwfilter_dhcpsnoop.c
===================================================================
--- libvirt.orig/src/nwfilter/nwfilter_dhcpsnoop.c
+++ libvirt/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -2117,6 +2117,16 @@ err_exit:
return -1;
}
+/**
+ * End a DHCP snoop thread on the given interface or end all
+ * DHCP snoop threads.
+ *
+ * @ifname: Name of an interface or NULL to stop all snoop threads
+ *
+ * It is not an error to call this function with an interface name
+ * for which no thread is snooping traffic. In this case the call will
+ * be a no-op.
+ */
void
virNWFilterDHCPSnoopEnd(const char *ifname)
{
@@ -2130,11 +2140,8 @@ virNWFilterDHCPSnoopEnd(const char *ifna
if (ifname) {
ifkey = (char *)virHashLookup(virNWFilterSnoopState.ifnameToKey,
ifname);
- if (!ifkey) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("ifname \"%s\" not in key map"), ifname);
+ if (!ifkey)
goto cleanup;
- }
ignore_value(virHashRemoveEntry(virNWFilterSnoopState.ifnameToKey,
ifname));
11 years, 6 months
[libvirt] [PATCH 0/2] qemu: Rework CD/DVD changing
by Michal Privoznik
The first patch is bare bug fix (without any bug reported though).
The second is again a bug fix, but not so easy to spot. Basically, when we
change a media, we should issue 'eject' first, then wait until the tray gets
open, after which we can finally issue 'change' command. Even for bare 'eject'
we ought to check status, shouldn't we?
Michal Privoznik (2):
qemu_monitor: Fix tray-open attribute in query-block
qemu_hotplug: Rework media changing process
src/qemu/qemu_hotplug.c | 51 +++++++++++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor_json.c | 2 +-
src/qemu/qemu_monitor_text.c | 6 +++---
3 files changed, 52 insertions(+), 7 deletions(-)
--
1.8.0.2
11 years, 6 months
[libvirt] New application
by Maciej Nabożny
Hello,
I'm developer of CC1 project in Institute of Nuclear Physics in
Cracow. We are creating cloud computing system based on Libvirt. Is it
possible to add link to our project at yours website in applications
section?
Title: CC1 Project (http://cc1.ifj.edu.pl)
Description: The Cloud Computing for Science and Economy project
At this time we are using version 0.8.3, but as soon as debian 7 will
we stable, we are going to migrate to newer version of Libvirt.
Regards,
Maciej Nabożny
11 years, 6 months