Commit Graph

22793 Commits

Author SHA1 Message Date
Andrea Bolognani
8531b85ba6 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.
2016-05-17 00:01:45 +02:00
John Ferlan
1222a3032b 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>
2016-05-16 13:41:17 -04:00
John Ferlan
52760707bc 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>
2016-05-16 13:41:10 -04:00
Fabian Freyer
a1efc9428b bhyve: implement virConnectIsAlive
bhyve connections are local, and a "connection will be classed as alive
if it is [...] local".
2016-05-16 19:19:49 +03:00
Cole Robinson
e3a6859019 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
2016-05-16 10:30:38 -04:00
Cole Robinson
7dbbc0ca07 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
2016-05-16 10:30:38 -04:00
Cole Robinson
077ba95677 qemu: command: escape commas in VNC socket path
This path can be dependent on the VM libdir, which contains its name
2016-05-16 10:30:38 -04:00
Cole Robinson
3153ac08c9 qemu: command: escape commas in secret master path
Need to convert the local function to virBuffer usage, so we
can use qemuBufferEscapeComma
2016-05-16 10:30:38 -04:00
Cole Robinson
0f377eb1b0 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
2016-05-16 10:30:38 -04:00
Cole Robinson
53d976b63a qemu: command: Add qemuBufferEscapeComma
Centralize the magic invocation for escaping commas on the qemu
command line, and document it a bit
2016-05-16 10:30:38 -04:00
Cole Robinson
ef2c82170f qemu: alias: Remove QEMU_CAPS_DEVICE
QEMU_CAPS_DEVICE is always set nowadays, so drop code that depends
on not-DEVICE
2016-05-16 10:29:39 -04:00
Erik Skultety
e54b81604d 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>
2016-05-16 16:26:47 +02:00
Jiri Denemark
5b62a95176 cpu: Properly report errors when parsing CPU map XML
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:30 +02:00
Jiri Denemark
17924643ec 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>
2016-05-16 15:46:30 +02:00
Jiri Denemark
1cc9a1d07c 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>
2016-05-16 15:46:29 +02:00
Jiri Denemark
49da4cf168 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>
2016-05-16 15:46:29 +02:00
Jiri Denemark
db8a1873fb 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>
2016-05-16 15:46:29 +02:00
Jiri Denemark
945776dbc6 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>
2016-05-16 15:46:28 +02:00
Jiri Denemark
26bfa2a63b cpu_x86: Remove comparisons to NULL
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:28 +02:00
Jiri Denemark
aa9e0ef0ef cpu_x86: Use for loop in x86Decode
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:28 +02:00
Jiri Denemark
2085f9a514 cpu_x86: Rename cleanup labels
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:27 +02:00
Jiri Denemark
ea51e6a045 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>
2016-05-16 15:46:27 +02:00
Jiri Denemark
5b991c44ed cpu_x86: Rename struct virCPUx86DataIterator
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:27 +02:00
Jiri Denemark
5778daf7db cpu_x86: Rename enum compare_result
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:26 +02:00
Jiri Denemark
bc01151a03 cpu_x86: Rename struct x86_map
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:26 +02:00
Jiri Denemark
449e2d43cc cpu_x86: Rename struct x86_model
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:26 +02:00
Jiri Denemark
44f9cf6c04 cpu_x86: Rename struct x86_kvm_feature
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:25 +02:00
Jiri Denemark
3925e073f1 cpu_x86: Rename struct x86_feature
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:25 +02:00
Jiri Denemark
49ecf3da24 cpu_x86: Rename struct x86_vendor
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 15:46:25 +02:00
Cole Robinson
c7d6c13989 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
2016-05-16 08:59:35 -04:00
Jiri Denemark
afdb3fc901 cpuGetModels: Fix memory leak on error
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 13:21:43 +02:00
Alexander Burluka
2b140f0cae 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>
2016-05-16 13:19:12 +02:00
John Ferlan
abd2272c02 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>
2016-05-16 12:58:48 +02:00
Peter Krempa
fb1dddfb00 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.
2016-05-16 12:58:48 +02:00
John Ferlan
1cf5af40b9 util: string: Introduce helper to determine whether a byte buffer is printable
Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-05-16 12:58:48 +02:00
Peter Krempa
cb2e3e50ee util: string: Introduce virStringEncodeBase64
Add a new helper that sanitizes error semantics of base64_encode_alloc.
2016-05-16 12:58:48 +02:00
Peter Krempa
1d632c3924 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).
2016-05-16 12:58:48 +02:00
Peter Krempa
eb2116fd9a 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.
2016-05-16 12:58:48 +02:00
Jiri Denemark
ced1e846a0 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>
2016-05-16 10:42:28 +02:00
Jiri Denemark
1522503189 qemuaincapstest: Give better names to test data files
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 10:37:29 +02:00
Jiri Denemark
9ac9b039c4 domaincapstest: Give better names to test data files
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 10:37:29 +02:00
Jiri Denemark
8ba37e7a6e domaincapstest: Use arch strings
They are shorter and most of the code requires the strings anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 10:37:29 +02:00
Michal Privoznik
4b3a46ca6a 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>
2016-05-14 09:46:44 +02:00
Michal Privoznik
6326865e6b 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>
2016-05-14 09:46:23 +02:00
Michal Privoznik
47d2dc831a 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>
2016-05-14 09:30:25 +02:00
Michal Privoznik
86d1705a8a 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>
2016-05-14 09:25:56 +02:00
Michal Privoznik
a1ffedc682 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>
2016-05-14 09:22:12 +02:00
Michal Privoznik
ca88c0e7b2 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>
2016-05-14 09:19:51 +02:00
Michal Privoznik
d16b7a8853 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>
2016-05-14 09:18:14 +02:00
Michal Privoznik
57c484dbac 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>
2016-05-14 09:10:40 +02:00