]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agoMerge processinfo.{c,h} into virprocess.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 14:58:41 +0000 (14:58 +0000)]
Merge processinfo.{c,h} into virprocess.{c,h}

12 years agoRename pci.{c,h} to virpci.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 14:52:25 +0000 (14:52 +0000)]
Rename pci.{c,h} to virpci.{c,h}

12 years agoRename memory.{c,h} to viralloc.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 18:06:53 +0000 (18:06 +0000)]
Rename memory.{c,h} to viralloc.{c,h}

12 years agoRename logging.{c,h} to virlog.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:59:27 +0000 (17:59 +0000)]
Rename logging.{c,h} to virlog.{c,h}

12 years agoRename json.{c,h} to virjson.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:53:50 +0000 (17:53 +0000)]
Rename json.{c,h} to virjson.{c,h}

12 years agoRename iptables.{c,h} to viriptables.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:42:44 +0000 (17:42 +0000)]
Rename iptables.{c,h} to viriptables.{c,h}

12 years agoRename hostusb.{c,h} to virusb.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:04:51 +0000 (17:04 +0000)]
Rename hostusb.{c,h} to virusb.{c,h}

12 years agoRename hooks.{c,h} to virhook.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:00:34 +0000 (17:00 +0000)]
Rename hooks.{c,h} to virhook.{c,h}

12 years agoRename event_poll.{c,h} to vireventpoll.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:54:55 +0000 (16:54 +0000)]
Rename event_poll.{c,h} to vireventpoll.{c,h}

12 years agoRename event.{c,h} to virevent.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:52:12 +0000 (16:52 +0000)]
Rename event.{c,h} to virevent.{c,h}

Since the event APIs are now in the public header, no internal
code should include virevent.h

12 years agoRename ebtables.{c,h} to virebtables.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:48:24 +0000 (16:48 +0000)]
Rename ebtables.{c,h} to virebtables.{c,h}

12 years agoRename dnsmasq.{c,h} to virdnsmasq.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:43:54 +0000 (16:43 +0000)]
Rename dnsmasq.{c,h} to virdnsmasq.{c,h}

12 years agoRename conf.{c,h} to virconf.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:35:35 +0000 (16:35 +0000)]
Rename conf.{c,h} to virconf.{c,h}

12 years agoRename command.{c,h} to vircommand.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:27:01 +0000 (16:27 +0000)]
Rename command.{c,h} to vircommand.{c,h}

12 years agoRename buf.{c,h} to virbuffer.{c,h}
Daniel P. Berrange [Tue, 4 Dec 2012 12:04:07 +0000 (12:04 +0000)]
Rename buf.{c,h} to virbuffer.{c,h}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename bitmap.{c,h} to virbitmap.{c,h}
Daniel P. Berrange [Tue, 4 Dec 2012 11:56:32 +0000 (11:56 +0000)]
Rename bitmap.{c,h} to virbitmap.{c,h}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename cgroup.{h,c} to vircgroup.{h,c}
Daniel P. Berrange [Mon, 3 Dec 2012 15:03:47 +0000 (15:03 +0000)]
Rename cgroup.{h,c} to vircgroup.{h,c}

To bring in line with new naming practice, rename the=
src/util/cgroup.{h,c} files to vircgroup.{h,c}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSupport all backend serial devices for pSeries guest
Li Zhang [Thu, 20 Dec 2012 06:02:25 +0000 (14:02 +0800)]
Support all backend serial devices for pSeries guest

Currently, it only considers PTY backend serial devices for pseries.
It need to support all kinds of serial devices.

This patch is to fix the problem which is that it doesn't work
when specifying source type as file.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoRemove QEMU_CAPS_NO_ACPI capability for non-x86 platform
Li Zhang [Thu, 20 Dec 2012 06:02:24 +0000 (14:02 +0800)]
Remove QEMU_CAPS_NO_ACPI capability for non-x86 platform

ACPI is only supported on x86 platform, PPC can't support it.
So QEMU_CAPS_NO_ACPI shouldn't be set.

This patch is to remove QEMU_CAPS_NO_ACPI capability for
non-x86 platform.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoSet std VGA model as default model for ppc64.
Li Zhang [Thu, 20 Dec 2012 06:02:22 +0000 (14:02 +0800)]
Set std VGA model as default model for ppc64.

Cirrus VGA model is not supported on ppc64 currently.
It needs to set std VGA model as the default model.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoAdd sysinfo data and enable virSysinfoRead test case for POWER
Li Zhang [Thu, 20 Dec 2012 02:31:05 +0000 (10:31 +0800)]
Add sysinfo data and enable virSysinfoRead test case for POWER

This patch is to enable virSysinfoRead test case for POWER,
and provide sysinfo data on POWER.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoutil: fix functions that retrieve SRIOV VF info
Laine Stump [Thu, 20 Dec 2012 18:22:17 +0000 (13:22 -0500)]
util: fix functions that retrieve SRIOV VF info

This patch resolves:

  https://bugzilla.redhat.com/show_bug.cgi?id=889319

When assigning an SRIOV virtual function to a guest using "intelligent
PCI passthrough" (<interface type='hostdev'>, which sets the MAC
address and vlan tag of the VF before passing its info to qemu),
libvirt first learns the current MAC address and vlan tag by sending
an NLM_F_REQUEST message for the VF's PF (physical function) to the
kernel via a NETLINK_ROUTE socket (see virNetDevLinkDump()); the
response message's IFLA_VFINFO_LIST section is examined to extract the
info for the particular VF being assigned.

This worked fine with kernels up until kernel commit
115c9b81928360d769a76c632bae62d15206a94a (first appearing in upstream
kernel 3.3) which changed the ABI to not return IFLA_VFINFO_LIST in
the response until a newly introduced IFLA_EXT_MASK field was included
in the request, with the (newly introduced, of course) RTEXT_FILTER_VF
flag set.

The justification for this ABI change was that new fields had been
added to the VFINFO, causing NLM_F_REQUEST messages to fail on systems
with large numbers of VFs if the requesting application didn't have a
large enough buffer for all the info. The idea is that most
applications doing an NLM_F_REQUEST don't care about VFINFO anyway, so
eliminating it from the response would lower the requirements on
buffer size. Apparently, the people who pushed this patch made the
mistaken assumption that iproute2 (the "ip" command) was the only
package that used IFLA_VFINFO_LIST, so it wouldn't break anything else
(and they made sure that iproute2 was fixed.

The logic of this "fix" is debatable at best (one could claim that the
proper fix would be for the applications in question to be fixed so
that they properly sized the buffer, which is what libvirt does
(purely by virtue of using libnl), but it is what it is and we have to
deal with it.

In order for <interface type='hostdev'> to work properly on systems
with a kernel 3.3 or later, libvirt needs to add the afore-mentioned
IFLA_EXT_MASK field with RTEXT_FILTER_VF set.

Of course we also need to continue working on systems with older
kernels, so that one bit of code is compiled conditionally. The one
time this could cause problems is if the libvirt binary was built on a
system without IFLA_EXT_MASK which was subsequently updated to a
kernel that *did* have it. That could be solved by manually providing
the values of IFLA_EXT_MASK and RTEXT_FILTER_VF and adding it to the
message anyway, but I'm uncertain what that might actually do on a
system that didn't support the message, so for the time being we'll
just fail in that case (which will very likely never happen anyway).

12 years agoutil: add missing error log messages when failing to get netlink VFINFO
Laine Stump [Thu, 20 Dec 2012 19:52:41 +0000 (14:52 -0500)]
util: add missing error log messages when failing to get netlink VFINFO

This patch fixes the lack of error messages when libvirt fails to find
VFINFO in a returned netlinke response message.

https://bugzilla.redhat.com/show_bug.cgi?id=827519#c10 is an example
of the error message that was previously logged when the
IFLA_VFINFO_LIST object was missing from the netlink response. The
reason for this failure is detailed in

   https://bugzilla.redhat.com/show_bug.cgi?id=889319

Even though that root problem has been fixed, the experience of
finding the root cause shows us how important it is to properly log an
error message in these cases. This patch *seems* to replace the entire
function, but really most of the changes are due to moving code that
was previously inside an if() statement out to the top level of the
function (the original if() was reversed and made to log an error and
return).

12 years agosecurity: fix #endif comment in security_stack.h
Ján Tomko [Thu, 20 Dec 2012 18:46:43 +0000 (19:46 +0100)]
security: fix #endif comment in security_stack.h

12 years agomaint: formatting cleanups in buf.c
Eric Blake [Wed, 19 Dec 2012 22:00:13 +0000 (15:00 -0700)]
maint: formatting cleanups in buf.c

* src/util/buf.c: Use consistent formatting.

12 years agobuild: use strchr now that we can work around broken gcc
Eric Blake [Wed, 19 Dec 2012 19:28:48 +0000 (12:28 -0700)]
build: use strchr now that we can work around broken gcc

Revert the complex workaround of commit 39d91e9, now that we have
a nicer framework for shutting up broken gcc.

* src/util/buf.c (virBufferEscape): Simplify.

12 years agobuild: make broken -Wlogical-op test be gcc-only
Eric Blake [Wed, 19 Dec 2012 19:07:39 +0000 (12:07 -0700)]
build: make broken -Wlogical-op test be gcc-only

Commit 8b8fcdea introduced a check for broken gcc -Wlogical-op,
but did not guard the check against non-gcc compilers, which might
lead to spurious failures when another compiler encounters an
unknown pragma.  Additionally, all of our compiler warning logic
should belong in a single file, and use cache variables to allow
overriding the decision at configure time if necessary.

* configure.ac (BROKEN_GCC_WLOGICALOP): Move...
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): ...here,
and update to modern autoconf idioms.

12 years agoutil: FreeBSD: stub out CPU affinity functions
Roman Bogorodskiy [Sun, 16 Dec 2012 14:47:56 +0000 (18:47 +0400)]
util: FreeBSD: stub out CPU affinity functions

12 years agonodeinfo: add FreeBSD support
Roman Bogorodskiy [Mon, 17 Dec 2012 18:12:44 +0000 (22:12 +0400)]
nodeinfo: add FreeBSD support

Uses sysctl(3) interface to obtain CPU and memory information on FreeBSD

12 years agoFix arch datatype in vahControl in virt-aa-helper.c
Daniel P. Berrange [Wed, 19 Dec 2012 11:45:31 +0000 (11:45 +0000)]
Fix arch datatype in vahControl in virt-aa-helper.c

When changing to virArch, the virt-aa-helper.c file was not
completely changed. The vahControl struct was left with a
char *arch field, instead of virArch arch field.

12 years agoChange string form of VIR_ARCH_ITANIUM back to ia64
Daniel P. Berrange [Wed, 19 Dec 2012 10:54:57 +0000 (10:54 +0000)]
Change string form of VIR_ARCH_ITANIUM back to ia64

Historically there was an inconsistency in handling of the
itanium arch. The xen driver & CPU model code treated it
as 'ia64' but the QEMU capabilities code used 'itanium'. On
the grounds that no one has ever seriously used  itanium
with QEMU, while RHEL shipped itanium with Xen, we should
favour 'ia64' as the canonical format

12 years agoFix parsing of arch from domain XML
Daniel P. Berrange [Wed, 19 Dec 2012 10:49:30 +0000 (10:49 +0000)]
Fix parsing of arch from domain XML

When parsing the arch from domain XML, the result was only
saved to a local variable, not the virDomainDefPtr

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix CPU baseline to not hardcode arch
Daniel P. Berrange [Wed, 19 Dec 2012 10:47:40 +0000 (10:47 +0000)]
Fix CPU baseline to not hardcode arch

Prior to the virArch changes, the CPU baseline method would
free the arch string in the returned CPU. Fix the regression
by setting arch to VIR_ARCH_NONE at the end

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix SELinux security label test
Daniel P. Berrange [Wed, 19 Dec 2012 10:05:17 +0000 (10:05 +0000)]
Fix SELinux security label test

If securityselinuxtest was run on a system with newer SELinux
policy it would fail, due to using svirt_tcg_t instead of
svirt_t. Fixing the domain type to be KVM avoids this issue.

12 years agoconf: eliminate redundant use of VIR_ALLOC
Martin Kletzander [Mon, 17 Dec 2012 15:03:15 +0000 (16:03 +0100)]
conf: eliminate redundant use of VIR_ALLOC

We can use VIR_REALLOC_N with NULL pointer, which behaves the same way
as VIR_ALLOC_N in that case, so no need for a condition that's
checking if some data are allocated already.

---

I tried to find other parts of the code similar to this, so I can do a
full cleanup for the whole repository, so I used this (excuse the long
line, but that's how I was writing it):

git grep -nHC 5 -e VIR_REALLOC_N -e VIR_ALLOC_N | while read line; do if [[ "$line" == "--" ]]; then if [[ ${#tmpbuf} -gt 10 && "$REALLOC_N" == "true" && "$ALLOC_N" == "true" ]]; then echo $line; while [[ ${#tmpbuf[*]} -gt 0 ]]; do echo "${tmpbuf[0]}"; tmpbuf=( "${tmpbuf[@]:1:${#tmpbuf[*]}}" ); done; fi; unset tmpbuf REALLOC_N ALLOC_N; else if [[ "$ALLOC_N" != "true" && "${line/VIR_ALLOC_N//}" != "${line}" ]]; then ALLOC_N="true"; fi; if [[ "$REALLOC_N" != "true" && "${line/VIR_REALLOC_N//}" != "${line}" ]]; then REALLOC_N="true"; fi; tmpbuf[${#tmpbuf[*]}]="$line"; fi; done | less

And reviewed the output just to find out this was the only occurrence of
the inconsistency.

12 years agoconf: minor indentation cleanups
Martin Kletzander [Mon, 17 Dec 2012 15:02:14 +0000 (16:02 +0100)]
conf: minor indentation cleanups

On few places there are too many levels of indentation when some of
them can be fixed with negating the option they are in or omitting
useless condition altogether.

12 years agofix typo in the word affinities
Martin Kletzander [Mon, 17 Dec 2012 15:01:41 +0000 (16:01 +0100)]
fix typo in the word affinities

This patch fixes just the word Affinites to Affinities (it's really
painful to search in TAGS without being able to find the right
function).

12 years agoFix libxl driver for virArch changes
Daniel P. Berrange [Tue, 18 Dec 2012 19:50:24 +0000 (19:50 +0000)]
Fix libxl driver for virArch changes

12 years agoFix test cases for virArch changes
Daniel P. Berrange [Tue, 18 Dec 2012 19:32:23 +0000 (19:32 +0000)]
Fix test cases for virArch changes

12 years agoFix XenAPI driver for virArch changes
Daniel P. Berrange [Tue, 18 Dec 2012 19:32:15 +0000 (19:32 +0000)]
Fix XenAPI driver for virArch changes

12 years agoExport all symbols from virarch.{c,h} to drivers/tests/etc
Daniel P. Berrange [Tue, 18 Dec 2012 19:31:47 +0000 (19:31 +0000)]
Export all symbols from virarch.{c,h} to drivers/tests/etc

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert QEMU capabilities code to use virArch
Daniel P. Berrange [Tue, 11 Dec 2012 13:06:45 +0000 (13:06 +0000)]
Convert QEMU capabilities code to use virArch

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agospec: Do not install *.py[co] in python examples
Jiri Denemark [Mon, 17 Dec 2012 18:27:38 +0000 (19:27 +0100)]
spec: Do not install *.py[co] in python examples

Unfortunately, rpm is stupid enough to bytycompile python scripts even
though they are located in /usr/share/doc/libvirt-python-*/examples and
it does so after %install phase is finished. Thus there's no way we
could remove those files from BUILDROOT. As a workaround, we may safely
remove the examples subdirectory completely without losing anything. The
python scripts that were installed there are also copied directly into
/usr/share/doc/libvirt-python-*/ by

    %doc python/tests/*.py

rule. And yes, the files are actually tests, not examples.

12 years agoConvert CPU APIs to use virArch
Daniel P. Berrange [Tue, 11 Dec 2012 12:58:54 +0000 (12:58 +0000)]
Convert CPU APIs to use virArch

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert capabilities / domain_conf to use virArch
Daniel P. Berrange [Mon, 10 Dec 2012 22:28:09 +0000 (22:28 +0000)]
Convert capabilities / domain_conf to use virArch

Convert the host capabilities and domain config structs to
use the virArch datatype. Update the parsers and all drivers
to take account of datatype change

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert QEMU command line builder to virArch APIs
Daniel P. Berrange [Mon, 10 Dec 2012 22:02:41 +0000 (22:02 +0000)]
Convert QEMU command line builder to virArch APIs

Use virArch APIs to determine host architecture when launching
QEMU.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert nodeGetInfo to virArch APIs
Daniel P. Berrange [Mon, 10 Dec 2012 21:58:16 +0000 (21:58 +0000)]
Convert nodeGetInfo to virArch APIs

Replace use of uname in nodeGetInfo with virArch APIs to
provide canonicalization of host architecture name

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce a set of APIs for managing architectures
Daniel P. Berrange [Mon, 10 Dec 2012 21:54:00 +0000 (21:54 +0000)]
Introduce a set of APIs for managing architectures

Introduce a 'virArch' enum for CPU architectures. Include
data type providing wordsize and endianness, and APIs to
query this info and convert to/from enum and string form.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agospec: Fix script warning when uninstalling libvirt-client
Cole Robinson [Mon, 17 Dec 2012 23:34:25 +0000 (18:34 -0500)]
spec: Fix script warning when uninstalling libvirt-client

https://bugzilla.redhat.com/show_bug.cgi?id=888071

12 years agodocs: Fix documentation for readonly element
Jiri Denemark [Tue, 18 Dec 2012 13:06:16 +0000 (14:06 +0100)]
docs: Fix documentation for readonly element

12 years agoAdded Ján Tomko to the commiters list
Daniel Veillard [Tue, 18 Dec 2012 03:08:01 +0000 (11:08 +0800)]
Added Ján Tomko to the commiters list

And Guannan Ren who was missing from the list

12 years agonetwork: don't require private addresses if dnsmasq uses SO_BINDTODEVICE
Laine Stump [Mon, 17 Dec 2012 17:49:18 +0000 (12:49 -0500)]
network: don't require private addresses if dnsmasq uses SO_BINDTODEVICE

This is yet another refinement to the fix for CVE-2012-3411:

   https://bugzilla.redhat.com/show_bug.cgi?id=833033

It turns out that it would be very intrusive to correctly backport the
entire --bind-dynamic option to older dnsmasq versions
(e.g. dnsmasq-2.48 that is used on RHEL6.x and CentOS 6.x), but very
simple to patch those versions to just use SO_BINDTODEVICE on all
their listening sockets (SO_BINDTODEVICE also has the desired effect
of permitting only traffic that was received on the interface(s) where
dnsmasq was set to listen.)

This patch modifies the dnsmasq capabilities detection to detect the
string:

    --bind-interfaces with SO_BINDTODEVICE

in the output of "dnsmasq --version", and in that case realize that
using the old --bind-interfaces option is just as safe as
--bind-dynamic (and therefore *not* forbid creation of networks that
use public IP address ranges).

If -bind-dynamic is available, it is still preferred over
--bind-interfaces.

Note that this patch does no harm in upstream, or in any distro's
downstream if it happens to end up there, but builds for distros that
have a new enough dnsmasq to support --bind-dynamic do *NOT* need to
specifically backport this patch; it's only required for distro
releases that have dnsmasq too old to have --bind-dynamic (and those
distros will need to add the SO_BINDTODEVICE patch to dnsmasq,
*including the extra string in the --version output*, as well.

12 years agoapparmor: Fix build
Jiri Denemark [Mon, 17 Dec 2012 20:17:15 +0000 (21:17 +0100)]
apparmor: Fix build

12 years agobuild: Fix AUTHORS generation
Jiri Denemark [Fri, 14 Dec 2012 15:14:15 +0000 (16:14 +0100)]
build: Fix AUTHORS generation

Using s/#authorslist#/$$out/ makes perl eat @domain part of all email
addresses from $out since it tries to interpret them as array variables.
I'm not sure if we can escape those in s/// but I know we can use print:

    s/#authorslist#// and print '$$out'

to tell perl not to even look inside $out.

This patch also fixes gen-AUTHORS so that it works in VPATH.

12 years agonetwork: fix indentation of networkDnsmasqConfContents
Laine Stump [Thu, 13 Dec 2012 16:40:47 +0000 (11:40 -0500)]
network: fix indentation of networkDnsmasqConfContents

Somehow I managed to push the changes to this file with improper
indentation. This patch just re-indents, reformats the comment lines,
and re-groups a couple of multi-line strings so that they fit within
80 columns. The resulting binary should be identical.

12 years ago.gitignore: add tests/sysinfotest
Cole Robinson [Mon, 17 Dec 2012 19:40:48 +0000 (14:40 -0500)]
.gitignore: add tests/sysinfotest

12 years agohostusb: Move USB_DEVFS define to hostusb.h to fix the build
Cole Robinson [Mon, 17 Dec 2012 19:37:11 +0000 (14:37 -0500)]
hostusb: Move USB_DEVFS define to hostusb.h to fix the build

12 years agodaemon: Preface polkit error output with 'polkit:'
Cole Robinson [Sun, 16 Dec 2012 22:59:08 +0000 (17:59 -0500)]
daemon: Preface polkit error output with 'polkit:'

There's been a few bugs about an expected error from polkit:

https://bugzilla.redhat.com/show_bug.cgi?id=873799
https://bugzilla.redhat.com/show_bug.cgi?id=872166

The error is:

Authorization requires authentication but no agent is available.

The error means that polkit needs a password, but there is no polkit
agent registered in your session. Polkit agents are the bit of UI that
pop up and actually ask for your password.

Preface the error with the string 'polkit:' so folks can hopefully
make more sense of it.

12 years agoAdd support for hotplug/unplug of host misc devices in LXC
Daniel P. Berrange [Wed, 28 Nov 2012 18:31:14 +0000 (18:31 +0000)]
Add support for hotplug/unplug of host misc devices in LXC

Wire up the attach/detach device drivers in LXC to support the
hotplug/unplug of host misc devices.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for hotplug/unplug of host storage devices in LXC
Daniel P. Berrange [Wed, 28 Nov 2012 16:48:18 +0000 (16:48 +0000)]
Add support for hotplug/unplug of host storage devices in LXC

Wire up the attach/detach device drivers in LXC to support the
hotplug/unplug of host storage devices.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for hotplug/unplug of USB host devices in LXC
Daniel P. Berrange [Tue, 27 Nov 2012 16:19:43 +0000 (16:19 +0000)]
Add support for hotplug/unplug of USB host devices in LXC

Wire up the attach/detach device drivers in LXC to support the
hotplug/unplug of USB host devices.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for hotplug/unplug of NIC devices in LXC
Daniel P. Berrange [Mon, 26 Nov 2012 16:14:37 +0000 (16:14 +0000)]
Add support for hotplug/unplug of NIC devices in LXC

Wire up the attach/detach device drivers in LXC to support the
hotplug/unplug of NICs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for hotplug/unplug of disk devices in LXC
Daniel P. Berrange [Thu, 22 Nov 2012 16:16:06 +0000 (16:16 +0000)]
Add support for hotplug/unplug of disk devices in LXC

Wire up the attach/detach device drivers in LXC to support the
hotplug/unplug of disks.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for attach/detach/update hostdev devices in config for LXC
Daniel P. Berrange [Tue, 27 Nov 2012 13:58:56 +0000 (13:58 +0000)]
Add support for attach/detach/update hostdev devices in config for LXC

Wire up the attach/detach/update device APIs to support changing
of hostdevs in the persistent config file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for attach/detach/update disk devices in config for LXC
Daniel P. Berrange [Thu, 22 Nov 2012 15:41:41 +0000 (15:41 +0000)]
Add support for attach/detach/update disk devices in config for LXC

Wire up the attach/detach/update device APIs to support changing
of disks in the persistent config file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for attach/detach/update net devices in config for LXC
Daniel P. Berrange [Fri, 23 Nov 2012 10:36:47 +0000 (10:36 +0000)]
Add support for attach/detach/update net devices in config for LXC

Wire up the attach/detach/update device APIs to support changing
of network interfaces in the persistent config file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd basic driver API framework for device attach/detach support in LXC
Daniel P. Berrange [Tue, 14 Aug 2012 15:38:27 +0000 (16:38 +0100)]
Add basic driver API framework for device attach/detach support in LXC

This wires up the LXC driver to support the domain device attach/
detach/update APIs, following the same code design as used in
the QEMU driver. No actual changes are possible with this commit,
it is only providing the framework

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for misc host device passthrough with LXC
Daniel P. Berrange [Wed, 28 Nov 2012 18:07:47 +0000 (18:07 +0000)]
Add support for misc host device passthrough with LXC

This extends support for host device passthrough with LXC to
cover misc devices. In this case all we need todo is a
mknod in the container's /dev and whitelist the device in
cgroups

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for storage host device passthrough with LXC
Daniel P. Berrange [Wed, 28 Nov 2012 16:13:27 +0000 (16:13 +0000)]
Add support for storage host device passthrough with LXC

This extends support for host device passthrough with LXC to
cover storage devices. In this case all we need todo is a
mknod in the container's /dev and whitelist the device in
cgroups

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for USB host device passthrough with LXC
Daniel P. Berrange [Fri, 23 Nov 2012 14:46:18 +0000 (14:46 +0000)]
Add support for USB host device passthrough with LXC

This adds support for host device passthrough with the
LXC driver. Since there is only a single kernel image,
it doesn't make sense to pass through PCI devices, but
USB devices are fine. For the latter we merely need to
make the /dev/bus/usb/NNN/MMM character device exist
in the container's /dev

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for disks with LXC
Daniel P. Berrange [Thu, 22 Nov 2012 14:33:48 +0000 (14:33 +0000)]
Add support for disks with LXC

Currently LXC guests can be given arbitrary pre-mounted
filesystems, however, for some usecases it is more appropriate
to provide block devices which the container can mount itself.
This first impl only allows for <disk type='block'>, in other
words exposing a host disk device to a container. Since LXC
does not have device namespace virtualization, we are cheating
a little bit. If the XML specifies /dev/sdc4 to be given to
the container as /dev/sda1, when we do the mknod /dev/sda1
in the container's /dev, we actually use the major:minor
number of /dev/sdc4, not /dev/sda1.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for SELinux labelling of hostdev storage/misc devices
Daniel P. Berrange [Wed, 28 Nov 2012 16:07:27 +0000 (16:07 +0000)]
Add support for SELinux labelling of hostdev storage/misc devices

The SELinux security driver needs to learn to label storage/misc
hostdev devices for LXC

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRefactor SELinux security driver hostdev labelling
Daniel P. Berrange [Wed, 28 Nov 2012 15:54:56 +0000 (15:54 +0000)]
Refactor SELinux security driver hostdev labelling

Prepare to support different types of hostdevs by refactoring
the current SELinux security driver code

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow passing a vroot into security manager hostdev labelling
Daniel P. Berrange [Tue, 27 Nov 2012 16:17:47 +0000 (16:17 +0000)]
Allow passing a vroot into security manager hostdev labelling

When LXC labels USB devices during hotplug, it is running in
host context, so it needs to pass in a vroot path to the
container root.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSkip bulk relabelling of resources in SELinux driver when used with LXC
Daniel P. Berrange [Wed, 28 Nov 2012 13:54:39 +0000 (13:54 +0000)]
Skip bulk relabelling of resources in SELinux driver when used with LXC

The virSecurityManager{Set,Restore}AllLabel methods are invoked
at domain startup/shutdown to relabel resources associated with
a domain. This works fine with QEMU, but with LXC they are in
fact both currently no-ops since LXC does not support disks,
hostdevs, or kernel/initrd files. Worse, when LXC gains support
for disks/hostdevs, they will do the wrong thing, since they
run in host context, not container context. Thus this patch
turns then into a formal no-op when used with LXC. The LXC
controller will call out to specific security manager labelling
APIs as required during startup.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRefactor LXC NIC creation to allow reuse by hotplug code
Daniel P. Berrange [Tue, 27 Nov 2012 12:55:02 +0000 (12:55 +0000)]
Refactor LXC NIC creation to allow reuse by hotplug code

The code for creating veth/macvlan devices is part of the
LXC process startup code. Refactor this a little and export
the methods to the rest of the LXC driver. This allows them
to be reused for NIC hotplug code

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for <hostdev mode="capabilities">
Daniel P. Berrange [Fri, 23 Nov 2012 13:50:29 +0000 (13:50 +0000)]
Add support for <hostdev mode="capabilities">

The <hostdev> device type has long had a redundant "mode"
attribute, which has always been "subsys". This finally
introduces a new mode "capabilities", which will be used
by the LXC driver for device assignment. Since container
based virtualization uses a single kernel, the idea of
assigning physical PCI devices doesn't make sense. It is
still reasonable to assign USB devices, but for assigning
arbitrary nodes in /dev, the new 'capabilities' mode is
to be used.

The first capability support is 'storage', which is for
assignment of block devices. Functionally this is really
pretty similar to the <disk> support. The only difference
is the device node name is identical in both host and
container namespaces.

    <hostdev mode='capabilities' type='storage'>
      <source>
        <block>/dev/sdf1</block>
      </source>
    </hostdev>

The second capability support is 'misc', which is for
assignment of character devices. There is no existing
parallel to this. Again the device node is the same
inside & outside the container.

    <hostdev mode='capabilities' type='misc'>
      <source>
        <char>/dev/input/event3</char>
      </source>
    </hostdev>

The reason for keeping the char & storage devices
separate in the domain XML, is to mirror the split
in the node device XML. NB the node device XML does
not yet report character devices, but that's another
new patch to come

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agotests: Add tests for sysinfo
Viktor Mihajlovski [Fri, 14 Dec 2012 15:08:25 +0000 (16:08 +0100)]
tests: Add tests for sysinfo

Test cases for virSysinfoRead. Initially, there are tests for
x86 (DMI based) and s390 (/proc/... based).
In lack of PPC data, I have stubbed out the test for it, but it
can be added with a minimal effort.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Fix virSysinfoRead memory corruption
Viktor Mihajlovski [Fri, 14 Dec 2012 15:08:24 +0000 (16:08 +0100)]
S390: Fix virSysinfoRead memory corruption

There was a double free issue caused by virSysinfoRead on s390,
as the same manufacturer string instance was assigned to more
than one processor record.
Cleaned up other potential memory issues and restructured the sysinfo
parsing code by moving repeating patterns into a helper function.

The restructuring made it necessary to conditionally disable
-Wlogical-op for some older GCC versions, using pragma GCC diagnostic.
This is a GCC specific pragma, which is acceptable, since we're
using it to work around a GCC specific bug.

Finally, added a function virSysinfoSetup to configure the sysinfo
data source files/script during run time, to facilitate writing test
programs. This function is not published in sysinfo.h and only
there for testing.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agobuild: Check for broken GCC -Wlogical-op in configure
Viktor Mihajlovski [Fri, 14 Dec 2012 15:08:23 +0000 (16:08 +0100)]
build: Check for broken GCC -Wlogical-op in configure

Some older versions of GCC report a false positive on code like
  char * haystack, needle;
  strchr(haystack, needle);

Added an extra check in configure.ac which will
  #define BROKEN_GCC_WLOGICALOP 1
in this case, allowing to special handle "offending" code.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoconf: cpu: Break some long lines
Peter Krempa [Mon, 17 Dec 2012 11:04:14 +0000 (12:04 +0100)]
conf: cpu: Break some long lines

12 years agoconf: cpu: Refactor parsing of vendor_id and fallback attributes
Peter Krempa [Mon, 17 Dec 2012 10:49:33 +0000 (11:49 +0100)]
conf: cpu: Refactor parsing of vendor_id and fallback attributes

This patch simplifies the code that parses the fallback and vendor_id
attributes from the domain xml cpu definition.

Changes done:
- free temp variables in the cleanup section instead of local use
- remove checking for presence of the attribute to directly getting the
value (saving call to virXPathBoolean)
- replace loop used to check for ',' in the vendor_id string with strchr

12 years agoconf: cpu: Fix memory leak when specifying cpu vendor_id manually
Peter Krempa [Mon, 17 Dec 2012 10:48:37 +0000 (11:48 +0100)]
conf: cpu: Fix memory leak when specifying cpu vendor_id manually

The field was not freed from the cpu definition.

12 years agoconf: cpu: Fix parsing of vendor_id
Ken ICHIKAWA [Mon, 17 Dec 2012 08:05:59 +0000 (17:05 +0900)]
conf: cpu: Fix parsing of vendor_id

This patch fixes a problem that vendor_id attribute can not be defined
when fallback attribute is not defined.

If I define domain xml like below:
<domain>
  <cpu>
    <model vendor_id='aaaabbbbcccc'>core2duo</model>
  </cpu>
</domain>

In dumpxml, vendor_id is not reflected:
<domain>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
  </cpu>
</domain>

The expected output is:
<domain>
  <cpu mode='custom' match='exact'>
    <model fallback='allow' vendor_id='aaaabbbbcccc'>core2duo</model>
  </cpu>
</domain>

If the fallback attribute and vendor_id attribute is defined at the same
time, it's reflected as expected.

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
12 years agoSupport custom 'svirt_tcg_t' context for TCG based guests
Daniel P. Berrange [Wed, 12 Dec 2012 11:47:19 +0000 (11:47 +0000)]
Support custom 'svirt_tcg_t' context for TCG based guests

The current SELinux policy only works for KVM guests, since
TCG requires the 'execmem' privilege. There is a 'virt_use_execmem'
boolean to turn this on globally, but that is unpleasant for users.
This changes libvirt to automatically use a new 'svirt_tcg_t'
context for TCG based guests. This obsoletes the previous
boolean tunable and makes things 'just work(tm)'

Since we can't assume we run with new enough policy, I also
make us log a warning message (once only) if we find the policy
lacks support. In this case we fallback to the normal label and
expect users to set the boolean tunable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agodocs: Replace </br> with <br/> in docs/news.html.in
Peter Krempa [Mon, 17 Dec 2012 10:01:16 +0000 (11:01 +0100)]
docs: Replace </br> with <br/> in docs/news.html.in

12 years agotests: add one -device video device testcase
Guannan Ren [Fri, 14 Dec 2012 07:09:17 +0000 (15:09 +0800)]
tests: add one -device video device testcase

The testcase is for testing non-fixed PCI address for primary
video device and using video args to -deivce qemu option.

12 years agoqemu: use newer -device video device in qemu commandline
Guannan Ren [Fri, 14 Dec 2012 07:08:01 +0000 (15:08 +0800)]
qemu: use newer -device video device in qemu commandline

'-device VGA' maps to '-vga std'
'-device cirrus-vga' maps to '-vga cirrus'
'-device qxl-vga' maps to '-vga qxl'
             (there is also '-device qxl' for secondary devices)
'-device vmware-svga' maps to '-vga vmware'

For qemu(>=1.2), we can use -device to replace -vga for video
device. For the primary video device, the patch tries to use 0x2
slot for matching old qemu. If the 0x2 slot is allocated already,
the addr property could help for using any available slot.
For qemu(< 1.2), we keep using -vga for primary device.

12 years agoconf: add optional attribte primary to video <model> element
Guannan Ren [Mon, 17 Dec 2012 06:01:20 +0000 (14:01 +0800)]
conf: add optional attribte primary to video <model> element

If there are multiple video devices
primary = 'yes' marks this video device as the primary one.
The rest are secondary video devices. No more than one could be
mark as primary. If none of them has primary attribute, the first
one will be the primary by default like what it was.
The reason of this changing is that for qemu, only one primary video
device is permitted which can be of any type. For secondary video
devices, only qxl is allowd. Primary attribute removes the restriction
that the first have to be the primary one.

We always put the primary video device into the first position of
video device structure array after parsing.

12 years agoqemu: add qemu vga devices caps and one cap to mark them usable
Guannan Ren [Fri, 14 Dec 2012 07:06:31 +0000 (15:06 +0800)]
qemu: add qemu vga devices caps and one cap to mark them usable

QEMU_CAPS_DEVICE_QXL          -device qxl
QEMU_CAPS_DEVICE_VGA          -device VGA
QEMU_CAPS_DEVICE_CIRRUS_VGA   -device cirrus-vga
QEMU_CAPS_DEVICE_VMWARE_SVGA  -device vmware-svga

QEMU_CAPS_DEVICE_VIDEO_PRIMARY  /* safe to use -device XXX
                                 for primary video device */

Fix a typo in qemuCapsObjectTypes, the string 'qxl' here
should be -device qxl rather than -vga [...|qxl|..]

12 years agoRelease of libvirt-1.0.1
Daniel Veillard [Mon, 17 Dec 2012 03:36:37 +0000 (11:36 +0800)]
Release of libvirt-1.0.1

- configure.ac docs/news.html.in: update for the release
- po/*.po: updated from transifex

12 years agobuild: minor build fixes for BSD
Eric Blake [Fri, 14 Dec 2012 19:02:10 +0000 (12:02 -0700)]
build: minor build fixes for BSD

Noticed these while building on FreeBSD.

* src/qemu/qemu_monitor.c (qemuMonitorBlockInfoLookup): Rename
variable to avoid 'devname' collision.
* src/qemu/qemu_driver.c (qemuDomainInterfaceStats): Mark unused
variable.

12 years agoSocket identity support for FreeBSD.
Roman Bogorodskiy [Fri, 14 Dec 2012 18:06:33 +0000 (22:06 +0400)]
Socket identity support for FreeBSD.

This adds an implementation of virNetSocketGetUNIXIdentity()
using LOCAL_PEERCRED socket option and xucred struct, defined
in <sys/ucred.h> on systems that have it.

12 years agonetwork: fix (non)update of dnsmasq config during virDomainUpdateDeviceFlags
Laine Stump [Fri, 14 Dec 2012 17:44:03 +0000 (12:44 -0500)]
network: fix (non)update of dnsmasq config during virDomainUpdateDeviceFlags

A forgotten "!" in recently-modified code at the top of
networkRefreshDaemon() meant an improper early return, which led to 1)
dnsmasq config files not being updated from the newly modified config,
and 2) dnsmasq not being sent a SIGHUP so that it could learn about
the changes to the config.

virNetworkDefGetIpByIndex() returns NULL if there are no ip objects of
the requested type, and if there are no IP elements, then dnsmasq
shouldn't be running, so we can return early. Otherwise we should
rewrite the config files and send a SIGHUP.

12 years agoRequire SANLK_INQ_WAIT for inq_lockspace support
Guido Günther [Thu, 13 Dec 2012 16:21:54 +0000 (17:21 +0100)]
Require SANLK_INQ_WAIT for inq_lockspace support

since compilation breaks otherwise with older libsanlock.

12 years agodocs: fix some typos in examples
Eric Blake [Fri, 14 Dec 2012 15:28:57 +0000 (08:28 -0700)]
docs: fix some typos in examples

As detected in https://bugzilla.redhat.com/show_bug.cgi?id=887187

* docs/formatdomain.html.in: Fix XML typos.

12 years agosanlock: Re-add lockspace unconditionally
Michal Privoznik [Fri, 14 Dec 2012 11:17:55 +0000 (12:17 +0100)]
sanlock: Re-add lockspace unconditionally

Currently, if sanlock is already registering a lockspace other
libvirtd instances (from other hosts) obtain -EINPROGRESS. On
sufficiently new sanlock, sanlock_inq_lockspace() is called,
which suspend execution until lockspace state is changed. With
current libvirt implementation, we fail to retry adding the
lockspace again but continue in error path. Therefore we produce
meaningless error message:

virLockManagerSanlockSetupLockspace:363 : Unable to add lockspace
/var/lib/libvirt/sanlock/__LIBVIRT__DISKS__: Success
qemudLoadDriverConfig:558 : Failed to load lock manager sanlock

We should try to re-add the lockspace after its state change to
be sure it was added successfully. In fact, with sufficiently new
sanlock we can just avoid dummy usleep() which is used if there's
no inquire API.

12 years agoinstall: fix virtlockd installation
Eric Blake [Thu, 13 Dec 2012 23:28:27 +0000 (16:28 -0700)]
install: fix virtlockd installation

The virtlockd daemon scripts were lousy, when compared to their
counterparts in daemon/Makefile.am.  In particular, when init
scripts were selected, this resulted in 'make distcheck' failing
due to failure to clean up src/virtlockd.init.

* src/Makefile.am (install-systemd): Fix dependencies.  Use MKDIR_P.
(uninstall-systemd): Remove empty directory.  Use fewer processes.
(install-init, install-sysconfig): Use MKDIR_P.
(uninstall-init): Remove correct file, and also empty directory.
(uninstall-sysconfig): Remove empty directory.
(DISTCLEANFILES): Clean up trivially built sources.

12 years agodocs: Fix location of libvirt.conf and auth.conf
Michał Łomnicki [Fri, 14 Dec 2012 02:52:17 +0000 (03:52 +0100)]
docs: Fix location of libvirt.conf and auth.conf

For a unprivileged user libvirt.conf and auth.conf are looked up in
$XDG_CONFIG_HOME but the docs incorrectly state that it's $XDG_CONFIG_DIR.

12 years agoqemu: don't fail update netdev on bridge detach failure
Laine Stump [Fri, 14 Dec 2012 00:09:51 +0000 (19:09 -0500)]
qemu: don't fail update netdev on bridge detach failure

When a network device's bridge connection is changed by
virDomainUpdateDevice, libvirt first removes the netdev's tap from its
old bridge, then adds it to the new bridge. Sometimes, due to a
network being destroyed while a guest device is still attached, the
tap may already be "removed" from the old bridge (or the old bridge
may not even exist any more); the existing code was needlessly failing
the update when this happened, making it impossible to recover from
the situation without completely detaching (i.e. removing) the netdev
from the guest and re-attaching.

Instead of failing the entire operation when removal of the tap from
the old bridge fails, this patch changes qemuDomainChangeNetBridge to
just log a warning and continue, allowing a reasonable recover from
the situation.

(you'll appreciate this change if you ever accidentally destroy a
network while your guests are still using it).