]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
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.

12 years agostorage: Error out if the target is already mounted for netfs pool
Osier Yang [Wed, 27 Jun 2012 14:02:23 +0000 (22:02 +0800)]
storage: Error out if the target is already mounted for netfs pool

mnt_fsname can not be the same, as we check the duplicate pool
sources earlier before, means it can't be the same pool, moreover,
a pool can't be started if it's already active anyway. So no reason
to act as success.

12 years agoconfigure: show correct default argument in help
Marc-André Lureau [Thu, 28 Jun 2012 00:21:49 +0000 (02:21 +0200)]
configure: show correct default argument in help

Pushed without ack, under the trivial rule.

12 years agoevents: Don't fail on registering events for two different domains
Michal Privoznik [Wed, 27 Jun 2012 10:06:45 +0000 (12:06 +0200)]
events: Don't fail on registering events for two different domains

virConnectDomainEventRegisterAny() takes a domain as an argument.
So it should be possible to register the same event (be it
VIR_DOMAIN_EVENT_ID_LIFECYCLE for example) for two different domains.
That is, we need to take domain into account when searching for
duplicate event being already registered.

12 years agovirsh: Add domdisplay cmd for VNC, SPICE and RDP
Doug Goldstein [Sun, 24 Jun 2012 21:14:54 +0000 (16:14 -0500)]
virsh: Add domdisplay cmd for VNC, SPICE and RDP

v2:
- Refactored to use virBuffer
- Refactored to use virXPath wrappers
- Added support for tls-port and password for SPICE
- Added optional flag to disable SPICE password to the URI
- Added support for RDP
- Fixed code reviews

Add a new 'domdisplay' command that provides a URI for VNC, SPICE and
RDP connections. Presently the 'vncdisplay' command provides you with
the port info that QEMU is listening on but there is no counterpart for
SPICE and RDP. Additionally this provides you with the bind address as
specified in the XML, which the existing 'vncdisplay' lacks. For SPICE
connections it supports secure and unsecure channels and optionally
providing the password for the SPICE channel.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
12 years agoRemove accidentally added Patch: lines from mingw-libvirt.spec.in
Daniel P. Berrange [Wed, 27 Jun 2012 13:31:52 +0000 (14:31 +0100)]
Remove accidentally added Patch: lines from mingw-libvirt.spec.in

12 years agodoc: fix typo in virDomainDestroy API doc
Christophe Fergeau [Wed, 27 Jun 2012 12:49:06 +0000 (14:49 +0200)]
doc: fix typo in virDomainDestroy API doc

12 years agoAdd /tools/libvirt-guests.service to .gitignore
Guido Günther [Tue, 26 Jun 2012 16:13:46 +0000 (18:13 +0200)]
Add /tools/libvirt-guests.service to .gitignore

since it's an autogenerated file

12 years agoDon't install systemd service files executable
Guido Günther [Tue, 26 Jun 2012 07:53:33 +0000 (09:53 +0200)]
Don't install systemd service files executable

since they aren't. Detected by Debian's lintian.

12 years agoAUTHORS: Update
Michal Privoznik [Mon, 25 Jun 2012 14:56:44 +0000 (16:56 +0200)]
AUTHORS: Update

Latest patchset enabling libvirt on s390(x) was developed by
  Viktor Mihajlovski   <mihajlov@linux.vnet.ibm.com>
  Thang Pham           <thang.pham@us.ibm.com>
Add them to the AUTHORS file.

12 years agoS390: Added sysinfo for host on s390(x).
Thang Pham [Fri, 22 Jun 2012 11:50:14 +0000 (13:50 +0200)]
S390: Added sysinfo for host on s390(x).

In order to retrieve some sysinfo data we need to parse /proc/sysinfo and
/proc/cpuinfo.

Signed-off-by: Thang Pham <thang.pham@us.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Fixed core identification for s390
Viktor Mihajlovski [Fri, 22 Jun 2012 11:50:13 +0000 (13:50 +0200)]
S390: Fixed core identification for s390

For the s390x architecture the sysfs core_id alone is not unique. As a
result it can happen that libvirt thinks there are less host CPUs available
than really present.
Currently, a logical CPU is equivalent to a core for s390x. We therefore
produce a fake core id from the CPU number.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture
Thang Pham [Fri, 22 Jun 2012 11:50:12 +0000 (13:50 +0200)]
S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture

Minimal CPU "parser" for s390 to avoid compile time warning.

Signed-off-by: Thang Pham <thang.pham@us.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: CPU support for s390(x)
Thang Pham [Fri, 22 Jun 2012 11:50:11 +0000 (13:50 +0200)]
S390: CPU support for s390(x)

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

Signed-off-by: Thang Pham <thang.pham@us.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Override QEMU_CAPS_NO_ACPI for s390x
Viktor Mihajlovski [Fri, 22 Jun 2012 11:50:10 +0000 (13:50 +0200)]
S390: Override QEMU_CAPS_NO_ACPI for s390x

Starting a KVM guest on s390 fails immediately. This is because
"qemu --help" reports -no-acpi even for the s390(x) architecture but
-no-acpi isn't supported there.
Workaround is to remove QEMU_CAPS_NO_ACPI from the capability set
after the version/capability extraction.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agostorage backend rbd: Do not prefix rbd: on volume names.
Wido den Hollander [Fri, 22 Jun 2012 12:45:59 +0000 (14:45 +0200)]
storage backend rbd: Do not prefix rbd: on volume names.

We used to prefix 'rbd:' to volume names, this is not necessary.

Qemu takes RBD devices in this way, like: qemu -drive rbd:pool/image

When attaching a network disk like RBD to a guest we however do not use this prefix.

Currently you can't map a RBD volume name directly to a domain without removing the prefix.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
12 years agoqemu: Improve error if setmem fails for lacking of balloon support
Osier Yang [Mon, 25 Jun 2012 13:34:22 +0000 (21:34 +0800)]
qemu: Improve error if setmem fails for lacking of balloon support

"cannot set memory of an active domain" is misleading, it sounds
like setting memory of active domain is not supported.

12 years agoInclude the default listen address in the live guest XML
Daniel P. Berrange [Mon, 25 Jun 2012 11:50:52 +0000 (12:50 +0100)]
Include the default listen address in the live guest XML

If no 'listen' attribute or <listen> element is set in the
guest XML, the default driver configured listen address is
used. There is no way to client applications to determine
what this address is though. When starting the guest, we
should update the live XML to include this default listen
address

12 years agostorage: Introduce --inactive for pool-dumpxml
Michal Privoznik [Mon, 25 Jun 2012 10:24:45 +0000 (12:24 +0200)]
storage: Introduce --inactive for pool-dumpxml

Storage is one of the last domains in libvirt where we don't fully
utilize inactive and live XML. Okay, it might be because we don't
have support for that. So implement such support. However, we need
to fallback when talking to old daemon which doesn't support this
new flag called VIR_STORAGE_XML_INACTIVE.

12 years agostorage: Switch to new def on pool-destroy
Michal Privoznik [Mon, 25 Jun 2012 09:38:17 +0000 (11:38 +0200)]
storage: Switch to new def on pool-destroy

Currently, we share the idea of old & new def with domains. Users can
*-edit an object (domain, pool) which spawns a new internal
representation for them. This is referenced via
{domainObj,poolObj}->newDef [compared to ->def]. However, for pool we
were never overwriting def with newDef. This must be done on
pool-destroy (like we do analogically in domain detroy).

12 years agosanlock: Properly indent
Michal Privoznik [Mon, 25 Jun 2012 10:46:21 +0000 (12:46 +0200)]
sanlock: Properly indent

One of latest patches (0fce94fe) didn't properly indented #define
making syntax-check fail.

12 years agoFix compilation on older sanlock
Daniel Veillard [Mon, 25 Jun 2012 10:31:09 +0000 (18:31 +0800)]
Fix compilation on older sanlock

Temporary fix since compilation broke with older version of
sanlock following acbd4965c44c4dbc676dfe89aff970052e376073

12 years agoRemove stray debug fprintf in XML parser
Daniel P. Berrange [Mon, 25 Jun 2012 10:26:29 +0000 (11:26 +0100)]
Remove stray debug fprintf in XML parser

12 years agoSupport bind mounting host files, as well as directories in LXC
Daniel J Walsh [Mon, 25 Jun 2012 09:53:39 +0000 (10:53 +0100)]
Support bind mounting host files, as well as directories in LXC

Currently libvirt-lxc checks to see if the destination exists and is a
directory.  If it is not a directory then the mount fails.  Since
libvirt-lxc can bind mount files on an inode, this patch is needed to
allow us to bind mount files on files.  Currently we want to bind mount
on top of /etc/machine-id, and /etc/adjtime

If the destination of the mount point does not exists, it checks if the
src is a directory and then attempts to create a directory, otherwise it
creates an empty file for the destination.  The code will then bind mount
over the destination.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow NOCONFIGURE=1 to make autogen.sh skip ./configure
Daniel P. Berrange [Thu, 21 Jun 2012 13:50:41 +0000 (14:50 +0100)]
Allow NOCONFIGURE=1 to make autogen.sh skip ./configure

Sometimes it is useful to re-bootstrap libvirt without running
through a ./configure invocation immediately. eg if you want
to run ./configure for Mingw32 rather than native.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix unused parameters / functions in virsh on Win32
Daniel P. Berrange [Thu, 21 Jun 2012 13:46:03 +0000 (14:46 +0100)]
Fix unused parameters / functions in virsh on Win32

The vshPrintRaw function is not used on Win32, and neither
is the 'msg' parameter of vshAskReedit. Change the nesting
of #ifdef WIN32 conditionals to address this

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUpdate to latest GNULIB to fix compat with Mingw64 toolchain
Daniel P. Berrange [Thu, 21 Jun 2012 13:55:51 +0000 (14:55 +0100)]
Update to latest GNULIB to fix compat with Mingw64 toolchain

On both x86_64-w64-mingw32 and i686-w64-mingw32 there were
the following warnings/errors:

  CC     fstat.lo
../../../gnulib/lib/fstat.c:27:0: warning: "stat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
                 from ../../../gnulib/lib/fstat.c:25:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition
../../../gnulib/lib/fstat.c:28:0: warning: "fstat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
                 from ../../../gnulib/lib/fstat.c:25:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:259:0: note: this is the location of the previous definition

  CC     stat.lo
../../../gnulib/lib/stat.c:32:0: warning: "stat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
                 from ../../../gnulib/lib/stat.c:27:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition

  CC     stdio-read.lo
../../../gnulib/lib/stdio-read.c:102:1: error: redefinition of 'vscanf'
In file included from ./stdio.h:43:0,
                 from ../../../gnulib/lib/stdio-read.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:397:7: note: previous definition of 'vscanf' was here
../../../gnulib/lib/stdio-read.c:108:1: error: redefinition of 'vfscanf'
In file included from ./stdio.h:43:0,
                 from ../../../gnulib/lib/stdio-read.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:384:7: note: previous definition of 'vfscanf' was here
make[3]: *** [stdio-read.lo] Error 1
make[3]: Leaving directory `/home/berrange/src/virt/libvirt/build/gnulib/lib'

While on x86_64-w64-mingw32 only there was:

In file included from ../../../gnulib/lib/regex.c:69:0:
../../../gnulib/lib/regcomp.c: In function 'parse_dup_op':
../../../gnulib/lib/regcomp.c:2624:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../../../gnulib/lib/regcomp.c: In function 'mark_opt_subexp':
../../../gnulib/lib/regcomp.c:3859:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agowinsock2.h must always be included before windows.h
Daniel P. Berrange [Thu, 21 Jun 2012 13:37:34 +0000 (14:37 +0100)]
winsock2.h must always be included before windows.h

Some GNULIB headers (eg unistd.h) will often need to include
winsock2.h for various symbols. There is a rule that winsock2.h
must be included before windows.h. This means that any file
which does

  #ifdef WIN32
  #include <windows.h>
  #endif
  #include <unistd.h>

is potentially broken. A simple rule is that /all/ includes of
windows.h must be matched with a preceding include of winsock2.h
regardless of whether unistd.h is used currently

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSwitch automated builds to use Mingw64 toolchain instead of Mingw32
Daniel P. Berrange [Fri, 15 Jun 2012 16:13:11 +0000 (17:13 +0100)]
Switch automated builds to use Mingw64 toolchain instead of Mingw32

The Mingw32 toolchain is broadly obsoleted by the Mingw64 toolchain.
The latter has been adopted by Fedora 17 and newer. Maintaining a
RPM spec for Mingw32 is a needless burden, so switch to a Mingw64
RPM spec (which provides 32 & 64 bit builds).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirsh: Use virXPath wrappers for vncdisplay cmd
Doug Goldstein [Sun, 24 Jun 2012 21:36:00 +0000 (16:36 -0500)]
virsh: Use virXPath wrappers for vncdisplay cmd

Update the vncdisplay command to use the virXPath wrappers as well as
check if the domain is up rather than using the port set to -1 to mean
the domain is not up.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
12 years agoAdd support for shared sanlock leases
Daniel P. Berrange [Thu, 21 Jun 2012 14:34:46 +0000 (15:34 +0100)]
Add support for shared sanlock leases

A sanlock lease can be marked as shared (rather
than exclusive)  using SANLK_RES_SHARED flag. This
adds support for that flag and ensures that in auto
disk mode, any shared disks use shared leases. This
also makes any read-only disks be completely
ignored.

These changes remove the need for the option

  ignore_readonly_and_shared_disks

so that is removed

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for guest bind mounts with LXC
Daniel P. Berrange [Wed, 20 Jun 2012 14:03:30 +0000 (15:03 +0100)]
Add support for guest bind mounts with LXC

Currently you can configure LXC to bind a host directory to
a guest directory, but not to bind a guest directory to a
guest directory. While the guest container init could do
this itself, allowing it in the libvirt XML means a stricter
SELinux policy can be written

12 years agoAdd support for RAM filesystems for LXC
Daniel P. Berrange [Tue, 8 May 2012 16:50:48 +0000 (17:50 +0100)]
Add support for RAM filesystems for LXC

Introduce a new syntax for filesystems to allow use of a RAM
filesystem

   <filesystem type='ram'>
      <source usage='10' units='MiB'/>
      <target dir='/mnt'/>
   </filesystem>

The usage units default to KiB to limit consumption of host memory.

* docs/formatdomain.html.in: Document new syntax
* docs/schemas/domaincommon.rng: Add new attributes
* src/conf/domain_conf.c: Parsing/formatting of RAM filesystems
* src/lxc/lxc_container.c: Mounting of RAM filesystems

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agofix a bug of ref count in virnetserver.c
Hu Tao [Fri, 22 Jun 2012 03:26:03 +0000 (11:26 +0800)]
fix a bug of ref count in virnetserver.c

The test of ref count is not protected by lock, which is unsafe because
the ref count may have been changed by other threads during the test.

This patch fixes this.

12 years agovirsh: Improve error when trying to change vm's cpu count 0
Peter Krempa [Thu, 21 Jun 2012 16:34:32 +0000 (18:34 +0200)]
virsh: Improve error when trying to change vm's cpu count 0

This patch adds a check for the count of processors the user requests
for the guest machine so that invalid values produce a more helpful
error message.