]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agoqemuPrepareNVRAM: Save domain after NVRAM path generation
Michal Privoznik [Thu, 25 Sep 2014 12:39:19 +0000 (14:39 +0200)]
qemuPrepareNVRAM: Save domain after NVRAM path generation

On a domain startup, the variable store path is generated if needed.
The path is intended to be generated only once. However, the updated
domain definition is not saved into config dir rather than state XML
only. So later, whenever the domain is destroyed and the daemon is
restarted, the generated path is forgotten and the file may be left
behind on virDomainUndefine() call.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoremoteNodeGetFreePages: Don't alloc args.pages.pages_val
Michal Privoznik [Thu, 25 Sep 2014 09:18:50 +0000 (11:18 +0200)]
remoteNodeGetFreePages: Don't alloc args.pages.pages_val

There's no one to free() it anyway. Instead, we can just pass the
provided array pointer directly.

==20039== 48 bytes in 4 blocks are definitely lost in loss record 658 of 787
==20039==    at 0x4C2A700: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==20039==    by 0x4EA661F: virAllocN (viralloc.c:191)
==20039==    by 0x50386EF: remoteNodeGetFreePages (remote_driver.c:7625)
==20039==    by 0x5003504: virNodeGetFreePages (libvirt.c:21379)
==20039==    by 0x154625: cmdFreepages (virsh-host.c:374)
==20039==    by 0x12F718: vshCommandRun (virsh.c:1935)
==20039==    by 0x1339FB: main (virsh.c:3747)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonodeinfo: fix version of nodeAllocPages
Tomoki Sekiyama [Thu, 25 Sep 2014 20:02:21 +0000 (16:02 -0400)]
nodeinfo: fix version of nodeAllocPages

Fix comments about the version in which '.nodeAllocPages' are added.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
10 years agoqemu: Always re-detect backing chain
Peter Krempa [Thu, 25 Sep 2014 15:30:28 +0000 (17:30 +0200)]
qemu: Always re-detect backing chain

Since 363e9a68 we track backing chain metadata when creating snapshots
the right way even for the inactive configuration. As we did not yet
update other code paths that modify the backing chain (blockpull) the
newDef backing chain gets out of sync.

After stopping of a VM the new definition gets copied to the next start
one. The new VM then has incorrect backing chain info. This patch
switches the backing chain detector to always purge the existing backing
chain and forces re-detection to avoid this issue until we'll have full
backing chain tracking support.

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

10 years agoevent_example: cleanup example code for tunable event
Pavel Hrdina [Thu, 25 Sep 2014 13:03:46 +0000 (15:03 +0200)]
event_example: cleanup example code for tunable event

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agovirNodeAllocPages: Disallow RO connection
Michal Privoznik [Thu, 25 Sep 2014 15:12:46 +0000 (17:12 +0200)]
virNodeAllocPages: Disallow RO connection

Due to a missing check the API can be successfully called even if
the connection is ReadOnly. Fortunately, the API hasn't been
released yet, so there's no need for a CVE.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoparallels: login to parallels SDK
Dmitry Guryanov [Thu, 11 Sep 2014 16:24:03 +0000 (20:24 +0400)]
parallels: login to parallels SDK

Add files parallels_sdk.c and parallels_sdk.h for code
which works with SDK, so libvirt's code will not mix with
dealing with parallels SDK.

To use Parallels SDK you must first call PrlApi_InitEx function,
and then you will be able to connect to a server with
PrlSrv_LoginLocalEx function. When you've done you must call
PrlApi_Deinit. So let's call PrlApi_InitEx on first .connectOpen,
count number of connections and deinitialize, when this counter
becomes zero.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: build with parallels SDK
Dmitry Guryanov [Thu, 11 Sep 2014 16:24:02 +0000 (20:24 +0400)]
parallels: build with parallels SDK

Executing prlctl command is not an optimal way to interact with
Parallels Cloud Server (PCS), it's better to use parallels SDK,
which is a remote API to paralles dispatcher service.

We prepared opensource version of this SDK and published it on
github, it's distributed under LGPL license. Here is a git repo:
https://github.com/Parallels/parallels-sdk.

To build with parallels SDK user should get compiler and linker
options from pkg-config 'parallels-sdk' file. So fix checks in
configure script and build with parallels SDK, if that pkg-config
file exists and add gcc options to makefile.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agovirnetserver: Raise log level of max_clients related messages
Michal Privoznik [Thu, 25 Sep 2014 09:50:04 +0000 (11:50 +0200)]
virnetserver: Raise log level of max_clients related messages

We have these configuration knobs, like max_clients and
max_anonymous_clients. They limit the number of clients
connected.  Whenever the limit is reached, the daemon stops
accepting new ones and resumes if one of the connected clients
disconnects. If that's the case, a debug message is printed into
the logs. And when the daemon starts over to accept new clients
too. However, the problem is the messages have debug priority.
This may be unfortunate, because if the daemon stops accepting
new clients all of a sudden, and users don't have debug logs
enabled they have no idea what's going on. Raise the messages
level to INFO at least.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agopolkit_driver: fix possible segfault
Pavel Hrdina [Thu, 25 Sep 2014 09:13:29 +0000 (11:13 +0200)]
polkit_driver: fix possible segfault

The changes in commit c7542573 introduced possible segfault. Looking
deeper into the code and the original code before the patch series were
applied I think that we should report error for each function failure
and also we shouldn't call some of the function twice.

Found by coverity.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoblkdeviotune: trigger tunable event for blkdeviotune updates
Pavel Hrdina [Thu, 25 Sep 2014 09:30:57 +0000 (11:30 +0200)]
blkdeviotune: trigger tunable event for blkdeviotune updates

Use the universal tunable event to report changes to user. All
blkdeviotune values are prefixed with "blkdeviotune".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoblkdeviotune: fix bug with saving values into live XML
Pavel Hrdina [Thu, 25 Sep 2014 09:28:25 +0000 (11:28 +0200)]
blkdeviotune: fix bug with saving values into live XML

When you updated some blkdeviotune values for running domain the values
were stored only internally, but not saved into the live XML so they
won't survive restarting the libvirtd.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoFix build without polkit
Pavel Hrdina [Thu, 25 Sep 2014 08:57:24 +0000 (10:57 +0200)]
Fix build without polkit

The commit 1b854c76 introduced a new function 'virPolkitCheckAuth' and
in the #else section when you don't have polkit all attributes should be
follwed by ATTRIBUTE_UNUSED.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agotunable_event: extend debug message and tweak limit for remote message
Pavel Hrdina [Wed, 24 Sep 2014 07:43:31 +0000 (09:43 +0200)]
tunable_event: extend debug message and tweak limit for remote message

It would be nice to also print a params pointer and number of params in
the debug message and the previous limit for number of params in the rpc
message was too large. The 2048 params will be enough for future events.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agovirsh: Expose virNodeAllocPages
Michal Privoznik [Wed, 17 Sep 2014 13:53:42 +0000 (15:53 +0200)]
virsh: Expose virNodeAllocPages

The new virsh command is named 'allocpages'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonodeinfo: Implement nodeAllocPages
Michal Privoznik [Thu, 18 Sep 2014 07:47:07 +0000 (09:47 +0200)]
nodeinfo: Implement nodeAllocPages

And add stubs to other drivers like: lxc, qemu, uml and vbox.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirnuma: Introduce virNumaSetPagePoolSize
Michal Privoznik [Thu, 18 Sep 2014 07:24:16 +0000 (09:24 +0200)]
virnuma: Introduce virNumaSetPagePoolSize

This internal API can be used to allocate or free some pages in
the huge pages pool.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoIntroduce virNodeAllocPages
Michal Privoznik [Tue, 16 Sep 2014 16:17:22 +0000 (18:17 +0200)]
Introduce virNodeAllocPages

A long time ago in a galaxy far, far away it has been decided
that libvirt will manage not only domains but host as well. And
with my latest work on qemu driver supporting huge pages, we miss
the cherry on top: an API to allocate huge pages on the run.
Currently users are forced to log into the host and adjust the
huge pages pool themselves.  However, with this API the problem
is gone - they can both size up and size down the pool.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonodeGetFreePages: Push forgotten change
Michal Privoznik [Wed, 24 Sep 2014 13:10:18 +0000 (15:10 +0200)]
nodeGetFreePages: Push forgotten change

In the previous patch I've changed the for loop bounds but forgot
to 'git add' changes that adapt the rest of the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agosecurity: Fix labelling host devices (bz 1145968)
Cole Robinson [Wed, 24 Sep 2014 15:47:46 +0000 (11:47 -0400)]
security: Fix labelling host devices (bz 1145968)

The check for ISCSI devices was missing a check of subsys type, which
meant we could skip labelling of other host devices as well. This fixes
USB hotplug on F21

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

10 years agoFix MinGW build
Pavel Hrdina [Wed, 24 Sep 2014 09:07:08 +0000 (11:07 +0200)]
Fix MinGW build

When building on mingw the format string for long long/unsigned long
long have to be I64d/I64u instead of lld/llu.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoConvert polkit code to use DBus API instead of CLI helper
Daniel P. Berrange [Wed, 10 Sep 2014 13:52:48 +0000 (14:52 +0100)]
Convert polkit code to use DBus API instead of CLI helper

Spawning the pkcheck program every time a permission check is
required is hugely expensive on CPU. The pkcheck program is just
a dumb wrapper for the DBus API, so rewrite the code to use the
DBus API directly. This also simplifies error handling a bit.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoSupport passing dict by reference for dbus messages
Daniel P. Berrange [Tue, 9 Sep 2014 14:19:58 +0000 (15:19 +0100)]
Support passing dict by reference for dbus messages

Currently DBus dict values must be passed inline

   virDBusMessageEncode("a{ss}",
                        3,
                        "key1", "val1",
                        "key2", "val2",
                        "key3", "val3");
   virDBusMessageDecode("a{ss}",
                        3,
                        &key1, &val1,
                        &key2, &val2,
                        &key3, &val3);

This allows them to be passed by reference

   const char **dictin = {
      "key1", "val1",
      "key2", "val2",
      "key3", "val3"
   };
   char **dictout;
   size_t ndictout;

   virDBusMessageEncode("a&{ss}",
                        ARRAY_CARDINALITY(dict) / 2,
                        dictin);
   virDBusMessageDecode("a&{ss}",
                        &ndictout,
                        &dictout);

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoConvert remote daemon & acl code to use polkit API
Daniel P. Berrange [Thu, 22 Aug 2013 16:09:03 +0000 (17:09 +0100)]
Convert remote daemon & acl code to use polkit API

Convert the remote daemon auth check and the access control
code to use the common polkit API for checking auth.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoConvert callers to use typesafe APIs for getting identity attrs
Daniel P. Berrange [Thu, 22 Aug 2013 16:02:40 +0000 (17:02 +0100)]
Convert callers to use typesafe APIs for getting identity attrs

Convert virAccessDriverPolkitFormatProcess to use typesafe API
for getting process ID attribute.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoConvert callers to use typesafe APIs for setting identity attrs
Daniel P. Berrange [Thu, 22 Aug 2013 15:58:58 +0000 (16:58 +0100)]
Convert callers to use typesafe APIs for setting identity attrs

Update virNetServerClientCreateIdentity and virIdentityGetSystem
to use the new typesafe APIs for setting identity attributes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoAdd typesafe APIs for virIdentity attributes
Daniel P. Berrange [Thu, 22 Aug 2013 15:43:35 +0000 (16:43 +0100)]
Add typesafe APIs for virIdentity attributes

Instead of requiring the caller to format to/from strings,
add typesafe APIs todo this work.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoAdd common API for doing polkit authentication
Daniel P. Berrange [Thu, 22 Aug 2013 13:27:19 +0000 (14:27 +0100)]
Add common API for doing polkit authentication

There are now two places in libvirt which use polkit. Currently
they use pkexec, which is set to be replaced by direct DBus API
calls. Add a common API which they will both be able to use for
this purpose.

No tests are added at this time, since the impl will be gutted
in favour of a DBus API call shortly.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoqemu: wire up virtio-net segment offloading options
Ján Tomko [Thu, 11 Sep 2014 10:58:04 +0000 (12:58 +0200)]
qemu: wire up virtio-net segment offloading options

Format the segment offloading options specified by
<driver>
  <host .../>
  <guest .../>
</driver>
on virtio-net command line.

10 years agoconf: add options for disabling segment offloading
Ján Tomko [Thu, 11 Sep 2014 10:56:31 +0000 (12:56 +0200)]
conf: add options for disabling segment offloading

Add options for tuning segment offloading:
<driver>
  <host csum='off' gso='off' tso4='off' tso6='off'
        ecn='off' ufo='off'/>
  <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
</driver>
which control the respective host_ and guest_ properties
of the virtio-net device.

10 years agonodeinfo: fix nodeGetFreePages when max node is zero
Jincheng Miao [Wed, 24 Sep 2014 05:45:30 +0000 (13:45 +0800)]
nodeinfo: fix nodeGetFreePages when max node is zero

In nodeGetFreePages, if startCell is given by '0',
and the max node number is '0' too. The for-loop
wouldn't be executed.
So convert it to while-loop.

Before:
> virsh freepages --cellno 0 --pagesize 4
error: internal error: no suitable info found

After:
> virsh freepages --cellno 0 --pagesize 4
4KiB: 472637

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoLXC: emphasis uid start of idmap only accept '0' in docs
Chen Hanxiao [Tue, 23 Sep 2014 03:40:03 +0000 (11:40 +0800)]
LXC: emphasis uid start of idmap only accept '0' in docs

We don't accept any other values except '0'.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agoFix bug with loading bridge name for active domain during libvirtd start
Pavel Hrdina [Thu, 18 Sep 2014 13:06:44 +0000 (15:06 +0200)]
Fix bug with loading bridge name for active domain during libvirtd start

If you have a bridge network in running domain and libvirtd is restarted
the information about host bridge interface is lost from live xml.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agostorage: Improve error message when traversing backing chains
Peter Krempa [Thu, 11 Sep 2014 17:09:48 +0000 (19:09 +0200)]
storage: Improve error message when traversing backing chains

Report also the name of the parent file and uid/gid used to access it to
help debugging broken storage configurations.

10 years agoqemu: Report better errors from broken backing chains
Peter Krempa [Thu, 11 Sep 2014 16:59:32 +0000 (18:59 +0200)]
qemu: Report better errors from broken backing chains

Request erroring out from the backing chain traveller and drop qemu's
internal backing chain integrity tester.

The backing chain traveller reports errors by itself with possibly more
detail than qemuDiskChainCheckBroken ever could.

We also need to make sure that we reconnect to existing qemu instances
even at the cost of losing the backing chain info (this really should be
stored in the XML rather than reloaded from disk, but that needs some
work).

10 years agoqemu: Sanitize argument names and empty disk check in qemuDomainDetermineDiskChain
Peter Krempa [Thu, 18 Sep 2014 09:21:10 +0000 (11:21 +0200)]
qemu: Sanitize argument names and empty disk check in qemuDomainDetermineDiskChain

Reuse virStorageSourceIsEmpty and rename "force" argument to
"force_probe".

10 years agoutil: storage: Allow metadata crawler to report useful errors
Peter Krempa [Thu, 11 Sep 2014 16:28:47 +0000 (18:28 +0200)]
util: storage: Allow metadata crawler to report useful errors

Add a new parameter to virStorageFileGetMetadata that will break the
backing chain detection process and report useful error message rather
than having to use virStorageFileChainGetBroken.

This patch just introduces the option, usage will be provided
separately.

10 years agolibvirt-guests: run after time-sync.target
Jim Fehlig [Mon, 8 Sep 2014 16:22:14 +0000 (10:22 -0600)]
libvirt-guests: run after time-sync.target

When libvirt-guests is configured to start guests on host
boot, it is possible for guests start and read the host
clock before it is synchronized.  Services such as
libvirt-guests that require correct time should use the
Special Passive System Unit time-sync.target

http://www.freedesktop.org/software/systemd/man/systemd.special.html#time-sync.target

10 years agocputune_event: queue the event for cputune updates
Pavel Hrdina [Tue, 9 Sep 2014 14:34:12 +0000 (16:34 +0200)]
cputune_event: queue the event for cputune updates

Now we have universal tunable event so we can use it for reporting
changes to user. The cputune values will be prefixed with "cputune" to
distinguish it from other tunable events.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoadd an example how to use tunable event
Pavel Hrdina [Tue, 26 Aug 2014 21:47:44 +0000 (23:47 +0200)]
add an example how to use tunable event

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoevent: introduce new event for tunable values
Pavel Hrdina [Wed, 10 Sep 2014 11:28:24 +0000 (13:28 +0200)]
event: introduce new event for tunable values

This new event will use typedParameters to expose what has been actually
updated and the reason is that we can in the future extend any tunable
values or add new tunable values. With typedParameters we don't have to
worry about creating some other events, we will just use this universal
event to inform user about updates.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoqemu: Fix memory leak in RDMA migration code
Jiri Denemark [Tue, 23 Sep 2014 13:22:24 +0000 (15:22 +0200)]
qemu: Fix memory leak in RDMA migration code

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoconf: sanitize tap and vhost paths
Martin Kletzander [Mon, 22 Sep 2014 14:26:53 +0000 (16:26 +0200)]
conf: sanitize tap and vhost paths

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemuBuildNumaArgStr: Discard def->cpu check
Michal Privoznik [Tue, 23 Sep 2014 11:08:39 +0000 (13:08 +0200)]
qemuBuildNumaArgStr: Discard def->cpu check

In the function at one place we check if def->cpu is NULL prior
to accessing def->cpu->ncells. Then, later in the code,
def->cpu->ncells is accessed directly, without the check. This
makes coverity unhappy, because the first check makes it think
def->cpu can be NULL. However, the function is not called if
def->cpu is NULL. Therefore, remove the first check and hopefully
make coverity cheer again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonodeinfo: Prefer MIN in nodeGetFreePages
Michal Privoznik [Tue, 23 Sep 2014 09:34:06 +0000 (11:34 +0200)]
nodeinfo: Prefer MIN in nodeGetFreePages

It's better to use a macro instead of if-else construct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agodomain_conf: separate structures from virDomainDef
Pavel Hrdina [Tue, 16 Sep 2014 16:41:12 +0000 (18:41 +0200)]
domain_conf: separate structures from virDomainDef

Cleanup virDomanDef structure from other nested structure and create
separate type definition for them.

Fix a typo in virDomainHugePage.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoFix typo of virNodeGetFreePages comment
Jincheng Miao [Mon, 22 Sep 2014 10:14:28 +0000 (18:14 +0800)]
Fix typo of virNodeGetFreePages comment

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
10 years agonodeinfo: report error when given node is out of range
Jincheng Miao [Mon, 22 Sep 2014 10:14:27 +0000 (18:14 +0800)]
nodeinfo: report error when given node is out of range

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

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirsh-host: fix pagesize unit of freepages
Jincheng Miao [Mon, 22 Sep 2014 10:14:26 +0000 (18:14 +0800)]
virsh-host: fix pagesize unit of freepages

The unit of '--pagesize' of freepages is kibibytes.

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

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: Memory pre-pinning support for RDMA migration
Michael R. Hines [Mon, 13 Jan 2014 06:28:12 +0000 (14:28 +0800)]
qemu: Memory pre-pinning support for RDMA migration

RDMA Live migration requires registering memory with the hardware, and
thus QEMU offers a new 'capability' to pre-register / mlock() the guest
memory in advance for higher RDMA performance before the migration
begins. This capability is disabled by default, which means QEMU will
register the memory with the hardware in an on-demand basis.

This patch exposes this capability with the following example usage:

virsh migrate --live --rdma-pin-all --migrateuri rdma://hostname domain qemu+ssh://hostname/system

Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: RDMA migration support
Michael R. Hines [Mon, 13 Jan 2014 06:28:11 +0000 (14:28 +0800)]
qemu: RDMA migration support

This patch adds support for RDMA protocol in migration URIs.

USAGE: $ virsh migrate --live --migrateuri rdma://hostname domain qemu+ssh://hostname/system

Since libvirt runs QEMU in a pretty restricted environment, several
files needs to be added to cgroup_device_acl (in qemu.conf) for QEMU to
be able to access the host's infiniband hardware. Full documenation of
the feature can be found on QEMU wiki:
http://wiki.qemu.org/Features/RDMALiveMigration

Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Add RDMA migration capabilities
Jiri Denemark [Thu, 11 Sep 2014 12:11:54 +0000 (14:11 +0200)]
qemu: Add RDMA migration capabilities

10 years agoqemu: Prepare support for arbitrary migration protocol
Jiri Denemark [Mon, 15 Sep 2014 16:15:42 +0000 (18:15 +0200)]
qemu: Prepare support for arbitrary migration protocol

Currently we only support TCP protocol for native QEMU migration but
this is going to be changed. Let's make the code more general and remove
hardcoded TCP protocol from several places.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Fix old tcp:host URIs more cleanly
Jiri Denemark [Mon, 15 Sep 2014 16:13:38 +0000 (18:13 +0200)]
qemu: Fix old tcp:host URIs more cleanly

For compatibility with old libvirt we need to support both tcp:host and
tcp://host migration URIs. Let's make the code that parses them a bit
cleaner.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Expose additional migration statistics
Michael R. Hines [Mon, 13 Jan 2014 06:28:10 +0000 (14:28 +0800)]
qemu: Expose additional migration statistics

RDMA migration uses the 'setup' state in QEMU to optionally lock
all memory before the migration starts. The total time spent in
this state is exposed as VIR_DOMAIN_JOB_SETUP_TIME.

Additionally, QEMU also exports migration throughput (mbps) for both
memory and disk, so let's add them too: VIR_DOMAIN_JOB_MEMORY_BPS,
VIR_DOMAIN_JOB_DISK_BPS.

Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agocpu: fix wrong single quote mark
Chen Fan [Tue, 23 Sep 2014 01:45:21 +0000 (09:45 +0800)]
cpu: fix wrong single quote mark

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agocpu: remove repeated word in error message
Daniel P. Berrange [Mon, 22 Sep 2014 15:41:42 +0000 (16:41 +0100)]
cpu: remove repeated word in error message

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoqemu: raise an error when trying to use readonly sata disks
Giuseppe Scrivano [Mon, 22 Sep 2014 13:58:21 +0000 (15:58 +0200)]
qemu: raise an error when trying to use readonly sata disks

commit 72f919f558902968bd0cf9f99f25ac62cbfe3ac6 introduced an user
friendly error message when trying to use IDE disks as readonly.

Do the same thing for the SATA bus.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1112939
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoqemu: hook: Provide hook when restoring a domain save image
Peter Krempa [Wed, 17 Sep 2014 09:38:39 +0000 (11:38 +0200)]
qemu: hook: Provide hook when restoring a domain save image

10 years agodocs: specify vhost-net instead of net-vhost
Jianwei Hu [Mon, 22 Sep 2014 13:12:18 +0000 (21:12 +0800)]
docs: specify vhost-net instead of net-vhost

For the tap backend the default is specified and the same should be
done for the vhost attribute.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoschema: properly set tap and vhost backend attributes optional
Jianwei Hu [Mon, 22 Sep 2014 13:46:29 +0000 (21:46 +0800)]
schema: properly set tap and vhost backend attributes optional

Each attribute is optional, commit af8b4a2 forgot to mention that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: save image: Split out checks done only when editing the save img
Peter Krempa [Wed, 17 Sep 2014 13:27:33 +0000 (15:27 +0200)]
qemu: save image: Split out checks done only when editing the save img

Move them to the single corresponding function rather than having them
in the common chunk of code.

10 years agoqemu: save image: Split out new definition check/update
Peter Krempa [Wed, 17 Sep 2014 13:06:18 +0000 (15:06 +0200)]
qemu: save image: Split out new definition check/update

Split out the call to the update method only to places where it is
actually used rather than having a mega-method that does all the stuff.

10 years agoqemu: save image: Add possibility to return XML stored in the image
Peter Krempa [Wed, 17 Sep 2014 12:50:04 +0000 (14:50 +0200)]
qemu: save image: Add possibility to return XML stored in the image

Add a new parameter that will allow to return the XML stored in the save
image for further manipulation and adjust the callers. This option will
be used in later patches.

10 years agoqemu: save image: Split out user provided XML checker
Peter Krempa [Wed, 17 Sep 2014 12:23:05 +0000 (14:23 +0200)]
qemu: save image: Split out user provided XML checker

Extract code used to check save image XMLs provided by users to separate
use.

10 years agolibxl: Drop driver lock in libxlDomainDefineXML
Jim Fehlig [Thu, 18 Sep 2014 21:05:34 +0000 (15:05 -0600)]
libxl: Drop driver lock in libxlDomainDefineXML

There is no need to acquire the driver-wide lock in
libxlDomainDefineXML.  When switching to jobs in the libxl
driver, most driver-wide locks were removed.  The locking here
was preserved since I mistakenly thought virDomainObjListAdd
needed protection.  This is not the case, so remove the
unnecessary locking.

10 years agoqemu: Process the hostdev "rawio" setting
John Ferlan [Tue, 9 Sep 2014 22:51:02 +0000 (18:51 -0400)]
qemu: Process the hostdev "rawio" setting

Mimic the "Disk" processing for 'rawio', but for a scsi_host hostdev
lun device.

10 years agohostdev: Add "rawio" attribute to _virDomainHostdevSubsysSCSI
John Ferlan [Tue, 9 Sep 2014 22:48:57 +0000 (18:48 -0400)]
hostdev: Add "rawio" attribute to _virDomainHostdevSubsysSCSI

Add the 'rawio' attribute to match _virDomainDiskDef and process the
hostdev XML similarly to the disk XML for a lun which supports/requires rawio

10 years agodomain_conf: Change virDomainDiskDef 'rawio' to use virTristateBool
John Ferlan [Thu, 18 Sep 2014 17:54:18 +0000 (13:54 -0400)]
domain_conf: Change virDomainDiskDef 'rawio' to use virTristateBool

Adjust disk definition for 'rawio' to use the TristateBool logic

10 years agoqemu: Add missing goto on rawio
John Ferlan [Fri, 19 Sep 2014 09:53:04 +0000 (05:53 -0400)]
qemu: Add missing goto on rawio

Commit id '9a2f36ec' added a build conditional of CAP_SYS_RAWIO
in order to determine whether or not a disk definition using rawio
should be allowed on platforms without CAP_SYS_RAWIO. If one was
found, virReportError was used but the code didn't goto cleanup.

This patch adds the goto.

10 years agoLXC: add HOME environment variable docs
Chen Hanxiao [Fri, 19 Sep 2014 02:01:04 +0000 (10:01 +0800)]
LXC: add HOME environment variable docs

commit
3020594ac57c5e06e79f3db8c765f6bb18c40802
add HOME environment variable.
Add a doc for this.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agoMove the FIPS detection from capabilities
Pavel Hrdina [Thu, 18 Sep 2014 15:38:32 +0000 (17:38 +0200)]
Move the FIPS detection from capabilities

We are not detecting the presence of FIPS from QEMU, but from procfs and
that means it's not QEMU capability. It was decided that we will pass
this flag to QEMU even if it's not supported by old QEMU binaries.

This patch also reverts changes done by commit a21cfb0f to
qemucapabilitestest and implements a new test case in qemuxml2argvtest.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agovirSecuritySELinuxSetTapFDLabel: Temporarily revert to old behavior
Michal Privoznik [Thu, 18 Sep 2014 13:17:29 +0000 (15:17 +0200)]
virSecuritySELinuxSetTapFDLabel: Temporarily revert to old behavior

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

A long time ago I've implemented support for so called multiqueue
net.  The idea was to let guest network traffic be processed by
multiple host CPUs and thus increasing performance. However, this
behavior is enabled by QEMU via special ioctl() iterated over the
all tap FDs passed in by libvirt. Unfortunately, SELinux comes in
and disallows the ioctl() call because the /dev/net/tun has label
system_u:object_r:tun_tap_device_t:s0 and 'attach_queue' ioctl()
is not allowed on tun_tap_device_t type. So after discussion with
a SELinux developer we've decided that the FDs passed to the QEMU
should be labelled with svirt_t type and SELinux policy will
allow the ioctl(). Therefore I've made a patch
(cf976d9dcf4e592261b14f03572) that does exactly this. The patch
was fixed then by a4431931393aeb1ac5893f121151fa3df4fde612 and
b635b7a1af0e64754016d758376f382470bc11e7. However, things are not
that easy - even though the API to label FD is called
(fsetfilecon_raw) the underlying file is labelled too! So
effectively we are mangling /dev/net/tun label. Yes, that broke
dozen of other application from openvpn, or boxes, to qemu
running other domains.

The best solution would be if SELinux provides a way to label an
FD only, which could be then labeled when passed to the qemu.
However that's a long path to go and we should fix this
regression AQAP. So I went to talk to the SELinux developer again
and we agreed on temporary solution that:

1) All the three patches are reverted
2) SELinux temporarily allows 'attach_queue' on the
tun_tap_device_t

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agodocs: update zfs documentation
Roman Bogorodskiy [Sun, 14 Sep 2014 05:17:54 +0000 (09:17 +0400)]
docs: update zfs documentation

 - docs/formatstorage.html.in: document 'zfs' pool type, add it
   to a list of pool types that could use source physical devices
 - docs/storage.html.in: update a ZFS pool example XML with
   source physical devices, mention that starting from 1.2.9 a
   pool could be created from this devices by libvirt and in earlier
   versions user still has to create a pool manually
 - docs/drvbhyve.html.in: add an example with ZFS pools

10 years agostorage: zfs: implement pool build and delete
Roman Bogorodskiy [Sun, 7 Sep 2014 14:01:34 +0000 (18:01 +0400)]
storage: zfs: implement pool build and delete

 - Provide an implementation for buildPool and deletePool operations
   for the ZFS storage backend.
 - Add VIR_STORAGE_POOL_SOURCE_DEVICE flag to ZFS pool poolOptions
   as now we can specify devices to build pool from
 - storagepool.rng: add an optional 'sourceinfodev' to 'sourcezfs' and
   add an optional 'target' to 'poolzfs' entity
 - Add a couple of tests to storagepoolxml2xmltest

10 years agoaudit: fix memory leak without WITH_AUDIT
Ján Tomko [Thu, 18 Sep 2014 10:08:37 +0000 (12:08 +0200)]
audit: fix memory leak without WITH_AUDIT

Free str unconditionally since we allocate it without WITH_AUDIT
too.

10 years agoaudit: remove redundant NULL assignment
Ján Tomko [Thu, 18 Sep 2014 09:59:38 +0000 (11:59 +0200)]
audit: remove redundant NULL assignment

virVasprintf sets the output to NULL on failure.

10 years agoFixes for domains with no iothreads
Ján Tomko [Thu, 18 Sep 2014 09:57:00 +0000 (11:57 +0200)]
Fixes for domains with no iothreads

Plug a memory leak and silence a warning.

10 years agoFix leak in x86UpdateHostModel
Ján Tomko [Thu, 18 Sep 2014 09:55:52 +0000 (11:55 +0200)]
Fix leak in x86UpdateHostModel

Commit de0aeaf introduced a memory leak.

10 years agoFix libvirtd crash when removing metadata
Erik Skultety [Thu, 18 Sep 2014 12:25:05 +0000 (14:25 +0200)]
Fix libvirtd crash when removing metadata

When trying to remove nonexistent metadata from XML, libvirt daemon
crashes due to dereferencing NULL pointer.

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

10 years agoqemu: Don't fail startup/attach for IOThreads if no JSON
John Ferlan [Wed, 17 Sep 2014 18:43:12 +0000 (14:43 -0400)]
qemu: Don't fail startup/attach for IOThreads if no JSON

If the qemu being used doesn't support JSON, then querying for IOThread
data would fail. In that case, ensure the *iothreads is NULL and return 0
as the count of iothreads available.

10 years agoFix build in qemu_command
Roman Bogorodskiy [Thu, 18 Sep 2014 06:36:27 +0000 (10:36 +0400)]
Fix build in qemu_command

Currently, build with clang fails with:

  CC       qemu/libvirt_driver_qemu_impl_la-qemu_command.lo
qemu/qemu_command.c:6580:58: error: implicit conversion from enumeration type
'virMemAccess' to different enumeration type 'virTristateSwitch'
[-Werror,-Wenum-conversion]
        virTristateSwitch memAccess = def->cpu->cells[i].memAccess;
                          ~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
1 error generated.

Fix that by using virMemAccess instead of virTristateSwitch.

10 years agoFix build in qemu_capabilities
Roman Bogorodskiy [Thu, 18 Sep 2014 06:30:40 +0000 (10:30 +0400)]
Fix build in qemu_capabilities

Commit f05b6a91 added virQEMUDriverConfigPtr argument to the
virQEMUCapsFillDomainCaps function and it uses forward declaration
of virQEMUDriverConfig and virQEMUDriverConfigPtr that casues clang
build to fail:

gmake[3]: Entering directory `/usr/home/novel/code/libvirt/src'
  CC       qemu/libvirt_driver_qemu_impl_la-qemu_capabilities.lo
In file included from qemu/qemu_capabilities.c:43:
In file included from qemu/qemu_hostdev.h:27:
qemu/qemu_conf.h:63:37: error: redefinition of typedef 'virQEMUDriverConfig'
is a C11 feature [-Werror,-Wtypedef-redefinition]
typedef struct _virQEMUDriverConfig virQEMUDriverConfig;
                                    ^
qemu/qemu_capabilities.h:328:37: note: previous definition is here
typedef struct _virQEMUDriverConfig virQEMUDriverConfig;
                                    ^

Fix that by passing loader and nloader config attributes directly
instead of passing complete config.

10 years agobhyve: tests: fix build
Roman Bogorodskiy [Thu, 18 Sep 2014 06:25:12 +0000 (10:25 +0400)]
bhyve: tests: fix build

Commit b20d39a introduced a new argument for the
virNetDevTapCreateInBridgePort function, however, its mock
in bhyve tests wasn't updated, so the build failed.

Fix build by adding this new argument to the mock version.

10 years agoqemu: fix crash with shared disks
Ján Tomko [Wed, 17 Sep 2014 10:36:21 +0000 (12:36 +0200)]
qemu: fix crash with shared disks

Commit f36a94f introduced a double free on all success paths
in qemuSharedDeviceEntryInsert.

Only call qemuSharedDeviceEntryFree on the error path and
set entry to NULL before jumping there if the entry already
is in the hash table.

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

10 years agoqemu: Improve check for local storage
Peter Krempa [Thu, 11 Sep 2014 17:28:10 +0000 (19:28 +0200)]
qemu: Improve check for local storage

Now that we have a simple function to check locality of storage, reuse
it in qemuDomainCheckDiskPresence().

Also reuse check for empty storage source.

10 years agoqemu: Drop unused formatting of uuid
Peter Krempa [Thu, 11 Sep 2014 16:49:02 +0000 (18:49 +0200)]
qemu: Drop unused formatting of uuid

The formatted UUID isn't used anywhere else in
qemuDomainCheckDiskStartupPolicy. Drop it.

10 years agomaint: clean up _virDomainMemoryStat
Wang Yufei [Tue, 16 Sep 2014 13:19:47 +0000 (21:19 +0800)]
maint: clean up _virDomainMemoryStat

Clean up all _virDomainMemoryStat.

Signed-off-by: James <james.wangyufei@huawei.com>
Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaint: clean up _virDomainBlockStats
Wang Yufei [Tue, 16 Sep 2014 13:19:46 +0000 (21:19 +0800)]
maint: clean up _virDomainBlockStats

Clean up all _virDomainBlockStats.

Signed-off-by: James <james.wangyufei@huawei.com>
Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaint: clean up _virDomainInterfaceStats
Wang Yufei [Tue, 16 Sep 2014 13:19:45 +0000 (21:19 +0800)]
maint: clean up _virDomainInterfaceStats

Clean up all _virDomainInterfaceStats.

Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoCVE-2014-3633: qemu: blkiotune: Use correct definition when looking up disk
Peter Krempa [Thu, 11 Sep 2014 14:35:53 +0000 (16:35 +0200)]
CVE-2014-3633: qemu: blkiotune: Use correct definition when looking up disk

Live definition was used to look up the disk index while persistent one
was indexed leading to a crash in qemuDomainGetBlockIoTune. Use the
correct def and report a nice error.

Unfortunately it's accessible via read-only connection, though it can
only crash libvirtd in the cases where the guest is hot-plugging disks
without reflecting those changes to the persistent definition.  So
avoiding hotplug, or doing hotplug where persistent is always modified
alongside live definition, will avoid the out-of-bounds access.

Introduced in: eca96694a7f992be633d48d5ca03cedc9bbc3c9aa (v0.9.8)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140724
Reported-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
10 years agoqemu: Honor hugepages for UMA domains
Michal Privoznik [Tue, 2 Sep 2014 14:53:10 +0000 (16:53 +0200)]
qemu: Honor hugepages for UMA domains

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

There are two ways how to tell qemu to use huge pages. The first one
is suitable for domains with NUMA nodes: the path to hugetlbfs mount
is appended to NUMA node definition on the command line. The second
one is suitable for UMA domains: here there's this global '-mem-path'
argument that accepts path to the hugetlbfs mount point. However, the
latter case was not used for all the cases that it should be. For
instance:

  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
    </hugepages>
  </memoryBacking>

didn't trigger the '-mem-path' so the huge pages - despite being
configured - were not used at all.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoconf: Disallow nonexistent NUMA nodes for hugepages
Michal Privoznik [Mon, 15 Sep 2014 09:59:09 +0000 (11:59 +0200)]
conf: Disallow nonexistent NUMA nodes for hugepages

As of 136ad4974 it is possible to specify different huge pages per
guest NUMA node. However, there's no check if nodeset specified in
./hugepages/page contains only those guest NUMA nodes that exist.
In other words with current code it is possible to define meaningless
combination:

  <memoryBacking>
    <hugepages>
      <page size='1048576' unit='KiB' nodeset='0,2-3'/>
      <page size='2048' unit='KiB' nodeset='1,4'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cpu>
    <numa>
      <cell id='0' cpus='0' memory='1048576'/>
      <cell id='1' cpus='1' memory='1048576'/>
      <cell id='2' cpus='2' memory='1048576'/>
      <cell id='3' cpus='3' memory='1048576'/>
    </numa>
  </cpu>

Notice the node 4 in <hugepages/>?

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoman: virsh: Add docs for supported stats groups
Peter Krempa [Mon, 15 Sep 2014 15:32:42 +0000 (17:32 +0200)]
man: virsh: Add docs for supported stats groups

Document the fields returned.

10 years agolib: Document that virConnectGetAllDomainStats may omit some stats fields
Peter Krempa [Mon, 15 Sep 2014 15:17:17 +0000 (17:17 +0200)]
lib: Document that virConnectGetAllDomainStats may omit some stats fields

Add a note to make the users aware that some stats groups or fields may
be missing in certain cases.

10 years agolib: De-duplicate stats group documentation for all stats functions
Peter Krempa [Mon, 15 Sep 2014 15:13:24 +0000 (17:13 +0200)]
lib: De-duplicate stats group documentation for all stats functions

State that full stats for the stats groups are available in the
virConnectGetAllDomainStats documentation section rather than
duplicating the docs.

10 years agovirsh: add options to query bulk stats group
Francesco Romani [Mon, 15 Sep 2014 08:48:10 +0000 (10:48 +0200)]
virsh: add options to query bulk stats group

Add new bulk stats groups to the domstats command.

Signed-off-by: Francesco Romani <fromani@redhat.com>
10 years agoqemu: bulk stats: implement block group
Francesco Romani [Mon, 15 Sep 2014 08:48:09 +0000 (10:48 +0200)]
qemu: bulk stats: implement block group

This patch implements the VIR_DOMAIN_STATS_BLOCK group of statistics.

To do so, a helper function to get the block stats of all the disks of
a domain is added.

Signed-off-by: Francesco Romani <fromani@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
10 years agoqemu: bulk stats: implement interface group
Francesco Romani [Mon, 15 Sep 2014 08:48:08 +0000 (10:48 +0200)]
qemu: bulk stats: implement interface group

This patch implements the VIR_DOMAIN_STATS_INTERFACE group of
statistics.

Signed-off-by: Francesco Romani <fromani@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
10 years agoqemu: bulk stats: implement VCPU group
Francesco Romani [Mon, 15 Sep 2014 08:48:07 +0000 (10:48 +0200)]
qemu: bulk stats: implement VCPU group

This patch implements the VIR_DOMAIN_STATS_VCPU group of statistics. To
do so, this patch also extracts a helper to gather the vCPU information.

Signed-off-by: Francesco Romani <fromani@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>