Commit Graph

10181 Commits

Author SHA1 Message Date
Viktor Mihajlovski
6e15887f30 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>
2012-07-11 11:19:05 +02:00
Viktor Mihajlovski
f5dd58a608 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>
2012-07-11 11:19:05 +02:00
Guido Günther
31351c316f 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.
2012-07-11 10:40:03 +02:00
Christophe Fergeau
626dd5180e 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
2012-07-11 09:10:21 +02:00
Eric Blake
0867a87721 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.
2012-07-10 15:49:41 -06:00
Jim Fehlig
4036aa91bf 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
2012-07-10 08:53:40 -06:00
Osier Yang
67d79ad7ff util: Use current uid and gid if they are passed as -1 for virDirCreate
All the callers of virDirCreate are updated incidentally.
2012-07-10 21:42:16 +08:00
Osier Yang
ea9509b9e8 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.
2012-07-10 21:37:13 +08:00
Hendrik Schwartke
fee00a6807 docs: added description of the vendor_id attribute 2012-07-10 11:25:14 +02:00
tangchen
097da1abbd Fix a string format bug in qemu_cgroup.c
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
2012-07-10 17:06:56 +08:00
Eric Blake
e4cce2c9be 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.
2012-07-09 16:03:07 -06:00
Eric Blake
56f34e5573 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.
2012-07-09 15:50:59 -06:00
Eric Blake
6bbbe53bea maint: update preferred contributor name
Based on off-list discussion with Royce.

* AUTHORS: Update to Royce Lv's preferred anglicized name.
* .mailmap: Likewise.
2012-07-09 13:05:06 -06:00
Peter Krempa
e16d434da7 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.
2012-07-09 19:38:22 +02:00
Peter Krempa
48b7851998 storage_backend_fs: Allocate entry for host before accessing it
Commit 122fa379de 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.
2012-07-09 16:28:16 +02:00
Peter Krempa
ab9c72ae9e 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.
2012-07-09 16:25:15 +02:00
Peter Krempa
73f4b30882 storage_conf: Break long line and polish coding style 2012-07-09 16:19:50 +02:00
Matthias Bolte
017edaf79a esx: Wrap libcurl multi handle 2012-07-08 11:28:44 +02:00
Daniel P. Berrange
6068754670 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>
2012-07-05 17:40:52 +01:00
Daniel Veillard
c47a8aec53 Fix one test regression on auth Ceph support
The extra data need to be added to one test case
2012-07-05 17:56:23 +08:00
Daniel P. Berrange
9a4d0b5170 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
9612e4b2e7 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
f547e8768d 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
deba8b0c4c 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
4c87afe0ac 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
25aa053282 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
37441d89d5 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
ef07d89f1f 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
eddca75a14 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>
2012-07-05 10:46:10 +01:00
Daniel P. Berrange
7a4bf9c39c 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>
2012-07-05 10:46:09 +01:00
Daniel P. Berrange
ba797c73e6 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>
2012-07-05 10:46:09 +01:00
Daniel P. Berrange
d624ad6a3d 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>
2012-07-05 10:46:09 +01:00
Daniel P. Berrange
284143bbee 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>
2012-07-05 10:46:09 +01:00
Daniel P. Berrange
dff6d809fb 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>
2012-07-05 10:46:09 +01:00
Daniel P. Berrange
c6b2d5d082 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>
2012-07-05 10:46:09 +01:00
Wido den Hollander
ccb9478500 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>
2012-07-05 17:01:56 +08:00
Peter Krempa
3cdb3b4e64 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.
2012-07-04 14:01:37 +02:00
Jean-Baptiste Rouault
fe04138ea0 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.
2012-07-04 11:41:13 +02:00
Peter Krempa
d59e10338d 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.
2012-07-04 11:16:47 +02:00
Peter Krempa
a4f74cd09a 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.
2012-07-04 11:06:51 +02:00
Hendrik Schwartke
a3389319ba 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.
2012-07-03 12:06:38 +02:00
Josh Durgin
78290b1641 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>
2012-07-02 14:52:27 -06:00
Eric Blake
30a30a7a70 maint: use full author name for previous commit
* .mailmap: Add a name alias.
2012-07-02 09:36:16 -06:00
lvroyce
811cea18f3 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>
2012-07-02 17:52:47 +08:00
Daniel Veillard
3a4d9d1ed3 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
2012-07-02 11:25:36 +08:00
Doug Goldstein
9faaaba432 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>
2012-06-29 15:40:22 -06:00
Eric Blake
791d095235 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.
2012-06-29 15:14:01 -06:00
Stefan Berger
b1675bac67 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.
2012-06-29 14:36:15 -04:00
Daniel P. Berrange
5bb83236c9 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.
2012-06-29 16:29:33 +01:00
Eiichi Tsukata
0ac3baee2c 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>
2012-06-29 10:56:13 +02:00