]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoremove redundant condition
Ján Tomko [Wed, 17 Jun 2015 15:57:56 +0000 (17:57 +0200)]
remove redundant condition

If the address type is SPAPRVIO, it will match the != NONE condition.

9 years agovirSysinfo: Introduce SMBIOS type 2 support
Michal Privoznik [Tue, 12 May 2015 14:47:49 +0000 (16:47 +0200)]
virSysinfo: Introduce SMBIOS type 2 support

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

This type of information defines attributes of a system
baseboard. With one exception: board type is yet not implemented
in qemu so it's not introduced here either.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Report all supported machine types in capabilities
Jiri Denemark [Fri, 12 Jun 2015 12:36:51 +0000 (14:36 +0200)]
qemu: Report all supported machine types in capabilities

Some machine types are only reported as canonical names for other
machine types, which make it a bit harder to find what machine types are
supported by a specific QEMU binary. Ideally, one would just use
/capabilities/guest/arch[@name='...']/machine/text() XPath to get a list
of all supported machine types, but it doesn't work right now.

For example, we report

    <machine canonical='pc-i440fx-2.3' maxCpus='255'>pc</machine>

in guest capabilities, but the corresponding

    <machine maxCpus='255'>pc-i440fx-2.3</machine>

is missing.

This is a result of QMP probing. With "-machine ?" parsing QEMU sends
us two lines:

pc                   Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.3)
pc-i440fx-2.3        Standard PC (i440FX + PIIX, 1996) (default)

while query-machines QMP command reports both in the same entry:

{"name": "pc-i440fx-2.3", "is-default": true, "cpu-max": 255, "alias": "pc"}

Let's make sure we always report separate <machine/> for both the
canonical name and its alias and using the canonical name as the default
machine type (i.e., inserting it before its alias) in case is-default is
true.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agotests: Sort EXTRA_DIST in the Makefile
Michal Privoznik [Wed, 17 Jun 2015 16:11:25 +0000 (18:11 +0200)]
tests: Sort EXTRA_DIST in the Makefile

We tend to keep the folders in the EXTRA_DIST sorted alphabetically.
However, we've failed sometimes and the list is not ordered anymore.
Reorder it back.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon: Don't just include admin RPC
Michal Privoznik [Wed, 17 Jun 2015 13:36:16 +0000 (15:36 +0200)]
daemon: Don't just include admin RPC

So, it's a little paradox that we use the file twice. Firstly to build
libvirt-admin.la (a client side of the Admin API), then once again to
build the server side. Well, the problem is, this does not play nicely
with the distclean since the file is generated. So while it's removed
in the src/ the distclean running in daemon/ will not find the file
and fail. The file is needed because it contains the RPC wrappers. So
let's leave the client code as is and from the daemon/ just link the
client library. The linker will find desired symbols and use them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonodedev: update netdev feature bits before each dumpxml
Laine Stump [Tue, 16 Jun 2015 15:57:11 +0000 (11:57 -0400)]
nodedev: update netdev feature bits before each dumpxml

As with several other attributes of devices (link status, sriov VF
list, IOMMU group list), the detdev feature bits aren't automatically
updated in the nodedev driver's cache when they change. In order to
get a properly up-to-date list when getting the XML of a device, we
must reget them in update-caps prior to each dumpxml.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1232880

9 years agolibvirt.spec: Don't expect virt-admin in libvirt-admin yet
Michal Privoznik [Wed, 17 Jun 2015 11:49:35 +0000 (13:49 +0200)]
libvirt.spec: Don't expect virt-admin in libvirt-admin yet

While Martin introduced the binary (and its manpage) in commit
4e7ccf87133 it was pushed by mistake. Therefore it was reverted in
220393bfb043. The problem is, the original commit was not quite right
as the binary was added into the spec file in a different commit:
55e0c840af. So as long as the binary does not exist, we must remove it
from the spec file too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotests: Follow virnetserver to virnetdaemon transition
Michal Privoznik [Wed, 17 Jun 2015 11:29:14 +0000 (13:29 +0200)]
tests: Follow virnetserver to virnetdaemon transition

In a4746114582 the virnetserver test was renamed to virnetdaemon.
Moreover, as the test relies on some data stored under
virnetserverdata/ the folder was renamed too. But this was not
reflected in the Makefile. Therefore when building outside of the
repository, the data folder was not distributed and test failed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon: Distribute admin_server.h
Michal Privoznik [Wed, 17 Jun 2015 11:25:47 +0000 (13:25 +0200)]
daemon: Distribute admin_server.h

The Admin API consists of a few files on daemon side. Notably
daemon/admin_server.{ch}. While they are both on the repo, only
the .c file is mentioned in Makefile. Therefore, .h is not
distributed and 'make rpm' fails.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoparallels: substitute parallels with vz spec file and Makefile
Maxim Nestratov [Wed, 10 Jun 2015 07:50:00 +0000 (10:50 +0300)]
parallels: substitute parallels with vz spec file and Makefile

Since we have changed the name of the driver to vz, let's
reference it as vz everywhere.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: rename all parallels files and driver directory to vz
Maxim Nestratov [Wed, 10 Jun 2015 07:50:00 +0000 (10:50 +0300)]
parallels: rename all parallels files and driver directory to vz

This patch moves all src/parallels/parallels* files to vz/vz*
and fixes build accordingly.
No functional changes.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: substitute parallels with vz in strings
Maxim Nestratov [Wed, 10 Jun 2015 07:50:00 +0000 (10:50 +0300)]
parallels: substitute parallels with vz in strings

Here we stop referencing vz driver by different names
in error messages. 'parallels driver', 'Parallels Cloud
Server', 'Parallels driver' all become just 'vz driver'.
No functional changes. Only renaming and a bit of rewording.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: change parallels prefixes to vz
Maxim Nestratov [Wed, 10 Jun 2015 07:50:00 +0000 (10:50 +0300)]
parallels: change parallels prefixes to vz

This patch changes all parallels/vz driver structure and
function prefixes from parallels to vz.
No functional changes.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agodaemon/Makefile: Add forgotten dependency
Michal Privoznik [Tue, 16 Jun 2015 16:11:17 +0000 (18:11 +0200)]
daemon/Makefile: Add forgotten dependency

In latest patches we added Admin API. However, the Makefile in daemon
was missing one dependency: admin_server.c is including generated file
admin_dispatch.h. However, this dependency was not explicitly marked
in the Makefile therefore the build happened to fail on some
occasions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirfile: virDirCreate: Insert blank lines to assure slightly better readability
Erik Skultety [Tue, 16 Jun 2015 06:50:03 +0000 (08:50 +0200)]
virfile: virDirCreate: Insert blank lines to assure slightly better readability

9 years agoutil: virfile: Fix 'unknown cause' error if NFS mount point creation fails
Erik Skultety [Thu, 11 Jun 2015 08:51:23 +0000 (10:51 +0200)]
util: virfile: Fix 'unknown cause' error if NFS mount point creation fails

This happens if user requires creation of a directory with specified
UID/GID permissions. To accomplish this, we use fork approach and
set particular UID/GID permissions in child process. However, child
process doesn't have a valid descriptor to a logfile (this is prohibited
explicitly) and since parent process doesn't handle negative exit codes from
child in any way, 'uknown cause' error is returned to the user.

Commit 92d9114e tweaked the way we handle child errors when using fork
approach to set specific permissions (features originally introduced
by 98f6f381). The same logic should be used to create directories with
specified permissions as well.

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

9 years agoutil: virDirCreate: Child now exits with positive errno-code
Erik Skultety [Tue, 16 Jun 2015 11:43:38 +0000 (13:43 +0200)]
util: virDirCreate: Child now exits with positive errno-code

Previous patch of this series proposed a fix to virDirCreate, so that parent
process reports an error if child process failed its task.
However our logic still permits the child to exit with negative errno followed
by a check of the status on the parent side using WEXITSTATUS which, being
POSIX compliant, takes the lower 8 bits of the exit code and returns is to
the caller. However, by taking 8 bits from a negative exit code
(two's complement) the status value we read and append to stream is
'2^8 - abs(original exit code)' which doesn't quite reflect the real cause when
compared to the meaning of errno values.

9 years agolxc: set nosuid+nodev+noexec flags on /proc/sys mount
Eric W. Biederman [Tue, 16 Jun 2015 13:44:36 +0000 (14:44 +0100)]
lxc: set nosuid+nodev+noexec flags on /proc/sys mount

Future kernels will mandate the use of nosuid+nodev+noexec
flags when mounting the /proc/sys filesystem. Unconditionally
add them now since they don't harm things regardless and could
mitigate future security attacks.

9 years agoutil: Fix Coverity RESOURCE_LEAK
John Ferlan [Tue, 16 Jun 2015 13:15:10 +0000 (09:15 -0400)]
util: Fix Coverity RESOURCE_LEAK

Commit id 'e44b0269c9' in advertently checked !dir before calling closedir

9 years agolxc: Rename daemon to dmn
Martin Kletzander [Tue, 16 Jun 2015 12:59:33 +0000 (14:59 +0200)]
lxc: Rename daemon to dmn

On older systems it shadows global declaration of daemon() function.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agonetserver: Remove duplicate forward declaration
Martin Kletzander [Tue, 16 Jun 2015 12:58:00 +0000 (14:58 +0200)]
netserver: Remove duplicate forward declaration

Commit fa14207368820b264123ba8429927b62258f996e added forward
declaration of virNetServerPtr into virnetserver.h even though we are
keeping these in virnetserverprogram.h due to older compilers having
problems with duplicate ones.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoRevert "rpc: Add virNetServerGetNClients"
Martin Kletzander [Tue, 16 Jun 2015 12:09:09 +0000 (14:09 +0200)]
Revert "rpc: Add virNetServerGetNClients"

This reverts commit 6bda9f8aa2cd07a3defda571c7d61401fd66c226.

I mistakenly pushed it along with the Admin API series.

9 years agoRevert "admin: Add virAdmHello function"
Martin Kletzander [Tue, 16 Jun 2015 12:08:59 +0000 (14:08 +0200)]
Revert "admin: Add virAdmHello function"

This reverts commit 5792fabb7b712749147e9d03348c798dc1943651.

I mistakenly pushed it along with the Admin API series.

9 years agoRevert "Example virt-admin"
Martin Kletzander [Tue, 16 Jun 2015 12:08:23 +0000 (14:08 +0200)]
Revert "Example virt-admin"

This reverts commit 4e7ccf87133ac59f68bdd0b4897178fa9e2feefd.

I mistakenly pushed it along with the Admin API series.

9 years agoChange livbirt version to 1.3.0 for the next release
Martin Kletzander [Tue, 16 Jun 2015 11:38:54 +0000 (13:38 +0200)]
Change livbirt version to 1.3.0 for the next release

Since the background for Admin API is merged upstream, we are bumping
the minor release version as discussed previously

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoExample virt-admin
Martin Kletzander [Tue, 17 Mar 2015 09:27:14 +0000 (10:27 +0100)]
Example virt-admin

You had only one job.  That's what you can say about this example
binary.  In future, parts of virsh that are usable for this binary
should be split into separate shell-utils and virt-admin should gain all
the cool features of virsh without too much code addition.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Add virAdmHello function
Martin Kletzander [Wed, 15 Apr 2015 14:35:42 +0000 (16:35 +0200)]
admin: Add virAdmHello function

Just one of the simplest functions that returns string "Clients: X"
where X is the number of connected clients to daemon's first
subserver (the original one), so it can be tested using virsh, ipython,
etc.

The subserver is gathered by incrementing its reference
counter (similarly to getting qemu capabilities), so there is no
deadlock with admin subserver in this API.

Here you can see how functions should be named in the client (virAdm*)
and server (adm*).

There is also a parameter @flags that must be 0, which helps testing
proper error propagation into the client.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorpc: Add virNetServerGetNClients
Martin Kletzander [Wed, 15 Apr 2015 14:39:04 +0000 (16:39 +0200)]
rpc: Add virNetServerGetNClients

This function accesses the number of connected clients while properly
locking the server it returns the data about.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoAdd support for admin API in libvirt daemon
Martin Kletzander [Wed, 15 Apr 2015 14:23:55 +0000 (16:23 +0200)]
Add support for admin API in libvirt daemon

For this to pe properly separated from other protocols used by the
server, there is second server added which allows access to the whole
virNetDaemon to its clients.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoAdd configuration options for permissions on daemon's admin socket
Martin Kletzander [Mon, 13 Apr 2015 14:05:46 +0000 (16:05 +0200)]
Add configuration options for permissions on daemon's admin socket

This is not going to be very widely used, but for some corner cases and
easier (unsafe) debugging, it might be nice.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoAdd XML files with admin API specification
Martin Kletzander [Wed, 15 Apr 2015 14:23:25 +0000 (16:23 +0200)]
Add XML files with admin API specification

No online docs are build from it since it doesn't really fit into our
document structure and new page will need to be created for it, but this
is at least a heads-up commit for easier parsing in order to build some
documentation (or python bindings) later on.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoAdd libvirt-admin library
Martin Kletzander [Wed, 15 Apr 2015 14:16:24 +0000 (16:16 +0200)]
Add libvirt-admin library

Initial scratch of the admin library.  It has its own virAdmConnectPtr
that inherits from virAbstractConnectPtr and thus trivially supports
error reporting.

There's pkg-config file added and spec-file adjusted as well.

Since the library should be "minimalistic" and not depend on any other
library, the list of files is especially crafted for it.  Most of them
could've been put to it's own sub-libraries that would be LIBADD'd to
libvirt_util, libvirt_net_rpc and libvirt_setuid_rpc_client to minimize
the number of object files being built, but that's a refactoring that
isn't the orginal aim of this commit.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoAdd admin error domain
Martin Kletzander [Wed, 15 Apr 2015 14:17:11 +0000 (16:17 +0200)]
Add admin error domain

Just the addition of VIR_FROM_ADMIN to the enum of error domains.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoBuild client headers for admin protocol
Martin Kletzander [Thu, 16 Apr 2015 12:23:16 +0000 (14:23 +0200)]
Build client headers for admin protocol

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoAdd admin protocol
Martin Kletzander [Wed, 15 Apr 2015 14:13:22 +0000 (16:13 +0200)]
Add admin protocol

For now there are only CONNECT_OPEN and CONNECT_CLOSE procedures.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoTeach gendispatch how to handle admin dispatching files
Martin Kletzander [Tue, 17 Mar 2015 09:09:48 +0000 (10:09 +0100)]
Teach gendispatch how to handle admin dispatching files

Since this is just a new option for gendispatch, it looks more like a
cleanup.  The only differences handled by it are connect pointers,
private pointers and API naming customs.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: Adapt virnetservertest to daemon refactor
Martin Kletzander [Thu, 11 Jun 2015 12:02:30 +0000 (14:02 +0200)]
tests: Adapt virnetservertest to daemon refactor

Rename the test to virnetdaemontest and use virNetDaemon objects instead
of virNetServer inside.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoMove daemon-related parts of virNetServer to virNetDaemon
Martin Kletzander [Mon, 16 Mar 2015 14:02:41 +0000 (15:02 +0100)]
Move daemon-related parts of virNetServer to virNetDaemon

This allows to have more servers in one daemon which helps isolating
some resources.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agolxc: properly clean up qemu-nbd
Cédric Bosdonnat [Tue, 26 May 2015 16:29:27 +0000 (18:29 +0200)]
lxc: properly clean up qemu-nbd

Add the qemu-nbd tasks to the container cgroup to make sure those will
be killed when the container is stopped. In order to reliably get the
qemu-nbd tasks PIDs, we use /sys/devices/virtual/block/<DEV>/pid as
qemu-nbd is daemonizing itself.

9 years agoAdd virProcessGetPids to get all tasks of a process
Cédric Bosdonnat [Mon, 1 Jun 2015 12:31:44 +0000 (14:31 +0200)]
Add virProcessGetPids to get all tasks of a process

This function gets all the PIDs listed in /proc/PID/task. This will be
needed at least to move all qmeu-nbd tasks to the container cgroup.

9 years agostorage: Generate correct parameters for CIFS
John Ferlan [Wed, 3 Jun 2015 14:20:56 +0000 (10:20 -0400)]
storage: Generate correct parameters for CIFS

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

When generating the path to the dir for a CIFS/Samba driver, the code
would generate a source path for the mount using "%s:%s" while the
mount.cifs expects to see "//%s/%s". So check for the cifsfs and
format the source path appropriately.

Additionally, since there is no means to authenticate, the mount
needs a "-o guest" on the command line in order to anonymously mount
the Samba directory.

9 years agostorage: Adjust command arglist for gluster
John Ferlan [Mon, 15 Jun 2015 21:20:32 +0000 (17:20 -0400)]
storage: Adjust command arglist for gluster

In order for the glusterfs boolean to be set, the pool->def->type must be
VIR_STORAGE_POOL_NETFS, thus the check within virCommandNewArgList whether
pool->def->type is VIR_STORAGE_POOL_FS will never be true, so remove it

9 years agostorage: Fix the schema and add tests for cifs pool
John Ferlan [Wed, 3 Jun 2015 15:43:00 +0000 (11:43 -0400)]
storage: Fix the schema and add tests for cifs pool

Commit id '887dd362' added support for a netfs pool format type 'cifs'
and 'gluster' in order to add rng support for Samba and glusterfs netfs
pools. Originally, the CIFS type support was added as part of commit
id '61fb6979'. Eventually commit id 'b325be12' fixed the gluster rng
definition to match expectations.

As it turns out the CIFS rng needed a similar change since the directory
path is not an absDirPath, rather just a dirPath will be required.

9 years agoconfigure: Remove check for pkcheck_supports_uid
Guido Günther [Fri, 5 Jun 2015 10:41:22 +0000 (12:41 +0200)]
configure: Remove check for pkcheck_supports_uid

We're using Polkit's DBus API so no need to check wether this feature is
supported. We don't use the result or the path to the pkcheck program
anywhere.

9 years agotests: Use libvirt properly with initialization and error dispatching
Martin Kletzander [Mon, 15 Jun 2015 08:41:17 +0000 (10:41 +0200)]
tests: Use libvirt properly with initialization and error dispatching

We were using "complicated" error printing in virnetservertest even
though we could've just dispatched the error.  Also add some good
practices that might come in handy (the code may fail without proper
initialization and event loop).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoGenerate JSON with mDNS entries only when built --with-avahi
Martin Kletzander [Mon, 15 Jun 2015 09:28:11 +0000 (11:28 +0200)]
Generate JSON with mDNS entries only when built --with-avahi

One string was already used only if that condition was true, second one
is added now.  Both are used in a nicer way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorpc: Fix possible crash when MDNSAddEntry fails
Martin Kletzander [Thu, 11 Jun 2015 11:58:43 +0000 (13:58 +0200)]
rpc: Fix possible crash when MDNSAddEntry fails

If virNetServerMDNSAddEntry() fails when adding a service to a server,
it doesn't decrease the number of services.  Hence access to their
members segfaults (e.g. when free()-ing the sruct).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agobuild: Remove unnecessarily repeated rules for syms -> def
Martin Kletzander [Thu, 21 May 2015 23:39:26 +0000 (16:39 -0700)]
build: Remove unnecessarily repeated rules for syms -> def

Suggested-by: Michal Prívozník <mprivozn@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: monitor: Add memory balloon support for virtio-ccw
Boris Fiuczynski [Wed, 10 Jun 2015 07:02:36 +0000 (09:02 +0200)]
qemu: monitor: Add memory balloon support for virtio-ccw

The search for the memory balloon driver object is extended by a
second known name "virtio-balloon-ccw" in support for virtio-ccw.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
9 years agoman: clarify usage of virsh blockcopy with --xml
Ján Tomko [Mon, 15 Jun 2015 12:08:05 +0000 (14:08 +0200)]
man: clarify usage of virsh blockcopy with --xml

The --xml option is mandatory if an XML description is used.
Otherwise the third parameter is treated as the destination.

https://bugzilla.redhat.com/show_bug.cgi?id=1206406#c3

9 years agoqemu: emulatorpin: Don't reset pinning when pinning to all cpus
Peter Krempa [Fri, 12 Jun 2015 13:53:05 +0000 (15:53 +0200)]
qemu: emulatorpin: Don't reset pinning when pinning to all cpus

Similarly to a02a161bb8a6caf0db4dd446ed1cdf53d97b40 remove the default
pinning assumption from emulatorpin.

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

9 years agogetOldStyleBlockDevice: Adjust formatting
Michal Privoznik [Mon, 15 Jun 2015 11:13:27 +0000 (13:13 +0200)]
getOldStyleBlockDevice: Adjust formatting

Instead of initializing return value to zero (success) and overwriting
it on every failure just before the control jumps onto 'out' label,
let's initialize to an error value and set to zero only when we are
sure about the success. Just follow the pattern we have in the rest of
the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agogetNewStyleBlockDevice: Adjust formatting
Michal Privoznik [Mon, 15 Jun 2015 11:13:27 +0000 (13:13 +0200)]
getNewStyleBlockDevice: Adjust formatting

Instead of initializing return value to zero (success) and overwriting
it on every failure just before the control jumps onto 'out' label,
let's initialize to an error value and set to zero only when we are
sure about the success. Just follow the pattern we have in the rest of
the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agostorage: Disallow wiping an extended disk partition
John Ferlan [Tue, 9 Jun 2015 22:15:39 +0000 (18:15 -0400)]
storage: Disallow wiping an extended disk partition

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

Check if the disk partition to be wiped is the extended partition, if
so then disallow it. Do this via changing the wipeVol backend to check
the volume before passing to the common virStorageBackendVolWipeLocal

9 years agoqemu caps: spell queue
Ján Tomko [Mon, 15 Jun 2015 08:38:21 +0000 (10:38 +0200)]
qemu caps: spell queue

9 years agoqemu: Do not support 'serial' scsi-block 'lun' devices
John Ferlan [Tue, 9 Jun 2015 20:49:00 +0000 (16:49 -0400)]
qemu: Do not support 'serial' scsi-block 'lun' devices

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

Seems the property has been deprecated for qemu, although seemingly ignored.

This patch enforces from a libvirt perspective that a scsi-block 'lun'
device should not provide the 'serial' property.

9 years agostorage: Need to set secrettype for direct iscsi disk volume
John Ferlan [Mon, 8 Jun 2015 22:41:28 +0000 (18:41 -0400)]
storage: Need to set secrettype for direct iscsi disk volume

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

Commit id '1b4eaa61' added the ability to have a mode='direct' for
an iscsi disk volume.  It relied on virStorageTranslateDiskSourcePool
in order to copy any disk source pool authentication information to
the direct disk volume, but it neglected to also copy the 'secrettype'
field which ends up being used in the domain volume formatting code.
Adding a secrettype for this case will allow for proper formatting later
and allow disk snapshotting to work properly

Additionally libvirtd restart processing would fail to find the domain
since the translation processing code is run after domain xml processing,
so handle the the case where the authdef could have an empty secrettype
field when processing the auth and additionally ignore performing the
actual and expected auth secret type checks for a DISK_VOLUME since that
data will be reassembled later during translation processing of the
running domain.

9 years agovirCapabilitiesDomainDataLookup: Produce saner error message
Michal Privoznik [Thu, 11 Jun 2015 14:15:46 +0000 (16:15 +0200)]
virCapabilitiesDomainDataLookup: Produce saner error message

During a review, I've noticed this error message that was eventually
produced when I was trying to define a domain:

error: invalid argument: could not find capabilities for arch=mips64el
domaintype=(null)

Look at the (null). Why is it there? Well, during XML parsing, we try
to look up the default emulator for given OS type and possibly virt
type too. And this is the problem, because if we don't want to look up
by virt type, a -1 is passed to note this fact. Later, the code
handles -1 just right. Except for error message. When it is
constructed (in a very fabulous way I must say), the value is compared
to zero, not -1. And since we don't have any translation from -1 to a
virt type string, we just print (null).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibxl: Add timestamp to the libxl driver log.
Anthony PERARD [Mon, 8 Jun 2015 17:05:06 +0000 (18:05 +0100)]
libxl: Add timestamp to the libxl driver log.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
9 years agoqemu: update netdevs of the same mac addrs correctly
zhang bo [Mon, 8 Jun 2015 08:25:10 +0000 (16:25 +0800)]
qemu: update netdevs of the same mac addrs correctly

If a guest has multiple network devices with the same MAC address,
when we online update the second device, libvirtd always updates
the first one.

commit def31e4c forgot to fix the online updating scenario. We need to
use virDomainNetFindIdx() to find the correct network device.

Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com>
9 years agoscsi: Need to translate disk source pool in config attach path
John Ferlan [Thu, 11 Jun 2015 21:07:38 +0000 (17:07 -0400)]
scsi: Need to translate disk source pool in config attach path

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

When attaching a scsi volume lun via the attach-device --config or
--persistent options, there was no translation of the source pool
like there was for the live path, thus the attempt to modify the config
would fail since not enough was known about the disk.

9 years agovirsysinfo: s/system/sysdef/
Michal Privoznik [Fri, 12 Jun 2015 12:51:09 +0000 (14:51 +0200)]
virsysinfo: s/system/sysdef/

A variable can't be named system, obviously. Well, it can if the
compiler is new enough to distinguish a variable named system and a
function call system(). And some older systems, don't have wise
compiler.

  CC     util/libvirt_util_la-virsysinfo.lo
cc1: warnings being treated as errors
../../src/util/virsysinfo.c: In function 'virSysinfoParseSystem':
../../src/util/virsysinfo.c:649: error: declaration of 'system' shadows a global declaration [-Wshadow]
/usr/include/stdlib.h:717: error: shadowed declaration is here [-Wshadow]
make[3]: *** [util/libvirt_util_la-virsysinfo.lo] Error 1

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agocmdNetworkList: Introduce --name, --uuid, --table
Michal Privoznik [Mon, 8 Jun 2015 14:13:28 +0000 (16:13 +0200)]
cmdNetworkList: Introduce --name, --uuid, --table

When reviewing some network patches, I've noticed we don't have
those switches to the 'net-list' command. We should. They are
merely copied over from 'list' command.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agocmdNetworkList: switch to FILTER
Michal Privoznik [Mon, 8 Jun 2015 14:13:14 +0000 (16:13 +0200)]
cmdNetworkList: switch to FILTER

Instead of sticking to old code pattern use the one laid out by
cmdList. Use FILTER() macro instead of series of boolean
variables.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuBuildDriveStr: s/virBufferEscapeString/virBufferAsprintf/
Michal Privoznik [Mon, 8 Jun 2015 13:42:44 +0000 (15:42 +0200)]
qemuBuildDriveStr: s/virBufferEscapeString/virBufferAsprintf/

We are using it to print a value that can't be NULL and does not need
any escaping anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirQEMUCapsArch: openrisc vs or32
Michal Privoznik [Thu, 11 Jun 2015 14:26:45 +0000 (16:26 +0200)]
virQEMUCapsArch: openrisc vs or32

With a few exceptions, we assume that qemu binary for given
architecture has form of qemu-system-$arch. Well, openrisc is yet
another exception. It's binary is called qemu-system-or32.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirSysinfoDef: Exempt SYSTEM variables
Michal Privoznik [Tue, 12 May 2015 12:33:12 +0000 (14:33 +0200)]
virSysinfoDef: Exempt SYSTEM variables

Move all the system_* fields into a separate struct. Not only this
simplifies the code a bit it also helps us to identify whether BIOS
info is present. We don't have to check all the four variables for
being not-NULL, but we can just check the pointer to the struct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirSysinfoDef: Exempt BIOS variables
Michal Privoznik [Tue, 12 May 2015 10:02:29 +0000 (12:02 +0200)]
virSysinfoDef: Exempt BIOS variables

Move all the bios_* fields into a separate struct. Not only this
simplifies the code a bit it also helps us to identify whether BIOS
info is present. We don't have to check all the four variables for
being not-NULL, but we can just check the pointer to the struct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotests: Distribute virnetserverdata
Michal Privoznik [Fri, 12 Jun 2015 07:48:04 +0000 (09:48 +0200)]
tests: Distribute virnetserverdata

Fairly recently we've introduced virnetservertest. This test has some
input data stored under tests/virnetserverdata which unfortunately was
not distributed among with the test. Therefore 'make distcheck'
failed. Fix this by adding the directory into EXTRA_DIST.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoschema: use arch list from basictypes for os arch attribute
James Cowgill [Mon, 8 Jun 2015 13:42:30 +0000 (14:42 +0100)]
schema: use arch list from basictypes for os arch attribute

I see no reason to duplicate this list of architectures. This also allows
more guest architectures to be used with libvirt (like the mips64el qemu
machine I am trying to run).

Signed-off-by: James Cowgill <james410@cowgill.org.uk>
9 years agoutil: add virJSONValueCopy
Martin Kletzander [Thu, 21 Aug 2014 10:23:41 +0000 (12:23 +0200)]
util: add virJSONValueCopy

Faster version of virJSONValueFromString(virJSONValueToString()).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: add multiqueue vhost-user support
Maxime Leroy [Thu, 26 Feb 2015 11:45:57 +0000 (12:45 +0100)]
qemu: add multiqueue vhost-user support

This patch adds the support of queues attribute of the driver element
for vhost-user interface type. Example:

<interface type='vhostuser'>
      <mac address='52:54:00:ee:96:6d'/>
      <source type='unix' path='/tmp/vhost2.sock' mode='client'/>
      <model type='virtio'/>
      <driver queues='4'/>
</interface>

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

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Add capability for vhost-user multiqueue
Martin Kletzander [Thu, 4 Jun 2015 09:37:37 +0000 (11:37 +0200)]
qemu: Add capability for vhost-user multiqueue

The support for this was added in QEMU with commit
830d70db692e374b55555f4407f96a1ceefdcc97.  Unfortunately we have to do
another ugly version-based capability check.  The other option would be
not to check for the capability at all and leave that to qemu as it's
done with multiqueue tap devices.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agodocs: Clarify that attribute name is not used for vhostuser
Maxime Leroy [Thu, 26 Feb 2015 11:45:57 +0000 (12:45 +0100)]
docs: Clarify that attribute name is not used for vhostuser

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoconf: Ignore multiqueue with one queue.
Martin Kletzander [Thu, 4 Jun 2015 09:23:28 +0000 (11:23 +0200)]
conf: Ignore multiqueue with one queue.

Multi != One.  And indeed, libvirt behaves the same way for queues='1'
as without such setting.  Let's make it clear in the XML.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoutil: Make virProcessGetAffinity more readable and fix coverity warning
Peter Krempa [Thu, 4 Jun 2015 12:13:15 +0000 (14:13 +0200)]
util: Make virProcessGetAffinity more readable and fix coverity warning

Store the cpu count in an intermediate variable and reuse it rather than
caluclating the index.

Additionally add a coverity silencing comment.

9 years agoapibuild: Generate macro/@string attribute
Jiri Denemark [Fri, 5 Jun 2015 09:48:59 +0000 (11:48 +0200)]
apibuild: Generate macro/@string attribute

If a macro has a string value, the @string attribute will contain the
value. Otherwise @string attribute will be missing.

For example, the following macro definition from libvirt-domain.h:

 /**
  * VIR_MIGRATE_PARAM_URI:
  * ...
  */
 # define VIR_MIGRATE_PARAM_URI               "migrate_uri"

will result in

 <macro name='VIR_MIGRATE_PARAM_URI' file='libvirt-domain' string='migrate_uri'>
   <info><![CDATA[...]]></info>
 </macro>

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoapibuild: Fix indentation
Jiri Denemark [Fri, 5 Jun 2015 09:38:51 +0000 (11:38 +0200)]
apibuild: Fix indentation

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agorpc: add testing of RPC JSON (de)serialization
Daniel P. Berrange [Fri, 22 May 2015 12:21:46 +0000 (13:21 +0100)]
rpc: add testing of RPC JSON (de)serialization

The virNetServer class has the ability to serialize its state
to a JSON file, and then re-load that data after an in-place
execve() call to re-connect to active file handles. This data
format is critical ABI that must have compatibility across
releases, so it should be tested...

9 years agorpc: add API for checking IPv4/6 availability
Daniel P. Berrange [Thu, 21 May 2015 15:27:15 +0000 (16:27 +0100)]
rpc: add API for checking IPv4/6 availability

The socket test suite has a function for checking if IPv4
or IPv6 are available, and returning a free socket. The
first bit of that will be needed in another test, so pull
that logic out into a separate helper method.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agorpc: allow selection of TCP address family
Daniel P. Berrange [Thu, 21 May 2015 14:51:28 +0000 (15:51 +0100)]
rpc: allow selection of TCP address family

By default, getaddrinfo() will return addresses for both
IPv4 and IPv6 if both protocols are enabled, and so the
RPC code will listen/connect to both protocols too. There
may be cases where it is desirable to restrict this to
just one of the two protocols, so add an 'int family'
parameter to all the TCP related APIs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agomaint: document use of zanata for translations
Eric Blake [Wed, 27 May 2015 14:42:30 +0000 (08:42 -0600)]
maint: document use of zanata for translations

Based on recent list questions on how to contribute a translation fix.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agovirNumaSetPagePoolSize: Produce friendlier error message
Michal Privoznik [Mon, 8 Jun 2015 12:05:25 +0000 (14:05 +0200)]
virNumaSetPagePoolSize: Produce friendlier error message

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

The function takes two important arguments (among many others): @node
and @page_size. From these two a path under /sys is constructed. The
path is then used to read and write the desired size of huge pages
pool. However, if the path does not exists due to either @node or
@page_size having nonexistent value (e.g. there's no such NUMA node or
no page size like -2), an cryptic error message is produced:

  virsh # allocpages --pagesize 2049 --pagecount 8 --cellno -2
  error: Failed to open file '/sys/devices/system/node/node-2/hugepages/hugepages-2049kB/nr_hugepages': No such file or directory

Add two more checks to catch this and therefore produce much more
friendlier error messages.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agological: Fix typo in error message
John Ferlan [Tue, 9 Jun 2015 22:21:57 +0000 (18:21 -0400)]
logical: Fix typo in error message

9 years agonetwork: escape quotes for dsmasq conf contents
Shivaprasad G Bhat [Mon, 1 Jun 2015 08:10:04 +0000 (13:40 +0530)]
network: escape quotes for dsmasq conf contents

dnsmasq conf file contents needs to have quotes escaped for it to
work.  Because of this, the network-create/start for a network with
quotes in the name fails. The patch escapes strings for the entries
that go into the conf file.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
9 years agoconf: fix domaincommon.rng to accept network name with quotes
Shivaprasad G Bhat [Mon, 1 Jun 2015 08:07:23 +0000 (13:37 +0530)]
conf: fix domaincommon.rng to accept network name with quotes

The network name is currently of type "deviceName" but it should be
"text" as name is defined in the network.rng.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
9 years agoparallels: fix formatting errors in parallels driver
Dmitry Guryanov [Tue, 9 Jun 2015 14:04:24 +0000 (17:04 +0300)]
parallels: fix formatting errors in parallels driver

This patch fixes several formatting errors, which I
missed before pushing previous patches. Mostly because
of missing cppi package.

9 years agoparallels: treat block devices as disks for containers
Maxim Nestratov [Wed, 3 Jun 2015 21:10:00 +0000 (00:10 +0300)]
parallels: treat block devices as disks for containers

We are going to add block devices as disks for containers
not as filesystems.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: report SATA bus type for container block devices disks
Maxim Nestratov [Wed, 3 Jun 2015 21:10:00 +0000 (00:10 +0300)]
parallels: report SATA bus type for container block devices disks

As we can add disks based on block devices to containers and bus type
doesn't have any meaning here, let us report always SATA for them.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: process '/' mount point correctly for containers
Maxim Nestratov [Wed, 3 Jun 2015 21:10:00 +0000 (00:10 +0300)]
parallels: process '/' mount point correctly for containers

Since we are going to add block devices as root disks we have
to specify root mount point for boot block devices. But we
shouldn't do this if a filesystem disk with such
target mount point already exists.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: add isCt parameter to prlsdkGetDiskInfo and prlsdkAddDisk
Maxim Nestratov [Wed, 3 Jun 2015 21:10:00 +0000 (00:10 +0300)]
parallels: add isCt parameter to prlsdkGetDiskInfo and prlsdkAddDisk

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: add block device statistics to driver
Nikolay Shirokovskiy [Tue, 9 Jun 2015 07:35:53 +0000 (10:35 +0300)]
parallels: add block device statistics to driver

Statistics provided through PCS SDK. As we have only async interface in SDK we
need to be subscribed to statistics in order to get it. Trivial solution on
every stat request to subscribe, wait event and then unsubscribe will lead to
significant delays in case of a number of successive requests, as the event
will be delivered on next PCS server notify cycle. On the other hand we don't
want to keep unnesessary subscribtion. So we take an hibrid solution to
subcsribe on first request and then keep a subscription while requests are
active. We populate cache of statistics on subscribtion events and use this
cache to serve libvirts requests.

 * Cache details.
Cache is just handle to last arrived event, we call this cache
as if this handle is valid it is used to serve synchronous
statistics requests. We use number of successive events count
to detect that user lost interest to statistics. We reset this
count to 0 on every request. If more than PARALLELS_STATISTICS_DROP_COUNT
successive events arrive we unsubscribe. Special value of -1
of this counter is used to differentiate between subscribed/unsubscribed state
to protect from delayed events.

Values of PARALLELS_STATISTICS_DROP_COUNT and PARALLELS_STATISTICS_TIMEOUT are
just drop-ins, choosen without special consideration.

 * Thread safety issues
Use parallelsDomObjFromDomainRef in parallelsDomainBlockStats as
we could wait on domain lock down on stack in prlsdkGetStatsParam
and if we won't keep reference we could get dangling pointer
on return from wait.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com>
9 years agovirsh: change-media: Fix behavior with --update without a source
Peter Krempa [Tue, 9 Jun 2015 11:27:42 +0000 (13:27 +0200)]
virsh: change-media: Fix behavior with --update without a source

Docs state that it should behave like eject. Currently the code does not
do that. This is a regression since f4b5f53027da4fed2250628e11bac4019.

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

9 years agoqemu: Capitalize "storage" in qemuDomainAttachUSBMassStorageDevice()
Andrea Bolognani [Tue, 9 Jun 2015 08:40:59 +0000 (10:40 +0200)]
qemu: Capitalize "storage" in qemuDomainAttachUSBMassStorageDevice()

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: caps: Advertise arm 32-on-64 KVM option
Cole Robinson [Thu, 21 May 2015 22:18:30 +0000 (18:18 -0400)]
qemu: caps: Advertise arm 32-on-64 KVM option

We need to use qemu-system-aarch64 to run armv7l KVM VMs on an aarch64
host.

9 years agoqemu: caps: qemu-system-aarch64 supports armv7l
Cole Robinson [Thu, 21 May 2015 22:06:09 +0000 (18:06 -0400)]
qemu: caps: qemu-system-aarch64 supports armv7l

And it always has, so advertise it similarly to i686

9 years agoqemu: command: Support arm 32-on-64 KVM with -cpu aarch64=off
Cole Robinson [Thu, 21 May 2015 22:18:20 +0000 (18:18 -0400)]
qemu: command: Support arm 32-on-64 KVM with -cpu aarch64=off

qemu 2.3.0 added the -cpu host,aarch64=off option, which allows using
qemu-system-aarch64 KVM to run armv7l VMs.

Add a capabilities check for it, wire it up in qemu_command, and test
the command line generation.

9 years agoparallels: return only success from PCS event handler
Nikolay Shirokovskiy [Fri, 5 Jun 2015 13:47:58 +0000 (16:47 +0300)]
parallels: return only success from PCS event handler

2 reasons to to this.
1. PCS SDK really don't care of handler return value.
2. It hard to imagine how notifier can handle
subscriber failures. Even if there are some situations
we probably will use some special error codes and
not just throw error codes we get from SDK itself.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com>
9 years agoparallels: simplify event types discrimination
Nikolay Shirokovskiy [Thu, 4 Jun 2015 11:45:02 +0000 (14:45 +0300)]
parallels: simplify event types discrimination

Use issuer type instead of event type to group
vm related events. This saves us from
explicit enumeration of all vm event types in
prlsdkHandleVmEvent.

9 years agoutiltest: Use int8_t instead of char.
Michal Privoznik [Mon, 8 Jun 2015 08:24:08 +0000 (10:24 +0200)]
utiltest: Use int8_t instead of char.

Not every architecture out there has 'char' signed by default.
For instance, my arm box has it unsigned by default:

  $ gcc -dM -E - < /dev/null | grep __CHAR_UNSIGNED__
  #define __CHAR_UNSIGNED__ 1

Therefore, after 65c61e50 the test if failing for me. Problem is,
we are trying to assign couple of negative values into char
assuming some will overflow and some don't. That can't be the
case if 'char' is unsigned by default. Lets use more explicit types
instead: int8_t and uint8_t where is no ambiguity.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>