Commit Graph

23004 Commits

Author SHA1 Message Date
Jiri Denemark
3704b9003f tests: Add CPU detection tests
So far we only test CPUID -> CPU def conversion on artificial CPUID data
computed from another CPU def. This patch adds the infrastructure to
test this conversion on real data gathered from a host CPU and two
helper scripts for adding new test data:

- cpu-gather.sh runs cpuid tool and qemu-system-x86_64 to get CPUID data
  from the host CPU; this is what users can be asked to run if they run
  into an issue with host CPU detection in libvirt

- cpu-parse.sh takes the data generated by cpu-gather.sh and creates
  data files for CPU detection tests

The CPUID data queried from QEMU will eventually switch to the format
used by query-host-cpu QMP command once QEMU implements it. Until then
we just spawn QEMU with -cpu host and query the guest CPU in QOM. They
should both provide the same CPUID results, but query-host-cpu does not
require any guest CPU to be created by QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
a54234c37b cpu_x86: Refactor internal KVM features
The internal features are only used in explicit checks with
cpuHasFeature. Loading them into the CPU map is dangerous since the
features may accidentally be reported to users when decoding CPUID data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
74b23a00eb cpu_ppc64: Avoid unnecessary pointer to virCPUppc64Data
virCPUData and struct ppc64_model structures contained a pointer to
virCPUppc64Data, which was not very nice since the real data were
accessible by yet another level of pointers from virCPUppc64Data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
9ea32aecb4 cpu_x86: Avoid unnecessary pointers to virCPUx86Data
virCPUData, virCPUx86Feature, and virCPUx86Model all contained a pointer
to virCPUx86Data, which was not very nice since the real CPUID data were
accessible by yet another pointer from virCPUx86Data. Moreover, using
virCPUx86Data directly will make static definitions of internal CPU
features a bit easier.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
474e627892 tests: Create simple monitor in qemuMonitorTestNewFromFile
The current version uses the first JSON reply from the file as monitor
greeting. With the new parameter the caller can now request a simple
test monitor to be created, which uses an artificial greeting and uses
all JSON strings from the file as regular replies.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
08529e1e27 tests: Fix "Reponse" typo
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
2dcacc0ecf tests: Introduce qemuMonitorTestNewFromFile
It's a convenient wrapper around qemuMonitorTestNew which feeds the test
monitor with QMP replies from a specified file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
2a8d40f4ec qemu: Refactor qemuMonitorJSONGetCPUx86Data
This patch splits qemuMonitorJSONGetCPUx86Data in three functions:

- qemuMonitorJSONCheckCPUx86 checks if QEMU supports reporting CPUID
  features for a guest CPU

- qemuMonitorJSONParseCPUx86Features parses CPUID features from a JSON
  array

- qemuMonitorJSONGetCPUx86Data gets the requested guest CPU property
  from QOM and uses qemuMonitorJSONParseCPUx86Features to parse it

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
90f4bc34b5 cpu_x86: Rename CPUID function to eax_in
CPUID instruction normally takes its parameter from EAX, but sometimes
ECX is used as an additional parameter. Let's rename 'function' to
'eax_in' in preparation for adding 'ecx_in'.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
7ab88767a7 cpu: Detect arch when parsing CPU data
A CPU data XML file already contains the architecture, let the parser
use it to detect which CPU driver should be used to parse the rest of
the file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
a68ab347d5 cpu_x86: Fix CPU data parser
The formatter uses /cpudata/cpuid elements and the parser should really
do the same.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
fc4ee3e674 cpu_x86: Propagate vendor to guest's virCPUData
When computing CPU data for a given guest CPU we should set CPUID vendor
bits appropriately so that we don't lose the vendor when transforming
CPU data back to XML description.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Pavel Hrdina
b1f6792cb6 virsh-domain: fix memory leak in cmdDomDisplay
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 09:14:32 +02:00
Ján Tomko
378ef3df57 Fix typo in virNetDevGetEthtoolGFeatures stub
s/ATTRIBUGE/ATTRIBUTE/

Reported-by: Olaf Hering <olaf@aepfle.de>
2016-06-09 08:45:14 +02:00
Tomáš Ryšavý
1a41ed5af5 tests: Rename virtTestMain to virTestMain.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:13 -04:00
Tomáš Ryšavý
6151dc2f55 tests: Rename virtTestErrorFuncQuiet to virTestErrorFuncQuiet.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:13 -04:00
Tomáš Ryšavý
f5444742b0 tests: Rename virtTestCounterNext to virTestCounterNext.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:13 -04:00
Tomáš Ryšavý
75f7309468 tests: Rename virtTestCaptureProgramOutput to virTestCaptureProgramOutput.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:13 -04:00
Tomáš Ryšavý
65979e5b62 tests: Rename virtTestDifferenceBin to virTestDifferenceBin.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
b468e8ba0b tests: Rename virtTestCaptureProgramExecChild to virTestCaptureProgramExecChild.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
5d36423993 tests: Rename virtTestDifferenceFullInternal to virTestDifferenceFullInternal.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
9b8ff67fc0 tests: Rename virtTestDifferenceFullNoRegenerate.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
1ff86b408a tests: Rename virtTestQuiesceLibvirtErrors to virTestQuiesceLibvirtErrors.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
c2f36506b7 tests: Rename virtTestUseTerminalColors to virTestUseTerminalColors.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
d77e453a01 tests: Rename virtTestLogContentAndReset to virTestLogContentAndReset.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
327b844341 tests: Rename virtTestCounterReset to virTestCounterReset.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
8a48cf6efa tests: Rename virtTest00MActive to virTest00MActive.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
8a9bd034c2 tests: Rename virtTestClearCommandPath to virTestClearCommandPath.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
753edcb3a4 Rename virtTestDifferenceFull to virTestDifferenceFull.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
239caffb1d tests: Rename virtTestCompareToFile to virTestCompareToFile.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
401bb813bd Rename virtTestLoadFile to virTestLoadFile.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
062ea148a0 Rename virtTestDifference to virTestDifference.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Tomáš Ryšavý
cd7dd1508d tests: Rename virtTestRun to virTestRun.
This function doesn't follow our convention of naming functions.
2016-06-08 11:23:12 -04:00
Ján Tomko
09b406a756 virschematest: call va_end even on OOM
Jump to cleanup if virAsprintf fails.
2016-06-08 16:33:26 +02:00
Jovanka Gulicoska
609ba3a751 node_device: Replace VIR_ERROR with standard vir*Error in state driver init 2016-06-08 10:19:32 -04:00
Michal Privoznik
5ec2b0cca5 virsh-network: Avoid possible NULL deref in cmdNetworkDHCPLeases
Problem is, localtime_r() returns a pointer to converted time or
NULL in case of an error. But checking the glibc sources, error
will occur iff a NULL has been passed as an either of arguments
the function takes. But GCC fails to see that:

../../tools/virsh-network.c: In function 'cmdNetworkDHCPLeases':
../../tools/virsh-network.c:1370:12: error: potential null pointer dereference [-Werror=null-dereference]
         ts = *localtime_r(&expirytime_tmp, &ts);
         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-08 15:56:08 +02:00
Ján Tomko
e4fd42d87b lxc: simplify lxcDomainGetBlkioParameters
Replace all the repetitive code by using
virDomainGetBlkioParametersAssignFromDef, similar to what commit 9f50f6e
did in the qemu driver.
2016-06-08 15:25:35 +02:00
Ján Tomko
32e6339c19 Export virDomainGetBlkioParametersAssignFromDef
Move qemuDomainGetBlkioParametersAssignFromDef into domain_conf
and export it, to allow reuse in the LXC driver.
2016-06-08 15:23:44 +02:00
Ján Tomko
e74bbe5caf Use virDomainObjGetDefs in lxcDomainGetBlkioParameters 2016-06-08 15:23:44 +02:00
Ján Tomko
f62e4f2091 Use virDomainObjGetDefs in lxcDomainSetBlkioParameters
Remove yet another usage of virDomainLiveConfigHelperMethod
along with an sa_assert that helped clang understand the code flow.
2016-06-08 15:23:44 +02:00
Ján Tomko
a4b1371803 Use virDomainObjGetDefs in lxcDomainGetMemoryParameters
Instead of virDomainLiveConfigHelperMethod.
2016-06-08 15:23:40 +02:00
Ján Tomko
c643910486 Use virDomainObjGetDefs in lxcDomainGetSchedulerParametersFlags
On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.
2016-06-08 15:22:36 +02:00
Ján Tomko
1ca45c8fb5 Use virDomainObjGetDefs in lxcDomainSetSchedulerParametersFlags
On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.
2016-06-08 15:22:00 +02:00
Ján Tomko
15654cc594 Use virDomainObjGetDefs in lxcDomainSetMemoryFlags
On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.
2016-06-08 15:21:57 +02:00
Ján Tomko
c646cd742a lxc: rename vmdef to persistentDef
A few functions using virDomainLiveConfigHelperMethod use the generic
name 'vmdef' to point to the persistent definition.

Use persistentDef and/or persistentDefCopy to make its purpose obvious.
2016-06-08 15:20:35 +02:00
Daniel P. Berrange
8dfb796080 Use @SYSTEM priority for TLS on Fedora >= 21
In Fedora >= 21, there is a new crypto priority framework
that sets TLS policies globally for all apps. To activate
this with GNUTLS we must request "@SYSTEM" instead of
the traditional "NORMAL" string. The '@' causes gnutls todo
a lookup in its config file for the 'SYSTEM' keyword entry.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:46 +01:00
Daniel P. Berrange
6d310c9cff remote: allow TLS priority to be customized
Support reading the TLS priority from the client configuration
file via the "tls_priority" config option, eg

 $ cat $HOME/.config/libvirt/libvirt.conf
 tls_priority="NORMAL:-VERS-SSL3.0"

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
5f1837eaca Pass config file object through to driver open methods
The virConnectOpenInternal method opens the libvirt client
config file and uses it to resolve things like URI aliases.

There may be driver specific things that are useful to
store in the config file too, so rather than have them
re-parse the same file, pass the virConfPtr down to the
drivers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
416358d99d remote: allow TLS protocol/cipher priority override in URI
Add support for a "tls_priority" URI parameter in remote
driver URIs. eg

 qemu+tls://localhost/session?tls_priority=NORMAL:-VERS-SSL3.0

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
c7d0fbe62b libvirtd: add config option for TLS priority
Add a "tls_priority" config option to /etc/libvirt/libvirtd.conf
to allow the administrator to override the built-in default
setting. This only affects the server side configuration.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00