]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoqemu: Simplify qemuDomainSetInterfaceParameters by using virDomainObjGetDefs
Peter Krempa [Mon, 15 Jun 2015 17:46:28 +0000 (19:46 +0200)]
qemu: Simplify qemuDomainSetInterfaceParameters by using virDomainObjGetDefs

9 years agoqemu: Simplify qemuDomainGetVcpusFlags by using virDomainObjGetOneDef
Peter Krempa [Mon, 15 Jun 2015 17:10:49 +0000 (19:10 +0200)]
qemu: Simplify qemuDomainGetVcpusFlags by using virDomainObjGetOneDef

virDomainObjGetOneDef is simpler to use than virDomainObjGetDefs

9 years agoqemu: Simplify qemuDomainGetEmulatorPinInfo by using virDomainObjGetOneDef
Peter Krempa [Mon, 15 Jun 2015 17:10:49 +0000 (19:10 +0200)]
qemu: Simplify qemuDomainGetEmulatorPinInfo by using virDomainObjGetOneDef

virDomainObjGetOneDef is simpler to use than virDomainObjGetDefs

9 years agoqemu: Simplify qemuDomainGetVcpuPinInfo by using virDomainObjGetOneDef
Peter Krempa [Mon, 15 Jun 2015 17:10:49 +0000 (19:10 +0200)]
qemu: Simplify qemuDomainGetVcpuPinInfo by using virDomainObjGetOneDef

virDomainObjGetOneDef is simpler to use than virDomainObjGetDefs

9 years agoqemu: Simplify qemuDomainGetNumaParameters by using virDomainObjGetOneDef
Peter Krempa [Mon, 15 Jun 2015 17:10:49 +0000 (19:10 +0200)]
qemu: Simplify qemuDomainGetNumaParameters by using virDomainObjGetOneDef

9 years agoqemu: Simplify qemuDomainGetInterfaceParameters by using virDomainObjGetOneDef
Peter Krempa [Mon, 15 Jun 2015 17:10:49 +0000 (19:10 +0200)]
qemu: Simplify qemuDomainGetInterfaceParameters by using virDomainObjGetOneDef

9 years agoconf: Introduce helper to help getting correct def for getter functions
Peter Krempa [Mon, 15 Jun 2015 17:04:41 +0000 (19:04 +0200)]
conf: Introduce helper to help getting correct def for getter functions

virDomainObjGetOneDef will help to retrieve the correct definition
pointer from @vm in cases where VIR_DOMAIN_AFFECT_LIVE and
VIR_DOMAIN_AFFECT_CONFIG are mutually exclusive. The function simply
returns the correct pointer. This similarly to virDomainObjGetDefs will
greatly simplify the code.

9 years agoconf: Fix virDomainObjGetDefs when getting persistent config on a live vm
Peter Krempa [Fri, 12 Jun 2015 12:37:18 +0000 (14:37 +0200)]
conf: Fix virDomainObjGetDefs when getting persistent config on a live vm

If @flags contains only VIR_DOMAIN_AFFECT_CONFIG and @vm is active, the
function would return the active config rather than the persistent one
that it should return. This happened due to the fact that
virDomainObjGetDefs was checking the updated flags which may not contain
VIR_DOMAIN_AFFECT_LIVE if it is not requested even if @vm is active.

Additionally the function would not take the flags into account when
setting the pointers which was later used to determine whether the code
needs to update the given configuration.

The mistake was caught by the virt-test suite.

9 years agoqemu: implement address for isa-serial
James Cowgill [Tue, 16 Jun 2015 13:07:59 +0000 (14:07 +0100)]
qemu: implement address for isa-serial

I needed to specify the iobase address for certain exotic mips configurations.

Signed-off-by: James Cowgill <james410@cowgill.org.uk>
9 years agoqemu: Add a check for slot and base dimm address conflicts
Luyao Huang [Mon, 15 Jun 2015 12:33:49 +0000 (20:33 +0800)]
qemu: Add a check for slot and base dimm address conflicts

When hotplugging a memory device, there wasn't a check to determine
if there is a conflict with the address space being used by the to
be added memory device and any existing device which is disallowed by qemu.

This patch adds a check to ensure the new device address doesn't
conflict with any existing device.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agodaemon: Add the admin service to the admin server only if it was allocated
Peter Krempa [Thu, 18 Jun 2015 09:40:08 +0000 (11:40 +0200)]
daemon: Add the admin service to the admin server only if it was allocated

If the admin service is disabled it would not be allocated, but the NULL
pointer still would be added to the admin server. Since
virNetServerAddService would dereference it, the daemon would crash.

Move the service registration into the block that allocates it.

9 years agorpc: Actually increase reference count on @srv in virNetDaemonAddServer
Peter Krempa [Thu, 18 Jun 2015 09:37:17 +0000 (11:37 +0200)]
rpc: Actually increase reference count on @srv in virNetDaemonAddServer

VIR_APPEND_ELEMENT would clear @srv to NULL after it successfully
inserted it thus the reference count could not be increased afterwards.

Switch to VIR_APPEND_ELEMENT_COPY. This fixes crash after terminating
the daemon.

9 years agoparallels: Fix false error messages in libvirt log
Mikhail Feoktistov [Wed, 17 Jun 2015 12:35:00 +0000 (15:35 +0300)]
parallels: Fix false error messages in libvirt log

There was many errors in libvirt.log caused by prlsdkDelNet function because
job variable was always initialized as PRL_INVALID_HANDLE
In this patch job variable gets return value of PrlSrv_DeleteVirtualNetwork function()

9 years agoparallels: Fix initialization of buflen variable in each loop iteration
Mikhail Feoktistov [Wed, 17 Jun 2015 12:35:00 +0000 (15:35 +0300)]
parallels: Fix initialization of buflen variable in each loop iteration

We need to initialize buflen every time when we get network adapter's
friendly name because we call PrlVmDev_GetFriendlyName in a loop

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>