]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
12 years agoqemu: support named nbd exports
Paolo Bonzini [Mon, 25 Feb 2013 17:44:23 +0000 (18:44 +0100)]
qemu: support named nbd exports

These are supported by nbd-server and by the NBD server that QEMU
embeds for live image access.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: rewrite NBD command-line builder and parser
Paolo Bonzini [Mon, 25 Feb 2013 17:44:22 +0000 (18:44 +0100)]
qemu: rewrite NBD command-line builder and parser

Move the code to an external function, and structure it to prepare
the addition of new features in the next few patches.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: test NBD command-line builder and parser
Paolo Bonzini [Mon, 25 Feb 2013 17:44:22 +0000 (18:44 +0100)]
qemu: test NBD command-line builder and parser

Enable more testing of NBD parsing, to ensure rewrites work.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoutil: portably check for unchanged uid
Eric Blake [Thu, 14 Mar 2013 22:28:29 +0000 (16:28 -0600)]
util: portably check for unchanged uid

We've already scrubbed for comparisons of 'uid_t == -1' (which fail
on platforms where uid_t is a u16), but another one snuck in.

* src/util/virutil.c (virSetUIDGIDWithCaps): Correct uid comparison.
* cfg.mk (sc_prohibit_risky_id_promotion): New rule.

12 years agoqemu: do not support non-network disks without -drive
Paolo Bonzini [Mon, 25 Feb 2013 17:44:21 +0000 (18:44 +0100)]
qemu: do not support non-network disks without -drive

QEMU added -drive in 2007, and NBD in 2008.  Both appeared first in
release 0.10.0.  Thus the code to support network disks without -drive
is dead, and in fact it incorrectly escapes commas.  Drop it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoCleanup useless flags specifications
Martin Kletzander [Tue, 12 Mar 2013 15:35:30 +0000 (16:35 +0100)]
Cleanup useless flags specifications

After we switched to C99 initialization, I noticed there were many
places where the specification of .flags parameter differed.  After
going through many options and deciding whether to unify the
initialization to be '.flags = 0' or '.flags = VSH_OFLAG_NONE', I
realized both can be removed and it makes the code easier to go
through.

12 years agoFix snapshot-create-as syntax in help output
Martin Kletzander [Tue, 12 Mar 2013 15:34:31 +0000 (16:34 +0100)]
Fix snapshot-create-as syntax in help output

According to the man page, the memspec parameter should have the
'--memspec' option mandatory and this is as close as we can get to
that.  What this change does is explained below.

man virsh:

snapshot-create-as ... [[--live] [--memspec memspec]]

virsh help snapshot-create-as before this patch:

  SYNOPSIS
    snapshot-create-as ... [<memspec>] ...
...
  OPTIONS
    [--memspec] <string> ...

virsh help snapshot-create-as after this patch:

  SYNOPSIS
    snapshot-create-as ... [--memspec <string>] ...
...
  OPTIONS
    --memspec <string> ...

12 years agoMake vshDebug work when parsing parameters
Martin Kletzander [Wed, 13 Mar 2013 08:03:34 +0000 (09:03 +0100)]
Make vshDebug work when parsing parameters

The vshInit initializes ctl->debug by which vshDebug (which is also
called in vshParseArgv) decides whether to print out the message or
not.

12 years agoRemove contiguous CPU indexes assumption
Li Zhang [Fri, 15 Mar 2013 09:25:09 +0000 (17:25 +0800)]
Remove contiguous CPU indexes assumption

When getting CPUs' information, it assumes that CPU indexes
are not contiguous. But for ppc64 platform, CPU indexes are not
contiguous because SMT is needed to be disabled, so CPU information
is not right on ppc64 and vpuinfo, vcpupin can't work corretly.

This patch is to remove the assumption to be compatible with ppc64.

Test:
   4 vcpus are assigned to one VM and execute vcpuinfo command.

   Without patch: There is only one vcpu informaion can be listed.
   With patch: All vcpus' information can be listed correctly.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoUpdate to COPYING.LIB to latest LGPLv2.1 copy
Christophe Fergeau [Mon, 11 Mar 2013 11:40:35 +0000 (12:40 +0100)]
Update to COPYING.LIB to latest LGPLv2.1 copy

The text version
of LGPLv2.1 available at
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt is slightly
different from COPYING.LIB:
- several paragraphs were rewrapped
- the FSF address has changed, so the license has been changed to
  indicate the newer address

I've checked that there are no changes in the license text apart from
the updated address, which is what I want to fix with this commit.

12 years agoFix a copy & paste error for virsh dump help
Yanbing Du [Fri, 15 Mar 2013 07:40:18 +0000 (15:40 +0800)]
Fix a copy & paste error for virsh dump help

Signed-off-by: Yanbing Du <ydu@redhat.com>
12 years agoaudit: Audit resources used by VirtIO RNG
Peter Krempa [Mon, 11 Mar 2013 16:09:19 +0000 (17:09 +0100)]
audit: Audit resources used by VirtIO RNG

This patch adds auditing of resources used by Virtio RNG devices. Only
resources on the local filesystems are audited.

The audit logs look like:

For the 'random' backend:
type=VIRT_RESOURCE msg=audit(1363099126.643:31): pid=995252 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=rng reason=start vm="qcow-test" uuid=118733ed-b658-3e22-a2cb-4fe5cb3ddf79 old-rng="?" new-rng="/dev/random": exe="/home/pipo/libvirt/daemon/.libs/libvirtd" hostname=? addr=? terminal=pts/0 res=success'

For local character device source:
type=VIRT_RESOURCE msg=audit(1363100164.240:96): pid=995252 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=rng reason=start vm="qcow-test" uuid=118733ed-b658-3e22-a2cb-4fe5cb3ddf79 old-rng="?" new-rng="/tmp/unix.sock": exe="/home/pipo/libvirt/daemon/.libs/libvirtd" hostname=? addr=? terminal=pts/0 res=success'

12 years agoS390: Testcases for virtio-scsi and virtio-rng
Viktor Mihajlovski [Thu, 14 Mar 2013 18:32:26 +0000 (19:32 +0100)]
S390: Testcases for virtio-scsi and virtio-rng

Adding test cases for virtio-scsi and virtio-rng. Since ccw is covering
the superset of the s390 bus handling, these are deemed to be sufficient.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Enable virtio-scsi and virtio-rng
Viktor Mihajlovski [Thu, 14 Mar 2013 18:32:25 +0000 (19:32 +0100)]
S390: Enable virtio-scsi and virtio-rng

Newer versions of QEMU support virtio-scsi and virtio-rng devices
on the virtio-s390 and ccw buses. Adding capability detection,
address assignment and command line generation for that.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Rename virtio-scsi capability
Viktor Mihajlovski [Thu, 14 Mar 2013 18:32:24 +0000 (19:32 +0100)]
qemu: Rename virtio-scsi capability

QEMU_CAPS_VIRTIO_SCSI_PCI implies that virtio-scsi is only supported
for the PCI bus, which is not the case. Remove the _PCI suffix.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoutil: fix clear_emulator_capabilities=0
Laine Stump [Wed, 13 Mar 2013 19:26:35 +0000 (15:26 -0400)]
util: fix clear_emulator_capabilities=0

My commit 7a2e845a865dc7fa82d2393ea2a770cfc8cf00b4 (and its
prerequisites) managed to effectively ignore the
clear_emulator_capabilities setting in qemu.conf (visible in the code
as the VIR_EXEC_CLEAR_CAPS flag when qemu is being exec'ed), with the
result that the capabilities are always cleared regardless of the
qemu.conf setting. This patch fixes it by passing the flag through to
virSetUIDGIDWithCaps(), which uses it to decide whether or not to
clear existing capabilities before adding in those that were
requested.

Note that the existing capabilities are *always* cleared if the new
process is going to run as non-root, since the whole point of running
non-root is to have the capabilities removed (it's still possible to
maintain individual capabilities as needed using the capBits argument
though).

12 years agoqemu: detect multi-head qxl via more than version check
Eric Blake [Thu, 14 Mar 2013 00:41:22 +0000 (18:41 -0600)]
qemu: detect multi-head qxl via more than version check

Multi-head QXL support is so useful that distros have started to
backport it to qemu earlier than 1.2.  After discussion with
Alon Levy, we determined that the existence of the qxl-vga.surfaces
property is a reliable indicator of whether '-device qxl-vga' works,
or whether we have to stick to the older '-vga qxl'.  I'm leaving
in the existing check for QEMU_CAPS_DEVICE_VIDEO_PRIMARY tied to
qemu 1.2 and newer (in case qemu is built without qxl support),
but for those distros that backport qxl, this additional capability
check will allow the correct command line for both RHEL 6.3 (which
lacks the feature) and RHEL 6.4 (where qemu still claims to be
version 0.12.2.x, but has backported multi-head qxl).

* src/qemu/qemu_capabilities.c (virQEMUCapsObjectPropsQxlVga): New
property test.
(virQEMUCapsExtractDeviceStr): Probe for backport of new
capability to qemu earlier than 1.2.
* tests/qemuhelpdata/qemu-kvm-1.2.0-device: Update test.
* tests/qemuhelpdata/qemu-1.2.0-device: Likewise.
* tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel62-beta-device:
Likewise.

12 years agoFix deps for generating RPC dispatch code
Daniel P. Berrange [Thu, 14 Mar 2013 14:54:09 +0000 (14:54 +0000)]
Fix deps for generating RPC dispatch code

The src/lxc/lxc_*_dispatch.h files only had deps on the
RPC generator script & the XDR definition file. So when
the Makefile.am args passed to the generator were change,
the disaptch code was not re-generated. This caused a
build failure

  CC       libvirt_lxc-lxc_controller.o
lxc/lxc_controller.c: In function 'virLXCControllerSetupServer':
lxc/lxc_controller.c:718:47: error: 'virLXCMonitorProcs' undeclared (first use in this function)
lxc/lxc_controller.c:718:47: note: each undeclared identifier is reported only once for each function it appears in
lxc/lxc_controller.c:719:47: error: 'virLXCMonitorNProcs' undeclared (first use in this function)
make[3]: *** [libvirt_lxc-lxc_controller.o] Error 1

For added fun, the generated files were not listed in
CLEANFILES, so only a 'git clean -f' would fix the build

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix size probing for VDI images
Ján Tomko [Thu, 14 Mar 2013 12:24:03 +0000 (13:24 +0100)]
Fix size probing for VDI images

Commit 027bf2ea used the wrong offset: the text field at the start
of the header has 64 bytes, not 68. [1]

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

[1] https://forums.virtualbox.org/viewtopic.php?p=29267#p29267

12 years agoFix generation of systemtap probes for RPC protocols
Daniel P. Berrange [Wed, 13 Mar 2013 19:19:22 +0000 (19:19 +0000)]
Fix generation of systemtap probes for RPC protocols

The naming used in the RPC protocols for the LXC monitor and
lock daemon confused the script used to generate systemtap
helper functions. Rename the LXC monitor protocol symbols to
reduce confusion. Adapt the gensystemtap.pl script to cope
with the LXC monitor / lock daemon naming conversions.

This has no functional impact on RPC wire protocol, since
names are only used in the C layer

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRe-add DTrace probes on 'dispose' functions
Daniel P. Berrange [Wed, 13 Mar 2013 19:17:32 +0000 (19:17 +0000)]
Re-add DTrace probes on 'dispose' functions

When converting to virObject, the probes on the 'Free' functions
were removed on the basis that there is a probe on virObjectFree
that suffices. This puts a burden on people writing probe scripts
to identify which object is being dispose. This adds back probes
in the 'Dispose' functions and updates the rpc monitor systemtap
example to use them

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix parsing of SELinux ranges without a category
Daniel P. Berrange [Wed, 13 Mar 2013 17:58:26 +0000 (17:58 +0000)]
Fix parsing of SELinux ranges without a category

Normally libvirtd should run with a SELinux label

  system_u:system_r:virtd_t:s0-s0:c0.c1023

If a user manually runs libvirtd though, it is sometimes
possible to get into a situation where it is running

  system_u:system_r:init_t:s0

The SELinux security driver isn't expecting this and can't
parse the security label since it lacks the ':c0.c1023' part
causing it to complain

  internal error Cannot parse sensitivity level in s0

This updates the parser to cope with this, so if no category
is present, libvirtd will hardcode the equivalent of c0.c1023.

Now this won't work if SELinux is in Enforcing mode, but that's
not an issue, because the user can only get into this problem
if in Permissive mode. This means they can now start VMs in
Permissive mode without hitting that parsing error

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSeparate MCS range parsing from MCS range checking
Daniel P. Berrange [Wed, 13 Mar 2013 17:41:19 +0000 (17:41 +0000)]
Separate MCS range parsing from MCS range checking

Pull the code which parses the current process MCS range
out of virSecuritySELinuxMCSFind and into a new method
virSecuritySELinuxMCSGetProcessRange.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix memory leak on OOM in virSecuritySELinuxMCSFind
Daniel P. Berrange [Wed, 13 Mar 2013 17:39:52 +0000 (17:39 +0000)]
Fix memory leak on OOM in virSecuritySELinuxMCSFind

The body of the loop in virSecuritySELinuxMCSFind would
directly 'return NULL' on OOM, instead of jumping to the
cleanup label. This caused a leak of several local vars.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAvoid closing uninitialized FDs when LXC startup fails
Daniel P. Berrange [Wed, 13 Mar 2013 17:30:31 +0000 (17:30 +0000)]
Avoid closing uninitialized FDs when LXC startup fails

If an LXC domain failed to start because of a bogus SELinux
label, virLXCProcessStart would call VIR_CLOSE(0) by mistake.
This is because the code which initializes the member of the
ttyFDs array to -1 got moved too far away from the place where
the array is first allocated.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoPrevent streams from becoming libvirtd controlling TTY
Daniel P. Berrange [Wed, 13 Mar 2013 17:22:28 +0000 (17:22 +0000)]
Prevent streams from becoming libvirtd controlling TTY

When opening a stream to a device which is a TTY, that device
may become the controlling TTY of libvirtd, if libvirtd was
daemonized. This in turn means when the other end of the stream
closes, libvirtd gets SIGHUP, causing it to reload its config.
Prevent this by forcing O_NOCTTY on all streams that are opened

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirtio-rng: Add rate limiting options for virtio-RNG
Peter Krempa [Wed, 13 Feb 2013 14:37:39 +0000 (15:37 +0100)]
virtio-rng: Add rate limiting options for virtio-RNG

Qemu's implementation of virtio RNG supports rate limiting of the
entropy used. This patch exposes the option to tune this functionality.

This patch is based on qemu commit 904d6f588063fb5ad2b61998acdf1e73fb4

The rate limiting is exported in the XML as:
<devices>
  ...
  <rng model='virtio'>
    <rate bytes='123' period='1234'/>
    <backend model='random'/>
  </rng>
  ...

12 years agoutil: escapes special characters in VIR_LOG_REGEX
Guannan Ren [Sat, 9 Mar 2013 14:49:16 +0000 (22:49 +0800)]
util: escapes special characters in VIR_LOG_REGEX

In debug mode, the bug failed to start vm
error: Failed to start domain rhel5u9
error: internal error Out of space while reading console log output:
...

12 years agoS390: Testcases for virtio-ccw machines
Viktor Mihajlovski [Tue, 5 Mar 2013 15:44:23 +0000 (16:44 +0100)]
S390: Testcases for virtio-ccw machines

This adds and corrects testcases for virtio devices on s390
guests.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Add hotplug support for s390 virtio devices
J.B. Joret [Tue, 5 Mar 2013 15:44:22 +0000 (16:44 +0100)]
S390: Add hotplug support for s390 virtio devices

We didn't yet expose the virtio device attach and detach functionality
for s390 domains as the device hotplug was very limited with the old
virtio-s390 bus. With the CCW bus there's full hotplug support for
virtio devices in QEMU, so we are adding this to libvirt too.

Since the virtio hotplug isn't limited to PCI anymore, we change the
function names from xxxPCIyyy to xxxVirtioyyy, where we handle all
three virtio bus types.

Signed-off-by: J.B. Joret <jb@linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: QEMU driver support for CCW addresses
Viktor Mihajlovski [Tue, 5 Mar 2013 15:44:21 +0000 (16:44 +0100)]
S390: QEMU driver support for CCW addresses

This commit adds the QEMU driver support for CCW addresses. The
current QEMU only allows virtio devices to be attached to the
CCW bus. We named the new capability indicating that support
QEMU_CAPS_VIRTIO_CCW accordingly.

The fact that CCW devices can only be assigned to domains with a
machine type of s390-ccw-virtio requires a few extra checks for
machine type in qemu_command.c on top of querying
QEMU_CAPS_VIRTIO_{CCW|S390}.

The majority of the new functions deals with CCW address generation
and management.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: domain_conf support for CCW
Viktor Mihajlovski [Tue, 5 Mar 2013 15:44:20 +0000 (16:44 +0100)]
S390: domain_conf support for CCW

Add necessary handling code for the new s390 CCW address type to
virDomainDeviceInfo. Further, introduce  memory management, XML
parsing, output formatting and range validation for the new
virDomainDeviceCCWAddress type.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Documentation for CCW address type
Viktor Mihajlovski [Tue, 5 Mar 2013 15:44:19 +0000 (16:44 +0100)]
S390: Documentation for CCW address type

The native bus for s390 I/O is called CCW (channel command word).
As QEMU has added basic support for the CCW bus, i.e. the
ability to assign CCW devnos (bus addresses) to devices.
Domains with the new machine type s390-ccw-virtio can use the
CCW bus. Currently QEMU will only allow to define virtio
devices on the CCW bus.
Here we add the new machine type and the new device address to the
schema definition and add a new paragraph to the domain XML
documentation.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoDaemonize fuse thread in libvirt_lxc
Daniel P. Berrange [Thu, 7 Mar 2013 18:49:45 +0000 (18:49 +0000)]
Daemonize fuse thread in libvirt_lxc

In some startup failure modes, the fuse thread may get itself
wedged. This will cause the entire libvirt_lxc process to
hang trying to the join the thread. There is no compelling
reason to wait for the thread to exit if the whole process
is exiting, so just daemonize the fuse thread instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse separate symbol file for GNUTLS symbols
Daniel P. Berrange [Wed, 13 Mar 2013 13:37:29 +0000 (13:37 +0000)]
Use separate symbol file for GNUTLS symbols

A number of symbols are only present when GNUTLS is enabled.
Thus we must use a separate libvirt_gnutls.syms file for them
instead of libvirt_private.syms

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix missing error dispatch in virDomainLxcEnterNamespace
Daniel P. Berrange [Tue, 12 Mar 2013 17:36:19 +0000 (17:36 +0000)]
Fix missing error dispatch in virDomainLxcEnterNamespace

The virDomainLxcEnterNamespace method mistakenly uses
virCheckFlags, which returns immediately instead of
virCheckFlagsGoto which jumps to the error cleanup
patch where there is a virDispatchError call

12 years agoFix query of LXC security label
Daniel P. Berrange [Tue, 12 Mar 2013 17:34:37 +0000 (17:34 +0000)]
Fix query of LXC security label

The virDomainGetSecurityLabel method is currently (mistakenly)
showing the label of the libvirt_lxc process:

...snip...
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:virtd_t:s0-s0:c0.c1023 (permissive)

when it should be showing the init process label

...snip...
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c724,c995 (permissive)

12 years agoApply security label when entering LXC namespaces
Daniel P. Berrange [Tue, 12 Mar 2013 17:24:01 +0000 (17:24 +0000)]
Apply security label when entering LXC namespaces

Add a new virDomainLxcEnterSecurityLabel() function as a
counterpart to virDomainLxcEnterNamespaces(), which can
change the current calling process to have a new security
context. This call runs client side, not in libvirtd
so we can't use the security driver infrastructure.

When entering a namespace, the process spawned from virsh
will default to running with the security label of virsh.
The actual desired behaviour is to run with the security
label of the container most of the time. So this changes
virsh lxc-enter-namespace command to invoke the
virDomainLxcEnterSecurityLabel method.

The current behaviour is:

LABEL                             PID TTY          TIME CMD
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 1 pts/0 00:00:00 systemd
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 3 pts/1 00:00:00 sh
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 24 ? 00:00:00 systemd-journal
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 29 ? 00:00:00 dhclient
staff_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 47 ? 00:00:00 ps

Note the ps command is running as unconfined_t,  After this patch,

The new behaviour is this:

virsh -c lxc:/// lxc-enter-namespace dan -- /bin/ps -eZ
LABEL                             PID TTY          TIME CMD
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 1 pts/0 00:00:00 systemd
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 3 pts/1 00:00:00 sh
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 24 ? 00:00:00 systemd-journal
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 32 ? 00:00:00 dhclient
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 38 ? 00:00:00 ps

The '--noseclabel' flag can be used to skip security labelling.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu_driver: Try KVM_CAP_MAX_VCPUS only if defined
Michal Privoznik [Wed, 13 Mar 2013 10:29:38 +0000 (11:29 +0100)]
qemu_driver: Try KVM_CAP_MAX_VCPUS only if defined

With our recent patch (1715c83b5f) we thrive to get the correct
number of maximal VCPUs. However, we are using a constant from
linux/kvm.h which may be not defined in every distro. Hence, we
should guard usage of the constant with ifdef preprocessor
directive. This was introduced in kernel:

    commit 8c3ba334f8588e1d5099f8602cf01897720e0eca
    Author: Sasha Levin <levinsasha928@gmail.com>
    Date:   Mon Jul 18 17:17:15 2011 +0300

    KVM: x86: Raise the hard VCPU count limit

    The patch raises the hard limit of VCPU count to 254.

    This will allow developers to easily work on scalability
    and will allow users to test high VCPU setups easily without
    patching the kernel.

    To prevent possible issues with current setups, KVM_CAP_NR_VCPUS
    now returns the recommended VCPU limit (which is still 64) - this
    should be a safe value for everybody, while a new KVM_CAP_MAX_VCPUS
    returns the hard limit which is now 254.

$ git desc 8c3ba334f
v3.1-rc7-48-g8c3ba33

12 years agovirCaps: conf: start splitting out irrelevat data
Peter Krempa [Tue, 5 Mar 2013 15:17:24 +0000 (16:17 +0100)]
virCaps: conf: start splitting out irrelevat data

The virCaps structure gathered a ton of irrelevant data over time that.
The original reason is that it was propagated to the XML parser
functions.

This patch aims to create a new data structure virDomainXMLConf that
will contain immutable data that are used by the XML parser. This will
allow two things we need:

1) Get rid of the stuff from virCaps

2) Allow us to add callbacks to check and add driver specific stuff
after domain XML is parsed.

This first attempt removes pointers to private data allocation functions
to this new structure and update all callers and function that require
them.

12 years agoRemove hack using existance of an 'identity' string to disable auth
Daniel P. Berrange [Fri, 20 Jan 2012 16:56:31 +0000 (16:56 +0000)]
Remove hack using existance of an 'identity' string to disable auth

Currently the server determines whether authentication of clients
is complete, by checking whether an identity is set. This patch
removes that lame hack and replaces it with an explicit method
for changing the client auth code

* daemon/remote.c: Update for new APis
* src/libvirt_private.syms, src/rpc/virnetserverclient.c,
  src/rpc/virnetserverclient.h: Remove virNetServerClientGetIdentity
  and virNetServerClientSetIdentity, adding a new method
  virNetServerClientSetAuth.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd API for thread cancellation
Daniel P. Berrange [Mon, 23 Jan 2012 14:58:13 +0000 (14:58 +0000)]
Add API for thread cancellation

Add a virThreadCancel function. This functional is inherently
dangerous and not something we want to use in general, but
integration with SELinux requires that we provide this stub.
We leave out any Win32 impl to discourage further use and
because obviously SELinux isn't enabled on Win32

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing break in LXC loop device setup
Daniel P. Berrange [Tue, 12 Mar 2013 11:52:09 +0000 (11:52 +0000)]
Add missing break in LXC loop device setup

When setting up disks with loop devices for LXC, one of the
switch cases was missing a 'break' causing it to fallthrough
to an error condition.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Avoid NULL dereference in qemuSharedDiskEntryFree
Jiri Denemark [Tue, 12 Mar 2013 08:10:41 +0000 (09:10 +0100)]
qemu: Avoid NULL dereference in qemuSharedDiskEntryFree

At least one caller may call qemuSharedDiskEntryFree with NULL as the
first argument. Let's make the function similar to other *Free functions
and do nothing in such case.

12 years agodocs: Clarify semantics of sparse storage volumes
Jiri Denemark [Mon, 11 Mar 2013 13:42:40 +0000 (14:42 +0100)]
docs: Clarify semantics of sparse storage volumes

Sparse LVM volumes do not behave in the way one would naively expect.
The allocation does not automatically increase (which is different from
how sparse files work).

12 years agoqemu: Fix retrieval of maximum number of vCPUs on KVM hosts
Peter Krempa [Mon, 11 Mar 2013 13:50:54 +0000 (14:50 +0100)]
qemu: Fix retrieval of maximum number of vCPUs on KVM hosts

The detection of the maximum number of cpus used incorrect ioctl
argument value. This flaw caused that on kvm hosts this returns always
"160" as the maximum. This is just a recommended maximum value. The real
value is higher than that.

This patch tweaks the detection function to behave as described by the
kernel docs:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/virtual/kvm/api.txt?id=refs/tags/v3.9-rc2#n199

12 years agonodeinfo: don't define nodeGetCellMemory if it isn't ever used
Hu Tao [Mon, 11 Mar 2013 08:57:26 +0000 (16:57 +0800)]
nodeinfo: don't define nodeGetCellMemory if it isn't ever used

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
12 years agovirsh: fix snapshot-create with no xmlfile
Ján Tomko [Mon, 11 Mar 2013 12:22:21 +0000 (13:22 +0100)]
virsh: fix snapshot-create with no xmlfile

Properly check the return value of vshCommandOptStringReq for xmlfile:
* error out on incorrect input (--xmlfile '')
* use default XML <domainsnapshot/> with no --xmlfile specified

(Broken by commit b2e8585)

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

12 years agoConvert HAVE_SELINUX to WITH_SELINUX
Guido Günther [Sat, 9 Mar 2013 14:56:11 +0000 (15:56 +0100)]
Convert HAVE_SELINUX to WITH_SELINUX

these were missed by 63f18f378693cac6b6e33f4a8c15c20cb191c7c8

12 years agolxc: Init activeUsbHostdevs
Guido Günther [Sat, 9 Mar 2013 13:51:25 +0000 (14:51 +0100)]
lxc: Init activeUsbHostdevs

otherwise we crash with

 #0  virUSBDeviceListFind (list=0x0, dev=dev@entry=0x8193d70) at util/virusb.c:526
 #1  0xb1a4995b in virLXCPrepareHostdevUSBDevices (driver=driver@entry=0x815d9a0, name=0x815dbf8 "debian-700267", list=list@entry=0x81d8f08) at lxc/lxc_hostdev.c:88
 #2  0xb1a49fce in virLXCPrepareHostUSBDevices (def=0x8193af8, driver=0x815d9a0) at lxc/lxc_hostdev.c:261
 #3  virLXCPrepareHostDevices (driver=driver@entry=0x815d9a0, def=0x8193af8) at lxc/lxc_hostdev.c:328
 #4  0xb1a4c5b1 in virLXCProcessStart (conn=0x817d3f8, driver=driver@entry=0x815d9a0, vm=vm@entry=0x8190908, autoDestroy=autoDestroy@entry=false, reason=reason@entry=VIR_DOMAIN_RUNNING_BOOTED)
     at lxc/lxc_process.c:1068
 #5  0xb1a57e00 in lxcDomainStartWithFlags (dom=dom@entry=0x815e460, flags=flags@entry=0) at lxc/lxc_driver.c:1014
 #6  0xb1a57fc3 in lxcDomainStart (dom=0x815e460) at lxc/lxc_driver.c:1046
 #7  0xb79c8375 in virDomainCreate (domain=domain@entry=0x815e460) at libvirt.c:8450
 #8  0x08078959 in remoteDispatchDomainCreate (args=0x81920a0, rerr=0xb65c21d0, client=0xb0d00490, server=<optimized out>, msg=<optimized out>) at remote_dispatch.h:1066
 #9  remoteDispatchDomainCreateHelper (server=0x80c4928, client=0xb0d00490, msg=0xb0d005b0, rerr=0xb65c21d0, args=0x81920a0, ret=0x815d208) at remote_dispatch.h:1044
 #10 0xb7a36901 in virNetServerProgramDispatchCall (msg=0xb0d005b0, client=0xb0d00490, server=0x80c4928, prog=0x80c6438) at rpc/virnetserverprogram.c:432
 #11 virNetServerProgramDispatch (prog=0x80c6438, server=server@entry=0x80c4928, client=0xb0d00490, msg=0xb0d005b0) at rpc/virnetserverprogram.c:305
 #12 0xb7a300a7 in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x80c4928) at rpc/virnetserver.c:162
 #13 virNetServerHandleJob (jobOpaque=0xb0d00510, opaque=0x80c4928) at rpc/virnetserver.c:183
 #14 0xb7924f98 in virThreadPoolWorker (opaque=opaque@entry=0x80a94b0) at util/virthreadpool.c:144
 #15 0xb7924515 in virThreadHelper (data=0x80a9440) at util/virthreadpthread.c:161
 #16 0xb7887c39 in start_thread (arg=0xb65c2b70) at pthread_create.c:304
 #17 0xb77eb78e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

when adding a domain with a usb device. This is Debian bug

    http://bugs.debian.org/700267

12 years agobandwidth: Require network QoS if interface uses 'floor'
Michal Privoznik [Thu, 7 Mar 2013 09:53:21 +0000 (10:53 +0100)]
bandwidth: Require network QoS if interface uses 'floor'

By current implementation, network inbound is required in order
to use 'floor' for guaranteeing  minimal throughput. This is so,
because we want user to tell us the maximal throughput of the
network instead of finding out ourselves (and detect bogus values
in case of virtual interfaces). However, we are nowadays
requiring this only on documentation level. So if user starts a
domain with 'floor' set on one its interfaces, we silently ignore
the setting. We should error out instead.

12 years agovirsh-domain: Remove unused vshCompleteXMLFromDomain
Peter Krempa [Fri, 8 Mar 2013 09:08:26 +0000 (10:08 +0100)]
virsh-domain: Remove unused vshCompleteXMLFromDomain

The function is marked as unused and breaks compilation on RHEL4. Remove
it from the tree until a new use case can be found.

12 years agoRevert "Ensure xmlSaveToBuffer is always defined"
Peter Krempa [Fri, 8 Mar 2013 09:04:55 +0000 (10:04 +0100)]
Revert "Ensure xmlSaveToBuffer is always defined"

The commit originally fixed code that isn't being used. Revert
it and remove the unused code as a real fix.

This reverts commit a66b32d9295ed87698ffd98d82e9e5818ff799e5.

12 years agocapabilities: add NUMA memory information
Dusty Mabe [Thu, 7 Mar 2013 16:03:36 +0000 (11:03 -0500)]
capabilities: add NUMA memory information

'virsh capabilities' will now include a new <memory> element
per <cell> of the topology, as in:

    <topology>
      <cells num='2'>
        <cell id='0'>
          <memory unit='KiB'>12572412</memory>
          <cpus num='12'>
          ...
        </cell>

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agolxc: include sys/stat.h
Guido Günther [Fri, 8 Mar 2013 16:28:37 +0000 (17:28 +0100)]
lxc: include sys/stat.h

This fixes the build on Debian Wheezy which otherwise fails with:

  CC     libvirt_driver_lxc_impl_la-lxc_process.lo
  lxc/lxc_process.c: In function 'virLXCProcessGetNsInode':
  lxc/lxc_process.c:648:5: error: implicit declaration of function 'stat' [-Werror=implicit-function-declaration]
  lxc/lxc_process.c:648:5: error: nested extern declaration of 'stat' [-Werror=nested-externs]
  cc1: all warnings being treated as errors

12 years agoqemuDomainBlockStatsFlags: Guard disk lookup with a domain job
Michal Privoznik [Fri, 8 Mar 2013 12:09:32 +0000 (13:09 +0100)]
qemuDomainBlockStatsFlags: Guard disk lookup with a domain job

When there are two concurrent threads, we may dereference a NULL
pointer, even though it has been checked before:

1. Thread1: starts executing qemuDomainBlockStatsFlags() with nparams != 0.
            It finds given disk and successfully pass check for disk->info.alias
            not being NULL.
2. Thread2: starts executing qemuDomainDetachDeviceFlags() on the very same
            disk as Thread1 is working on.
3. Thread1: gets to qemuDomainObjBeginJob() where it sets a job on a
            domain.
4. Thread2: also tries to set a job. However, we are not guaranteed which
            thread wins. So assume it's Thread2 who can continue.
5. Thread2: does the actual detach and frees disk->info.alias
6. Thread2: quits the job
7. Thread1: now successfully acquires the job, and accesses a NULL pointer.

12 years agoapparmor: use AppArmorSetFDLabel for both imageFD and tapFD
Guannan Ren [Thu, 7 Mar 2013 16:16:59 +0000 (00:16 +0800)]
apparmor: use AppArmorSetFDLabel for both imageFD and tapFD

Rename AppArmorSetImageFDLabel to AppArmorSetFDLabel which could
be used as a common function for *ALL* fd relabelling in Linux.

In apparmor profile for specific vm with uuid cdbebdfa-1d6d-65c3-be0f-fd74b978a773
Path: /etc/apparmor.d/libvirt/libvirt-cdbebdfa-1d6d-65c3-be0f-fd74b978a773.files
The last line is for the tapfd relabelling.

 # DO NOT EDIT THIS FILE DIRECTLY. IT IS MANAGED BY LIBVIRT.
  "/var/log/libvirt/**/rhel6qcow2.log" w,
  "/var/lib/libvirt/**/rhel6qcow2.monitor" rw,
  "/var/run/libvirt/**/rhel6qcow2.pid" rwk,
  "/run/libvirt/**/rhel6qcow2.pid" rwk,
  "/var/run/libvirt/**/*.tunnelmigrate.dest.rhel6qcow2" rw,
  "/run/libvirt/**/*.tunnelmigrate.dest.rhel6qcow2" rw,
  "/var/lib/libvirt/images/rhel6u3qcow2.img" rw,
  "/dev/tap45" rw,

12 years agoInclude pid namespace inode in LXC audit messages
Daniel P. Berrange [Wed, 6 Mar 2013 14:56:49 +0000 (14:56 +0000)]
Include pid namespace inode in LXC audit messages

To allow the efficient correlation of container audit messages
with host hosts, include the pid namespace inode in audit
messages.

12 years agoAdd support for disks backed by plain files in LXC
Daniel P. Berrange [Mon, 4 Mar 2013 18:09:23 +0000 (18:09 +0000)]
Add support for disks backed by plain files in LXC

By using a loopback device, disks backed by plain files can
be made available to LXC containers. We make no attempt to
auto-detect format if <driver type="raw"/> is not set,
instead we unconditionally treat that as meaning raw. This
is to avoid the security issues inherent with format
auto-detection

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRefactor loop device setup code in LXC
Daniel P. Berrange [Mon, 4 Mar 2013 18:02:42 +0000 (18:02 +0000)]
Refactor loop device setup code in LXC

Minor re-factoring of code for setting up loop devices in
the LXC controller

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert QEMU driver to use virLogProbablyLogMessage
Daniel P. Berrange [Mon, 4 Mar 2013 20:50:42 +0000 (20:50 +0000)]
Convert QEMU driver to use virLogProbablyLogMessage

The current QEMU code for skipping log messages only skips over
'debug' message, switch to virLogProbablyLogMessage to make sure
it skips over all of them

12 years agoImprove LXC startup error reporting
Daniel P. Berrange [Mon, 4 Mar 2013 20:47:37 +0000 (20:47 +0000)]
Improve LXC startup error reporting

Currently we rely on a VIR_ERROR message being logged by the
virRaiseError function to report LXC startup errors. This gives
the right message, but is rather ugly and can be truncated
if lots of log messages are written. Change the LXC controller
to explicitly print any virErrorPtr message to stderr. Then
change the driver to skip over anything that looks like a log
message.

The result is that this

error: Failed to start domain busy
error: internal error guest failed to start: 2013-03-04 19:46:42.846+0000: 1734: info : libvirt version: 1.0.2
2013-03-04 19:46:42.846+0000: 1734: error : virFileLoopDeviceAssociate:600 : Unable to open /root/disk.raw: No such file or directory

changes to

error: Failed to start domain busy
error: internal error guest failed to start: Unable to open /root/disk.raw: No such file or directory
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd method for checking if a string is (probably) a log message
Daniel P. Berrange [Mon, 4 Mar 2013 20:46:32 +0000 (20:46 +0000)]
Add method for checking if a string is (probably) a log message

When reading log output from QEMU/LXC we need to skip over any
libvirt log messages. Currently the QEMU driver checks for a
fixed string, but this is better done with a regex. Add a method
virLogProbablyLogMessage to do a regex check

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse VIR_MASS_CLOSE in LXC container startup
Daniel P. Berrange [Thu, 7 Mar 2013 16:39:33 +0000 (16:39 +0000)]
Use VIR_MASS_CLOSE in LXC container startup

In the LXC container startup code when switching stdio
streams, we call VIR_FORCE_CLOSE on all FDs. This triggers
a huge number of warnings, but we don't see them because
stdio is closed at this point. strace() however shows them
which can confuse people debugging the code. Switch to
VIR_MASS_CLOSE to avoid this

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoEnsure xmlSaveToBuffer is always defined
Daniel P. Berrange [Thu, 7 Mar 2013 16:38:56 +0000 (16:38 +0000)]
Ensure xmlSaveToBuffer is always defined

RHEL4 vintage libxml2 header files are missing xmlSaveToBuffer
despite the symbol existing in the binary

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix conditional build of virNetDevSetupControlFull
Daniel P. Berrange [Thu, 7 Mar 2013 16:36:57 +0000 (16:36 +0000)]
Fix conditional build of virNetDevSetupControlFull

The virNetDevSetupControlFull function was protected by a
conditional on SIOCBRADDBR, which is bogus since it does
not use that symbol. Update the conditionals around all
callers to do stricter checks to ensure we always build
succesfully

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoEnsure GET_VLAN_VID_CMD is always defined
Daniel P. Berrange [Thu, 7 Mar 2013 16:35:59 +0000 (16:35 +0000)]
Ensure GET_VLAN_VID_CMD is always defined

The RHEL4 vintage header files do not define GET_VLAN_VID_CMD.
Conditionally define it in our source, since the kernel can
raise a runtime error if it isn't supported

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't import loop.h unless HAVE_DECL_LO_FLAGS_AUTOCLEAR is defined
Daniel P. Berrange [Thu, 7 Mar 2013 16:34:54 +0000 (16:34 +0000)]
Don't import loop.h unless HAVE_DECL_LO_FLAGS_AUTOCLEAR is defined

The loop.h on RHEL4 is broken and cannot be imported. We already
detect this in configure as a side-effect of looking for whether
LO_FLAGS_AUTOCLEAR is available. We protected the impl with
HAVE_DECL_LO_FLAGS_AUTOCLEAR, but not the header import

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename 'daemon' param to 'binary' in virNetClientNewUNIX
Daniel P. Berrange [Thu, 7 Mar 2013 16:33:33 +0000 (16:33 +0000)]
Rename 'daemon' param to 'binary' in virNetClientNewUNIX

To avoid a clash with daemon() libc API, rename the
'daemon' param in the header file to 'binary'. The
source file already uses the name 'binary'.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename 'clone' to 'clonevol' to avoid name clash with clone() syscall
Daniel P. Berrange [Thu, 7 Mar 2013 16:32:27 +0000 (16:32 +0000)]
Rename 'clone' to 'clonevol' to avoid name clash with clone() syscall

On RHEL-4 vintage one of the header files is polluted causing a
clash between the clone() syscall and the 'clone' parameter in
a libvirt driver API

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoviralloc: use consistent naming
Eric Blake [Thu, 7 Mar 2013 14:53:42 +0000 (07:53 -0700)]
viralloc: use consistent naming

Commit 0df3e89 only touched the header, but the .c file had the
same shadowing potential.

* src/util/viralloc.c (virDeleteElementsN): s/remove/toremove/ to
match the header.

12 years agorng: allow default device in RNG grammar
Eric Blake [Thu, 7 Mar 2013 14:06:53 +0000 (07:06 -0700)]
rng: allow default device in RNG grammar

This matches the documentation of commit 4932ef4, and the
C code changes of commit 75e656a.

* docs/schemas/domaincommon.rng: Allow default entry.

12 years agobuild: avoid shadowing a function name
Eric Blake [Thu, 7 Mar 2013 13:38:37 +0000 (06:38 -0700)]
build: avoid shadowing a function name

Make the same fix as in commit de53eff.

* src/util/viralloc.h (virDeleteElementsN): Cater to old glibc.

12 years agoFix crash parsing RNG device specification
Daniel P. Berrange [Thu, 7 Mar 2013 11:50:14 +0000 (11:50 +0000)]
Fix crash parsing RNG device specification

Code that validates the whitelist for the RNG device filename
didn't account for fact that filename may be NULL. This led
to a NULL reference crash. This wasn't caught since the test
suite was not covering this XML syntax

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoResolve valgrind error
John Ferlan [Wed, 6 Mar 2013 04:43:56 +0000 (23:43 -0500)]
Resolve valgrind error

Resolves the following valgrind error from qemuxml2argvtest:

==20393== 5 bytes in 1 blocks are definitely lost in loss record 2 of 60
==20393==    at 0x4A0883C: malloc (vg_replace_malloc.c:270)
==20393==    by 0x38D690A167: __vasprintf_chk (in /usr/lib64/libc-2.16.so)
==20393==    by 0x4CB0D97: virVasprintf (stdio2.h:210)
==20393==    by 0x4CB0E53: virAsprintf (virutil.c:2017)
==20393==    by 0x428DC5: qemuAssignDeviceAliases (qemu_command.c:791)
==20393==    by 0x41DF93: testCompareXMLToArgvHelper (qemuxml2argvtest.c:151)
==20393==    by 0x41F53F: virtTestRun (testutils.c:157)
==20393==    by 0x41DA9B: mymain (qemuxml2argvtest.c:885)
==20393==    by 0x41FB7A: virtTestMain (testutils.c:719)
==20393==    by 0x38D6821A04: (below main) (in /usr/lib64/libc-2.16.so)
==20393==

From qemu_command.c/line 791:

    if (def->rng) {
        if (virAsprintf(&def->rng->info.alias, "rng%d", 0) < 0)
            goto no_memory;
    }

12 years agostorage: Cleanup logical volume creation code
Jiri Denemark [Wed, 6 Mar 2013 11:57:40 +0000 (12:57 +0100)]
storage: Cleanup logical volume creation code

This patch plugs two memory leaks, removes some useless and confusing
constructs and renames renames "cleanup" label as "error" since it is
only used for error path rather then being common for both success and
error paths.

12 years agosheepdog: Adjust logic to break while loop to avoid Coverity error
John Ferlan [Tue, 5 Mar 2013 12:28:04 +0000 (07:28 -0500)]
sheepdog: Adjust logic to break while loop to avoid Coverity error

Change the various "return -1" to "break".  Avoids Coverity error and
perhaps other/future analyzer issues.

12 years agolibxl_driver: Resolve Coverity errors
John Ferlan [Thu, 28 Feb 2013 14:48:16 +0000 (09:48 -0500)]
libxl_driver: Resolve Coverity errors

1. The virObjectLock() call was unconditional, but Unlock was conditional
   on vm being valid.  Removed the check

2. A call to virDomainEventNewFromObj() isn't guaranteed to return an
   event - that check needs to be made prior to libxlDomainEventQueue()
   of the event. Did not add libxlDriverLock/Unlock around the call since
   some callers already have lock taken

3. Need to initialize fd = -1 in libxlDoDomainSave() since we can jump
   to cleanup before it's set.

4. Missing break;'s in libxlDomainModifyDeviceFlags() for case
   LIBXL_DEVICE_UPDATE.  The default: case would report an error

12 years agolibxl_conf: Resolve Coverity issue with call to regcomp()
John Ferlan [Thu, 28 Feb 2013 14:46:34 +0000 (09:46 -0500)]
libxl_conf: Resolve Coverity issue with call to regcomp()

12 years agoqemu: update domain live xml for virsh memtune with --live flag
Guannan Ren [Tue, 5 Mar 2013 16:24:57 +0000 (00:24 +0800)]
qemu: update domain live xml for virsh memtune with --live flag

virsh subcommand memtune forgot updating domain live xml
after setting cgroup value.

12 years agoutil: fix a integer boundary error
Guannan Ren [Tue, 5 Mar 2013 15:13:21 +0000 (23:13 +0800)]
util: fix a integer boundary error

A value which is equal to a integer maximum such as LLONG_MAX is
a valid integer value.

The patch fix the following error:
1, virsh memtune vm --swap-hard-limit -1
2, virsh start vm
In debug mode, it shows error like:
virScaleInteger:1813 : numerical overflow:\
                       value too large: 9007199254740991KiB

12 years agoconf: Report errors on cputune parameter parsing
Peter Krempa [Wed, 20 Feb 2013 15:15:34 +0000 (16:15 +0100)]
conf: Report errors on cputune parameter parsing

This patch adds proper error reporting if parsing of cputune parameters
fails due to incorrect values provided by the user. Previously no errors
were reported in such a case and the failure was silently ignored.

12 years agoconf: Make virDomainDeviceInfoIterate usable without os type
Peter Krempa [Wed, 20 Feb 2013 13:06:52 +0000 (14:06 +0100)]
conf: Make virDomainDeviceInfoIterate usable without os type

Make the iterator function usable in the next patches. Also refactor
some parts to avoid strcmp if not necessary.

This commit tweaks and shadows the change that was done in commit
babe7dada0f90bfde74a716e8fc963b049d76f96 and was needed after the
support for multiple console devices was added. Historically the first
<console> element is alias for the <serial> device.

12 years agoconf: whitespace cleanups and refactors with no semantic impact
Peter Krempa [Tue, 19 Feb 2013 10:55:27 +0000 (11:55 +0100)]
conf: whitespace cleanups and refactors with no semantic impact

This patch changes many unrelated places to simplify the code or update
code style. This patch should not have any semantic impact on the code.

12 years agovirsh-snapshot: Add ability to print only snapshot names
Peter Krempa [Fri, 1 Mar 2013 14:42:25 +0000 (15:42 +0100)]
virsh-snapshot: Add ability to print only snapshot names

Help script creators by not having to parse the names from the table.

12 years agoRelease of libvirt 1.0.3
Daniel Veillard [Tue, 5 Mar 2013 04:00:53 +0000 (12:00 +0800)]
Release of libvirt 1.0.3

- configure.ac docs/news.html.in libvirt.spec.in: update for the release
- po/*.po*: merged in transifex updates for fr,hi,pl,ja,uk,it and
  regenerated

12 years agorng: restrict passthrough names to known-good files
Eric Blake [Mon, 4 Mar 2013 22:42:07 +0000 (15:42 -0700)]
rng: restrict passthrough names to known-good files

There is some controversy[1] on the qemu list on whether qemu should
have ever allowed arbitrary file name passthrough, or whether it
should be restricted to JUST /dev/random and /dev/hwrng.  It is
always easier to add support for additional filenames than it is
to remove support for something once released, so this patch
restricts libvirt 1.0.3 (where the virtio-random backend was first
supported) to just the two uncontroversial names, letting us defer
to a later date any decision on whether supporting arbitrary files
makes sense. Additionally, since qemu 1.4 does NOT support
/dev/fdset/nnn fd passthrough for the backend, limiting to just
two known names means that we don't get tempted to try fd
passthrough where it won't work.

[1]https://lists.gnu.org/archive/html/qemu-devel/2013-03/threads.html#00023

* src/conf/domain_conf.c (virDomainRNGDefParseXML): Only allow
/dev/random and /dev/hwrng.
* docs/schemas/domaincommon.rng: Flag invalid files.
* docs/formatdomain.html.in (elementsRng): Document this.
* tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args:
Update test to match.
* tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml:
Likewise.

12 years agointernals: Update to include RPC and Lock links and add new data
John Ferlan [Sat, 16 Feb 2013 12:43:31 +0000 (07:43 -0500)]
internals: Update to include RPC and Lock links and add new data

Added a picture and explanation describing the virConnectOpen processing
at a "higher" level, but with some source code references.

12 years agoAdd references for phyp and parallels
John Ferlan [Thu, 14 Feb 2013 15:06:58 +0000 (10:06 -0500)]
Add references for phyp and parallels

12 years agoapi: Add text and references for daemon
John Ferlan [Thu, 14 Feb 2013 15:04:13 +0000 (10:04 -0500)]
api: Add text and references for daemon

12 years agoapi: Add text and references for drivers section
John Ferlan [Tue, 12 Feb 2013 19:01:49 +0000 (14:01 -0500)]
api: Add text and references for drivers section

12 years agoapi: Complete list of function and naming conventions
John Ferlan [Tue, 12 Feb 2013 17:58:42 +0000 (12:58 -0500)]
api: Complete list of function and naming conventions

12 years agoapi: Reword and clean lists for object description
John Ferlan [Tue, 12 Feb 2013 17:53:59 +0000 (12:53 -0500)]
api: Reword and clean lists for object description

12 years agoapi: Reword objects exposed section
John Ferlan [Tue, 12 Feb 2013 17:48:46 +0000 (12:48 -0500)]
api: Reword objects exposed section

12 years agohellolibvirt: Adjust code to use new APIs
John Ferlan [Tue, 26 Feb 2013 14:11:10 +0000 (09:11 -0500)]
hellolibvirt: Adjust code to use new APIs

Change the order of some conditions and use the AllDomains API to get
a list of all the active and defined domains, then use the Active and
Name API's in order to print.

This changes here adjust the output from:

Attempting to connect to hypervisor
Connected to hypervisor at "qemu:///system"
Hypervisor: "QEMU" version: 0.32.656
There are 0 active and 2 inactive domains
Inactive domains:
  foo
  bar
Disconnected from hypervisor

to

Attempting to connect to hypervisor
Connected to hypervisor at "qemu:///system"
Hypervisor: "QEMU" version: 0.32.656
There are 0 active and 2 inactive domains
       foo (non-active)
       bar (non-active)
Disconnected from hypervisor

12 years agolibvirt: Update headers for doc
John Ferlan [Tue, 12 Feb 2013 17:50:16 +0000 (12:50 -0500)]
libvirt: Update headers for doc

Update the function prototypes to include a message about the client needing
to free() returned name fields.  Fix the all domains example flags values.

12 years agoFix TLS tests with gnutls 3
Daniel P. Berrange [Mon, 4 Mar 2013 17:27:38 +0000 (17:27 +0000)]
Fix TLS tests with gnutls 3

When given a CA cert with basic constraints to set non-critical,
and key usage of 'key signing', this should be rejected. Version
of GNUTLS < 3 do not rejecte it though, so we never noticed the
test case was broken

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: fix wrong evaluation in qemuDomainSetMemoryParameters
Satoru Moriya [Mon, 4 Mar 2013 17:27:45 +0000 (17:27 +0000)]
qemu: fix wrong evaluation in qemuDomainSetMemoryParameters

19c6ad9a (qemu: Refactor qemuDomainSetMemoryParameters) introduced
a new macro, VIR_GET_LIMIT_PARAMETER(PARAM, VALUE). But if statement
in the macro is not correct and so set_XXXX flags are set to false
in the wrong. As a result, libvirt ignores all memtune parameters.
This patch fixes the conditional expression to work correctly.

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
12 years agoutil: use string libvirt to prefix error message instead of libvir
Guannan Ren [Mon, 4 Mar 2013 12:38:18 +0000 (20:38 +0800)]
util: use string libvirt to prefix error message instead of libvir

BZ:https://bugzilla.redhat.com/show_bug.cgi?id=912021
Without error handler set, virDefaultErrorFunc will be called, the
error message is prefixed with "libvir:". It become a little better
by using prefix "libvirt:" when working with upper application.

For example:
1, stop libvirtd daemon
2, run virt-top.
libvir: XML-RPC error : Failed to connect \
        socket to '/var/run/libvirt/libvirt-sock-ro': \
        No such file or directory
libvirt: VIR_ERR_SYSTEM_ERROR: VIR_FROM_RPC: \
        Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': \
        No such file or directory

12 years agolibvirt does not logout of iscsi targets, causing system hang on shutdown
Fritz Elfert [Thu, 28 Feb 2013 20:46:19 +0000 (21:46 +0100)]
libvirt does not logout of iscsi targets, causing system hang on shutdown

There's a quite old bug entry here:

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

I just stumbled over that very issue on F18. Doing a little bit
debugging of the shutdown sequence, it turns out that - at least on my
F18 installation - libvirtd is shutdown *after* iscsid, which makes it
impossible for libvirt to perform the logout of the iscsi session properly.

This patch simply adds another startup dependancy on iscsid.service
which in turn delays iscsid shutdown until after libvirtd has stopped.
Having that applied, the system shuts down properly again.

Signed-off-by: Eric Blake <eblake@redhat.com>