]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoconf: disk: Extract checking of removable status
Peter Krempa [Wed, 20 Apr 2016 15:19:04 +0000 (17:19 +0200)]
conf: disk: Extract checking of removable status

9 years agoconf: disk: Move validation of disk bus vs disk type
Peter Krempa [Wed, 20 Apr 2016 15:11:52 +0000 (17:11 +0200)]
conf: disk: Move validation of disk bus vs disk type

9 years agoconf: disk: extract sgio/rawio validation
Peter Krempa [Wed, 20 Apr 2016 14:52:46 +0000 (16:52 +0200)]
conf: disk: extract sgio/rawio validation

9 years agoconf: disk: Don't bother setting removable state to 0 by default
Peter Krempa [Wed, 20 Apr 2016 14:40:48 +0000 (16:40 +0200)]
conf: disk: Don't bother setting removable state to 0 by default

9 years agoconf: disk: Initialize closed device tray state to 0
Peter Krempa [Wed, 20 Apr 2016 14:39:44 +0000 (16:39 +0200)]
conf: disk: Initialize closed device tray state to 0

Additionally avoid initializing it after being calloced.

9 years agoconf: disk: Extract disk type and device right away
Peter Krempa [Wed, 20 Apr 2016 14:35:26 +0000 (16:35 +0200)]
conf: disk: Extract disk type and device right away

Additionally switch to using a common temp variable for the xml
elements.

9 years agoconf: disk: Remove custom single-use temporary variables
Peter Krempa [Wed, 20 Apr 2016 14:16:22 +0000 (16:16 +0200)]
conf: disk: Remove custom single-use temporary variables

Use a single temporary variable instead shortening the code.

9 years agoconf: disk: Mark VIR_DOMAIN_DISK_IO_DEFAULT as 0 and simplify parsing
Peter Krempa [Wed, 20 Apr 2016 13:50:04 +0000 (15:50 +0200)]
conf: disk: Mark VIR_DOMAIN_DISK_IO_DEFAULT as 0 and simplify parsing

9 years agoconf: disk: Sanitize parsing of disk format
Peter Krempa [Wed, 20 Apr 2016 13:36:05 +0000 (15:36 +0200)]
conf: disk: Sanitize parsing of disk format

9 years agoconf: disk: Avoid temporary variable when parsing driver name
Peter Krempa [Wed, 20 Apr 2016 13:08:52 +0000 (15:08 +0200)]
conf: disk: Avoid temporary variable when parsing driver name

9 years agoconf: disk: Split out parsing of disk <driver> element
Peter Krempa [Wed, 20 Apr 2016 12:41:27 +0000 (14:41 +0200)]
conf: disk: Split out parsing of disk <driver> element

9 years agoconf: disk: Extract verification of disk config
Peter Krempa [Wed, 20 Apr 2016 13:01:44 +0000 (15:01 +0200)]
conf: disk: Extract verification of disk config

Rather than checking individual fields in dubious places extract them to
a central point.

9 years agobuild: Fix default network generation on FreeBSD
Andrea Bolognani [Thu, 21 Apr 2016 10:01:27 +0000 (12:01 +0200)]
build: Fix default network generation on FreeBSD

FreeBSD's sed(1) doesn't support using "\n" to insert a newline,
so the installed default.xml file ends up containing a literal
"n" between tags; to work around this problem, add a tr(1)
invocation as suggested by the sed FAQ[1].

[1] http://sed.sourceforge.net/sedfaq4.html (4.1 c)

9 years agodaemonStreamHandleRead: Rework to follow our coding pattern
Michal Privoznik [Fri, 8 Apr 2016 14:56:28 +0000 (16:56 +0200)]
daemonStreamHandleRead: Rework to follow our coding pattern

Usually, we have this 'if() goto cleanup;' pattern in our new
code. It is going to be useful here too. Thing is, there was a
memleak. If there has been an error in
virNetServerProgramSendStreamError() or
virNetServerProgramSendStreamData() created message was never
freed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNet{Client,Server}*Stream: Update comment
Michal Privoznik [Mon, 4 Apr 2016 14:44:27 +0000 (16:44 +0200)]
virNet{Client,Server}*Stream: Update comment

After 434de30da545aea137 the status values are prefixed VIR_NET_
rather than REMOTE_.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon stream: Remove useless empty lines from header file
Michal Privoznik [Mon, 4 Apr 2016 11:01:17 +0000 (13:01 +0200)]
daemon stream: Remove useless empty lines from header file

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon stream: Convert @tx in daemonClientStream to bool
Michal Privoznik [Mon, 4 Apr 2016 10:49:48 +0000 (12:49 +0200)]
daemon stream: Convert @tx in daemonClientStream to bool

This structure item is used as pure boolean. There's no need to
hold whole integer for it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon stream: Prefer bool over unsigned int var:1
Michal Privoznik [Mon, 4 Apr 2016 10:46:19 +0000 (12:46 +0200)]
daemon stream: Prefer bool over unsigned int var:1

There is no need for doing that since we have a bool type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemonClientStream: Use unsigned int to store stream @serial
Michal Privoznik [Tue, 29 Mar 2016 15:33:14 +0000 (17:33 +0200)]
daemonClientStream: Use unsigned int to store stream @serial

The stream serial number is the serial number of the RPC call
that initiated a data transfer. And as such can never be
negative. Moreover, when looking up internal state for a stream,
the serial numbers are compared. But hey, the serial number in
message header is unsigned too!

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoinclude: common: Fix function formatting
Peter Krempa [Thu, 21 Apr 2016 12:49:18 +0000 (14:49 +0200)]
include: common: Fix function formatting

9 years agoapi: Generate docs for libvirt-common.h
Peter Krempa [Thu, 21 Apr 2016 12:35:29 +0000 (14:35 +0200)]
api: Generate docs for libvirt-common.h

Since commit f5d9c5d00cfc0c moved the virTypedParam stuff into
libvirt-common we did not generate any docs for them and neither did we
populate them into libvirt-api.xml. This broke the sanity check in
libvirt python. Fix it by generating docs for libvirt-common.h too.

9 years agoapibuild: Allow completely skipping certain macros
Peter Krempa [Thu, 21 Apr 2016 12:31:23 +0000 (14:31 +0200)]
apibuild: Allow completely skipping certain macros

Some macros don't make sense to be documented at all. Add infrastructure
to the web/api generator and add VIR_DEPRECATED and VIR_EXPORT_VAR as
macros we should not document.

9 years agoinclude: common: Fix file header for apibuild.py
Peter Krempa [Thu, 21 Apr 2016 12:27:24 +0000 (14:27 +0200)]
include: common: Fix file header for apibuild.py

Our docs/web generator would take the complete license text and put it
into the description of the file, since it depends on position of the
"Author:" line. Move the author line to the top and remove the spurious
emacs comment.

9 years agodist: ln(1) is not guaranteed to have a '-f' option
Andrea Bolognani [Thu, 21 Apr 2016 11:16:56 +0000 (13:16 +0200)]
dist: ln(1) is not guaranteed to have a '-f' option

According to the autoconf manual, using '$(LN_S) -f' is not
portable; remove the target explicitly beforehand to work around
this limitation.

Adjust some slightly awkward indentation while at it.

9 years agoqemu: process: split out startup XML validation
Cole Robinson [Wed, 20 Apr 2016 20:55:48 +0000 (16:55 -0400)]
qemu: process: split out startup XML validation

And document that these specific bits are done at startup time for
back compat reasons

9 years agoqemu: process: split out shmem startup warning
Cole Robinson [Wed, 20 Apr 2016 20:44:25 +0000 (16:44 -0400)]
qemu: process: split out shmem startup warning

Now we can return early and save some indentation

9 years agovirsh: Don't clear old connection if 'connect $uri' fails
Cole Robinson [Wed, 20 Apr 2016 17:56:27 +0000 (13:56 -0400)]
virsh: Don't clear old connection if 'connect $uri' fails

    virsh # list --all
     Id    Name                           State
    ----------------------------------------------------
     1     test                           running

    virsh # connect frob
    error: Failed to connect to the hypervisor
    error: no connection driver available for frob

    virsh # list --all
    error: failed to connect to the hypervisor
    error: no valid connection
    error: no connection driver available for frob

Seems sensible IMO to just not clear out the old connection state
until the new virConnectOpen succeeds.

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

9 years agolibvirt: Fix crash on URI without scheme
Cole Robinson [Wed, 20 Apr 2016 17:25:07 +0000 (13:25 -0400)]
libvirt: Fix crash on URI without scheme

My commit 0d1579572 crashes on a URI without a scheme, like via
'virsh --connect frob'

Add a check on uri->server too while we are at it, and centralize
them all

9 years agotests: virnetdaemontest: Enable testing for no-keepalive-required
Erik Skultety [Wed, 13 Apr 2016 19:06:00 +0000 (21:06 +0200)]
tests: virnetdaemontest: Enable testing for no-keepalive-required

Commit a8743c39 removed keepalive_required attribute from daemon, added a test
case for it, but forgot to enable the test itself in virnetdaemontest.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agotests: virnetdaemon: Replace tabs with spaces
Erik Skultety [Wed, 13 Apr 2016 18:41:16 +0000 (20:41 +0200)]
tests: virnetdaemon: Replace tabs with spaces

We already did this once, but somehow commit 252610f7 managed to bring the tabs
back again.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agotests: remove virnetservertest data leftovers
Erik Skultety [Tue, 12 Apr 2016 19:08:57 +0000 (21:08 +0200)]
tests: remove virnetservertest data leftovers

Commit a4746114 renamed virnetservertest to virnetdaemontest to reflect some
refactor changes to virNetServer code (which moved daemon-related parts to
virNetDaemon module). Moving test data from virnetserverdata to
virnetdaemondata was also part of the commit, but the commit failed to clean
half of the files that were copied (rather than moved).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agovirsh: re-fix help printing without connection
Roman Bogorodskiy [Thu, 21 Apr 2016 08:26:31 +0000 (11:26 +0300)]
virsh: re-fix help printing without connection

Re-do 0217089 so it does not add regression for commit c0726e0 that allowed to
print help without making a connection to the daemon.

9 years agobuild: Use $(LN_S) safely
Andrea Bolognani [Wed, 20 Apr 2016 17:24:22 +0000 (19:24 +0200)]
build: Use $(LN_S) safely

The autoconf documentation recommends to always use this
construct when creating symbolic links with $(LN_S) to avoid
unexpected behavior.

9 years agobuild: Overwrite existing symbolic links
Andrea Bolognani [Wed, 20 Apr 2016 16:33:20 +0000 (18:33 +0200)]
build: Overwrite existing symbolic links

The current rule fails if the target already exists:

  cd /home/jenkins/build/libvirt/lib && \
    ln -s libnss_libvirt.so.1 nss_libvirt.so.1
  ln: nss_libvirt.so.1: File exists
  Makefile:3357: recipe for target 'install-exec-hook' failed

However, all other rules concerned with installation are
idempotent and will happily overwrite an existing target,
so this one should as well.

9 years agobuild: Add AC_PROG_LN_S to configure
Andrea Bolognani [Wed, 20 Apr 2016 17:15:56 +0000 (19:15 +0200)]
build: Add AC_PROG_LN_S to configure

We use $(LN_S) for creating symbolic links, but the appropriate
autoconf macro was not included among the checks for external
programs.

9 years agobuild: Always use $(LN_S) and $(MKDIR_P)
Andrea Bolognani [Wed, 20 Apr 2016 16:17:07 +0000 (18:17 +0200)]
build: Always use $(LN_S) and $(MKDIR_P)

autotools provide those for our convenience, so let's use them
everywhere instead of mixing in native command invocation.

9 years agovirsh: perf: Remove unnecessary 'error' label
Peter Krempa [Thu, 21 Apr 2016 07:54:45 +0000 (09:54 +0200)]
virsh: perf: Remove unnecessary 'error' label

The only place that uses it doesn't warrant a separate label.

9 years agovirsh: perf: Don't leak domain
Peter Krempa [Thu, 21 Apr 2016 07:51:08 +0000 (09:51 +0200)]
virsh: perf: Don't leak domain

After failing to parse the perf event list, the code would return
failure without freeing the previously acquired object. Rearrange the
code to avoid the problem.

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

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