]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoutil: string: Introduce virStringEncodeBase64
Peter Krempa [Fri, 13 May 2016 11:15:15 +0000 (13:15 +0200)]
util: string: Introduce virStringEncodeBase64

Add a new helper that sanitizes error semantics of base64_encode_alloc.

8 years agosecret: util: Refactor virSecretGetSecretString
Peter Krempa [Fri, 13 May 2016 11:32:48 +0000 (13:32 +0200)]
secret: util: Refactor virSecretGetSecretString

Call the internal driver callbacks rather than the public APIs to avoid
calling unnecessarily the error dispatching code and don't overwrite
the error messages provided by the APIs. They are good enough to
describe which secret is missing either by UUID or the usage (basically
name).

8 years agoutil: alloc: Introduce freeing helpers that clear the memory before freeing
Peter Krempa [Fri, 13 May 2016 12:59:01 +0000 (14:59 +0200)]
util: alloc: Introduce freeing helpers that clear the memory before freeing

For a few cases where we handle secret information it's good to clear
the buffers containing sensitive data before freeing them.

Introduce VIR_DISPOSE, VIR_DISPOSE_N and VIR_DISPOSE_STRING that allow
simple clearing fo the buffers holding sensitive information on cleanup
paths.

8 years agocapabilities: Advertise cpuselection if -cpu host is usable
Jiri Denemark [Wed, 13 Apr 2016 07:06:23 +0000 (09:06 +0200)]
capabilities: Advertise cpuselection if -cpu host is usable

When -cpu host is supported by a QEMU binary, a user can use
<cpu mode='host-passthrough'/> in domain XML even when libvirtd failed
to find a matching model for the host CPU. Let's make it obvious by
advertising <cpuselection/> guest capability whenever -cpu host is
supported.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuaincapstest: Give better names to test data files
Jiri Denemark [Tue, 10 May 2016 18:39:11 +0000 (20:39 +0200)]
qemuaincapstest: Give better names to test data files

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodomaincapstest: Give better names to test data files
Jiri Denemark [Tue, 10 May 2016 18:29:17 +0000 (20:29 +0200)]
domaincapstest: Give better names to test data files

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodomaincapstest: Use arch strings
Jiri Denemark [Tue, 10 May 2016 17:59:48 +0000 (19:59 +0200)]
domaincapstest: Use arch strings

They are shorter and most of the code requires the strings anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Introduce check-file-access.pl
Michal Privoznik [Mon, 18 Apr 2016 14:15:35 +0000 (16:15 +0200)]
tests: Introduce check-file-access.pl

This script will check output generated by virtestmock against a
white list. All non matching records found are printed out. So
far, the white list is rather sparse at the moment.
This test should be ran only after all other tests finished, and
should cleanup the temporary file before their execution. Because
I'm unable to reflect these requirements in Makefile.am
correctly, I've introduced new target 'check-access' under which
this test is available.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirtestmock: Print invalid file accesses into a file
Michal Privoznik [Mon, 18 Apr 2016 12:10:33 +0000 (14:10 +0200)]
virtestmock: Print invalid file accesses into a file

All the accesses to files outside our build or source directories
are now identified and appended into a file for later processing.
The location of the file that contains all the records can be
controlled via VIR_TEST_FILE_ACCESS env variable and defaults to
abs_builddir "/test_file_access.txt".

The script that will process the access file is to be added in
next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: Introduce global mock library
Michal Privoznik [Fri, 13 May 2016 12:08:29 +0000 (14:08 +0200)]
tests: Introduce global mock library

The intent is that this library is going to be called every time
to check if we are not touching anything outside srcdir or
builddir.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirmock.h: Introduce VIR_MOCK_CALL_STAT
Michal Privoznik [Fri, 13 May 2016 11:42:13 +0000 (13:42 +0200)]
virmock.h: Introduce VIR_MOCK_CALL_STAT

There is some magic going on when it comes to stat() or lstat().
Basically, stat() can either be a regular function, an inline
function that calls __xstat(_STAT_VER, ...) or a macro that does
the same as the inline func. Don't ask why is that, just read the
documentation in sys/stat.h and make sure you have a bucket next
to you. Anyway, currently there will not be both stat and __xstat
symbols at the same time, as one of them gets overwritten to the
other one during compilation. But this is not true anymore once
we start chaining our mocking libraries. Therefore we need a
wrapper that calls desired function from glibc.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agosecurityselinuxhelper: Adapt to virmock.h
Michal Privoznik [Fri, 13 May 2016 10:46:35 +0000 (12:46 +0200)]
securityselinuxhelper: Adapt to virmock.h

Instead of introducing our own wrapper for dlsym()
we can use the one provided by virmock.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonssmock: Adapt to virmock.h
Michal Privoznik [Fri, 13 May 2016 10:46:35 +0000 (12:46 +0200)]
nssmock: Adapt to virmock.h

Instead of introducing our own wrapper for dlsym()
we can use the one provided by virmock.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovircgroupmock: Adapt to virmock.h
Michal Privoznik [Fri, 13 May 2016 10:46:35 +0000 (12:46 +0200)]
vircgroupmock: Adapt to virmock.h

Instead of introducing our own wrapper for dlsym()
we can use the one provided by virmock.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirpcimock: Adapt to virmock.h
Michal Privoznik [Fri, 13 May 2016 10:32:00 +0000 (12:32 +0200)]
virpcimock: Adapt to virmock.h

Instead of introducing our own wrapper for dlsym()
we can use the one provided by virmock.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: remove ATTRIBUTE_UNUSED in connectGetType
Fabian Freyer [Fri, 13 May 2016 19:07:35 +0000 (21:07 +0200)]
qemu: remove ATTRIBUTE_UNUSED in connectGetType

This is not needed here, since the conn parameter is used in the ACL
checking calls, which were introduced in abf75aea2.

8 years agobhyve: implement virConnectGetType
Fabian Freyer [Fri, 13 May 2016 14:01:33 +0000 (16:01 +0200)]
bhyve: implement virConnectGetType

This implements virConnectGetType for the bhyve driver.

8 years agoxlconfigtests: use qemu-xen in all test data files
Jim Fehlig [Thu, 12 May 2016 20:40:29 +0000 (14:40 -0600)]
xlconfigtests: use qemu-xen in all test data files

Some of the test configuration files in tests/xlconfigdata
use the old qemu-dm as the emulator. Many of the configuration
features tested (spice, rbd, multi-usb) are not even usable with
the old qemu. Change these files to use the new qemu-xen (also
known as qemu upstream) emulator.

Note: This change fixes xlconfigtest failures when the old
qemu is actually installed on the system. During device post
parse, the libxl driver attempts to invoke the emulator to
determine if it is the old or new qemu so it can properly set
video RAM defaults. With the old qemu installed, the default
video RAM was set differently than the expected value.
Changing all the test data files to use qemu-xen ensures
predictable results wrt default video RAM size.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: don't attempt to probe a non-existent emulator
Jim Fehlig [Thu, 12 May 2016 20:40:28 +0000 (14:40 -0600)]
libxl: don't attempt to probe a non-existent emulator

When probing the <emulator> with '-help' to determine if
it is the old qemu, errors are reported if the emulator
doesn't exist

libvirt:  error : internal error: Child process
(/usr/lib/xen/bin/qemu-dm -help) unexpected exit status 127:
libvirt:  error : cannot execute binary /usr/lib/xen/bin/qemu-dm:
No such file or directory

Avoid the probe if the specified emulator doesn't exist,
squelching the error. There is no behavior change since
libxlDomainGetEmulatorType() would return
LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN if the probe failed
via virCommandRun().

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agovirt-aa-helper: remove replace_string and use virStringReplace instead
Pavel Hrdina [Fri, 13 May 2016 08:48:12 +0000 (10:48 +0200)]
virt-aa-helper: remove replace_string and use virStringReplace instead

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agonetwork: log error when <bandwidth> is requested for hostdev interfaces
Laine Stump [Wed, 27 Apr 2016 16:57:08 +0000 (12:57 -0400)]
network: log error when <bandwidth> is requested for hostdev interfaces

This would previously be silently ignored.

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

8 years agovirfile: Introduce virFileRemoveLastComponent
Michal Privoznik [Thu, 12 May 2016 11:05:37 +0000 (13:05 +0200)]
virfile: Introduce virFileRemoveLastComponent

Move some parts of virStorageFileRemoveLastPathComponent
into a separate function so they can be reused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoleave out the default USB controller only on i440fx during migration
Shivaprasad G Bhat [Wed, 4 May 2016 08:31:05 +0000 (14:01 +0530)]
leave out the default USB controller only on i440fx during migration

Further followup discussions in list on commit 192a53e concluded
that we should be leaving out the USB controller only for
i440fx machines as default USB can be used by someone on q35
at random slots.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
8 years agoqemu: domain: Fix name of macro defining AES IV length
Peter Krempa [Thu, 12 May 2016 15:13:09 +0000 (17:13 +0200)]
qemu: domain: Fix name of macro defining AES IV length

The initialization vector is a technical term by itself different from
the key.

8 years agoqemu: Change from SecretIV or _IV to SecretAES or _AES
John Ferlan [Wed, 11 May 2016 20:57:54 +0000 (16:57 -0400)]
qemu: Change from SecretIV or _IV to SecretAES or _AES

The preferred name will be AES not IV, change current references

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoschemas: Improve outdated comment
Christophe Fergeau [Sat, 12 Mar 2016 22:14:39 +0000 (23:14 +0100)]
schemas: Improve outdated comment

8 years agoFix tests to include video ram size
Ján Tomko [Thu, 12 May 2016 12:19:52 +0000 (14:19 +0200)]
Fix tests to include video ram size

My commit 3e42867 started filling out the video size in post-parse,
but did not adjust the tests.

8 years agoFill out default vram in DeviceDefPostParse
Ján Tomko [Wed, 11 May 2016 10:39:52 +0000 (12:39 +0200)]
Fill out default vram in DeviceDefPostParse

Move filling out the default video (v)ram to DeviceDefPostParse.

This means it can be removed from virDomainVideoDefParseXML
and qemuParseCommandLine. Also, we no longer need to special case
VIR_DOMAIN_VIRT_XEN, since the per-driver callback gets called
before the generic one.

8 years agoCall per-device post-parse callback even on implicit video
Ján Tomko [Wed, 11 May 2016 10:13:51 +0000 (12:13 +0200)]
Call per-device post-parse callback even on implicit video

Commit 6879be48 moved adding of an implicit video device after XML
parsing. As a result, libxlDomainDeviceDefPostParse() is no longer
called to set the default vram when adding an implicit device.
Commit 6879be48 assumes virDomainVideoDefaultRAM() will set the
default vram, but it returns 0 if the domain virtType is
VIR_DOMAIN_VIRT_XEN. Attempting to start an HVM domain with vram=0
results in

error: unsupported configuration: videoram must be at least 4MB for CIRRUS

The default vram setting for Xen HVM domains depends on the device
model used (qemu-xen vs qemu-traditional), hence setting the
default is deferred to libxlDomainDeviceDefPostParse().

Call the device post-parse callback even for implicit video,
to fill out the default vram even for VIR_DOMAIN_VIRT_XEN.

https://bugzilla.redhat.com/show_bug.cgi?id=1334557
Most-of-commit-message-by: Jim Fehlig <jfehlig@suse.com>
8 years agoMove virDomainDefPostParseInternal after virDomainDeviceDefPostParse
Ján Tomko [Wed, 11 May 2016 09:57:33 +0000 (11:57 +0200)]
Move virDomainDefPostParseInternal after virDomainDeviceDefPostParse

Future commit will call DeviceDefPostParse on a device auto-added
in DomainDefPostParse.

8 years agoutil: Fix virGetLastErrorMessage to return proper error when 'err' is NULL
Erik Skultety [Wed, 11 May 2016 18:10:35 +0000 (20:10 +0200)]
util: Fix virGetLastErrorMessage to return proper error when 'err' is NULL

Both virGetLastError and virGetLastErrorMessage call virLastErrorObject method
that returns a thread-local error object. However, if a direct call to malloc
or pthread_setspecific (probably also due to malloc, since it sets ENOMEM)
fail, virLastErrorObject returns NULL which, although incorrectly interpreted
by virGetLastError as no error, still requires the caller to check for NULL
pointer. This isn't the case with virGetLastErrorMessage that also treated it
incorrectly as no error, but returned the literal "no error".
This patch tweaks the checks in the virGetLastErrorMessage function, so that
if virLastErrorObject failed, it returned "unknown error" which is equivalent
to the current approach with virGetLastError and if it returned NULL,
"unknown error" was set.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agospec: Fix broken indentation reported by syntax-check
Erik Skultety [Wed, 11 May 2016 18:03:57 +0000 (20:03 +0200)]
spec: Fix broken indentation reported by syntax-check

syntax-check complained about broken indentation in libvirt.spec.in which was
broken by commit 3694e038

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agolibvit.spec.in: Add missing BuildRequires against sheepdog
Daniel P. Berrange [Wed, 11 May 2016 15:41:34 +0000 (16:41 +0100)]
libvit.spec.in: Add missing BuildRequires against sheepdog

We were adding a sheepdog requirement at runtime, but forgetting
to turn it on at build time, so the underlying code was never
built.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove all changelog entries
Daniel P. Berrange [Wed, 4 May 2016 16:22:13 +0000 (17:22 +0100)]
libvirt.spec.in: remove all changelog entries

The %changelog entries in the RPM are just a poor immitation
of the release notes, which is not what %changelog section
is for. It should be reflecting changes in the RPM packaging,
not changes in the application releases. Further, this bogus
list of changes has to be manually deleted every time we sync
the RPM with Fedora. Remove them, since they serve no useful
purpose.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: use explicit --with-xxx for all features
Daniel P. Berrange [Wed, 4 May 2016 15:50:55 +0000 (16:50 +0100)]
libvirt.spec.in: use explicit --with-xxx for all features

Rather than letting the configure script auto-detect features
we expect, use --with-xxx to explicitly mandate them. This
ensures that we get an error upfront when running configure,
rather than a failure later during build or RPM file packaging
time.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove nss plugin conditional
Daniel P. Berrange [Wed, 4 May 2016 15:46:16 +0000 (16:46 +0100)]
libvirt.spec.in: remove nss plugin conditional

Both RHEL and Fedora build the nss plugin at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove libnl conditional
Daniel P. Berrange [Wed, 4 May 2016 15:44:48 +0000 (16:44 +0100)]
libvirt.spec.in: remove libnl conditional

Both RHEL and Fedora build with libnl3 at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove macvtap conditional
Daniel P. Berrange [Wed, 4 May 2016 15:44:27 +0000 (16:44 +0100)]
libvirt.spec.in: remove macvtap conditional

Both RHEL and Fedora build with macvtap at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove libpcap conditional
Daniel P. Berrange [Wed, 4 May 2016 15:43:44 +0000 (16:43 +0100)]
libvirt.spec.in: remove libpcap conditional

Both RHEL and Fedora build with libpcap at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove nwfilter driver conditional
Daniel P. Berrange [Wed, 4 May 2016 15:42:30 +0000 (16:42 +0100)]
libvirt.spec.in: remove nwfilter driver conditional

Both RHEL and Fedora build with the nwfilter driver enabled
at all times

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove nodedev conditional
Daniel P. Berrange [Wed, 4 May 2016 15:41:16 +0000 (16:41 +0100)]
libvirt.spec.in: remove nodedev conditional

Both RHEL and Fedora build with the nodedev driver enabled
at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove most storage conditionals
Daniel P. Berrange [Wed, 4 May 2016 15:40:08 +0000 (16:40 +0100)]
libvirt.spec.in: remove most storage conditionals

Both RHEL and Fedora build with the storage driver and
most of its sub-drivers enabled at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove network driver conditiaonl
Daniel P. Berrange [Wed, 4 May 2016 15:36:17 +0000 (16:36 +0100)]
libvirt.spec.in: remove network driver conditiaonl

Both RHEL and Fedora build with the network driver
enabled at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove interface driver conditional
Daniel P. Berrange [Wed, 4 May 2016 15:34:37 +0000 (16:34 +0100)]
libvirt.spec.in: remove interface driver conditional

Both RHEL and Fedora build with the interface driver
enabled at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove selinux conditional
Daniel P. Berrange [Wed, 4 May 2016 15:33:14 +0000 (16:33 +0100)]
libvirt.spec.in: remove selinux conditional

Both RHEL and Fedora build with selinux enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove yajl conditional
Daniel P. Berrange [Wed, 4 May 2016 15:32:18 +0000 (16:32 +0100)]
libvirt.spec.in: remove yajl conditional

Both RHEL and Fedora build with yajl enabled at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove polkit conditional
Daniel P. Berrange [Wed, 4 May 2016 15:31:38 +0000 (16:31 +0100)]
libvirt.spec.in: remove polkit conditional

Both RHEL and Fedora build with polkit enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove sasl conditionals
Daniel P. Berrange [Wed, 4 May 2016 15:29:49 +0000 (16:29 +0100)]
libvirt.spec.in: remove sasl conditionals

Both RHEL and Fedora build with sasl enabled at all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove dtrace conditional
Daniel P. Berrange [Wed, 4 May 2016 15:27:46 +0000 (16:27 +0100)]
libvirt.spec.in: remove dtrace conditional

Both RHEL and Fedora build with dtrace enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove audit conditional
Daniel P. Berrange [Wed, 4 May 2016 15:26:58 +0000 (16:26 +0100)]
libvirt.spec.in: remove audit conditional

Both RHEL and Fedora build with audit enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove netcf conditional
Daniel P. Berrange [Wed, 4 May 2016 15:26:30 +0000 (16:26 +0100)]
libvirt.spec.in: remove netcf conditional

Both RHEL and Fedora build with netcf enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove udev conditional
Daniel P. Berrange [Wed, 4 May 2016 15:25:37 +0000 (16:25 +0100)]
libvirt.spec.in: remove udev conditional

Both RHEL and Fedora build with udev enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove capng conditional
Daniel P. Berrange [Wed, 4 May 2016 15:24:39 +0000 (16:24 +0100)]
libvirt.spec.in: remove capng conditional

Both RHEL and Fedora build with capng enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove apparmor conditional
Daniel P. Berrange [Wed, 4 May 2016 15:24:02 +0000 (16:24 +0100)]
libvirt.spec.in: remove apparmor conditional

Neither RHEL or Fedora build apparmor

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove hal conditional
Daniel P. Berrange [Wed, 4 May 2016 15:22:18 +0000 (16:22 +0100)]
libvirt.spec.in: remove hal conditional

Neither RHEL or Fedora build HAL anymore.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove avahi conditional
Daniel P. Berrange [Wed, 4 May 2016 15:21:42 +0000 (16:21 +0100)]
libvirt.spec.in: remove avahi conditional

Both RHEL and Fedora build with avahi enabled at all
times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove libvirtd conditional
Daniel P. Berrange [Wed, 4 May 2016 15:20:58 +0000 (16:20 +0100)]
libvirt.spec.in: remove libvirtd conditional

Both RHEL and Fedora build with libvirtd enabled at
all times.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove conditional for driver modules
Daniel P. Berrange [Wed, 4 May 2016 15:14:10 +0000 (16:14 +0100)]
libvirt.spec.in: remove conditional for driver modules

Both RHEL and Fedora build with driver modules enabled by
default, so there is no need for any conditional.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: remove client only build option
Daniel P. Berrange [Wed, 4 May 2016 14:44:57 +0000 (15:44 +0100)]
libvirt.spec.in: remove client only build option

A client only build dates back to RHEL5 where some architectures
did not build the libvirtd daemon, only the clients. Since RHEL5
was dropped this is no longer required.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: drop Fedora < 20 and RHEL < 6
Daniel P. Berrange [Wed, 4 May 2016 14:43:08 +0000 (15:43 +0100)]
libvirt.spec.in: drop Fedora < 20 and RHEL < 6

Simplify conditionals to assume Fedora >= 20 or RHEL >= 6

The %prep section will explicitly check the version and
refuse to run if insufficient.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: explicitly disable xenapi & vz drivers
Daniel P. Berrange [Wed, 4 May 2016 14:11:01 +0000 (15:11 +0100)]
libvirt.spec.in: explicitly disable xenapi & vz drivers

The xenapi & vz drivers won't build in Fedora or RHEL
since their deps don't exist there.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agostorage: Fix virStorageBackendDiskDeleteVol for device mapper
John Ferlan [Tue, 26 Apr 2016 12:53:57 +0000 (08:53 -0400)]
storage: Fix virStorageBackendDiskDeleteVol for device mapper

Commit id 'df1011ca8' modified virStorageBackendDiskDeleteVol to use
"dmsetup remove --force" to remove the volume, but left things in an
inconsistent state since the partition still existed on the disk and
only the device mapper device (/dev/dm-#) was removed.

Prior to commit '1895b421' (or '1ffd82bb' and '471e1c4e'), this could
go unnoticed since virStorageBackendDiskRefreshPool wasn't called.
However, the pool would be unusable since the /dev/dm-# device would
be removed even though the partition was not removed unless a multipathd
restart reset the link. That would of course make the volume appear again
in the pool after a refresh or pool start after libvirt reload.

This patch removes the 'dmsetup' logic and re-implements the partition
deletion logic for device mapper devices. The removal of the partition
via 'parted rm --script #' will cause udev device change logic to allow
multipathd to handle removing the dm-* device associated with the partition.

8 years agostorage: Fix algorithm generating path names for devmapper
John Ferlan [Mon, 9 May 2016 18:57:17 +0000 (14:57 -0400)]
storage: Fix algorithm generating path names for devmapper

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

Commit id '020135dc' didn't quite get the algorithm correct when a
device mapper source ended with a non numeric value (e.g. ends with
an alphabet value).

This patch modifies the 'part_separator' logic to add the "p" separator
to the attempted target path name only when specified as part_separator='yes'.

For a source name that already ends with a number, the logic doesn't change
as the part separator would need to be there.

For a source name that ends with something other than a number, this allows
the possibility that a "p" separator can be added. The default for one of
these source devices is to not add the separator.

The key for device mapper and the need for a partition separator "p" is
the presence of a number in the last character of the device name link
in /dev/mapper.  A name such as "/dev/mapper/mpatha1" would generate
a "/dev/mapper/mpatha1p1" partition, while "/dev/mapper/mpatha" would
generate partition "/dev/mapper/mpatha1". Similarly for a device
mapper entry not using friendly names or an alias, a device such as
"/dev/mapper/3600a0b80005b10ca00005ad656fd8d93" would generate a
paritition "/dev/mapper/3600a0b80005b10ca00005ad656fd8d93p1", while
a device such as "/dev/mapper/3600a0b80005b10ca00005e115729093f" would
generate a partition "/dev/mapper/3600a0b80005b10ca00005e115729093f1".
The long number is the WWID of the device. It's also possible to assign
an alias for a device mapper entry, that alias follows the same rules
with respect to ending with a number or not when adding a "p" to create
the target device path.

8 years agostorage: Need to clear pool prior to calling the refreshPool
John Ferlan [Tue, 26 Apr 2016 12:19:07 +0000 (08:19 -0400)]
storage: Need to clear pool prior to calling the refreshPool

Prior to calling the 'refreshPool' during CreatePool or UploadPool
operations, we need to clear the pool; otherwise, the pool will
have duplicated entries.

8 years agostorage: Fix regression cloning volume into a logical pool
John Ferlan [Fri, 29 Apr 2016 11:43:57 +0000 (07:43 -0400)]
storage: Fix regression cloning volume into a logical pool

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

Commit id 'dd519a294' caused a regression cloning a volume into a
logical pool by removing just the 'allocation' adjustment during
storageVolCreateXMLFrom. Combined with the change to not require the
new volume input XML to have a capacity listed (commit id 'e3f1d2a8')
left the possibility that a zero allocation value (e.g., not provided)
would create a thin/sparse logical volume. When a thin lv becomes fully
populated, then LVM sets the partition 'inactive' and the subsequent
fdatasync() fails.

Add a new 'has_allocation' flag to be set at XML parse time to indicate
that allocation was provided. This is done so that if it's not provided
the create-from code uses the capacity value since we document that if
omitted, the volume will be fully allocated at time of creation.

For a logical backend, that creation time is 'createVol', while for a
file backend, creation doesn't set the size, but the 'createRaw' called
during buildVolFrom will decide whether the file is sparse or not based
on the provided capacity and allocation value.

For volume clones that provide different allocation and capacity values
to allow for sparse files, there is no change.

8 years agoheaders: Remove unnecessary keyword extern from function declaration
Erik Skultety [Tue, 10 May 2016 11:37:32 +0000 (13:37 +0200)]
headers: Remove unnecessary keyword extern from function declaration

Usage of this keyword in front of function declaration that is exported via a
header file is unnecessary, since internally, this has been the default for most
compilers for quite some time.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoconf: log error when incorrect PCI root controller is added to domain
Laine Stump [Tue, 19 Apr 2016 21:05:54 +0000 (17:05 -0400)]
conf: log error when incorrect PCI root controller is added to domain

libvirt may automatically add a pci-root or pcie-root controller to a
domain, depending on the arch/machinetype, and it hopefully always
makes the right decision about which to add (since in all cases these
controllers are an implicit part of the virtual machine).

But it's always possible that someone will create a config that
explicitly supplies the wrong type of PCI controller for the selected
machinetype. In the past that would lead to an error later when
libvirt was trying to assign addresses to other devices, for example:

  XML error: PCI bus is not compatible with the device at
  0000:00:02.0. Device requires a PCI Express slot, which is not
  provided by bus 0000:00

(that's the error message that appears if you replace the pcie-root
controller in a Q35 domain with a pci-root controller).

This patch adds a check at the same place that the implicit
controllers are added (to ensure that the same logic is used to check
which type of pci root is correct). If a pci controller with index='0'
is already present, we verify that it is of the model that we would
have otherwise added automatically; if not, an error is logged:

  The PCI controller with index='0' must be " model='pcie-root' for
  this machine type, " but model='pci-root' was found instead.

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

8 years agoconf: make virDomainDefAddController() public
Laine Stump [Tue, 19 Apr 2016 19:31:36 +0000 (15:31 -0400)]
conf: make virDomainDefAddController() public

This will be needed by the qemu driver in an upcoming patch.

8 years agolibxl: support migration stream V2 in migration
Jim Fehlig [Fri, 29 Apr 2016 21:08:05 +0000 (15:08 -0600)]
libxl: support migration stream V2 in migration

Similar to "support Xen migration stream V2 in save/restore",
add support for indicating the migration stream version in
the migration code. To accomplish this, add a minimal migration
cookie in the libxl driver that is passed between source and
destination hosts. Initially, the cookie is only used in
the Begin and Prepare phases of migration to communicate the
version of the migration stream produced by the source.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: support Xen migration stream V2 in save/restore
Jim Fehlig [Mon, 2 May 2016 18:00:39 +0000 (12:00 -0600)]
libxl: support Xen migration stream V2 in save/restore

Xen 4.6 introduced a new migration stream commonly referred to as
"migration V2". Xen 4.6 and newer always produce this new stream,
whereas Xen 4.5 and older always produce the legacy stream.
Support for migration stream V2 can be detected at build time with
LIBXL_HAVE_SRM_V2 from libxl.h. The legacy and V2 streams are not
compatible, but a V2 host can accept and convert a legacy stream.

Commit e7440656 changed the libxl driver to use the lowest libxl
API version possible (version 0x040200) to ensure the driver
builds against older Xen releases. The old 4.2 restore API does
not support specifying a stream version and assumes a legacy
stream, even if the incoming stream is migration V2. Thinking it
has been given a legacy stream, libxl will fail to convert an
incoming stream that is already V2, which causes the entire
restore operation to fail. Xen's libvirt-related OSSTest has been
failing since commit e7440656 landed in libvirt.git master. One
of the more recent failures can be seen here

http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg00071.html

This patch changes the call to libxl_domain_create_restore() to
include the stream version if LIBXL_HAVE_SRM_V2 is defined. The
version field of the libxlSavefileHeader struct is also updated
to '2' when LIBXL_HAVE_SRM_V2 is defined, ensuring the stream
version in the header matches the actual stream version produced
by Xen. Along with bumping the libxl API requirement to 0x040400,
this patch fixes save/restore on a migration V2 Xen host.

Oddly, migration has never used the libxlSavefileHeader. It
handles passing configuration in the Begin and Prepare phases,
and then calls libxl directly to transfer domain state/memory
in the Perform phase. A subsequent patch will add stream
version handling in the Begin and Prepare phase handshaking,
which will fix the migration related OSSTest failures.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: switch to using libxl_domain_create_restore from v4.4 API
Jim Fehlig [Fri, 29 Apr 2016 03:08:28 +0000 (21:08 -0600)]
libxl: switch to using libxl_domain_create_restore from v4.4 API

In LIBXL_API_VERSION 0x040400, the libxl_domain_create_restore API
gained a parameter for specifying restore parameters. Switch to
using version 0x040400, which will be useful in a subsequent commit
to specify the Xen migration stream version when restoring.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agodocs: Fix disk "volume" description
John Ferlan [Fri, 29 Apr 2016 17:09:07 +0000 (13:09 -0400)]
docs: Fix disk "volume" description

Missing a close single quote and a 'be' before used.

8 years agoqemu: Add extra checks for secret destroy API's
John Ferlan [Tue, 10 May 2016 18:26:44 +0000 (14:26 -0400)]
qemu: Add extra checks for secret destroy API's

Remove the possibility that a NULL hostdev->privateData or a
disk->privateData could crash libvirtd by checking for NULL
before dereferencing for the secinfo structure in the
qemuDomainSecret{Disk|Hostdev}Destroy functions. The hostdevPriv
could be NULL if qemuProcessNetworkPrepareDevices adds a new
hostdev during virDomainNetGetActualHostdev that then gets
inserted via virDomainHostdevInsert. The hostdevPriv was added
by commit id '27726d8' and is currently only used by scsi hostdev.

8 years agodocs: fix version number in vlan tagging documentation
Laine Stump [Tue, 10 May 2016 19:23:55 +0000 (15:23 -0400)]
docs: fix version number in vlan tagging documentation

My brain suffered a time warp and I got the version number wrong.

8 years agoutil: set vlan tag for macvtap passthrough mode on SRIOV VFs
Laine Stump [Wed, 4 May 2016 17:18:16 +0000 (13:18 -0400)]
util: set vlan tag for macvtap passthrough mode on SRIOV VFs

SRIOV VFs used in macvtap passthrough mode can take advantage of the
SRIOV card's transparent vlan tagging. All the code was there to set
the vlan tag, and it has been used for SRIOV VFs used for hostdev
interfaces for several years, but for some reason, the vlan tag for
macvtap passthrough devices was stubbed out with a -1.

This patch moves a bit of common validation down to a lower level
(virNetDevReplaceNetConfig()) so it is shared by hostdev and macvtap
modes, and updates the macvtap caller to actually send the vlan config
instead of -1.

8 years agoseclabeltest: Update to use VIRT_TEST_MAIN
Michal Privoznik [Thu, 25 Feb 2016 16:13:00 +0000 (17:13 +0100)]
seclabeltest: Update to use VIRT_TEST_MAIN

Our tests should use either VIRT_TEST_MAIN() or
VIRT_TEST_MAIN_PRELOAD() macros which create main() function and
call the passed callback subsequently. This is important because
the wrapper which calls the callback eventually does important
stuff like setting logging based on env variables and such.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirt-admin: Introduce client-disconnect command
Erik Skultety [Thu, 28 Apr 2016 08:38:32 +0000 (10:38 +0200)]
virt-admin: Introduce client-disconnect command

Enable the client disconnect within virt-admin. Also, update the man page
accordingly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Introduce virAdmClientClose API
Erik Skultety [Thu, 28 Apr 2016 08:26:25 +0000 (10:26 +0200)]
admin: Introduce virAdmClientClose API

Once we're able to list and identify all clients connected to a specific
server, we can then support force-closing a connection. This patch introduces
a simple API calling virNetServerClientClose on a specific client, which
can be later extended easily, e.g. by sending an event once the client is
disconnected successfully.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Remove flags checking from virAdmConnectOpen public API
Erik Skultety [Thu, 5 May 2016 11:42:52 +0000 (13:42 +0200)]
admin: Remove flags checking from virAdmConnectOpen public API

Unlike the previous commit, we do actually support one client-side only flag
VIR_CONNECT_NO_ALIASES, so besides removing the check for flags this flag
has to be masked out before sending a message to the daemon, otherwise it
would trigger an error when checking flags on the daemon side.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Remove flags checking from public API entry points
Erik Skultety [Thu, 5 May 2016 11:30:42 +0000 (13:30 +0200)]
admin: Remove flags checking from public API entry points

Due to compatibility reasons these should be checked on the server side.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoqemu_hotplug: fix checking graphics ports
Pavel Hrdina [Thu, 28 Apr 2016 15:55:11 +0000 (17:55 +0200)]
qemu_hotplug: fix checking graphics ports

We cannot change ports for running domain and we should error out if
autoport is enabled.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: merge graphics code into qemuProcessSetupGraphics
Pavel Hrdina [Mon, 9 May 2016 12:52:52 +0000 (14:52 +0200)]
qemu_process: merge graphics code into qemuProcessSetupGraphics

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agographics: generate fake ports also for tests
Pavel Hrdina [Mon, 9 May 2016 12:30:27 +0000 (14:30 +0200)]
graphics: generate fake ports also for tests

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: separate graphics port reservation
Pavel Hrdina [Mon, 9 May 2016 12:20:08 +0000 (14:20 +0200)]
qemu_process: separate graphics port reservation

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agouml: only build on Linux
Roman Bogorodskiy [Sun, 8 May 2016 13:31:37 +0000 (16:31 +0300)]
uml: only build on Linux

8 years agoconfigure: split out UML driver checks
Roman Bogorodskiy [Sun, 8 May 2016 13:31:36 +0000 (16:31 +0300)]
configure: split out UML driver checks

Move all the UML driver related routines into m4/virt-driver-uml.m4.

8 years agoconf: don't redefine virDomainCapsDeviceHostdev
Roman Bogorodskiy [Tue, 10 May 2016 04:06:45 +0000 (07:06 +0300)]
conf: don't redefine virDomainCapsDeviceHostdev

Commit 5ed235c6 added unnecessary redifinition of
virDomainCapsDeviceHostdev in conf/domain_capabilities.h. This breaks
build with clang 3.4:

In file included from conf/domain_capabilities.c:25:
conf/domain_capabilities.h:88:44: error: redefinition of typedef
'virDomainCapsDeviceHostdev' is a C11 feature
[-Werror,-Wtypedef-redefinition]
typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
                                           ^
conf/domain_capabilities.h:86:44: note: previous definition is here
typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;

So drop one of those.

8 years agoconf: Fix error path in virNodeDevPCICapabilityParseXML
John Ferlan [Thu, 5 May 2016 22:41:28 +0000 (18:41 -0400)]
conf: Fix error path in virNodeDevPCICapabilityParseXML

If the call to virXPathNodeSet to set naddresses fails, Coverity notes
that the subsequent VIR_ALLOC_N cannot have a negative value (well it
probably wouldn't be negative per se).

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoadmin: Clean up error path in adminServerListClients
John Ferlan [Thu, 5 May 2016 22:32:25 +0000 (18:32 -0400)]
admin: Clean up error path in adminServerListClients

Coverity noted that in adminServerListClients if virNetServerGetClients
returns a -1 into ret, then the call virObjectListFreeCount in cleanup
will not be very happy.

Adjust the code to skip the cleanup label and just return -1 if
virNetServerGetClients fails.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoUse virGetLastErrorMessage to avoid Coverity message
John Ferlan [Thu, 5 May 2016 22:27:00 +0000 (18:27 -0400)]
Use virGetLastErrorMessage to avoid Coverity message

Both instances use VIR_WARN() to print the error from a failed
virDBusGetSystemBus() call.  Rather than use the virGetLastError
and need to check for valid return err pointer, just use the
virGetLastErrorMessage.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: command: unconditionally allow accel3d='no'
Cole Robinson [Sun, 8 May 2016 17:38:56 +0000 (13:38 -0400)]
qemu: command: unconditionally allow accel3d='no'

This matches how we handle spice gl='no' even if spice GL isn't
supported. Not too interesting in practice but I figure we should
be consistent

8 years agodomaincaps: Report video modelType
Cole Robinson [Sun, 8 May 2016 16:11:39 +0000 (12:11 -0400)]
domaincaps: Report video modelType

Requires adding the plumbing for <device><video>
The value is <enum name='modelType'> to match the associated domain
XML of <video><model type='XXX'/>

Wire it up for qemu too

8 years agodomaincaps: Report graphics type enum
Cole Robinson [Sun, 8 May 2016 15:57:20 +0000 (11:57 -0400)]
domaincaps: Report graphics type enum

Requires adding the plumbing for <device><graphics>
Wire it up for qemu too

8 years agoutil: polkit: Fix polkit agent startup
Peter Krempa [Mon, 9 May 2016 09:02:51 +0000 (11:02 +0200)]
util: polkit: Fix polkit agent startup

Commit 0b36b0e9 broke polkit agent startup when attempting to fix a
coverity warning. Refactor it properly so that we don't need the 'cmd'
intermediate variable.

8 years agoqemu: domain: Don't treat unknown storage type as not having backing chain
Peter Krempa [Thu, 5 May 2016 13:25:52 +0000 (15:25 +0200)]
qemu: domain: Don't treat unknown storage type as not having backing chain

qemuDomainCheckDiskPresence has short-circuit code to skip the
determination of the disk backing chain for storage formats that can't
have backing volumes. The code treats VIR_STORAGE_FILE_NONE as not
having backing chain and skips the call to qemuDomainDetermineDiskChain.

This is wrong as qemuDomainDetermineDiskChain is responsible for storage
format detection and has logic to determine the default type if format
detection is disabled.

This allows to storage passed via <disk type="volume"> to circumvent the
enforcement to have correct storage format or that we shall default to
format='raw', since we don't set the default type via the post parse
callback for "volume" backed disks as the translation code could come up
with a better guess.

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

8 years agoqemu: Reject invalid block copy targets for <disk device='lun'>
Peter Krempa [Mon, 2 May 2016 13:26:51 +0000 (15:26 +0200)]
qemu: Reject invalid block copy targets for <disk device='lun'>

Extract the relevant parts of the existing checker and reuse them for
blockcopy since copying to a non-block device creates an invalid
configuration.

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

8 years agoqemu: command: Remove unnecessary label in qemuCheckDiskConfig
Peter Krempa [Mon, 2 May 2016 13:16:50 +0000 (15:16 +0200)]
qemu: command: Remove unnecessary label in qemuCheckDiskConfig

8 years agoconf: Kill now unused virDomainDiskSourceIsBlockType
Peter Krempa [Mon, 2 May 2016 13:07:34 +0000 (15:07 +0200)]
conf: Kill now unused virDomainDiskSourceIsBlockType

8 years agoqemu: command: Use more appropriate checking function for block devices
Peter Krempa [Mon, 2 May 2016 12:57:09 +0000 (14:57 +0200)]
qemu: command: Use more appropriate checking function for block devices

In qemuCheckDiskConfig would now use virDomainDiskSourceIsBlockType just
as a glorified version of virStorageSourceIsBlockLocal that reports
error messages. Replace it with the latter including the message for
clarity.

8 years agoqemu: Support <disk device='lun'> for iSCSI direct mapped volumes
Peter Krempa [Mon, 2 May 2016 12:47:18 +0000 (14:47 +0200)]
qemu: Support <disk device='lun'> for iSCSI direct mapped volumes

Commit c820fbff9fbfe1f2549a5b60967496587f8d8bfc added support for iSCSI
disk as backing for <disk device='lun'>. We would not use it for a disk
type="volume" with direct access mode which basically maps to direct
iSCSI usage. Fix it by adding the storage source type accessor that
resolves the volume type.