[libvirt] [PATCH] Fix compile error for stable 1.2.9
by Yang hongyang
Seems a backport miss. An extra member is passed to struct
virLXCBasicMountInfo.
Signed-off-by: Yang hongyang <hongyang.yang(a)easystack.cn>
---
src/lxc/lxc_container.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 28dabec..1c65fa9 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -760,7 +760,7 @@ typedef struct {
static const virLXCBasicMountInfo lxcBasicMounts[] = {
{ "proc", "/proc", "proc", MS_NOSUID|MS_NOEXEC|MS_NODEV, false, false },
- { "/proc/sys", "/proc/sys", NULL, MS_BIND|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false, false },
+ { "/proc/sys", "/proc/sys", NULL, MS_BIND|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false },
{ "sysfs", "/sys", "sysfs", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false },
{ "securityfs", "/sys/kernel/security", "securityfs", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, true, true },
#if WITH_SELINUX
--
1.7.1
11 months, 2 weeks
[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
11 months, 2 weeks
[libvirt] [PATCH v2] qemu: command: align disk serial check to schema
by Nikolay Shirokovskiy
Disk serial schema has extra '.+' allowed characters in comparison
with check in code. Looks like there is no reason for that as qemu
allows any character AFAIK for serial. This discrepancy is originated
in 85d15b51 where ability to add serial was added.
---
Diff from v1:
* fix xml2argv disk serial test to use all valid chars
Looks like there is no existing infrastructure to test every invalid character.
src/qemu/qemu_command.c | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c76f923..c5369b0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -432,7 +432,7 @@ qemuBuildIoEventFdStr(virBufferPtr buf,
}
#define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ "
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+"
static int
qemuSafeSerialParamValue(const char *value)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
index 2cefdca..fa0fc93 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
@@ -18,6 +18,6 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive 'file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-1,\
-serial=\ \ WD-WMAP9A966149' \
+serial=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_\ .+' \
-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
index 565462e..d54d73b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
@@ -17,7 +17,7 @@
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
- <serial> WD-WMAP9A966149</serial>
+ <serial>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+</serial>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='usb' index='0'/>
--
1.8.3.1
7 years, 1 month
[libvirt] [PATCH RESEND] Interface: return appropriate status for bridge device
by Lin Ma
In function udevInterfaceIsActive, The current design relies on the sys
attribute 'operstate' to determine whether the interface is active.
For the device node of virtual network(say virbr0), There is already a
dummy tap device to maintain a fixed mac on it, So it's available and
its status should be considered as active. But if no anyelse tap device
connects to it, The value of operstate of virbr0 in sysfs is 'down', So
udevInterfaceIsActive returns 0, It causes 'virsh iface-list --all' to
report the status of virbr0 as 'inactive'.
This patch fixes the issue by counting slave devices for bridge device.
Signed-off-by: Lin Ma <lma(a)suse.com>
---
src/interface/interface_backend_udev.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 5d0fc64..9ac4674 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -1127,6 +1127,11 @@ udevInterfaceIsActive(virInterfacePtr ifinfo)
struct udev_device *dev;
virInterfaceDefPtr def = NULL;
int status = -1;
+ struct dirent **member_list = NULL;
+ const char *devtype;
+ int member_count = 0;
+ char *member_path;
+ size_t i;
dev = udev_device_new_from_subsystem_sysname(udev, "net",
ifinfo->name);
@@ -1146,6 +1151,23 @@ udevInterfaceIsActive(virInterfacePtr ifinfo)
/* Check if it's active or not */
status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
+ if (!status) {
+ devtype = udev_device_get_devtype(dev);
+ if (STREQ_NULLABLE(devtype, "bridge")) {
+ if (virAsprintf(&member_path, "%s/%s",
+ udev_device_get_syspath(dev), "brif") < 0)
+ goto cleanup;
+ member_count = scandir(member_path, &member_list,
+ udevBridgeScanDirFilter, alphasort);
+ if (member_count > 0)
+ status = 1;
+ for (i = 0; i < member_count; i++)
+ VIR_FREE(member_list[i]);
+ VIR_FREE(member_list);
+ VIR_FREE(member_path);
+ }
+ }
+
udev_device_unref(dev);
cleanup:
--
2.9.2
7 years, 2 months
[libvirt] [PATCH v3 0/2] Allow saving VM state to pipe
by Chen Hanxiao
This series introduce flag VIR_DOMAIN_SAVE_DIRECT
to enable command 'save' to write to PIPE.
This will write QEMU_SAVE_MAGIC directly.
Base upon patches from Roy Keene <rkeene(a)knightpoint.com>
with some fixes.
Change from original patch:
1) Check whether the specified path is a PIPE.
2) Rebase on upstream.
3) Add doc for virsh command
v3:
add doc/news.xml
rebase on upstream
v2-resend:
rebase on upstream
v2:
rename VIR_DOMAIN_SAVE_PIPE to VIR_DOMAIN_SAVE_DIRECT
remove S_ISFIFO check
Chen Hanxiao (2):
qemu: Allow qemuDomainSaveMemory saving VM state to a pipe
virsh: introduce flage --direct for save command
docs/news.xml | 9 +++++++
include/libvirt/libvirt-domain.h | 1 +
src/qemu/qemu_driver.c | 54 ++++++++++++++++++++++++++--------------
tools/virsh-domain.c | 6 +++++
tools/virsh.pod | 5 +++-
5 files changed, 56 insertions(+), 19 deletions(-)
--
2.7.4
7 years, 2 months
[libvirt] [PATCH 0/3] libxl: Add a test suite for libxl_domain_config generator
by Jim Fehlig
Long ago danpb posted some patches to test libvirt domXML to
libxl_domain_config conversion
https://www.redhat.com/archives/libvir-list/2014-May/msg01102.html
Some of the prerequisite patches were pushed, but we've never managed
to push patches actually providing the conversion tests. I sent several
follow-ups to Dan's work but never converged on a satisfactory solution
for all the Xen versions supported by libvirt. The last attempt was in
Sept 2014
https://www.redhat.com/archives/libvir-list/2014-September/msg00698.html
I tried to revive the work in Jan 2015, but that also stalled
https://www.redhat.com/archives/libvir-list/2015-January/msg00924.html
Fast-forward over 2.5 years from the first attempt and libvirt no longer
supports older Xen versions 4.2 and 4.3 that were proving to be problematic.
Starting with Xen 4.5 libxl added support for libxl_domain_config_from_json,
which provides a way to implement the conversion tests that work with all
Xen versions >= 4.5 (including latest xen.git master).
The previous approaches compared a static json doc with the results of
domXML->libxl_domain_config conversion done in the libxl driver.
As discussed in those approaches, the json doc returned from
libxl_domain_config_to_json can change over Xen releases as the
libxl_domain_config object gains new fields, making it difficult to
compare the conversion with a static doc.
I had some time last week to pick at this thorn and reworked the test
to make use of libxl_domain_config_from_json introduced in Xen 4.5.
Instead of comparing the conversion results directly to a static json doc,
the static doc is first round-tripped through _from_json -> _to_json. Any
new fields added to libxl_domain_config object are then included in both
docs, allowing comparison across multiple Xen releases.
Patch3 provides the conversion tests using this new approach. The tests
are not run on Xen 4.4 (oldest version currently supported by libvirt)
since it does not provide libxl_domain_config_from_json.
Patches 1 and 2 fix some issues found while working on the tests.
See their commit messages for details.
Jim Fehlig (3):
libxl: determine device model version from emulator name
libxl: relax checks on <emulator>
libxl: Add a test suite for libxl_domain_config generator
m4/virt-driver-libxl.m4 | 6 +-
src/libxl/libxl_capabilities.c | 37 ++---
src/libxl/libxl_conf.c | 14 --
tests/Makefile.am | 18 ++-
tests/libxlxml2domconfigdata/basic-hvm.json | 89 +++++++++++
tests/libxlxml2domconfigdata/basic-hvm.xml | 36 +++++
tests/libxlxml2domconfigdata/basic-pv.json | 65 ++++++++
tests/libxlxml2domconfigdata/basic-pv.xml | 28 ++++
tests/libxlxml2domconfigdata/moredevs-hvm.json | 111 +++++++++++++
tests/libxlxml2domconfigdata/moredevs-hvm.xml | 63 ++++++++
tests/libxlxml2domconfigtest.c | 208 +++++++++++++++++++++++++
tests/virmocklibxl.c | 87 +++++++++++
12 files changed, 723 insertions(+), 39 deletions(-)
create mode 100644 tests/libxlxml2domconfigdata/basic-hvm.json
create mode 100644 tests/libxlxml2domconfigdata/basic-hvm.xml
create mode 100644 tests/libxlxml2domconfigdata/basic-pv.json
create mode 100644 tests/libxlxml2domconfigdata/basic-pv.xml
create mode 100644 tests/libxlxml2domconfigdata/moredevs-hvm.json
create mode 100644 tests/libxlxml2domconfigdata/moredevs-hvm.xml
create mode 100644 tests/libxlxml2domconfigtest.c
create mode 100644 tests/virmocklibxl.c
--
2.11.0
7 years, 2 months
[libvirt] [PATCH] qemu: Use iohelper during restore
by Shivaprasad G Bhat
Commit afe6e58 & c4caab53 made necessary changes to use io-helpers
during save and restore. The commit c4caab53 missed to remove the
redundant check in qemuDomainSaveImageOpen() because of which
virFileWrapperFdNew() is not called if bypass_cache is false.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 516a851..ac89372 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6150,9 +6150,11 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
virDomainDefPtr def = NULL;
int oflags = open_write ? O_RDWR : O_RDONLY;
virCapsPtr caps = NULL;
+ unsigned int wrapperFlags = VIR_FILE_WRAPPER_NON_BLOCKING;
if (bypass_cache) {
int directFlag = virFileDirectFdFlag();
+ wrapperFlags |= VIR_FILE_WRAPPER_BYPASS_CACHE;
if (directFlag < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("bypass cache unsupported by this system"));
@@ -6166,9 +6168,8 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
if ((fd = qemuOpenFile(driver, NULL, path, oflags, NULL, NULL)) < 0)
goto error;
- if (bypass_cache &&
- !(*wrapperFd = virFileWrapperFdNew(&fd, path,
- VIR_FILE_WRAPPER_BYPASS_CACHE)))
+ if (wrapperFd &&
+ !(*wrapperFd = virFileWrapperFdNew(&fd, path, wrapperFlags)))
goto error;
if (saferead(fd, &header, sizeof(header)) != sizeof(header)) {
7 years, 3 months
[libvirt] [RFC] qemu: monitor: do not report error on shutdown
by Christian Ehrhardt
If a shutdown is expected because it was triggered via libvirt we can
also expect the monitor to close. In those cases do not report an
internal error like:
"internal error: End of file from qemu monitor"
Signed-off-by: Christian Ehrhardt <christian.ehrhardt(a)canonical.com>
---
src/qemu/qemu_monitor.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index d71f84c..352cc8a 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -63,6 +63,7 @@ struct _qemuMonitor {
int fd;
int watch;
int hasSendFD;
+ int willhangup;
virDomainObjPtr vm;
@@ -691,8 +692,10 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
if (events & VIR_EVENT_HANDLE_HANGUP) {
hangup = true;
if (!error) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("End of file from qemu monitor"));
+ if (!mon->willhangup) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("End of file from qemu monitor"));
+ }
eof = true;
events &= ~VIR_EVENT_HANDLE_HANGUP;
}
@@ -731,7 +734,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
if (mon->lastError.code != VIR_ERR_OK) {
/* Already have an error, so clear any new error */
virResetLastError();
- } else {
+ } else if (!mon->willhangup) {
virErrorPtr err = virGetLastError();
if (!err)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1282,6 +1285,7 @@ qemuMonitorEmitShutdown(qemuMonitorPtr mon)
{
int ret = -1;
VIR_DEBUG("mon=%p", mon);
+ mon->willhangup = 1;
QEMU_MONITOR_CALLBACK(mon, ret, domainShutdown, mon->vm);
return ret;
--
2.7.4
7 years, 5 months