]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agobhyve: implement virConnectIsSecure
Fabian Freyer [Tue, 17 May 2016 12:49:21 +0000 (14:49 +0200)]
bhyve: implement virConnectIsSecure

Trivially return 1, since bhyve is considered a local connection that
should not be vulnerable to eavesdropping.

8 years agobhyve: Implement virConnectIsEncrypted
Fabian Freyer [Tue, 17 May 2016 12:49:20 +0000 (14:49 +0200)]
bhyve: Implement virConnectIsEncrypted

Being a local connection, bhyve does not support encryption. Therefore
trivially return 0.

8 years agospec: Remove %defattr usage
Cole Robinson [Sun, 15 May 2016 21:31:42 +0000 (17:31 -0400)]
spec: Remove %defattr usage

It was only needed for rpm versions that are much older than our
minimally supported distro

Some more details here: https://fedorahosted.org/fpc/ticket/77

8 years agoRevert "vz: handle sourceless cdroms"
Maxim Nestratov [Tue, 17 May 2016 12:11:35 +0000 (15:11 +0300)]
Revert "vz: handle sourceless cdroms"

This reverts commit 071fe092.
It was committed by a mistake and correct patch was committed
earlier as baad90fb.

8 years agoqemu: hotplug: Report error if we hit tray status timeout
Cole Robinson [Mon, 2 May 2016 23:07:34 +0000 (19:07 -0400)]
qemu: hotplug: Report error if we hit tray status timeout

If we exceed the timeout waiting for the tray status to change,
we don't report an error. Fix it

8 years agodocs: formatdomain: document virtio-mmio device addresses
Cole Robinson [Sun, 15 May 2016 21:58:19 +0000 (17:58 -0400)]
docs: formatdomain: document virtio-mmio device addresses

8 years agoadmin: include: Rename argument dmn to conn in virAdmConnectListServers
Erik Skultety [Tue, 17 May 2016 10:39:02 +0000 (12:39 +0200)]
admin: include: Rename argument dmn to conn in virAdmConnectListServers

This is just a trivial cosmetic change, throughout all the APIs the argument
is called conn as from 'connection', having 'dmn' at just this single place
might look odd, so better change it now when the interface is still explicitly
disabled and we still have the ability to alter the signatures and public
names before officially enabling it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovz: make error path code idiomatic
Nikolay Shirokovskiy [Fri, 8 Apr 2016 07:41:36 +0000 (10:41 +0300)]
vz: make error path code idiomatic

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: fix template ct creation
Mikhail Feoktistov [Fri, 8 Apr 2016 07:41:35 +0000 (10:41 +0300)]
vz: fix template ct creation

First we don't need to add disk in this case. Second flag should
be skipped.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: fix error message for readonly fs
Nikolay Shirokovskiy [Fri, 8 Apr 2016 07:41:34 +0000 (10:41 +0300)]
vz: fix error message for readonly fs

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: handle sourceless cdroms
Mikhail Feoktistov [Fri, 8 Apr 2016 07:41:33 +0000 (10:41 +0300)]
vz: handle sourceless cdroms

SDK handles empty cdroms all right. We just need to
pass "" instead of NULL (not setting is good too).

However we can get problems here. Disk detaching treats source
as ids. Fortunately disk detaching is not supported for cdroms
yet and for hard disks we can not get empty source - this is prohibitited
by xml parsing code.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: fix vzCheckUnsupportedDisks format checks for cdroms
Nikolay Shirokovskiy [Fri, 8 Apr 2016 07:41:32 +0000 (10:41 +0300)]
vz: fix vzCheckUnsupportedDisks format checks for cdroms

Current version of the function does not check format of cdroms at all.
At the same time prlsdkGetDiskInfo give hints that cdroms always
have format VIR_STORAGE_FILE_RAW. So fix vzCheckUnsupportedDisks.

About structure of checks. As we don't have means to store format
in SDK we always have only one format in every situation. So instead
of setting boolean let's get allowed format instead and finally compare
it to the requested. This structure of checks seems stable to me
because we have only one format in every situation.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: remove check for auto file format for disks
Nikolay Shirokovskiy [Fri, 8 Apr 2016 07:41:31 +0000 (10:41 +0300)]
vz: remove check for auto file format for disks

VIR_STORAGE_FILE_AUTO can not be set from xml description.
At the same time we don't set disks format to this value
as for example qemu does. Thus this we can never get this
value in format.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agodomain_conf: cleanup virDomainGraphicsListenDefParseXML
Pavel Hrdina [Mon, 2 May 2016 12:49:38 +0000 (14:49 +0200)]
domain_conf: cleanup virDomainGraphicsListenDefParseXML

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agographics: make address attribute for listen type='address' optional
Pavel Hrdina [Mon, 9 May 2016 13:50:54 +0000 (15:50 +0200)]
graphics: make address attribute for listen type='address' optional

We support omitting listen attribute of graphics element so we should
also support omitting address attribute of listen element.  This patch
also updates libvirt to always add a listen element into domain XML
except for VNC graphics if socket attribute is specified.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agodomain_conf: parse listen attribute while parsing listen elements
Pavel Hrdina [Fri, 6 May 2016 12:54:59 +0000 (14:54 +0200)]
domain_conf: parse listen attribute while parsing listen elements

Move the compatibility code out of virDomainGraphicsListensParseXML()
into virDomainGraphicsListenDefParseXML().  This also fixes a small
inconsistency between the code and error message itself.

Before this patch we would search first listen element that is
type='address' to validate listen and address attributes. After this
patch we always take the first listen element regardless of the type.

This shouldn't break anything since all drivers supports only one
listen.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agographics: don't parse listens if socket attribute is present
Pavel Hrdina [Fri, 29 Apr 2016 10:19:03 +0000 (12:19 +0200)]
graphics: don't parse listens if socket attribute is present

If socket attribute is present we start VNC that listens only on that
unix socket.  This makes the parser behave the same way as we actually
use the socket attribute.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconf: Allow all volume modes for disk type='lun' sources
Peter Krempa [Wed, 11 May 2016 08:25:24 +0000 (10:25 +0200)]
conf: Allow all volume modes for disk type='lun' sources

Commit 82ba41108acd0f3f made possible to use direct mapped iSCSI
volumes in qemu as disk sources but didn't remove the define time check.

Rework the check by simplifying the condition and allow any volumes to
be used with disk type='lun'.

8 years agoqemu: Drop QEMU_CAPS_VIRTIO_BLK_SG_IO
Andrea Bolognani [Mon, 16 May 2016 08:29:57 +0000 (10:29 +0200)]
qemu: Drop QEMU_CAPS_VIRTIO_BLK_SG_IO

The only QEMU versions that don't have such capability are <0.11,
which we no longer support anyway

8 years agoqemu: Drop QEMU_CAPS_CPU_HOST
Andrea Bolognani [Mon, 16 May 2016 08:08:29 +0000 (10:08 +0200)]
qemu: Drop QEMU_CAPS_CPU_HOST

The only QEMU versions that don't have such capability are <0.11,
which we no longer support anyway

8 years agoqemu: Drop QEMU_CAPS_PCI_ROMBAR
Andrea Bolognani [Mon, 16 May 2016 07:51:42 +0000 (09:51 +0200)]
qemu: Drop QEMU_CAPS_PCI_ROMBAR

The only QEMU versions that don't have such capability are <0.12,
which we no longer support anyway.

Additionally, this solves the issue of some QEMU binaries being
reported as not having such capability just because they lacked
the {kvm-}pci-assign QMP object.

8 years agolibxl: Free migration cookie
John Ferlan [Mon, 16 May 2016 12:20:46 +0000 (08:20 -0400)]
libxl: Free migration cookie

Commit id 'f9edcfa4' added cookie manipulation for libxl; however, some
cookie crumb cleanup was missed. Found by Coverity.

In libxlDomainMigrationBegin, the cookie is allocated and baked; however,
the mig ingredients weren't cleaned up.

In libxlDomainMigrationPrepare, when the 'mig' cookie is added to the
args, set the 'mig = NULL'; otherwise, other failure paths between when
the code ate the cookie data and when it was added to args would fail
to clean up the crumbs.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: More qemu_monitor_json cleanups
John Ferlan [Mon, 16 May 2016 11:47:26 +0000 (07:47 -0400)]
qemu:  More qemu_monitor_json cleanups

Recent adjustments to the code produced a litany of coverity false
positives, but only because the "standard" procedure of setting a
variable to NULL after it was assigned to something else and keeping
the *Free/*FREE call in the cleanup path wasn't kept. So this patch
makes those adjustments (assign variable to NULL and remove the if
'ret < 0' condition to clean it up).

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agobhyve: implement virConnectIsAlive
Fabian Freyer [Fri, 13 May 2016 19:22:57 +0000 (21:22 +0200)]
bhyve: implement virConnectIsAlive

bhyve connections are local, and a "connection will be classed as alive
if it is [...] local".

8 years agoqemu: command: Use -name guest= if available
Cole Robinson [Fri, 22 Apr 2016 22:39:09 +0000 (18:39 -0400)]
qemu: command: Use -name guest= if available

-name guest= is the explicit parameter for passing a VM name. Using
it is required to allow a VM with an '=' in the name

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

8 years agoqemu: command: escape commas in chardev socket path
Cole Robinson [Fri, 22 Apr 2016 22:27:44 +0000 (18:27 -0400)]
qemu: command: escape commas in chardev socket path

After this, a default virt-manager VM will startup with a comma
in the VM name:

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

8 years agoqemu: command: escape commas in VNC socket path
Cole Robinson [Sun, 8 May 2016 18:33:50 +0000 (14:33 -0400)]
qemu: command: escape commas in VNC socket path

This path can be dependent on the VM libdir, which contains its name

8 years agoqemu: command: escape commas in secret master path
Cole Robinson [Fri, 22 Apr 2016 22:22:05 +0000 (18:22 -0400)]
qemu: command: escape commas in secret master path

Need to convert the local function to virBuffer usage, so we
can use qemuBufferEscapeComma

8 years agoqemu: command: escape commas in VM name
Cole Robinson [Fri, 22 Apr 2016 14:40:57 +0000 (10:40 -0400)]
qemu: command: escape commas in VM name

This isn't sufficient on its own, since the VM name is used for things
like monitor paths, which we don't escape yet

8 years agoqemu: command: Add qemuBufferEscapeComma
Cole Robinson [Sun, 8 May 2016 18:22:13 +0000 (14:22 -0400)]
qemu: command: Add qemuBufferEscapeComma

Centralize the magic invocation for escaping commas on the qemu
command line, and document it a bit

8 years agoqemu: alias: Remove QEMU_CAPS_DEVICE
Cole Robinson [Sun, 15 May 2016 21:24:54 +0000 (17:24 -0400)]
qemu: alias: Remove QEMU_CAPS_DEVICE

QEMU_CAPS_DEVICE is always set nowadays, so drop code that depends
on not-DEVICE

8 years agoadmin: Fix passing an incorrect readonly attribute to virNetServerServiceNew
Erik Skultety [Sat, 14 May 2016 17:10:39 +0000 (19:10 +0200)]
admin: Fix passing an incorrect readonly attribute to virNetServerServiceNew

When registering admin UNIX socket, a new service is created for it. This
service is incorrectly initialized to be readonly, which is later inherited by
all clients connected to the socket. In libvirt-admin's case there currently
isn't any use for the attribute anyway, but since the socket has root-only
access permissions, the least we can do is to make every admin client
connected to it report readonly as false.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agocpu: Properly report errors when parsing CPU map XML
Jiri Denemark [Fri, 13 May 2016 16:27:09 +0000 (18:27 +0200)]
cpu: Properly report errors when parsing CPU map XML

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Check vendor early
Jiri Denemark [Thu, 12 May 2016 14:02:09 +0000 (16:02 +0200)]
cpu_x86: Check vendor early

When searching for the best CPU model for CPUID data we can easily
ignore models with non-matching vendor before spending time on CPUID
data to virCPUDef conversion.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Don't ignore parsing errors in x86ModelLoad
Jiri Denemark [Thu, 12 May 2016 13:34:27 +0000 (15:34 +0200)]
cpu_x86: Don't ignore parsing errors in x86ModelLoad

CPU map XML is our internal data file, it makes no sense to tolerate any
errors in it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Don't ignore parsing errors in x86FeatureLoad
Jiri Denemark [Thu, 12 May 2016 13:30:45 +0000 (15:30 +0200)]
cpu_x86: Don't ignore parsing errors in x86FeatureLoad

CPU map XML is our internal data file, it makes no sense to tolerate any
errors in it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Don't ignore parsing errors in x86VendorLoad
Jiri Denemark [Thu, 12 May 2016 13:29:49 +0000 (15:29 +0200)]
cpu_x86: Don't ignore parsing errors in x86VendorLoad

CPU map XML is our internal data file, it makes no sense to tolerate any
errors in it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Simplify insertions into a linked list
Jiri Denemark [Thu, 12 May 2016 13:18:26 +0000 (15:18 +0200)]
cpu_x86: Simplify insertions into a linked list

The next pointer is initialized to NULL, overwriting to with another
NULL doesn't hurt.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Remove comparisons to NULL
Jiri Denemark [Thu, 12 May 2016 13:06:25 +0000 (15:06 +0200)]
cpu_x86: Remove comparisons to NULL

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Use for loop in x86Decode
Jiri Denemark [Thu, 12 May 2016 12:53:31 +0000 (14:53 +0200)]
cpu_x86: Use for loop in x86Decode

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename cleanup labels
Jiri Denemark [Thu, 12 May 2016 12:52:26 +0000 (14:52 +0200)]
cpu_x86: Rename cleanup labels

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Compare CPU candidates in a separate function
Jiri Denemark [Thu, 12 May 2016 12:50:17 +0000 (14:50 +0200)]
cpu_x86: Compare CPU candidates in a separate function

Splitting the comparison into a separate function makes the code cleaner
and easier to update in the future.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename struct virCPUx86DataIterator
Jiri Denemark [Wed, 11 May 2016 10:39:15 +0000 (12:39 +0200)]
cpu_x86: Rename struct virCPUx86DataIterator

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename enum compare_result
Jiri Denemark [Wed, 11 May 2016 10:36:43 +0000 (12:36 +0200)]
cpu_x86: Rename enum compare_result

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename struct x86_map
Jiri Denemark [Wed, 11 May 2016 10:30:04 +0000 (12:30 +0200)]
cpu_x86: Rename struct x86_map

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename struct x86_model
Jiri Denemark [Wed, 11 May 2016 10:03:48 +0000 (12:03 +0200)]
cpu_x86: Rename struct x86_model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename struct x86_kvm_feature
Jiri Denemark [Wed, 11 May 2016 09:59:29 +0000 (11:59 +0200)]
cpu_x86: Rename struct x86_kvm_feature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename struct x86_feature
Jiri Denemark [Wed, 11 May 2016 09:56:14 +0000 (11:56 +0200)]
cpu_x86: Rename struct x86_feature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Rename struct x86_vendor
Jiri Denemark [Wed, 11 May 2016 08:47:21 +0000 (10:47 +0200)]
cpu_x86: Rename struct x86_vendor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: command: Ignore QEMU_CAPS_DEVICE when building drive alias
Cole Robinson [Sun, 15 May 2016 20:33:27 +0000 (16:33 -0400)]
qemu: command: Ignore QEMU_CAPS_DEVICE when building drive alias

QEMU_CAPS_DEVICE is always set nowadays, so we can drop the
non-DEVICE code paths

8 years agocpuGetModels: Fix memory leak on error
Jiri Denemark [Fri, 29 Apr 2016 08:43:31 +0000 (10:43 +0200)]
cpuGetModels: Fix memory leak on error

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Add support for clflushopt and tsc_adjust Intel features
Alexander Burluka [Sat, 14 May 2016 10:06:56 +0000 (13:06 +0300)]
cpu: Add support for clflushopt and tsc_adjust Intel features

Corresponding QEMU commits:
    clflushopt f7fda280948a5e74aeb076ef346b991ecb173c56
    tsc_adjust 7b458bfd12a71b3da6b531daedc417492c9334e0

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
8 years agosecret: Alter virSecretGetSecretString
John Ferlan [Thu, 12 May 2016 15:43:39 +0000 (11:43 -0400)]
secret: Alter virSecretGetSecretString

Rather than returning a "char *" indicating perhaps some sized set of
characters that is NUL terminated, alter the function to return 0 or -1
for success/failure and add two parameters to handle returning the
buffer and it's size.

The function no longer encodes the returned secret, rather it returns
the unencoded secret forcing callers to make the necessary adjustments.

Alter the callers to handle the adjusted model.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: domain: Fix names for functions that clear security info
Peter Krempa [Fri, 13 May 2016 14:46:47 +0000 (16:46 +0200)]
qemu: domain: Fix names for functions that clear security info

They don't free the structure itself so they should be called *Clear
rather than *Free.

8 years agoutil: string: Introduce helper to determine whether a byte buffer is printable
John Ferlan [Thu, 12 May 2016 15:43:39 +0000 (11:43 -0400)]
util: string: Introduce helper to determine whether a byte buffer is printable

Signed-off-by: John Ferlan <jferlan@redhat.com>
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>