[libvirt] [PATCH 00/10 v3] Support scsi device passthrough via scsi-generic
by Osier Yang
This adds the support for qemu's scsi-generic device, which can be
used to passthrough scsi host device. An example of the XML:
<hostdev mode='subsystem' type='scsi' managed='no'>
<source>
<adapter name='scsi_host7'/>
<address bus='0' target='0' unit='0'/>
</source>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</hostdev>
Mainly changes from v2.5 (details in each patch):
* 1/10 and 2/10 of v2.5 are pushed
* 8/10 of v2.5 is splitted
* A better way to generate the address for scsi host device instead of
the rigid one.
* Support all scsi controllers when building the qemu command line.
* Figure out the limits of the qemu properties, and do checking
* Don't forget DAC and apparmor security backends
* Orgnize the patches in a better way.
* Fix the make check failure
Han Cheng (7):
conf: Introduce XMLs for scsi hostdev
qemu: New cap flags for scsi-generic
utils: util functions for scsi hostdev
qemu: Build qemu command line for scsi host device
qemu: Introduce activeScsiHostdevs list for scsi host devices
qemu: Allow the scsi-generic device in cgroup
qemu: Add hotplug support for scsi host device
Osier Yang (3):
security: Manage the security label for scsi host device
qemu: Refactor helpers for USB device attachment
conf: Generate address for scsi host device automatically
docs/formatdomain.html.in | 38 +-
docs/schemas/domaincommon.rng | 29 ++
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/domain_audit.c | 10 +
src/conf/domain_conf.c | 312 +++++++++++++++-
src/conf/domain_conf.h | 8 +
src/libvirt_private.syms | 22 ++
src/qemu/qemu_capabilities.c | 14 +-
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_cgroup.c | 72 +++-
src/qemu/qemu_cgroup.h | 3 +
src/qemu/qemu_command.c | 154 +++++++-
src/qemu/qemu_command.h | 6 +
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_driver.c | 3 +
src/qemu/qemu_hostdev.c | 213 +++++++++++
src/qemu/qemu_hostdev.h | 10 +
src/qemu/qemu_hotplug.c | 224 +++++++++---
src/qemu/qemu_process.c | 3 +
src/security/security_apparmor.c | 49 ++-
src/security/security_dac.c | 77 +++-
src/security/security_selinux.c | 72 +++-
src/util/virscsi.c | 407 +++++++++++++++++++++
src/util/virscsi.h | 84 +++++
tests/qemuhelpdata/qemu-1.0-device | 10 +
tests/qemuhelpdata/qemu-1.1.0-device | 10 +
tests/qemuhelpdata/qemu-1.2.0-device | 5 +
tests/qemuhelpdata/qemu-kvm-1.2.0-device | 5 +
tests/qemuhelptest.c | 19 +-
.../qemuxml2argv-hostdev-scsi-boot.args | 9 +
.../qemuxml2argv-hostdev-scsi-boot.xml | 34 ++
.../qemuxml2argv-hostdev-scsi-readonly.args | 9 +
.../qemuxml2argv-hostdev-scsi-readonly.xml | 35 ++
tests/qemuxml2argvtest.c | 9 +
tests/qemuxml2xmltest.c | 2 +
36 files changed, 1842 insertions(+), 121 deletions(-)
create mode 100644 src/util/virscsi.c
create mode 100644 src/util/virscsi.h
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.xml
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH 0/2] VFIO bugfix and naming tweak
by Laine Stump
Laine Stump (2):
network: support <driver name='vfio'/> in network definitions
conf: remove extraneous _TYPE from driver backend enums
src/conf/domain_conf.c | 6 +++---
src/conf/domain_conf.h | 6 +++---
src/conf/network_conf.c | 39 +++++++++++++++++++++++++++++++++-
src/conf/network_conf.h | 17 ++++++++++++++-
src/network/bridge_driver.c | 23 ++++++++++++++++++++
src/qemu/qemu_command.c | 8 +++----
src/qemu/qemu_hostdev.c | 4 ++--
src/qemu/qemu_hotplug.c | 4 ++--
src/security/security_apparmor.c | 2 +-
src/security/security_dac.c | 4 ++--
src/security/security_selinux.c | 4 ++--
tests/networkxml2xmlin/hostdev-pf.xml | 1 +
tests/networkxml2xmlout/hostdev-pf.xml | 1 +
13 files changed, 98 insertions(+), 21 deletions(-)
--
1.7.11.7
11 years, 7 months
[libvirt] [PATCH v2 0/2] qemu: invoke qemu-bridge-helper from libvirtd
by Paolo Bonzini
The <interface type='bridge'> is working mostly because of a peculiar
design decision in Linux. Ideally, QEMU would run with an empty
capability bounding set and would not be able to do any privileged
operation (not even by running a helper program). This is not the case
because dropping capabilities from the bounding set requires a capability
of its own, CAP_SETPCAP; thus QEMU does *not* run with an empty bounding
set if invoked via qemu:///session. This is apparently for security
reasons, to avoid that dropping _some_ caps but not all of them lets
you exploit untested error paths in suid binaries.
This series lets libvirtd invoke the privileged helper program on its own,
which is a cleaner design that would work even if the above Linux quirk
was not there. Also, this adds a <target dev='tap0'/> element to the
XML of an active domain using <interface type='bridge'>.
Thanks to the patches that have already been committed, the recvfd and
virCommand APIs make the task almost trivial.
v1->v2: OOM fix in patch 1, change label name in patch 2, rebase
Paolo Bonzini (2):
virnetdevtap: add virNetDevTapGetName
qemu: launch bridge helper from libvirtd
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 133 ++++++++++++++++++++++++++++++++++-------------
src/qemu/qemu_command.h | 1 -
src/qemu/qemu_hotplug.c | 25 +++------
src/util/virnetdevtap.c | 33 ++++++++++++
src/util/virnetdevtap.h | 3 ++
6 files changed, 143 insertions(+), 53 deletions(-)
--
1.8.2
11 years, 7 months
[libvirt] [PATCH-v4 0/2] Static Route related updates
by Gene Czarcinski
This update includes two patch files:
1. The first file adds virSocketAddrGetIpPrefix() to
determine the prefix for a network. This function
is used by the static route code and has also been
used to update (replace the code in)
virNetworkIpDefPrefix() in src/conf/network_conf.c
2. The second and major update adds functionality to
implement static route for both IPv4 and IPv6. Having
static route provides the routing information needed
to forward packets not directly reachable from a
host.
As far as I can determine, this update has adopted all
suggestions made against the previous version (except
that I am still using CommandRun ... that will be
addressed in a future update).
I also plan to take a look at <ip> processing such as
handling ULong return codes. I also raise the question
as to whether address= should be manditory rather than
(currently) optional ... I am not sure what <ip> means
with address= being optional.
Gene Czarcinski (2):
create virSocketAddrGetIpPrefix utility function
Support for static routes on a virtual bridge
docs/formatnetwork.html.in | 80 +++++
docs/schemas/network.rng | 22 ++
src/conf/network_conf.c | 364 +++++++++++++++++++--
src/conf/network_conf.h | 20 ++
src/libvirt_private.syms | 2 +
src/network/bridge_driver.c | 41 +++
src/util/virnetdev.c | 44 +++
src/util/virnetdev.h | 5 +
src/util/virsocketaddr.c | 43 +++
src/util/virsocketaddr.h | 3 +
.../networkxml2xmlin/dhcp6host-routed-network.xml | 2 +
.../networkxml2xmlout/dhcp6host-routed-network.xml | 2 +
12 files changed, 600 insertions(+), 28 deletions(-)
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] qemu: don't assign a PCI address to 'none' USB controller
by Ján Tomko
---
src/qemu/qemu_command.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9737609..126cced 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1925,6 +1925,11 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI)
continue;
+ /* USB controller model 'none' doesn't need a PCI address */
+ if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+ def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
+ continue;
+
/* FDC lives behind the ISA bridge; CCID is a usb device */
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_FDC ||
def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_CCID)
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] fix segfault during virsh save in pv guest
by Bamvor Jian Zhang
this patch fix the wrong sequence for fd and timeout register. the sequence
was right in dfa1e1dd for fd register, but it changed in e0622ca2.
in this patch, set priv, xl_priv in info and increase info->priv ref count
before virEventAddHandle. if do this after virEventAddHandle, the fd
callback or fd deregister maybe got the empty priv, xl_priv or wrong ref
count.
after apply this patch, test more than 100 rounds passed compare to fail
within 3 rounds without this patch. each round includes define -> start ->
destroy -> create -> suspend -> resume -> reboot -> shutdown -> save ->
resotre -> dump -> destroy -> create -> setmem -> setvcpus -> destroy.
Signed-off-by: Bamvor Jian Zhang <bjzhang(a)suse.com>
---
src/libxl/libxl_driver.c | 39 +++++++++++++++++++++------------------
1 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index b4f1889..212d0fc 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -181,26 +181,28 @@ libxlFDRegisterEventHook(void *priv, int fd, void **hndp,
return -1;
}
+ info->priv = priv;
+ /*
+ * Take a reference on the domain object. Reference is dropped in
+ * libxlEventHookInfoFree, ensuring the domain object outlives the fd
+ * event objects.
+ */
+ virObjectRef(info->priv);
+ info->xl_priv = xl_priv;
+
if (events & POLLIN)
vir_events |= VIR_EVENT_HANDLE_READABLE;
if (events & POLLOUT)
vir_events |= VIR_EVENT_HANDLE_WRITABLE;
+
info->id = virEventAddHandle(fd, vir_events, libxlFDEventCallback,
info, libxlEventHookInfoFree);
if (info->id < 0) {
+ virObjectUnref(info->priv);
VIR_FREE(info);
return -1;
}
- info->priv = priv;
- /*
- * Take a reference on the domain object. Reference is dropped in
- * libxlEventHookInfoFree, ensuring the domain object outlives the fd
- * event objects.
- */
- virObjectRef(info->priv);
-
- info->xl_priv = xl_priv;
*hndp = info;
return 0;
@@ -283,6 +285,15 @@ libxlTimeoutRegisterEventHook(void *priv,
return -1;
}
+ info->priv = priv;
+ /*
+ * Also take a reference on the domain object. Reference is dropped in
+ * libxlEventHookInfoFree, ensuring the domain object outlives the timeout
+ * event objects.
+ */
+ virObjectRef(info->priv);
+ info->xl_priv = xl_priv;
+
gettimeofday(&now, NULL);
timersub(&abs_t, &now, &res);
/* Ensure timeout is not overflowed */
@@ -296,22 +307,14 @@ libxlTimeoutRegisterEventHook(void *priv,
info->id = virEventAddTimeout(timeout, libxlTimerCallback,
info, libxlEventHookInfoFree);
if (info->id < 0) {
+ virObjectUnref(info->priv);
VIR_FREE(info);
return -1;
}
- info->priv = priv;
- /*
- * Also take a reference on the domain object. Reference is dropped in
- * libxlEventHookInfoFree, ensuring the domain object outlives the timeout
- * event objects.
- */
- virObjectRef(info->priv);
-
virObjectLock(info->priv);
LIBXL_EV_REG_APPEND(info->priv->timerRegistrations, info);
virObjectUnlock(info->priv);
- info->xl_priv = xl_priv;
*hndp = info;
return 0;
--
1.6.0.2
11 years, 7 months
[libvirt] KVM Forum 2013 Save the Date
by KVM-Forum-2013-PC@redhat.com
KVM is an industry leading open source hypervisor that provides an ideal
platform for datacenter virtualization, virtual desktop infrastructure,
and cloud computing. Once again, it's time to bring together the
community of developers and users that define the KVM ecosystem for
our annual technical conference. We will discuss the current state of
affairs and plan for the future of KVM, its surrounding infrastructure,
and management tools. The oVirt Workshop will run in parallel with the
KVM Forum again, bringing in a community focused on enterprise datacenter
virtualization management built on KVM. So mark your calendar and join
us in advancing KVM.
Once again we are colocated with The Linux Foundation's LinuxCon Europe,
this year in Edinburgh.
Date: October 21-23, 2013
Location: Edinburgh International Conference Centre - Edinburgh, UK
Details regarding registration and proposal submission are forthcoming.
thanks,
-KVM Forum 2013 Program Commitee
11 years, 7 months
[libvirt] [PATCH 0/4] Remaining patches from VFIO series
by Laine Stump
I've pushed everything else from all 3 VFIO series.
Patch 1/4 in this series had questions from Eric about whether it is
the right way to go, or if we want to do something more limited:
https://www.redhat.com/archives/libvir-list/2013-April/msg01864.html
Eric and danpb had both raised issues with Patch 2/4, so I redid it
addressing all the points they brought up, and it's now ready for
review:
https://www.redhat.com/archives/libvir-list/2013-April/msg01853.html
https://www.redhat.com/archives/libvir-list/2013-April/msg01869.html
3/4 and 4/4 were ACKed, but depend on 2/4, so I couldn't push them.
If these patches are ACKed and DV wants to make the RC1 snapshot
before I wake up, anyone else feel free to push these 4 patches as
they are (assuming they're ACKed, of course :-)
Laine Stump (4):
util: new virCommandSetMax(MemLock|Processes|Files)
qemu: use new virCommandSetMax(Processes|Files)
qemu: set qemu process' RLIMIT_MEMLOCK when VFIO is used
qemu: add VFIO devices to cgroup ACL
configure.ac | 2 +-
src/libvirt_private.syms | 6 ++
src/qemu/qemu_cgroup.c | 11 ++++
src/qemu/qemu_command.c | 25 +++++---
src/qemu/qemu_hotplug.c | 27 ++++++---
src/qemu/qemu_process.c | 38 +-----------
src/util/vircommand.c | 38 ++++++++++++
src/util/vircommand.h | 4 ++
src/util/virprocess.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++-
src/util/virprocess.h | 5 +-
10 files changed, 255 insertions(+), 53 deletions(-)
--
1.7.11.7
11 years, 7 months