]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agovirsh: don't override connection URI from argv
Roman Bogorodskiy [Thu, 21 Apr 2016 06:32:00 +0000 (09:32 +0300)]
virsh: don't override connection URI from argv

Currently, if a connection URI was specified on the command line by the
'-c' switch, virsh connects to it, but after connecting overrides its
value with the one it tries to obtain from the VIRSH_DEFAULT_CONNECT_URI
environment variable.

This makes virsh connecting to the wrong URI if it disconnects from the
hypervisor and then tries to reconnect, and also leaks the original connname.

Fix by calling virGetEnvBlockSUID() before virshParseArgv().

9 years agodocs: domain: Document network <filterref>
Cole Robinson [Fri, 15 Apr 2016 21:58:00 +0000 (17:58 -0400)]
docs: domain: Document network <filterref>

The proper nwfilter docs go into full detail, but we should still
have a brief bit about domain XML in the domain documentation

9 years agodocs: Don't leave any documentation behind
Michal Privoznik [Tue, 19 Apr 2016 11:22:27 +0000 (13:22 +0200)]
docs: Don't leave any documentation behind

Our uninstall script is not exact counterpart of install one.
Therefore we are leaving couple of files behind. This should not
happen.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodocs: Uninstall libvirt logo too
Michal Privoznik [Tue, 19 Apr 2016 09:20:10 +0000 (11:20 +0200)]
docs: Uninstall libvirt logo too

While we could leave it behind as an indelible sign that libvirt
has been running on host, other users might not be that fond of
it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoexamples: Try harder to uninstall nwfilter
Michal Privoznik [Tue, 19 Apr 2016 09:13:00 +0000 (11:13 +0200)]
examples: Try harder to uninstall nwfilter

We have this code in our Makefile that tries to remove
/etc/libvirt/nwfilter if directory is left empty after all our
example nwfilters were uninstalled. However, the check for that
is missing quotation marks thus rendering the test useless:

test -z allow-arp.xml allow-dhcp-server.xml .. qemu-announce-self.xml || \
  rmdir "/some/path/libvirt.git/_install/etc/libvirt/nwfilter"
/bin/sh: line 0: test: too many arguments

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonss: Try harder to uninstall
Michal Privoznik [Tue, 19 Apr 2016 09:08:48 +0000 (11:08 +0200)]
nss: Try harder to uninstall

On BSD we are creating this symlink to libnss_libvirt.so called
nss_libvirt.so. That's just the way it is on BSD. However, when
uninstalling, we try to remove libnss_libvirt.so instead of the
symlink. Moreover, if file we are trying to remove does not exist
we error out instead of ignoring the error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovz: fix config input device check
Nikolay Shirokovskiy [Wed, 20 Apr 2016 08:58:21 +0000 (11:58 +0300)]
vz: fix config input device check

We don't have input devices in SDK thus for define/dumpxml
operations to be consistent we need to:

1. on dumpxml: infer input devices from other parts of config.
It is already done in prlsdkLoadDomain.

2. on define: check that input devices are the same that
will be infer back on dumpxml operation.

The second part should be fixed.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovz: add default input devices on post parse
Nikolay Shirokovskiy [Wed, 20 Apr 2016 08:58:20 +0000 (11:58 +0300)]
vz: add default input devices on post parse

It is on par with prlsdkLoadDomain actions.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovirt-aa-helper: disallow VNC socket read permissions
Simon Arlott [Fri, 8 Apr 2016 13:01:33 +0000 (09:01 -0400)]
virt-aa-helper: disallow VNC socket read permissions

The VM does not need read permission for its own VNC socket to create(),
bind(), accept() connections or to receive(), send(), etc. on connections.

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

9 years agostorage: drop the plumbing needed for kvm-img/qcow-create
Cole Robinson [Fri, 15 Apr 2016 21:07:02 +0000 (17:07 -0400)]
storage: drop the plumbing needed for kvm-img/qcow-create

Remove all the plumbing needed for the different qcow-create/kvm-img
non-raw file creation.

We can drop the error messages because CreateQemuImg will thrown an
error for us but with slightly less fidelity (unable to find qemu-img),
which I think is acceptable given the unlikeliness of that error in
practice.

9 years agostorage: remove support for /usr/bin/kvm-img
Cole Robinson [Fri, 15 Apr 2016 21:00:40 +0000 (17:00 -0400)]
storage: remove support for /usr/bin/kvm-img

This an ubuntu/debian packaging convention. At one point it may have
been an actually different binary, but at least as of ubuntu precise
(the oldest supported ubuntu distro, released april 2012) kvm-img is
just a symlink to qemu-img for back compat.

I think it's safe to drop support for it

9 years agostorage: remove support for /usr/bin/qcow-create
Cole Robinson [Fri, 15 Apr 2016 20:48:59 +0000 (16:48 -0400)]
storage: remove support for /usr/bin/qcow-create

qcow-create was a crippled qemu-img impl that shipped with xen. I
think supporting this was only relevant for really old distros
that didn't have a proper qemu package, like early RHEL5. I think
it's fair to drop support

9 years agoman: Clarify virsh vol-clone works within a single pool
Cole Robinson [Tue, 19 Apr 2016 21:34:57 +0000 (17:34 -0400)]
man: Clarify virsh vol-clone works within a single pool

virsh vol-clone is expected to clone a volume within a single
pool; it doesn't work for cloning across pools. Clarify the docs

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

9 years agonetwork: Don't use ERR_NO_SUPPORT for invalid net-update requests
Cole Robinson [Tue, 19 Apr 2016 18:48:30 +0000 (14:48 -0400)]
network: Don't use ERR_NO_SUPPORT for invalid net-update requests

VIR_ERR_NO_SUPPORT maps to the error string

    this function is not supported by the connection driver

and is largely only used for when a driver doesn't have any
implementation for a public API. So its usage with invalid
net-update requests is a bit out of place. Instead use
VIR_ERR_OPERATION_UNSUPPORTED which maps to:

    Operation not supported

And is what qemu's hotplug routines use in similar scenarios

9 years agolibvirt: Use conventional function names
Cole Robinson [Tue, 19 Apr 2016 16:18:40 +0000 (12:18 -0400)]
libvirt: Use conventional function names

do_open and winsock_init don't follow the naming pattern of other
functions in this file. Rename them to match

9 years agoRevert "daemon: use socket activation with systemd"
Cole Robinson [Mon, 11 Apr 2016 22:36:20 +0000 (18:36 -0400)]
Revert "daemon: use socket activation with systemd"

This reverts commit 1e9808d3a1e00a7121bae8b163d9c42d441d2ca8.

We shouldn't advertise libvirtd.socket activation, since currently
it means VM/network/... autostart won't work as expected.

We tried to find a middle ground by installing the config file without
an [Install] section, since systemd won't allow .socket to be enabled
without one... or at least it did do that; presently on f24 it allows
activating the socket quite happily. This also caused user confusion[1]

Just remove the socket file. I've filed a new RFE to track coming up
with a solution to the autostart problem[2], we can point users at that
if there's more confusion:

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1279348
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=1326136

9 years agotests: Fix enumeration value
Andrea Bolognani [Wed, 20 Apr 2016 12:36:37 +0000 (14:36 +0200)]
tests: Fix enumeration value

Commit 3a773c43c801 introduced the testCompareNetXML2XMLResult
enumeration; however, in one instance the result variable was
assigned a value from the very similar testCompareDocXML2XMLResult
enumeration, leading to a build error.

  networkxml2xmltest.c:33:42: error:
    implicit conversion from enumeration type 'testCompareDomXML2XMLResult'
    to different enumeration type 'testCompareNetXML2XMLResult'
    [-Werror,-Wenum-conversion]

  testCompareNetXML2XMLResult result = TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS;
                              ~~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use the proper value (TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS) instead.

9 years agodocs: Document the new XML elements
Andrea Bolognani [Mon, 18 Apr 2016 17:20:07 +0000 (19:20 +0200)]
docs: Document the new XML elements

9 years agoqemu: Cache GIC capabilities
Andrea Bolognani [Thu, 10 Mar 2016 16:59:51 +0000 (17:59 +0100)]
qemu: Cache GIC capabilities

Implement support for saving GIC capabilities in the cache and
read them back.

9 years agoqemu: Fill in GIC capabilities
Andrea Bolognani [Wed, 9 Mar 2016 18:18:24 +0000 (19:18 +0100)]
qemu: Fill in GIC capabilities

Take the GIC capabilities stored in a virQEMUCaps instance and
update a virDomainCaps instance appropriately.

9 years agoconf: Expose GIC capabilities
Andrea Bolognani [Wed, 9 Mar 2016 17:28:59 +0000 (18:28 +0100)]
conf: Expose GIC capabilities

Add information about GIC capabilities to virDomainCaps and update
the formatter to include them in the XML output.

9 years agoschema: Validate GIC capabilities
Andrea Bolognani [Wed, 9 Mar 2016 17:42:14 +0000 (18:42 +0100)]
schema: Validate GIC capabilities

We need to expose GIC capabilities in the domain capabilities
XML: update the schema to validate documents that contain the
new information.

9 years agoqemu: Probe GIC capabilities
Andrea Bolognani [Tue, 8 Mar 2016 17:24:18 +0000 (18:24 +0100)]
qemu: Probe GIC capabilities

QEMU introduced the query-gic-capabilities QMP command
with commit 4468d4e0f383: use the command, if available,
to probe available GIC capabilities.

The information obtained is stored in a virQEMUCaps
instance, and will be later used to fill in a
virDomainCaps instance.

9 years agoconf: Get rid of virDomainCapsDevice
Andrea Bolognani [Thu, 10 Mar 2016 18:52:52 +0000 (19:52 +0100)]
conf: Get rid of virDomainCapsDevice

The struct contains a single boolean field, 'supported':
the meaning of this field is too generic to be limited to
devices only, and in fact it's already being used for
other things like loaders and OSs.

Instead of trying to come up with a more generic name just
get rid of the struct altogether.

9 years agoExplicitly error on uri=qemu://system
Cole Robinson [Sat, 16 Apr 2016 12:59:08 +0000 (08:59 -0400)]
Explicitly error on uri=qemu://system

It's a fairly common error that a user tries to connect to a URI
like qemu://system or qemu://session (missing a slash). This errors
like:

$ virsh --connect qemu://session
error: failed to connect to the hypervisor
error: Unable to resolve address 'session' service '16514': No address associated with hostname

If you already know that the standard qemu URI has 3 slashes, that
error will make it obvious enough. But new user's may not get it.
There's even a RHEL support page explicitly mentioning it!:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Troubleshooting-Common_libvirt_errors_and_troubleshooting.html

Catch this error early in libvirt.c virConnectOpen for qemu (and vbox
which has similar rules

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

9 years agovz: handle sourceless cdroms
Mikhail Feoktistov [Thu, 14 Apr 2016 15:00:09 +0000 (18:00 +0300)]
vz: handle sourceless cdroms

libvirt handles empty source as NULL, while vz sdk as
"" thus we need a bit of conversion.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovz: cleanup: remove trivial function
Nikolay Shirokovskiy [Thu, 14 Apr 2016 10:45:06 +0000 (13:45 +0300)]
vz: cleanup: remove trivial function

9 years agovz: fix boot check to use new disk id
Nikolay Shirokovskiy [Thu, 14 Apr 2016 10:45:05 +0000 (13:45 +0300)]
vz: fix boot check to use new disk id

Current implementation does not detect all incompatible configurations.
For example if we have in vzsdk bootorder "cdrom1, cdrom0" (that is
"hdb, hda" in case of ide cdroms) and cdroms do not have disk
images inserted. In this case boot order check code fails to
distiguish them at all as for both PrlVmDev_GetFriendlyName gives "".
Well the consequences are only missing warnings but as
we just have introduced all the necessary tools to face the problem -
let's fix it.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovz: fix detach disk to use new disk id
Nikolay Shirokovskiy [Thu, 14 Apr 2016 10:45:04 +0000 (13:45 +0300)]
vz: fix detach disk to use new disk id

Actually using disk PrlVmDev_GetFriendlyName as id on
detaching volumes is not a problem. We can only detach
hard disks and these can not have empty friendly names.
But upcoming update device functionality for cdroms
can not use disk source as id at all as update operation
typically change this same source value. Thus we will need
to use cdrom bus and cdrom target name as cdrom id. So in attempt
to use same id scheme for all purpuses lets fix hard disk
detach function to use new id.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovz: introduce vzsdk disk id function
Nikolay Shirokovskiy [Thu, 14 Apr 2016 10:45:03 +0000 (13:45 +0300)]
vz: introduce vzsdk disk id function

Our intention is to use disk bus and disk target name pair
as disk id instead of name returned by PrlVmDev_GetFriendlyName.
We already have the code that extracts this pair from vzsdk
data. Let's factor it out into a function.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agonetwork: prevent duplicate entries in network device pools
Laine Stump [Mon, 18 Apr 2016 19:07:26 +0000 (15:07 -0400)]
network: prevent duplicate entries in network device pools

Prior to this patch we didn't make any attempt to prevent two entries
in the array of interfaces/PCI devices from pointing to the same
device.

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

9 years agotest: enable testing for expected parse errors in network XML
Laine Stump [Mon, 18 Apr 2016 18:18:37 +0000 (14:18 -0400)]
test: enable testing for expected parse errors in network XML

This is patterned after similar functionality for domain XML tests,
but tries harder to avoid reading non-existent networkxml2xmlout data
file when parse fails.

9 years agoqemu: command: drop redundant min_guarantee check
Cole Robinson [Mon, 18 Apr 2016 23:06:12 +0000 (19:06 -0400)]
qemu: command: drop redundant min_guarantee check

We already reject a VM with min_guarantee early in the VM startup
in qemuProcessStartValidate

9 years agoqemu: Remove redundant DomainObjIsActive calls
Cole Robinson [Fri, 15 Apr 2016 13:37:19 +0000 (09:37 -0400)]
qemu: Remove redundant DomainObjIsActive calls

The common idiom in the driver API implementations is roughly:

- ACL check
- BeginJob (if needed)
- AgentAvailable (if needed)
- !IsActive

A few calls had an extra !IsActive before BeginJob, which doesn't
seem to serve much use. Drop them

9 years agolxc: explicitly error on interface type=ethernet
Cole Robinson [Mon, 11 Apr 2016 14:48:20 +0000 (10:48 -0400)]
lxc: explicitly error on interface type=ethernet

It isn't implemented and does not work:

error: internal error: guest failed to start: /usr/lib/libvirt/libvirt_lxc: option '--veth' requires an argument
syntax: /usr/lib/libvirt/libvirt_lxc [OPTIONS] ...

We previously threw an explicit error, but this changed in
22cff52a2b8e06c913b1f97767e5d390fb17fc3b , which I suspect was
untested for LXC

9 years agoInclude sysmacros.h where needed
Martin Kletzander [Thu, 14 Apr 2016 13:11:45 +0000 (15:11 +0200)]
Include sysmacros.h where needed

So in glibc-2.23 sys/sysmacros.h is no longer included from sys/types.h
and we don't build because of the usage of major/minor/makedev macros.
Autoconf already has AC_HEADER_MAJOR macro that check where exactly
these functions/macros are defined, so let's use that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agosecurity: Rename DomainSetDirLabel to DomainSetPathLabel
Martin Kletzander [Thu, 14 Apr 2016 07:20:55 +0000 (09:20 +0200)]
security: Rename DomainSetDirLabel to DomainSetPathLabel

It already labels abritrary paths, so it's just the naming that was
wrong.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: Fix syntax in iSCSI auth/secret tests
John Ferlan [Sat, 16 Apr 2016 12:11:00 +0000 (08:11 -0400)]
tests: Fix syntax in iSCSI auth/secret tests

While working on the tests for the secret initialization vector, I found
that the existing iSCSI tests were lacking in how they defined the IQN.
Many had IQN's of just 'iqn.1992-01.com.example' for one disk while using
'iqn.1992-01.com.example/1' for the second disk (same for hostdevs - guess
how they were copied/generated).

Typically (and documented this way), IQN's would include be of the form
'iqn.1992-01.com.example:storage/1' indicating an IQN using "storage" for
naming authority specific string and "/1" for the iSCSI LUN.

So modify the input XML's to use the more proper format - this of course
has a ripple effect on the output XML and the args.

Also note that the "%3A" is generated by the virURIFormat/xmlSaveUri
to represent the colon.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirDomain{Get,Set}PerfEvents: Tweak documentation
Michal Privoznik [Thu, 31 Mar 2016 09:09:56 +0000 (11:09 +0200)]
virDomain{Get,Set}PerfEvents: Tweak documentation

These API already support VIR_DOMAIN_AFFECT_* flags. But the
documentation does not mention it. Eww.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirt-admin: Introduce srv-threadpool-info and srv-threadpool-set commands
Erik Skultety [Wed, 17 Feb 2016 08:55:19 +0000 (09:55 +0100)]
virt-admin: Introduce srv-threadpool-info and srv-threadpool-set commands

Wire up the server threadpool tunable APIs to virt-admin client. Also, provide
a man page for both commands.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoadmin: Introduce virAdmServerSetThreadPoolParameters
Erik Skultety [Mon, 22 Feb 2016 13:24:04 +0000 (14:24 +0100)]
admin: Introduce virAdmServerSetThreadPoolParameters

Since threadpool increments the current number of threads according to current
load, i.e. how many jobs are waiting in the queue. The count however, is
constrained by max and min limits of workers. The logic of this new API works
like this:
    1) setting the minimum
        a) When the limit is increased, depending on the current number of
           threads, new threads are possibly spawned if the current number of
           threads is less than the new minimum limit
        b) Decreasing the minimum limit has no possible effect on the current
           number of threads
    2) setting the maximum
        a) Icreasing the maximum limit has no immediate effect on the current
           number of threads, it only allows the threadpool to spawn more
           threads when new jobs, that would otherwise end up queued, arrive.
        b) Decreasing the maximum limit may affect the current number of
           threads, if the current number of threads is less than the new
           maximum limit. Since there may be some ongoing time-consuming jobs
           that would effectively block this API from killing any threads.
           Therefore, this API is asynchronous with best-effort execution,
           i.e. the necessary number of workers will be terminated once they
           finish their previous job, unless other workers had already
           terminated, decreasing the limit to the requested value.
    3) setting priority workers
        - both increase and decrease in count of these workers have an
          immediate impact on the current number of workers, new ones will be
          spawned or some of them get terminated respectively.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoadmin: Introduce virAdmServerGethreadPoolParameters
Erik Skultety [Mon, 23 Nov 2015 11:41:32 +0000 (12:41 +0100)]
admin: Introduce virAdmServerGethreadPoolParameters

New API to retrieve current server workerpool specs. Since it uses typed
parameters, more specs to retrieve can be further included in the pool of
supported ones.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoadmin: Prepare admin protocol for future worker related procedures
Erik Skultety [Tue, 9 Feb 2016 14:09:49 +0000 (15:09 +0100)]
admin: Prepare admin protocol for future worker related procedures

Before any getter or setter methods can be introduced, first specify a set of
public attributes/flags that these methods will be compatible with.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoutil: Add more getters to threadpool parameters
Erik Skultety [Thu, 25 Feb 2016 12:14:36 +0000 (13:14 +0100)]
util: Add more getters to threadpool parameters

In order for the client to see all thread counts and limits, current total
and free worker count getters need to be introduced. Client might also be
interested in the job queue length, so provide a getter for that too. As with
the other getters, preparing for the admin interface, mutual exclusion is used
within all getters.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoutil: Use a mutex when retrieving threadpool data
Erik Skultety [Mon, 4 Apr 2016 20:32:16 +0000 (22:32 +0200)]
util: Use a mutex when retrieving threadpool data

So far, the values the affected getters retrieve are static, i.e. there's no
way of changing them during runtime. But admin interface will later enable
not only getting but changing them as well. So to prevent phenomenons like
torn reads or concurrent reads and writes of unaligned values, use mutual
exclusion when getting these values (writes do, understandably, use them
already).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoutil: Report system error when virThreadCreateFull fails
Erik Skultety [Fri, 26 Feb 2016 16:48:03 +0000 (17:48 +0100)]
util: Report system error when virThreadCreateFull fails

Otherwise 'Unknown' error will be returned to client.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoutil: Refactor thread creation by introducing virThreadPoolExpand
Erik Skultety [Thu, 25 Feb 2016 11:45:32 +0000 (12:45 +0100)]
util: Refactor thread creation by introducing virThreadPoolExpand

When either creating a threadpool, or creating a new thread to accomplish a job
that had been placed into the jobqueue, every time thread-specific data need to
be allocated, threadpool needs to be (re)-allocated and thread count indicators
updated. Make the code clearer to read by compressing these operations into a
more complex one.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoadmin: Enable usage of typed parameters
Erik Skultety [Mon, 25 Jan 2016 15:30:27 +0000 (16:30 +0100)]
admin: Enable usage of typed parameters

Make all relevant changes to admin protocol, in order to achieve $(subj)

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agolibvirt-host: Move virTypedParam* to libvirt-common
Erik Skultety [Thu, 4 Feb 2016 14:23:00 +0000 (15:23 +0100)]
libvirt-host: Move virTypedParam* to libvirt-common

Commits 0472cef69afc115f8cd1d546 exported typed params handlers internally,
but a commit which would move the public definition from libvirt-host to
libvirt-common was missing.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoevent-test: Enforce domain event sync
Peter Krempa [Thu, 14 Apr 2016 15:41:19 +0000 (17:41 +0200)]
event-test: Enforce domain event sync

Use verify to force adding new events by means of static assertions.

9 years agoevent-test: Add VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
Peter Krempa [Thu, 14 Apr 2016 15:48:13 +0000 (17:48 +0200)]
event-test: Add VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON

When adding the static check I've noticed that one other event is
missing.

9 years agoevent-test: Add VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED
Peter Krempa [Thu, 14 Apr 2016 15:34:50 +0000 (17:34 +0200)]
event-test: Add VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED

9 years agoevent-test: Add VIR_DOMAIN_EVENT_ID_JOB_COMPLETED
Peter Krempa [Thu, 14 Apr 2016 15:31:52 +0000 (17:31 +0200)]
event-test: Add VIR_DOMAIN_EVENT_ID_JOB_COMPLETED

9 years agoevent-test: Add VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION callback
Peter Krempa [Thu, 14 Apr 2016 15:26:53 +0000 (17:26 +0200)]
event-test: Add VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION callback

9 years agoevent-test: Add VIR_DOMAIN_EVENT_ID_BLOCK_JOB and VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2
Peter Krempa [Thu, 14 Apr 2016 15:16:35 +0000 (17:16 +0200)]
event-test: Add VIR_DOMAIN_EVENT_ID_BLOCK_JOB and VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2

9 years agoevent-test: make domain event registration declarative
Peter Krempa [Thu, 14 Apr 2016 14:57:02 +0000 (16:57 +0200)]
event-test: make domain event registration declarative

Rather than copying loads of ugly code, let's help out by a few C
tricks.

9 years agoevent-test: warn on unhandled enum values
Peter Krempa [Thu, 14 Apr 2016 13:11:49 +0000 (15:11 +0200)]
event-test: warn on unhandled enum values

Avoid forgetting to add the correct fields to the switches in
event-test.

9 years agoevent-test: make few switch statements future proof
Peter Krempa [Thu, 14 Apr 2016 12:51:40 +0000 (14:51 +0200)]
event-test: make few switch statements future proof

Make them return "uknown" for invalid values without breaking compiler
checks to add new values.

9 years agoevent-test: Use switch instead of if/else if chains for lifecycle event translation
Peter Krempa [Thu, 14 Apr 2016 12:44:07 +0000 (14:44 +0200)]
event-test: Use switch instead of if/else if chains for lifecycle event translation

9 years agoevent-test: Use typecasted enum to convert graphics event phase
Peter Krempa [Thu, 14 Apr 2016 08:49:59 +0000 (10:49 +0200)]
event-test: Use typecasted enum to convert graphics event phase

9 years agoevent-test: Force compiler check in switch for connectClose callback
Peter Krempa [Thu, 14 Apr 2016 07:04:52 +0000 (09:04 +0200)]
event-test: Force compiler check in switch for connectClose callback

9 years agolib: document fields virConnectDomainEventDiskChangeReason
Peter Krempa [Thu, 14 Apr 2016 09:17:56 +0000 (11:17 +0200)]
lib: document fields virConnectDomainEventDiskChangeReason

9 years agoevent-test: Use functions with typecasted switch to convert enums
Peter Krempa [Wed, 13 Apr 2016 15:38:16 +0000 (17:38 +0200)]
event-test: Use functions with typecasted switch to convert enums

Arrays would induce crash if a new value was introduced without adding
it here. This could happen for
VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START

9 years agoevent-test: touch up coding style
Peter Krempa [Wed, 13 Apr 2016 13:45:52 +0000 (15:45 +0200)]
event-test: touch up coding style

Break long lines and format headers correctly.

9 years agoevent-test: Remove unnecessary 'usage' function
Peter Krempa [Wed, 13 Apr 2016 13:21:17 +0000 (15:21 +0200)]
event-test: Remove unnecessary 'usage' function

9 years agoevent-test: Get rid of useless and ambiguous VIR_DEBUG macro
Peter Krempa [Wed, 13 Apr 2016 11:55:12 +0000 (13:55 +0200)]
event-test: Get rid of useless and ambiguous VIR_DEBUG macro

The event test does not try to include libvirt internals. Using a macro
named VIR_DEBUG might hint to such usage. Additionally it's useless
since it's used only in the main() function.

Modernize the message strings while touching them.

9 years agoevent-test: Remove forward declarations
Peter Krempa [Wed, 13 Apr 2016 11:47:22 +0000 (13:47 +0200)]
event-test: Remove forward declarations

Most of the functions are no longer in this file. 'usage' does not need
a declaration.

9 years agoLibvirt: virTypedParamsValidate: Fix detection of multiple parameters
Jason J. Herne [Tue, 12 Apr 2016 14:13:27 +0000 (10:13 -0400)]
Libvirt: virTypedParamsValidate: Fix detection of multiple parameters

virTypedParamsValidate currently uses an index based check to find
duplicate parameters. This check does not work. Consider the following
simple example:

We have only 2 keys
A  (multiples allowed)
B  (multiples NOT allowed)

We are given the following list of parameters to check:
A
A
B

If you work through the validation loop you will see that our last iteration
through the loop has i=2 and j=1. In this case, i > j and keys[j].value.i will
indicate that multiples are not allowed. Both conditionals are satisfied so
an incorrect error will be given: "parameter '%s' occurs multiple times"

This patch replaces the index based check with code that remembers
the name of the last parameter seen and only triggers the error case if
the current parameter name equals the last one. This works because the
list is sorted and duplicate parameters will be grouped together.

In reality, we hit this bug while using selective block migration to migrate
a guest with 5 disks. 5 was apparently just the right number to push i > j
and hit this bug.

virsh migrate --live guestname --copy-storage-all
              --migrate-disks vdb,vdc,vdd,vde,vdf
              qemu+ssh://dsthost/system

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
9 years agoqemu: migration: new migration param for persistent destination XML
Dmitry Andreev [Thu, 17 Mar 2016 16:31:45 +0000 (19:31 +0300)]
qemu: migration: new migration param for persistent destination XML

Migration API allows to specify a destination domain configuration.
Offline domain has only inactive XML and it is replaced by configuration
specified using VIR_MIGRATE_PARAM_DEST_XML param. In case of live
migration VIR_MIGRATE_PARAM_DEST_XML param is applied for active XML.

This commit introduces the new VIR_MIGRATE_PARAM_PERSIST_XML param
that can be used within live migration to replace persistent/inactive
configuration.

Required for: https://bugzilla.redhat.com/show_bug.cgi?id=835300

9 years agoqemuMigrationCookieAddPersistent: move it out and change argument type
Dmitry Andreev [Thu, 17 Mar 2016 16:31:44 +0000 (19:31 +0300)]
qemuMigrationCookieAddPersistent: move it out and change argument type

This changes allow to use qemuMigrationCookieAddPersistent with
an XML definition that isn't assigned to any domain.

9 years agoZFS: Support sparse volumes
Richard Laager [Thu, 24 Mar 2016 05:11:11 +0000 (00:11 -0500)]
ZFS: Support sparse volumes

By default, `zfs create -V ...` reserves space for the entire volsize,
plus some extra (which attempts to account for overhead).

If `zfs create -s -V ...` is used instead, zvols are (fully) sparse.

A middle ground (partial allocation) can be achieved with
`zfs create -s -o refreservation=... -V ...`.  Both libvirt and ZFS
support this approach, so the ZFS storage backend should support it.

Signed-off-by: Richard Laager <rlaager@wiktel.com>
9 years agoResolve a couple of memory leaks
John Ferlan [Thu, 14 Apr 2016 14:21:27 +0000 (10:21 -0400)]
Resolve a couple of memory leaks

Commit id '4b75237f' seems to have triggered Coverity into finding
at least one memory leak in xen_xl.c for error path for cleanup where
the listenAddr would be leaked. Reviewing other callers, it seems that
qemu_parse_command.c would have the same issue, so just it too.

9 years agotools: Fix memory leak
John Ferlan [Thu, 14 Apr 2016 13:55:21 +0000 (09:55 -0400)]
tools: Fix memory leak

Coverity found that commit id 'c661b675f' needed to create a cleanup
path to handle the closing of 'fp' if the virBitmapNewQuiet failed.

9 years agoqemu: Fix qemuBuildCommandLine prototype
John Ferlan [Thu, 14 Apr 2016 13:51:38 +0000 (09:51 -0400)]
qemu: Fix qemuBuildCommandLine prototype

Commit id '0da965c5e' removed the 11th parameter, but neglected to
remove the ATTRIBUTE_NONNULL for it and adjust the 17th and 18th.

9 years agolibxl: use LIBXL_API_VERSION 0x040200
Jim Fehlig [Thu, 14 Apr 2016 22:10:32 +0000 (16:10 -0600)]
libxl: use LIBXL_API_VERSION 0x040200

To ensure the libvirt libxl driver will build with future versions
of Xen where the libxl API may change in incompatible ways,
explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
does use new libxl APIs that have been added since Xen 4.2, but
currently it does not make use of any changes made to existing
APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
The version can be bumped if/when the libxl driver consumes the
changed APIs.

Further details can be found in the following discussion thread

https://www.redhat.com/archives/libvir-list/2016-April/msg00178.html
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoqemu: Label master key file
Martin Kletzander [Wed, 13 Apr 2016 15:17:35 +0000 (17:17 +0200)]
qemu: Label master key file

When creating the master key, we used mode 0600 (which we should) but
because we were creating it as root, the file is not readable by any
qemu running as non-root.  Fortunately, it's just a matter of labelling
the file.  We are generating the file path few times already, so let's
label it in the same function that has access to the path already.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoploop: Fix build with gluster
Jiri Denemark [Fri, 15 Apr 2016 16:05:37 +0000 (18:05 +0200)]
ploop: Fix build with gluster

Recent patches addiing support for ploop volumes did not properly update
gluster backend.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoAdd functions for handling exponential backoff loops.
Richard W.M. Jones [Fri, 8 Apr 2016 11:11:10 +0000 (12:11 +0100)]
Add functions for handling exponential backoff loops.

In a few places in libvirt we busy-wait for events, for example qemu
creating a monitor socket.  This is problematic because:

 - We need to choose a sufficiently small polling period so that
   libvirt doesn't add unnecessary delays.

 - We need to choose a sufficiently large polling period so that
   the effect of busy-waiting doesn't affect the system.

The solution to this conflict is to use an exponential backoff.

This patch adds two functions to hide the details, and modifies a few
places where we currently busy-wait.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
9 years agostorage: dir: adapt .uploadVol .dowloadVol for ploop volume
Olga Krishtal [Mon, 11 Apr 2016 16:16:25 +0000 (19:16 +0300)]
storage: dir: adapt .uploadVol .dowloadVol for ploop volume

In case of ploop volume, target path of the volume is the path to the
directory that contains image file named root.hds and DiskDescriptor.xml.
While using uploadVol and downloadVol callbacks we need to open root.hds
itself.
Upload or download operations with ploop volume are only allowed when
images do not have snapshots. Otherwise operation fails.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agostorage: dir: adapt .refreshVol and .refreshPool for ploop volumes
Olga Krishtal [Mon, 11 Apr 2016 16:16:24 +0000 (19:16 +0300)]
storage: dir: adapt .refreshVol and .refreshPool for ploop volumes

Refreshes meta-information such as allocation, capacity, format, etc.
Ploop volumes differ from other volume types. Path to volume is the path
to directory with image file root.hds and DiskDescriptor.xml.
https://openvz.org/Ploop/format
Due to this fact, operations of opening the volume have to be done once
again. get the information.

To decide whether the given volume is ploops one, it is necessary to check
the presence of root.hds and DiskDescriptor.xml files in volumes' directory.
Only in this case the volume can be manipulated as the ploops one.
Such strategy helps us to resolve problems that might occure, when we
upload some other volume type from ploop source.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agostorage: dir: .wipeVol is left unsupported for ploop volume
Olga Krishtal [Mon, 11 Apr 2016 16:16:23 +0000 (19:16 +0300)]
storage: dir: .wipeVol is left unsupported for ploop volume

Returns error in case of vol-wipe cmd for a ploop volume

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
9 years agostorage: dir: .resizeVol callback for ploop volume
Olga Krishtal [Mon, 11 Apr 2016 16:16:22 +0000 (19:16 +0300)]
storage: dir: .resizeVol callback for ploop volume

Changes the size of given ploop volume via ploop resize tool.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
9 years agostorage: dir: .deleteVol callback for ploop volume
Olga Krishtal [Mon, 11 Apr 2016 16:16:21 +0000 (19:16 +0300)]
storage: dir: .deleteVol callback for ploop volume

Recursively deletes whole directory of a ploop volume.
To delete ploop image it has to be unmounted.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
9 years agostorage: dir: .buildVol and .buildVolFrom callbacks for ploop
Olga Krishtal [Mon, 11 Apr 2016 16:16:20 +0000 (19:16 +0300)]
storage: dir: .buildVol and .buildVolFrom callbacks for ploop

These callbacks let us to create ploop volumes in dir, fs and etc. pools.
If a ploop volume was created via buildVol callback, then this volume
is an empty ploop device with DiskDescriptor.xml.
If the volume was created via .buildFrom - then its content is similar to
input volume content.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agostorage: add ploop volume type
Olga Krishtal [Mon, 11 Apr 2016 16:16:19 +0000 (19:16 +0300)]
storage: add ploop volume type

Ploop image consists of directory with two files: ploop image itself,
called root.hds and DiskDescriptor.xml that contains information about
ploop device: https://openvz.org/Ploop/format.
Such volume are difficult to manipulate in terms of existing volume types
because they are neither a single files nor a directory.
This patch introduces new volume type - ploop. This volume type is used
by ploop volume's exclusively.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agocfg.mk: Get rid of quotation tricks
Andrea Bolognani [Mon, 11 Apr 2016 15:00:26 +0000 (17:00 +0200)]
cfg.mk: Get rid of quotation tricks

To prevent the error messages in cfg.mk from triggering the very
same rules they're supposed to explain, we split the message in
the middle of a symbol name, ending up with stuff like

  'I am a me'ssage

Instead of relying on these quotation tricks, simply exclude
cfg.mk from the relevant checks.

9 years agoReturn error when --start <number> in cpu-stats is invalid.
Nitesh Konkar [Fri, 15 Apr 2016 07:28:53 +0000 (03:28 -0400)]
Return error when --start <number> in cpu-stats is invalid.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
9 years agoqemu: hotplug: Properly recalculate/reload balloon size after hot(un)plug
Peter Krempa [Wed, 6 Apr 2016 13:57:57 +0000 (15:57 +0200)]
qemu: hotplug: Properly recalculate/reload balloon size after hot(un)plug

Rather than trying some magic calculations on our side query the monitor
for the current size of the memory balloon both on hotplug and
hotunplug.

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

9 years agoqemu: process: Simplify condition in qemuProcessRefreshBalloonState
Peter Krempa [Wed, 6 Apr 2016 13:43:40 +0000 (15:43 +0200)]
qemu: process: Simplify condition in qemuProcessRefreshBalloonState

No need to store failure and re-check right away.

9 years agoqemu: driver: Reuse qemuDomainGetMonitor in qemuDomainMemoryStats
Peter Krempa [Wed, 6 Apr 2016 13:05:10 +0000 (15:05 +0200)]
qemu: driver: Reuse qemuDomainGetMonitor in qemuDomainMemoryStats

9 years agodomain: Add helper to determine presence of memory baloon
Peter Krempa [Wed, 6 Apr 2016 13:02:31 +0000 (15:02 +0200)]
domain: Add helper to determine presence of memory baloon

9 years agoqemu: command: Refactor memballoon command line formatting
Peter Krempa [Wed, 6 Apr 2016 11:41:31 +0000 (13:41 +0200)]
qemu: command: Refactor memballoon command line formatting

Now that there is just one format of the memory balloon command line
used the code can be merged into a single function.

Additionally with some tweaks to the control flow the code is easier to
read.

9 years agoqemu: command: Drop obsolete comment
Peter Krempa [Wed, 6 Apr 2016 12:34:05 +0000 (14:34 +0200)]
qemu: command: Drop obsolete comment

The change that made qemu not add the memballoon by default happened
prior to 0.12.0. Additionaly the comment was misleading due to the code
that was added below. Since we always need to add a balloon on the
commandline drop the comment.

9 years agoqemu: caps: Deprecate QEMU_CAPS_BALLOON
Peter Krempa [Wed, 6 Apr 2016 12:29:26 +0000 (14:29 +0200)]
qemu: caps: Deprecate QEMU_CAPS_BALLOON

The flag is now unused and all qemus supported by libvirt already
support it.

9 years agoqemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args
Peter Krempa [Wed, 6 Apr 2016 12:24:39 +0000 (14:24 +0200)]
qemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args

9 years agospec: Only pull in API docs with -devel package
Cole Robinson [Wed, 13 Apr 2016 14:37:42 +0000 (10:37 -0400)]
spec: Only pull in API docs with -devel package

Move some API specific documentation out of -docs package and into
-devel, and some end user docs out of -devel and into -docs, then
drop the -devel dep on -docs. This is more in line with the suggested
Fedora guidelines.

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

9 years agoqemu: migration: Drop dead VNC cookie handling
Cole Robinson [Wed, 13 Apr 2016 15:06:42 +0000 (11:06 -0400)]
qemu: migration: Drop dead VNC cookie handling

The only caller of this code is:

    for (i = 0; i < dom->def->ngraphics; i++) {
       if (dom->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
           if (!(mig->graphics =
                 qemuMigrationCookieGraphicsAlloc(driver, dom->def->graphics[i])))
               return -1;
           mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS;
           break;
       }
    }

So this is never triggered for VNC, and in fact VNC has no support for
seamless migration anyways so that seems correct. Drop the dead VNC
handling.

9 years agomakefile: Move include/Makefile.am to include/libvirt/Makefile.am
Erik Skultety [Tue, 5 Apr 2016 19:04:06 +0000 (21:04 +0200)]
makefile: Move include/Makefile.am to include/libvirt/Makefile.am

The reason for this is to fix the automatic rebuild of libvirt-common.h.in.
All *.in files should be automatically rebuilt each time they're modified.
It works well for makefiles and pkgconfig files, since they do have a valid
dependency in the top-level Makefile. However, with libvirt-common.h.in
there is no dependency in the top-level Makefile and there's no need for it
either, so this rule

include/libvirt/libvirt-common.h: $(top_builddir)/config.status \
        $(top_srcdir)/include/libvirt/libvirt-common.h.in
    cd $(top_builddir) && $(SHELL) ./config.status $@

is never hit and should be moved to include/Makefile, but that's automake's
job. According to GNU automake docs:

"Files created by AC_CONFIG_FILES, be they
Automake Makefiles or not, are all removed by ‘make distclean’. Their inputs
are automatically distributed, unless they are the output of prior
AC_CONFIG_FILES commands. Finally, rebuild rules are generated in the Automake
Makefile existing in the subdirectory of the output file, if there is one, or
in the top-level Makefile otherwise."

Which means that if we want to have the rule for libvirt-common.h automatically
generated by automake, the include/Makefile.am needs to be moved into libvirt/
subdirectory and $SUBDIRS in the top-level Makefile need to be adjusted as
well. This patch moves Makefile.am from include/ to include/libvirt, adjusting
the prefixes accordingly as well as updates the top-level Makefile $SUBDIRS to
properly hint automake to generate all rules at proper places.

Best way to see the changes, use -M with 'git show'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agovz: make it possible to use shared drivers API with vz driver connection
Maxim Nestratov [Thu, 14 Apr 2016 14:52:32 +0000 (17:52 +0300)]
vz: make it possible to use shared drivers API with vz driver connection

Since vz driver is now lives as a part of daemon we can benefit from
this fact and allow vz clients to use shared drivers API like storage,
network, nwfilter etc.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agoqemu: support new pci controller model "pcie-expander-bus"
Laine Stump [Wed, 23 Mar 2016 19:49:29 +0000 (15:49 -0400)]
qemu: support new pci controller model "pcie-expander-bus"

This is backed by the qemu device pxb-pcie, which will be available in
qemu 2.6.0.

As with pci-expander-bus (which uses qemu's pxb device), the busNr
attribute and <node> subelement of <target> are used to set the bus_nr
and numa_node options.

During post-parse we validate that the domain's machinetype is
q35-based (since the device shows up for 440fx-based machinetypes, but
is unusable), as well as checking that <node> specifies a node that is
actually configured on the guest.