]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agolxcContainerMountCGroups also mounts a tmpfs that needs to be labeled.
Dan Walsh [Wed, 18 Jul 2012 19:36:20 +0000 (15:36 -0400)]
lxcContainerMountCGroups also mounts a tmpfs that needs to be labeled.

This patch passes down the sec_mount_options to the
lxcContainerMountCGroups function and then mounts the tmpfs with
the correct label.

12 years agoAdd a sheepdog backend for the storage driver
Sebastian Wiedenroth [Wed, 18 Jul 2012 19:06:58 +0000 (20:06 +0100)]
Add a sheepdog backend for the storage driver

This patch brings support to manage sheepdog pools and volumes to libvirt.
It uses the "collie" command-line utility that comes with sheepdog for that.

A sheepdog pool in libvirt maps to a sheepdog cluster.
It needs a host and port to connect to, which in most cases
is just going to be the default of localhost on port 7000.

A sheepdog volume in libvirt maps to a sheepdog vdi.
To create one specify the pool, a name and the capacity.
Volumes can also be resized later.

In the volume XML the vdi name has to be put into the <target><path>.
To use the volume as a disk source for virtual machines specify
the vdi name as "name" attribute of the <source>.
The host and port information from the pool are specified inside the host tag.

  <disk type='network'>
    ...
    <source protocol="sheepdog" name="vdi_name">
      <host name="localhost" port="7000"/>
    </source>
  </disk>

To work right this patch parses the output of collie,
so it relies on the raw output option. There recently was a bug which caused
size information to be reported wrong. This is fixed upstream already and
will be in the next release.

Signed-off-by: Sebastian Wiedenroth <wiedi@frubar.net>
12 years agoMount all tmpfs filesystems with correct SELinux label
Daniel J Walsh [Wed, 18 Jul 2012 18:44:47 +0000 (19:44 +0100)]
Mount all tmpfs filesystems with correct SELinux label

Basically within a Secure Linux Container (virt-sandbox) we want all content
that the process within the container can write to be labeled the same.  We
are labeling the physical disk correctly but when we create "RAM" based file
systems
libvirt is not labeling them, and they are defaulting to tmpfs_t, which will
will not allow the processes to write.  This patch labels the RAM based file
systems correctly.

12 years agoReplace use of virNodeDeviceReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:42:38 +0000 (12:42 +0100)]
Replace use of virNodeDeviceReportError with virReportError

Update the node device driver to use virReportError instead of
the virNodeDeviceReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virSecretReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:40:16 +0000 (12:40 +0100)]
Replace use of virSecretReportError with virReportError

Update the secret driver to use virReportError instead of the
virSecretReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virStorageReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:38:29 +0000 (12:38 +0100)]
Replace use of virStorageReportError with virReportError

Update the storage driver to use virReportError instead of
the virStorageReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing "%s" format to const error message in RBD storage driver
Daniel P. Berrange [Wed, 18 Jul 2012 18:32:24 +0000 (19:32 +0100)]
Add missing "%s" format to const error message in RBD storage driver

When passing a const message string to the error reporting APIs
RBD forgot to use "%s" to avoid GCC format string warnings

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert all files in src/conf/ to use virReportError()
Daniel P. Berrange [Wed, 18 Jul 2012 10:50:44 +0000 (11:50 +0100)]
Convert all files in src/conf/ to use virReportError()

This removes all the per-file error reporting macros
from the code in src/conf/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing _(...) around 2 error messages in test driver
Daniel P. Berrange [Wed, 18 Jul 2012 15:38:41 +0000 (16:38 +0100)]
Add missing _(...) around 2 error messages in test driver

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix parameter passed with VIR_ERR_INVALID_ARG in sanlock driver
Daniel P. Berrange [Wed, 18 Jul 2012 15:37:29 +0000 (16:37 +0100)]
Fix parameter passed with VIR_ERR_INVALID_ARG in sanlock driver

The VIR_ERR_INVALID_ARG is typically given the function name
via __FUNCTION__

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert all files in src/rpc/ to use virReportError()
Daniel P. Berrange [Wed, 18 Jul 2012 10:41:47 +0000 (11:41 +0100)]
Convert all files in src/rpc/ to use virReportError()

This rmoves all the per-file error reporting macros
from the code in src/rpc/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert (nearly) all files in src/util/ to use virReportError()
Daniel P. Berrange [Wed, 18 Jul 2012 10:26:24 +0000 (11:26 +0100)]
Convert (nearly) all files in src/util/ to use virReportError()

This removes nearly all the per-file error reporting macros
from the code in src/util/. A few custom macros remain for the
case, where the file needs to report errors with a variety of
different codes or parameters

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix bogus cast to (int) in virNetServerMDNSTimeoutNew
Daniel P. Berrange [Wed, 18 Jul 2012 15:29:19 +0000 (16:29 +0100)]
Fix bogus cast to (int) in virNetServerMDNSTimeoutNew

The virNetServerMDNSTimeoutNew method was casting a long long
to an int when reporting errors. This should just be using
%lld instead of %d, avoiding the need to cast

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing "%s" with constant string error message in stats_linux.c
Daniel P. Berrange [Wed, 18 Jul 2012 15:25:05 +0000 (16:25 +0100)]
Add missing "%s" with constant string error message in stats_linux.c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove newline from end of error message in virnodesuspend.c
Daniel P. Berrange [Wed, 18 Jul 2012 10:52:05 +0000 (11:52 +0100)]
Remove newline from end of error message in virnodesuspend.c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd _(...) around two error messages in src/util/
Daniel P. Berrange [Wed, 18 Jul 2012 10:44:24 +0000 (11:44 +0100)]
Add _(...) around two error messages in src/util/

The virnetdevtap.c and viruri.c files had two error report
messages which were not annotated with _(...)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce virReportError macro for general error reporting
Daniel P. Berrange [Wed, 18 Jul 2012 10:23:56 +0000 (11:23 +0100)]
Introduce virReportError macro for general error reporting

Nearly every source file does something like

  #define VIR_FROM_THIS VIR_FROM_FOO
  #define virFooReportErorr(code, ...) \
     virReportErrorHelper(VIR_FROM_THIS, code,  __FILE__,    \
                          __FUNCTION__, __LINE__, \
                          __VA_ARGS__)

This creates needless duplication and inconsistent error
reporting function names in each file. It is trivial to
just have virterror_internal.h provide a virReportError
macro that is equivalent

* src/util/virterror_internal.h: Define virReportError(code, ...)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoremote: Fix locking in stream APIs
Jiri Denemark [Tue, 17 Jul 2012 14:36:23 +0000 (16:36 +0200)]
remote: Fix locking in stream APIs

Remote driver needs to make sure the driver lock is released before
entering client IO loop as that may block indefinitely in poll(). As a
direct consequence of not following this in stream APIs, tunneled
migration to a destination host which becomes non-responding may block
qemu driver. Luckily, if keepalive is turned for p2p migrations, both
remote and qemu drivers will get automagically unblocked after keepalive
timeout.

12 years agoxenapi: Convert to virMacAddr
Jiri Denemark [Tue, 17 Jul 2012 15:18:36 +0000 (17:18 +0200)]
xenapi: Convert to virMacAddr

12 years agonwfilter: Convert to virMacAddrPtr not virMacAddrPtr*
Michal Privoznik [Tue, 17 Jul 2012 14:29:43 +0000 (16:29 +0200)]
nwfilter: Convert to virMacAddrPtr not virMacAddrPtr*

My previous patch wasn't complete as it converted from
(unsigned char *) to (virMacAddrPtr *). It should be
(virMacAddrPtr) only.

12 years agonwfilter: Convert to virMacAddrPtr completely
Michal Privoznik [Tue, 17 Jul 2012 14:00:34 +0000 (16:00 +0200)]
nwfilter: Convert to virMacAddrPtr completely

The previous commit (387117ad92) was incomplete leaving those
who does not use libpcap with uncompilable sources beacuse
of incomplete conversion of virNWFilterDHCPSnoopReq function.

12 years agoconfigure: rbd doesn't need -lcrypto
Cole Robinson [Sun, 15 Jul 2012 17:18:44 +0000 (13:18 -0400)]
configure: rbd doesn't need -lcrypto

See https://www.redhat.com/archives/libvir-list/2012-July/msg00493.html

Basically building against librbd doesn't seem to actually require -lcrypto.

Also report the rbd linker flags in configure output

12 years agoConvert 'raw MAC address' usages to use virMacAddr
Stefan Berger [Tue, 17 Jul 2012 12:07:59 +0000 (08:07 -0400)]
Convert 'raw MAC address' usages to use virMacAddr

Introduce new members in the virMacAddr 'class'
- virMacAddrSet: set virMacAddr from a virMacAddr
- virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
- virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
- virMacAddrCmp: comparing two virMacAddr
- virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer

then replace raw MAC addresses by replacing

- 'unsigned char *' with virMacAddrPtr
- 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr

and introduce usage of above functions where necessary.

12 years agoqemu: Do not fail virConnectCompareCPU if host CPU is not known
Jiri Denemark [Thu, 12 Jul 2012 09:49:15 +0000 (11:49 +0200)]
qemu: Do not fail virConnectCompareCPU if host CPU is not known

When host CPU could not be properly detected, virConnectCompareCPU will
just report that any CPU is incompatible with host CPU instead of
failing.

12 years agoqemu: Fix probing for guest capabilities
Jiri Denemark [Fri, 13 Jul 2012 14:30:55 +0000 (16:30 +0200)]
qemu: Fix probing for guest capabilities

Even though qemu-kvm binaries can be used in TCG mode, libvirt would
only detect them if /dev/kvm was available. Thus, one would need to make
a /usr/bin/qemu symlink to be able to use TCG mode with qemu-kvm in an
environment without KVM support.

And even though QEMU is able to make use of KVM, libvirt would not
advertise KVM support unless there was a qemu-kvm symlink available.

This patch fixes both issues.

12 years agodocs: Improve patch submission guidelines
Michal Privoznik [Mon, 9 Jul 2012 08:01:21 +0000 (10:01 +0200)]
docs: Improve patch submission guidelines

We should really advise (new) developers to send rebased patches
that apply cleanly and use git-send-email rather than all other
obscure ways.

12 years agoWire up handling for QMP's BALLOON_EVENT
Daniel P. Berrange [Thu, 12 Jul 2012 15:45:57 +0000 (23:45 +0800)]
Wire up handling for QMP's BALLOON_EVENT

If QEMU supports the BALLOON_EVENT QMP event, then we can
avoid invoking 'query-balloon' when returning XML or the
domain info.

* src/qemu/qemu_capabilities.c, src/qemu/qemu_capabilities.h:
  Add QEMU_CAPS_BALLOON_EVENT
* src/qemu/qemu_driver.c: Skip query-balloon in
  qemudDomainGetInfo and qemuDomainGetXMLDesc if we have
  QEMU_CAPS_BALLOON_EVENT set
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Check
  for BALLOON_EVENT at connect to monitor. Add callback
  for balloon change notifications
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h:
  Add handling of BALLOON_EVENT and impl 'query-events'
  check

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDefine public API for receiving guest memory balloon events
Daniel P. Berrange [Fri, 13 Jul 2012 09:05:17 +0000 (17:05 +0800)]
Define public API for receiving guest memory balloon events

When the guest changes its memory balloon applications may want
to know what the new value is, without having to periodically
poll on XML / domain info. Introduce a "balloon change" event
to let apps see this

* include/libvirt/libvirt.h.in: Define the
  virConnectDomainEventBalloonChangeCallback callback
  and VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE constant
* python/libvirt-override-virConnect.py,
  python/libvirt-override.c: Wire up helpers for new event
* daemon/remote.c: Helper for serializing balloon event
* examples/domain-events/events-c/event-test.c,
  examples/domain-events/events-python/event-test.py: Add
  example of balloon event usage
* src/conf/domain_event.c, src/conf/domain_event.h: Handling
  of balloon events
* src/remote/remote_driver.c: Add handler of balloon events
* src/remote/remote_protocol.x: Define wire protocol for
  balloon events
* src/remote_protocol-structs: Likewise.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoARMHF: CPU Support for armhf.
Chuck Short [Thu, 12 Jul 2012 15:28:17 +0000 (10:28 -0500)]
ARMHF: CPU Support for armhf.

Adding CPU encoder/decoder for armhf to avoid runtime error messages.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
12 years agofix failure when building with --disable-debug
Hu Tao [Fri, 13 Jul 2012 07:50:04 +0000 (15:50 +0800)]
fix failure when building with --disable-debug

When building with --disable-debug, VIR_DEBUG expands to a nop.
But parameters to VIR_DEBUG can be variables that are passed only
to VIR_DEBUG. In the case the building system complains about unused
variables.

12 years agovirsh: remove unnecessary sleep for nodecpustats --percent
Viktor Mihajlovski [Fri, 13 Jul 2012 07:50:25 +0000 (09:50 +0200)]
virsh: remove unnecessary sleep for nodecpustats --percent

Fix for a minor issue:
the sleep(1) statement was called twice,
effectively doubling the elapsed time
execution "virsh nodecpustats --percent".

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoClarify direct migration
Jiri Denemark [Thu, 12 Jul 2012 13:27:18 +0000 (15:27 +0200)]
Clarify direct migration

When --direct is used when migrating a domain running on a hypervisor
that does not support direct migration (such as QEMU), the caller would
get the following error message:

    this function is not supported by the connection driver:
    virDomainMigrateToURI2

which is a complete nonsense since qemu driver implements
virDomainMigrateToURI2. This patch would emit a more sensible error in
this case:

    Requested operation is not valid: direct migration is not supported
    by the connection driver

12 years agoFix daemon auto-spawning
Christophe Fergeau [Thu, 12 Jul 2012 11:52:36 +0000 (13:52 +0200)]
Fix daemon auto-spawning

Commit 32a9aac switched libvirt to use the XDG base directories
to locate most of its data/config. In particular, the per-user socket
for qemu:///session is now stored in the XDG runtime directory.
This directory is located by looking at the XDG_RUNTIME_DIR environment
variable, with a fallback to ~/.cache/libvirt if this variable is not
set.

When the daemon is autospawned because a client application wants
to use qemu:///session, the daemon is ran in a clean environment
which does not contain XDG_RUNTIME_DIR. It will create its socket
in ~/.cache/libvirt. If the client application has XDG_RUNTIME_DIR
set, it will not look for the socket in the fallback place, and will
fail to connect to the autospawned daemon.

This patch adds XDG_RUNTIME_DIR to the daemon environment before
auto-starting it. I've done this in virNetSocketForkDaemon rather
than in virCommandAddEnvPassCommon as I wasn't sure we want to pass
these variables to other commands libvirt spawns. XDG_CACHE_HOME
and XDG_CONFIG_HOME are also added to the daemon env as it makes use
of those as well.

12 years agoSupport creation of sparse LVM volumes
Daniel P. Berrange [Wed, 11 Jul 2012 16:28:39 +0000 (17:28 +0100)]
Support creation of sparse LVM volumes

When calling 'lvcreate' if specifying both the '-L' and
'--virtualsize' options, the latter will be treated as
the capacity and the former as the allocation. This can
be used to support sparse volume creation. In addition,
when listing volumes it is necessary to include the 'size'
field in lvs output, so that we can detect sparse volume
allocation correctly.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove all use of virRun in storage code
Daniel P. Berrange [Wed, 11 Jul 2012 14:56:55 +0000 (15:56 +0100)]
Remove all use of virRun in storage code

To make it easier to dynamically change the command line ARGV,
switch all storage code over to use virCommandPtr APIs for
running programs

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirsh: remove extra space between function name and opening brace
Guido Günther [Wed, 11 Jul 2012 06:17:28 +0000 (08:17 +0200)]
virsh: remove extra space between function name and opening brace

to match our CodingStyle.

12 years agoFix directory removal in filesystem storage driver
Sascha Peilicke [Wed, 11 Jul 2012 15:34:58 +0000 (16:34 +0100)]
Fix directory removal in filesystem storage driver

Fix the virStorageBackendFileSystemVolDelete method to not use
unlink() unconditionally. It must use rmdir() for volumes which
are directories. It should also raise an error if given a volume
which has the network/block type.

12 years agostorage: Default pool permission mode to 0755
Osier Yang [Wed, 11 Jul 2012 14:40:48 +0000 (22:40 +0800)]
storage: Default pool permission mode to 0755

Per the typical use of libvirt is to fork the qemu process with
qemu:qemu. Setting the pool permission mode as 0700 by default
will prevent the guest start with permission reason.

Define macro for the default pool and vol permission modes
incidentally.

12 years agoFix shutdown of LXC controller
Daniel P. Berrange [Mon, 9 Jul 2012 13:55:31 +0000 (14:55 +0100)]
Fix shutdown of LXC controller

Since we are not yet using the virNetServerPtr object for running
the event loop, we can't use virNetServerQuit(). Instead set the
global 'quit' flag in libvirt_lxc

12 years agotest: Add test case for nodeinfotest if host machine doesn't have NUMA
Peter Krempa [Wed, 27 Jun 2012 12:48:57 +0000 (14:48 +0200)]
test: Add test case for nodeinfotest if host machine doesn't have NUMA

Test filling of nodeinfo structure if /sys/devices/system/node does not
exist. (Based on dump from a real machine)

12 years agotest: Add new test case for nodeinfotest
Peter Krempa [Wed, 27 Jun 2012 12:42:48 +0000 (14:42 +0200)]
test: Add new test case for nodeinfotest

This patch adds test data that describe a machine that has two physical
processors that don't share same core id's on their cores. On this data
the "virsh nodeinfo" reported that the machine had 10 cores per socket
while the processor had only 8. (Before fixing nodeinfo gathering code).

12 years agonodeinfo: Fix gathering of nodeinfo data structure
Peter Krempa [Mon, 9 Jul 2012 14:57:49 +0000 (16:57 +0200)]
nodeinfo: Fix gathering of nodeinfo data structure

This patch changes the way data to fill the nodeinfo structure are
gathered. We've gathere the test data by iterating processors an sockets
separately from nodes. The reported data was based solely on information
about core id. Problems arise when eg cores in mulit-processor machines
don't have same id's on both processors or maybe one physical processor
contains more NUMA nodes.

This patch changes the approach how we detect processors and nodes. Now
we start at enumerating nodes and for each node processors, sockets and
threads are enumerated separately. This approach provides acurate data
that comply to docs about the nodeinfo structure. This also enables to
get rid of hacks: see commits 10d9038b744a69c8d4bd29c2e8c012a097481586,
ac9dd4a676f21b5e3ca6dbe0526f2a6709072beb. (Those changes in nodeinfo.c
are efectively reverted by this patch).

This patch also changes output of one of the tests, as the processor
topology is now acquired more precisely.

12 years agonodeinfo_test: Enhance test data before changing nodeinfo gathering
Peter Krempa [Mon, 9 Jul 2012 14:46:54 +0000 (16:46 +0200)]
nodeinfo_test: Enhance test data before changing nodeinfo gathering

This patch adds test data needed by the new way node information will be
gathered. This patch adds symlinks to cpu cores to their corresponding
node directory.

12 years agoS390: Adding testcases for s390
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:07 +0000 (17:02 +0200)]
S390: Adding testcases for s390

Add minimal s390-virtio domain testcase and testcases for virtio serial,
net, disk for the virtio-s390 bus.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Domain Schema for s390-virtio machines.
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:06 +0000 (17:02 +0200)]
S390: Domain Schema for s390-virtio machines.

Added s390-virtio machine type to the XML schema for domains in order
to not fail the domain schema tests.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Add support for virtio-s390 devices.
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:05 +0000 (17:02 +0200)]
S390: Add support for virtio-s390 devices.

The s390(x) architecture doesn't feature a PCI bus. For the purpose of
supporting virtio devices a virtual bus called virtio-s390 is used.
A new address type VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 is used to
distinguish the virtio devices on s390 from PCI-based virtio devices.

V3 Change: updated QEMU_CAPS_VIRTIO_S390 to fit upstream.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Change tests to use (modified) qemuDomainAssignAddresses
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:04 +0000 (17:02 +0200)]
qemu: Change tests to use (modified) qemuDomainAssignAddresses

Rewrote the device assignment parts in tests to use qemuDomainAssignAddresses.
This way the tests will work for new device address types as they show
up in the future (like s390 device types).

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Extended qemuDomainAssignAddresses to be callable from everywhere.
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:03 +0000 (17:02 +0200)]
qemu: Extended qemuDomainAssignAddresses to be callable from everywhere.

This is in preparation of the enablement of s390 guests with virtio devices.

The assignment of device addresses happens in different places, i.e. the
qemu driver and process modules as well as in the unit tests in slightly
different flavors. Currently, these are PPC spapr-vio and PCI
devices, virtio-s390 (not PCI based) will follow.

By optionally passing to qemuDomainAssignAddresses the domain
object and the capabilities it is now possible to call the function
from most of the places (except for hotplug) where address assignment
is done.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoopenvz: Handle domain obj hash map errors
Guido Günther [Mon, 9 Jul 2012 10:11:17 +0000 (12:11 +0200)]
openvz: Handle domain obj hash map errors

This makes the driver fail with a clear error message in case of UUID
collisions (for example if somebody copied a container configuration
without updating the UUID) and also raises an error on other hash map
failures.

OpenVZ itself doesn't complain about duplicate UUIDs since this
parameter is only used by libvirt.

12 years agoFix /domain/features setting in qemuParseCommandLine
Christophe Fergeau [Tue, 10 Jul 2012 10:02:10 +0000 (12:02 +0200)]
Fix /domain/features setting in qemuParseCommandLine

Commit 5e6ce1 moved down detection of the ACPI feature in
qemuParseCommandLine. However, when ACPI is detected, it clears
all feature flags in def->features to only set ACPI. This used to
be fine because this was the first place were def->features was set,
but after the move this is no longer necessarily true because this
block comes before the ACPI check:

if (strstr(def->emulator, "kvm")) {
    def->virtType = VIR_DOMAIN_VIRT_KVM;
    def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
}

Since def is allocated in qemuParseCommandLine using VIR_ALLOC, we
can always use |= when modifying def->features

12 years agobuild: detect all improper uses of _("%s")
Eric Blake [Tue, 10 Jul 2012 21:43:08 +0000 (15:43 -0600)]
build: detect all improper uses of _("%s")

The only useful translation of "%s" as a format string is "%s" (I
suppose you could claim "%1$s" is also valid, but why bother).  So
it is not worth translating; fixing this exposes some instances
where we were failing to translate real error messages.  This makes
the fix of commit 097da1ab more generic, as well as ensuring no
future regressions.

* cfg.mk (sc_prohibit_useless_translation): New rule.
* src/lxc/lxc_driver.c (lxcSetVcpuBWLive): Fix offender.
* src/openvz/openvz_conf.c (openvzReadFSConf): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupCgroupForVcpu): Likewise.
* src/qemu/qemu_driver.c (qemuSetVcpusBWLive): Likewise.
* src/xenapi/xenapi_utils.c (xenapiSessionErrorHandle): Likewise.

12 years agosystemd: start libvirtd after network
Jim Fehlig [Mon, 9 Jul 2012 15:52:55 +0000 (09:52 -0600)]
systemd: start libvirtd after network

Domains configured with autostart may fail to start if the host
network stack has not been started.  E.g. when using bridged
networking autostarting a domain can fail with

libvirtd[1403]: 2012-06-20 13:23:49.833+0000: 1485: error :
qemuAutostartDomain:177 : Failed to autostart VM 'test': Cannot get
interface MTU on 'br0': No such device

12 years agoutil: Use current uid and gid if they are passed as -1 for virDirCreate
Osier Yang [Thu, 21 Jun 2012 07:11:20 +0000 (15:11 +0800)]
util: Use current uid and gid if they are passed as -1 for virDirCreate

All the callers of virDirCreate are updated incidentally.

12 years agovirsh: Ensure the parents of the readline history path exists
Osier Yang [Tue, 10 Jul 2012 11:24:04 +0000 (19:24 +0800)]
virsh: Ensure the parents of the readline history path exists

Instead of changing the existed virFileMakePath to accept mode
argument and modifying a pile of its uses, this patch introduces
virFileMakePathWithMode, and use it instead of mkdir() to create
the readline history dir.

12 years agodocs: added description of the vendor_id attribute
Hendrik Schwartke [Tue, 10 Jul 2012 08:01:03 +0000 (10:01 +0200)]
docs: added description of the vendor_id attribute

12 years agoFix a string format bug in qemu_cgroup.c
tangchen [Fri, 6 Jul 2012 01:53:11 +0000 (09:53 +0800)]
Fix a string format bug in qemu_cgroup.c

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
12 years agomaint: revert gnulib update, until fixed automake is in more distros
Eric Blake [Mon, 9 Jul 2012 22:03:07 +0000 (16:03 -0600)]
maint: revert gnulib update, until fixed automake is in more distros

The previous commit (56f34e5) accidentally bumped to latest gnulib,
but that adds a syntax check for CVE-2012-3386 that won't be fixed
until Automake 1.11.6/1.12.2 lands in more distros.

* .gnulib: Undo accidental commit.

12 years agobuild: fix typo that breaks non-Linux builds
Eric Blake [Mon, 9 Jul 2012 21:21:10 +0000 (15:21 -0600)]
build: fix typo that breaks non-Linux builds

Commit 9612e4b2 introduced a typo and unused variable that break
non-Linux builds.

* src/util/virfile.c (virFileLoopDeviceAssociate): Fix syntax error.

12 years agomaint: update preferred contributor name
Eric Blake [Mon, 9 Jul 2012 18:08:52 +0000 (12:08 -0600)]
maint: update preferred contributor name

Based on off-list discussion with Royce.

* AUTHORS: Update to Royce Lv's preferred anglicized name.
* .mailmap: Likewise.

12 years agovirsh: Clarify documentation for virsh dompmsuspend command
Peter Krempa [Thu, 21 Jun 2012 15:59:27 +0000 (17:59 +0200)]
virsh: Clarify documentation for virsh dompmsuspend command

Clarify the docs to make more clear what this command does and that it
requires a guest agent running in the guest.

12 years agostorage_backend_fs: Allocate entry for host before accessing it
Peter Krempa [Mon, 9 Jul 2012 12:37:01 +0000 (14:37 +0200)]
storage_backend_fs: Allocate entry for host before accessing it

Commit 122fa379de44a2fd0a6d5fbcb634535d647ada17 introduces option to
store more than one host entry in a storage pool source definition. That
commit causes a regression, where a check is added that only one host
entry should be present (that actualy is not present as the source
structure was just allocated and zeroed) instead of allocating memory
for the host entry.

12 years agostorage_backend_fs: Don't free a part of a structure on error
Peter Krempa [Mon, 9 Jul 2012 12:10:05 +0000 (14:10 +0200)]
storage_backend_fs: Don't free a part of a structure on error

As the storage pool sources are stored in a list of structs, the pointer
returned by virStoragePoolSourceListNewSource() shouldn't be freed as it
points in the middle of a memory block. This combined with a regression
that takes the error path every time on caused a double-free abort on
the src struct in question.

12 years agostorage_conf: Break long line and polish coding style
Peter Krempa [Mon, 9 Jul 2012 12:08:00 +0000 (14:08 +0200)]
storage_conf: Break long line and polish coding style

12 years agoesx: Wrap libcurl multi handle
Matthias Bolte [Mon, 2 Jul 2012 20:52:48 +0000 (22:52 +0200)]
esx: Wrap libcurl multi handle

12 years agoOnly ummount /proc, /sys, /dev if the root source is '/'
Daniel P. Berrange [Thu, 5 Jul 2012 16:07:48 +0000 (17:07 +0100)]
Only ummount /proc, /sys, /dev if the root source is '/'

Previous commits added code to unmount the existing /proc,
/sys and /dev hierarchies on the root filesystem of the
container. This should only have been done if the container's
root filesystem was the same as the host's root. ie if
the root source is '/'.   As it is, this causes LXC containersr
to fail to start if their root source is not '/'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix one test regression on auth Ceph support
Daniel Veillard [Thu, 5 Jul 2012 09:56:23 +0000 (17:56 +0800)]
Fix one test regression on auth Ceph support

The extra data need to be added to one test case

12 years agoSwitch to using virNetServer APIs for monitor socket
Daniel P. Berrange [Tue, 3 Jul 2012 14:25:30 +0000 (15:25 +0100)]
Switch to using virNetServer APIs for monitor socket

In preparation for introducing a full RPC protocol for
libvirt_lxc, switch over to using the virNetServer APIs
for the monitor connection

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove loop device setup code into virfile.{c,h}
Daniel P. Berrange [Tue, 3 Jul 2012 14:06:27 +0000 (15:06 +0100)]
Move loop device setup code into virfile.{c,h}

While it is not currently used elsewhere in libvirt, the code
for finding a free loop device & associating a file with it
is not LXC specific. Move it into the viffile.{c,h} file where
potentially shared code is more commonly kept.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove cgroup objects into virLXCControllerPtr
Daniel P. Berrange [Tue, 3 Jul 2012 13:53:59 +0000 (14:53 +0100)]
Move cgroup objects into virLXCControllerPtr

Move the cgroup object into virLXCControllerPtr and rename
all the setup methods to include 'Cgroup' in their name
if appropriate

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove monitor into virLXCControllerPtr
Daniel P. Berrange [Tue, 3 Jul 2012 13:40:45 +0000 (14:40 +0100)]
Move monitor into virLXCControllerPtr

Move the monitor FDs into the virLXCControllerPtr object
removing the need for the 'struct lxcMonitor' object

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove /dev/pts setup out of virLXCControllerRun
Daniel P. Berrange [Tue, 3 Jul 2012 13:02:33 +0000 (14:02 +0100)]
Move /dev/pts setup out of virLXCControllerRun

The virLXCControllerRun method is getting a little too large,
and about 50% of its code is related to setting up a /dev/pts
mount. Move the latter out into a dedicated method

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove security manager into virLXCControllerPtr object
Daniel P. Berrange [Tue, 3 Jul 2012 12:59:36 +0000 (13:59 +0100)]
Move security manager into virLXCControllerPtr object

Move the security manager object into the virLXCControllerPtr
object. Also simplify the code creating it in the first place

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove loop device FDs into virLXCControllerPtr object
Daniel P. Berrange [Tue, 3 Jul 2012 12:49:19 +0000 (13:49 +0100)]
Move loop device FDs into virLXCControllerPtr object

Move the list of loop device FDs into the virLXCControllerPtr
object and make sure that virLXCControllerStopInit will
close them all

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove daemon handshake FD into virLXCControllerPtr
Daniel P. Berrange [Tue, 3 Jul 2012 12:16:48 +0000 (13:16 +0100)]
Move daemon handshake FD into virLXCControllerPtr

Keep the FD used to handshake with the libvirtd daemon in the
virLXCControllerPtr object.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake console handling part of virLXCControllerPtr
Daniel P. Berrange [Tue, 3 Jul 2012 11:42:53 +0000 (12:42 +0100)]
Make console handling part of virLXCControllerPtr

Turn 'struct lxc_console' into virLXCControllerConsolePtr and make it
a part of virLXCControllerPtr

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoStore the init PID in the virLXCController object
Daniel P. Berrange [Tue, 3 Jul 2012 11:12:59 +0000 (12:12 +0100)]
Store the init PID in the virLXCController object

Keep a record of the init PID in the virLXCController object
and create a virLXCControllerStopInit method for killing this
process

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove veth device management into virLXCControllerPtr object
Daniel P. Berrange [Tue, 3 Jul 2012 11:06:38 +0000 (12:06 +0100)]
Move veth device management into virLXCControllerPtr object

Move the veth device name state into the virLXCControllerPtr
object and stop passing it around. Also use size_t instead
of unsigned int for the array length parameters.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce a virLXCControllerPtr object to hold LXC controller state
Daniel P. Berrange [Tue, 3 Jul 2012 10:54:09 +0000 (11:54 +0100)]
Introduce a virLXCControllerPtr object to hold LXC controller state

The LXC controller code is having to pass around an ever increasing
number of parameters between methods. To make the code more managable
introduce a virLXCControllerPtr to hold all this state, starting with
the container name and virDomainDefPtr object

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAvoid build shared source files again for libvirt_lxc
Daniel P. Berrange [Tue, 3 Jul 2012 14:37:08 +0000 (15:37 +0100)]
Avoid build shared source files again for libvirt_lxc

Currently the build of libvirt_lxc will cause recompilation
of all sources under src/util, src/conf, src/security and
more. Switch the libvirt_lxc process to link against the
libtool convenience libraries that are already built as
part of the main libvirt.os & libvirtd build process

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow RPC server to run single threaded
Daniel P. Berrange [Thu, 15 Mar 2012 18:18:07 +0000 (18:18 +0000)]
Allow RPC server to run single threaded

Refactor the RPC server dispatcher code so that if 'max_workers==0'
the entire server will run single threaded. This is useful for
use cases where there will only ever be 1 client connected
which serializes its requests

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a opaque parameter to the RPC client init callback
Daniel P. Berrange [Thu, 15 Mar 2012 18:14:51 +0000 (18:14 +0000)]
Add a opaque parameter to the RPC client init callback

The callback that is invoked when a new RPC client is
initialized does not have any opaque parameter. Add
one so that custom data can be passed into the callback

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Always set auth_supported for Ceph disks.
Wido den Hollander [Mon, 25 Jun 2012 15:44:01 +0000 (17:44 +0200)]
qemu: Always set auth_supported for Ceph disks.

Recently the Ceph project defaulted auth_supported from 'none' to 'cephx'.

When no auth information was set for Ceph disks this would lead to librados defaulting to
'cephx', but there would be no additional authorization information.

We now explicitly set auth_supported to none when passing down arguments to Qemu.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
12 years agovirsh: Fix ordering of arguments when calling vshCalloc.
Peter Krempa [Wed, 4 Jul 2012 10:15:19 +0000 (12:15 +0200)]
virsh: Fix ordering of arguments when calling vshCalloc.

In vshSnapshotListCollect() vshCalloc was called with swapped nmemb and
size argument. This caused division by zero in xalloc_oversized as the
macro doesn't expect size to be zero.

12 years agovmware: detect when a domain was shut down from the inside
Jean-Baptiste Rouault [Mon, 2 Apr 2012 13:59:32 +0000 (15:59 +0200)]
vmware: detect when a domain was shut down from the inside

This patch adds an internal function vmwareUpdateVMStatus to
update the real state of the domain. This function is used in
various places in the driver, in particular to detect when
the domain has been shut down by the user with the "halt"
command.

12 years agoremote: Fill remote parameters in remoteDomainListAllSnapshots()
Peter Krempa [Wed, 4 Jul 2012 08:58:39 +0000 (10:58 +0200)]
remote: Fill remote parameters in remoteDomainListAllSnapshots()

This patch fills the domain argument that is sent to the remote side.
This caused a client segfault as the argument was NULL.

12 years agoqemu: Mark domains as having managed state image only on managed save
Peter Krempa [Wed, 4 Jul 2012 08:19:45 +0000 (10:19 +0200)]
qemu: Mark domains as having managed state image only on managed save

QEMU domains were marked as having managed save image even if they were
saved using the regular save. With this patch, domains are marked so
only when using managed save API.

12 years agoAdded the attribute vendor_id to the cpu model
Hendrik Schwartke [Thu, 28 Jun 2012 10:21:17 +0000 (12:21 +0200)]
Added the attribute vendor_id to the cpu model

Introducing the attribute vendor_id to force the CPUID instruction
in a kvm guest to return the specified vendor.

12 years agoqemu: add rbd to whitelist of migration-safe formats
Josh Durgin [Mon, 2 Jul 2012 18:55:26 +0000 (11:55 -0700)]
qemu: add rbd to whitelist of migration-safe formats

QEMU (and librbd) flush the cache on the source before the
destination starts, and the destination does not read any
changeable data before that, so live migration with rbd caching
is safe.

This makes 'virsh migrate' work with rbd and caching without the
--unsafe flag.

Reported-by: Vladimir Bashkirtsev <vladimir@bashkirtsev.com>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
12 years agomaint: use full author name for previous commit
Eric Blake [Mon, 2 Jul 2012 15:36:16 +0000 (09:36 -0600)]
maint: use full author name for previous commit

* .mailmap: Add a name alias.

12 years agofix key error for qemuMonitorGetBlockStatsInfo
lvroyce [Thu, 21 Jun 2012 07:37:13 +0000 (15:37 +0800)]
fix key error for qemuMonitorGetBlockStatsInfo

virDomainBlockStatsFlags can't collect total_time_ns for read/write/flush
because of key typo when retriveing from qemu cmd result

Signed-off-by: lvroyce <lvroyce@linux.vnet.ibm.com>
12 years agoRelease of libvirt-0.9.13
Daniel Veillard [Mon, 2 Jul 2012 03:15:43 +0000 (11:15 +0800)]
Release of libvirt-0.9.13

* configure.ac docs/news.html.in libvirt.spec.in: new version and
  documentation update
* po/*.po*: updated and regenerated localizations

12 years agovirsh: Cleanup virsh -V output
Doug Goldstein [Tue, 26 Jun 2012 18:31:31 +0000 (13:31 -0500)]
virsh: Cleanup virsh -V output

Fixed up virsh -V output by removing invalid WITH_PROXY & WITH_ONE
checks, adding several missing checks, and fixing the DTrace check.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: use correct limit for unsigned long long
Eric Blake [Fri, 29 Jun 2012 21:09:57 +0000 (15:09 -0600)]
build: use correct limit for unsigned long long

Reported by Jason Helfman as a build-breaker on FreeBSD.

* src/conf/domain_conf.c (virDomainFSDefParseXML): Use POSIX
spelling.
* src/openvz/openvz_conf.c (openvzReadFSConf): Likewise.

12 years agonwfilter: Fix memory leak
Stefan Berger [Fri, 29 Jun 2012 18:36:15 +0000 (14:36 -0400)]
nwfilter: Fix memory leak

Below patch fixes this coverity report:

/libvirt/src/conf/nwfilter_conf.c:382:
leaked_storage: Variable "varAccess" going out of scope leaks the storage it points to.

12 years agoRemove sub-mounts under /dev when starting an LXC container
Daniel P. Berrange [Fri, 29 Jun 2012 15:29:33 +0000 (16:29 +0100)]
Remove sub-mounts under /dev when starting an LXC container

Since we are mounting a new /dev in the container, we must
remove any sub-mounts like /dev/shm, /dev/mqueue, etc,
otherwise they'll be recorded in /proc/mounts, but not be
accessible to applications.

12 years agoFix vm's outbound traffic control problem
Eiichi Tsukata [Fri, 29 Jun 2012 06:09:16 +0000 (15:09 +0900)]
Fix vm's outbound traffic control problem

Hello,

This is a patch to fix vm's outbound traffic control problem.

Currently, vm's outbound traffic control by libvirt doesn't go well.
This problem was previously discussed at libvir-list ML, however
it seems that there isn't still any answer to the problem.
http://www.redhat.com/archives/libvir-list/2011-August/msg00333.html

I measured Guest(with virtio-net) to Host TCP throughput with the
command "netperf -H".
Here are the outbound QoS parameters and the results.

outbound average rate[kilobytes/s] : Guest to Host throughput[Mbit/s]
======================================================================
1024  (8Mbit/s)                    : 4.56
2048  (16Mbit/s)                   : 3.29
4096  (32Mbit/s)                   : 3.35
8192  (64Mbit/s)                   : 3.95
16384 (128Mbit/s)                  : 4.08
32768 (256Mbit/s)                  : 3.94
65536 (512Mbit/s)                  : 3.23

The outbound traffic goes down unreasonably and is even not controled.

The cause of this problem is too large mtu value in "tc filter" command run by
libvirt. The command uses burst value to set mtu and the burst is equal to
average rate value if it's not set. This value is too large. For example
if the average rate is set to 1024 kilobytes/s, the mtu value is set to 1024
kilobytes. That's too large compared to the size of network packets.
Here libvirt applies tc ingress filter to Host's vnet(tun) device.
Tc ingress filter is implemented with TBF(Token Buckets Filter) algorithm. TBF
uses mtu value to calculate the amount of token consumed by each packet. With too
large mtu value, the token consumption rate is set too large. This leads to
token starvation and deterioration of TCP throughput.

Then, should we use the default mtu value 2 kilobytes?
The anser is No, because Guest with virtio-net device uses 65536 bytes
as mtu to transmit packets to Host, and the tc filter with the default mtu
value 2k drops packets whose size is larger than 2k. So, the most packets
is droped and again leads to deterioration of TCP throughput.

The appropriate mtu value is 65536 bytes which is equal to the maximum value
of network interface device defined in <linux/netdevice.h>. The value is
not so large that it causes token starvation and not so small that it
drops most packets.
Therefore this patch set the mtu value to 64kb(== 65535 bytes).

Again, here are the outbound QoS parameters and the TCP throughput with
the libvirt patched.

outbound average rate[kilobytes/s] : Guest to Host throughput[Mbit/s]
======================================================================
1024  (8Mbit/s)                    : 8.22
2048  (16Mbit/s)                   : 16.42
4096  (32Mbit/s)                   : 32.93
8192  (64Mbit/s)                   : 66.85
16384 (128Mbit/s)                  : 133.88
32768 (256Mbit/s)                  : 271.01
65536 (512Mbit/s)                  : 547.32

The outbound traffic conforms to the given limit.

Thank you,

Signed-off-by: Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com>
12 years agonetwork_conf: Don't free uninitialized pointers while parsing DNS SRV
Peter Krempa [Thu, 28 Jun 2012 21:42:50 +0000 (23:42 +0200)]
network_conf: Don't free uninitialized pointers while parsing DNS SRV

If the user specified invalid protocol type in a network's SRV record
the error path ended up in freeing uninitialized pointers causing a
daemon crash.

*network_conf.c: virNetworkDNSSrvDefParseXML(): initialize local
                                                variables

12 years agoconf: Don't shadow error from virGetDomain()
Peter Krempa [Thu, 28 Jun 2012 14:26:07 +0000 (16:26 +0200)]
conf: Don't shadow error from virGetDomain()

virGetDomain() does a good job of reporting errors itself. This patch
removes shadowing of that error in virDomainListPopulate().

12 years agomaint: include ignore-value in internal.h
Peter Krempa [Fri, 8 Jun 2012 13:29:17 +0000 (15:29 +0200)]
maint: include ignore-value in internal.h

The ignore_value macro is used across libvirt. This patch includes it in
the internal header and cleans all other includes.

12 years agovbox: Add support for virConnectListAllDomains()
Peter Krempa [Tue, 5 Jun 2012 12:12:21 +0000 (14:12 +0200)]
vbox: Add support for virConnectListAllDomains()

VirtualBox doesn't use the common virDomainObj implementation so this
patch adds a separate implementation using the VirtualBox API.

This driver implementation supports all currently defined flags. As
VirtualBox does not support transient guests, managed save images and
autostarting we assume all guests are persistent, don't have a managed
save image and are not autostarted. Filtering for existence of those
properities results in empty list.