[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
1 year
[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 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, 3 months
[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, 3 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, 3 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, 3 months
[libvirt] [PATCH 00/16] Make the virNetworkObjPtr private
by John Ferlan
All part of the effort I have to have a common object model. This series
is network test, driver, and virnetworkobj related to work towards that
goal. By the last patch, the object is now private to virnetworkobj.c
John Ferlan (16):
test: Fix up formatting in network test API's
test: Use consistent variable names for network test driver APIs
network: Perform some formatting cleanup in bridge_driver
network: Use consistent naming in bridge_driver for virNetwork objects
network: Move macmap mgmt from bridge_driver to virnetworkobj
network: Add virNetworkObj Get/Set API's for @dnsmasqPid and @radvdPid
network: Alter virNetworkObj @class_id to be @classIdMap
network: Add virNetworkObj Get/Set API's for @floor_sum
network: Add virNetworkObj Get API's for @def and @newDef
network: Introduce virNetworkObj{Get|Set}Autostart
network: Introduce virNetworkObj{Is|Set}Active
network: Introduce virNetworkObjIsPersistent
network: Consistent use of @obj for virnetworkobj
network: Adjust virNetworkObjNew call and return
network: Modify naming for virNetworkObjList* fetching APIs
network: Privatize virNetworkObj
src/conf/virnetworkobj.c | 679 +++++++++++++++------
src/conf/virnetworkobj.h | 107 +++-
src/libvirt_private.syms | 20 +
src/network/bridge_driver.c | 1415 +++++++++++++++++++++++--------------------
src/network/bridge_driver.h | 50 +-
src/test/test_driver.c | 279 +++++----
tests/networkxml2conftest.c | 13 +-
7 files changed, 1538 insertions(+), 1025 deletions(-)
--
2.9.3
7 years, 3 months
[libvirt] [PATCH 00/19] Start altering storage code to privatize of the object
by John Ferlan
Begin the process of making adjustments to the storage pool and volume code
in order to privatize the virStoragePoolObj and virStoragePoolObjList
Didn't want to post 40+ patches at one time... This is the first storage
pile including some test driver cleanups w/r/t storage code.
John Ferlan (19):
test: Fix up formatting in storage test API's
test: Use consistent variable names for storage test driver APIs
test: Cleanup exit/failure paths of some storage pool APIs
test: Add helpers to fetch active/inactive storage pool by name
test: Add testStorageVolDefFindByName for storage volume tests
storage: Fix return value checks for virAsprintf
storage: Use consistent variable names in virstorageobj
storage: Use consistent variable names for driver
storage: Alter volume num, name, and export API's to just take obj
storage: Create accessor API's for virStoragePoolObj
storage: Introduce virStoragePoolObjNew
storage: Introduce virStoragePoolObj{Get|Set}Autostart
storage: Move autostartLink deletion to virstorageobj
storage: Introduce storage volume add, delete, count APIs
storage: Introduce virStoragePoolObjForEachVolume
storage: Use virStoragePoolObj accessors for driver
storage: Use virStoragePoolObj accessors for storage test API's
storage: Use virStoragePoolObj accessors for storage_util
storage: Change storage_util to use obj instead of pool
src/conf/virstorageobj.c | 568 +++++++++-----
src/conf/virstorageobj.h | 84 +-
src/libvirt_private.syms | 16 +
src/storage/storage_backend_disk.c | 31 +-
src/storage/storage_backend_gluster.c | 3 +-
src/storage/storage_backend_logical.c | 5 +-
src/storage/storage_backend_mpath.c | 3 +-
src/storage/storage_backend_rbd.c | 12 +-
src/storage/storage_backend_sheepdog.c | 8 +-
src/storage/storage_backend_zfs.c | 9 +-
src/storage/storage_driver.c | 1308 ++++++++++++++++----------------
src/storage/storage_driver.h | 4 +-
src/storage/storage_util.c | 200 ++---
src/storage/storage_util.h | 30 +-
src/test/test_driver.c | 780 +++++++++----------
15 files changed, 1614 insertions(+), 1447 deletions(-)
--
2.9.3
7 years, 4 months