]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
9 years agoutil: process: fix build on FreeBSD
Roman Bogorodskiy [Mon, 8 Jun 2015 07:13:41 +0000 (11:13 +0400)]
util: process: fix build on FreeBSD

Commit 825df8c3 refactored virProcess{Set,Get}Affinity routines,
however broke BSD implementation because of the incorrect variable
name. Fix build by using a proper variable name.

Pushing as trivial and build break fix.

9 years agoutil: Properly return error from virGetUserID and virGetGroupID stubs
Peter Krempa [Mon, 8 Jun 2015 07:32:24 +0000 (09:32 +0200)]
util: Properly return error from virGetUserID and virGetGroupID stubs

The stubs for the two functions that are compiled on platforms that
don't have HAVE_GETPWUID_R and friends defined do not return error but
report an error message. The calling code then assumes that the @uid or
@gid arguments were filled, which is not the case in the stubs.

9 years agoTurn qemuMonitorFindBalloonObjectPath into a void function
Ján Tomko [Thu, 4 Jun 2015 13:44:29 +0000 (15:44 +0200)]
Turn qemuMonitorFindBalloonObjectPath into a void function

We were effectively ignoring its errors anyway.

9 years agoDo not access the domain definition in qemuMonitorFindBalloonObjectPath
Ján Tomko [Wed, 3 Jun 2015 15:19:06 +0000 (17:19 +0200)]
Do not access the domain definition in qemuMonitorFindBalloonObjectPath

The monitor code does not hold the virDomainObjPtr lock and should
not access the defitinion.

9 years agoOnly call SetMemoryStatsPeriod for virtio memballoon
Ján Tomko [Wed, 3 Jun 2015 15:13:47 +0000 (17:13 +0200)]
Only call SetMemoryStatsPeriod for virtio memballoon

9 years agoCheck for balloon model in qemuDomainSetMemoryStatsPeriod
Ján Tomko [Wed, 3 Jun 2015 14:52:57 +0000 (16:52 +0200)]
Check for balloon model in qemuDomainSetMemoryStatsPeriod

There's no point in calling the monitor if there is no balloon.

9 years agoOnly call qemuMonitorGetMemoryStats for virtio memballoon
Ján Tomko [Wed, 3 Jun 2015 15:02:42 +0000 (17:02 +0200)]
Only call qemuMonitorGetMemoryStats for virtio memballoon

There is nothing to get from the monitor for model='none'.

9 years agoInvert the condition in qemuDomainMemoryStats
Ján Tomko [Wed, 3 Jun 2015 14:58:31 +0000 (16:58 +0200)]
Invert the condition in qemuDomainMemoryStats

It only makes sense if qemuMonitorGetMemoryStats is called,
but the following patch will make that call conditional.

9 years agoAdd endjob label to qemuDomainMemoryStats
Ján Tomko [Wed, 3 Jun 2015 14:55:25 +0000 (16:55 +0200)]
Add endjob label to qemuDomainMemoryStats

Reduce the indentation level.

9 years agoRemove path argument from qemuMonitorJSONFindLinkPath
Ján Tomko [Wed, 3 Jun 2015 10:58:17 +0000 (12:58 +0200)]
Remove path argument from qemuMonitorJSONFindLinkPath

All the callers use "/" anyway.

9 years agoIntroduce qemuMonitorJSONFindLinkPath
Ján Tomko [Wed, 3 Jun 2015 10:40:08 +0000 (12:40 +0200)]
Introduce qemuMonitorJSONFindLinkPath

When traversing through the QOM tree, we're looking for
a link to a device, e.g.:
link<virtio-balloon-pci>

Introduce a helper that will format the link name at the start,
instead of doing it every time while recursing through the tree.

9 years agoMove qemuMonitorFindObjectPath to qemu_monitor_json
Ján Tomko [Wed, 3 Jun 2015 10:22:53 +0000 (12:22 +0200)]
Move qemuMonitorFindObjectPath to qemu_monitor_json

This function is specific to the JSON monitor.

9 years agorpc: Fix reference counting around virNetSocketAddIOCallback
Daniel P. Berrange [Thu, 4 Jun 2015 17:18:56 +0000 (19:18 +0200)]
rpc: Fix reference counting around virNetSocketAddIOCallback

Ref service passed as a parameter to the callback.  And don't unref the
socket that is part of the service being passed at another point in code.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorpc: Don't use unrelated value as privateData of client
Daniel P. Berrange [Thu, 4 Jun 2015 17:16:32 +0000 (19:16 +0200)]
rpc: Don't use unrelated value as privateData of client

Append privateData of the client only if there are any, otherwise the
previous value (socket data) will get there again.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorpc: Make virNetServerAddClient function dynamic
Daniel P. Berrange [Thu, 4 Jun 2015 17:16:32 +0000 (19:16 +0200)]
rpc: Make virNetServerAddClient function dynamic

As opposed to 'static'; by exporting it (privately).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agomdns: Set error when failing due to missing avahi
Martin Kletzander [Thu, 4 Jun 2015 15:34:42 +0000 (17:34 +0200)]
mdns: Set error when failing due to missing avahi

When building without avahi support, we used VIR_DEBUG() to note that to
the user.  However, functions that fail because of that (return NULL/-1)
did not set the error message.  This was the only file that forgot to do
such thing.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agostorage: Add check for valid FS types in checkPool callback
John Ferlan [Tue, 2 Jun 2015 23:48:56 +0000 (19:48 -0400)]
storage: Add check for valid FS types in checkPool callback

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

The virStorageBackendFileSystemIsMounted is called from three source paths
checkPool, startPool, and stopPool. Both start and stop validate the FS
fields before calling *IsMounted; however the check path there is no call.
This could lead the code into returning a true in "isActive" if for some
reason the target path for the pool was mounted. The assumption being
that if it was mounted, then we believe we started/mounted it.

It's also of note that commit id '81165294' added an error message for
the start/mount path regarding that the target is already mounted so
fail the start. That check was adjusted by commit id '13fde7ce' to
only message if actually mounted.

At one time this led to the libvirtd restart autostart code to declare
that the pool was active even though the startPool would inhibit startup
and the stopPool would inhibit shutdown. The autostart path changed as
of commit id '2a31c5f0' as part of the keep storage pools started between
libvirtd restarts.

This patch adds the same check made prior to start/mount and stop/unmount
to ensure we have a valid configuration before attempting to see if the
target is already mounted to declare "isActive" or not. Finding an improper
configuration will now cause an error at checkPool, which should make it
so we can no longer be left in a situation where the pool was started and
we have no way to stop it.

9 years agostorage: FS backend adjust error message on error path
John Ferlan [Tue, 2 Jun 2015 20:25:58 +0000 (16:25 -0400)]
storage: FS backend adjust error message on error path

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

Currently the assumption on the error message is that there are
no source device paths defined when the number of devices check
fails, but in reality the XML could have had none or it could have
had more than the value supported. Adjust the error message accordingly
to make it clearer what the error really is.

9 years agostorage: Refactor storage pool type checks
John Ferlan [Tue, 2 Jun 2015 23:35:35 +0000 (19:35 -0400)]
storage: Refactor storage pool type checks

Refactor the code for both startPool (*Mount) and stopPool (*Unmount) code
paths by introducing virStorageBackendFileSystemIsValid.

9 years agostorage: Remove extraneous @conn from function comments
John Ferlan [Tue, 2 Jun 2015 23:58:33 +0000 (19:58 -0400)]
storage: Remove extraneous @conn from function comments

Over time the parameters changed, but the comment wasn't updated

9 years agoremote: fix odd comma operator
Eric Blake [Fri, 5 Jun 2015 03:44:48 +0000 (21:44 -0600)]
remote: fix odd comma operator

Commit 1882c0bd accidentally used ',' instead of ';'; oddly
enough, the result was still syntactically valid (yes, C is
a fun language).  But it made me do a double take; it's better
to use idiomatic syntax.

* daemon/remote.c (remoteRelayDomainEventDeviceAdded): Fix
harmless typo.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agoqemu: Update balloon info only if job is allowed
Peter Krempa [Thu, 4 Jun 2015 11:47:02 +0000 (13:47 +0200)]
qemu: Update balloon info only if job is allowed

In qemuDomainUpdateCurrentMemorySize I misplaced the actual update of
the balloon size to a place where it may not be initialized. Move it a
few lines above.

9 years agoconf: Fix mistakes in pointer usage in virDomainObjGetDefs
Peter Krempa [Thu, 4 Jun 2015 11:20:12 +0000 (13:20 +0200)]
conf: Fix mistakes in pointer usage in virDomainObjGetDefs

Coverity rightfully determined that in commit 3d021381c71221e563182f03
I made a mistake in the first check if @persDef is not NULL is
dereferencing it rather than checking.

Additionally if the vm is online the code would set @liveDef twice
rather than modifying @persDef. Fix both mistakes.

9 years agoqemu: Check for qemu capability when calling virDomainGetBlockIoTune()
Martin Kletzander [Thu, 28 May 2015 09:38:43 +0000 (11:38 +0200)]
qemu: Check for qemu capability when calling virDomainGetBlockIoTune()

When getting block device I/O tuning data there is no check for whether
QEMU supports such options and the call fails on
qemuMonitorGetBlockIoThrottle() when getting the particular throttle
data.  So try reporting a better error when blkdeviotune is not
supported.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Refactor qemuDomainSetVcpusFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:29:06 +0000 (14:29 +0200)]
qemu: Refactor qemuDomainSetVcpusFlags by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetEmulatorPinInfo by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:29:06 +0000 (14:29 +0200)]
qemu: Refactor qemuDomainGetEmulatorPinInfo by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainPinEmulator by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:29:06 +0000 (14:29 +0200)]
qemu: Refactor qemuDomainPinEmulator by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainPinVcpuFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:17:35 +0000 (14:17 +0200)]
qemu: Refactor qemuDomainPinVcpuFlags by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainSetBlkioParameters by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainSetBlkioParameters by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainChgIOThread by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainChgIOThread by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainPinIOThread by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainPinIOThread by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetIOThreadInfo by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainGetIOThreadInfo by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetVcpusFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainGetVcpusFlags by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainSetMemoryStatsPeriod by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainSetMemoryStatsPeriod by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainSetMemoryFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainSetMemoryFlags by reusing virDomainObjGetDefs