]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agovirt-login-shell: mark as Linux only
Roman Bogorodskiy [Sun, 12 Jun 2016 09:05:57 +0000 (12:05 +0300)]
virt-login-shell: mark as Linux only

Currently, virt-login-shell is not allowed to build on Windows.
However, as it's designed around LXC, it does not make sense to
build it on anything but Linux, so make the check stricter and allow to
enable it on Linux only.

8 years agoapparmor: Don't scrub environment of virtlogd process
Guido Günther [Sat, 11 Jun 2016 19:22:00 +0000 (21:22 +0200)]
apparmor: Don't scrub environment of virtlogd process

otherwise we drop variables like XDG_RUNTIME_DIR with qemu:///session
and libvirtd faild to find virtlogd's socket.

8 years agobhyve: fix bhyvexml2arg test
Roman Bogorodskiy [Sun, 12 Jun 2016 08:01:50 +0000 (11:01 +0300)]
bhyve: fix bhyvexml2arg test

Don't use duplicating target dev names.

8 years agobhyve: add missing virhost(cpu|mem).h headers
Roman Bogorodskiy [Sun, 12 Jun 2016 07:56:11 +0000 (10:56 +0300)]
bhyve: add missing virhost(cpu|mem).h headers

8 years agohostcpu: fix build on FreeBSD
Roman Bogorodskiy [Sun, 12 Jun 2016 07:53:23 +0000 (10:53 +0300)]
hostcpu: fix build on FreeBSD

 * Fix misspelt function name:
    s/virHostCPUGetStatsFreebsd/virHostCPUGetStatsFreeBSD/
 * Mark the first argument to virHostCPUGetInfo with ATTRIBUTE_UNUSED
   as it's not actually used on non-Linux

8 years agonodeinfo: fix build on non-Linux
Roman Bogorodskiy [Sun, 12 Jun 2016 07:33:17 +0000 (10:33 +0300)]
nodeinfo: fix build on non-Linux

SYSFS_SYSTEM_PATH is only defined for Linux, however it's used outside
of #ifdef __linux__ code, e.g. as the first argument to
nodeCapsInitNUMAFake().

But as this argument's value is used on Linux only, it's safe to define
SYSFS_SYSTEM_PATH to "fake" to get things built on FreeBSD.

8 years agovz: fix crash when parsing unexpected disk configuration
Maxim Nestratov [Mon, 6 Jun 2016 15:54:23 +0000 (18:54 +0300)]
vz: fix crash when parsing unexpected disk configuration

As it turned out PrlVmDev_GetStackIndex can return negative values
without reporting an error, which is incorrect but nevertheless.
After that we feed this negative index to virIndexToDiskName,
which in turn returns NULL and we set it to virDomainDiskDef.dst.
Using virDiskNameToBusDeviceIndex with a virDomainDiskDef structure
which has NULL dst field crashes.
Fix this by returning an error in prlsdkGetDiskId in such cases.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: implementation of domainSetUserPassword callback
Mikhail Feoktistov [Fri, 27 May 2016 15:16:34 +0000 (11:16 -0400)]
vz: implementation of domainSetUserPassword callback

8 years agovz: return correct result for unimplemented ChangeState actions
Maxim Nestratov [Thu, 26 May 2016 09:15:21 +0000 (12:15 +0300)]
vz: return correct result for unimplemented ChangeState actions

Map PRL_ERR_UNIMPLEMENTED to VIR_ERR_OPERATION_INVALID

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: remove unused macro logPrlEventError
Maxim Nestratov [Thu, 26 May 2016 08:53:08 +0000 (11:53 +0300)]
vz: remove unused macro logPrlEventError

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: keep subscription to performance events thru domain lifetime
Nikolay Shirokovskiy [Fri, 3 Jun 2016 07:11:44 +0000 (10:11 +0300)]
vz: keep subscription to performance events thru domain lifetime

The approach of subscribing on first stat API call and then waiting
for receiving of performance event from sdk to process the call originates
in times when every vz libvirt connections spawns its own sdk connection.
Thus without this waiting virsh stat call would return empty stats. Now
with single sdk connection this scheme is unnecessary complicated.

This patch subscribes to performance events on first domain appearence
and unsubscribe on its removing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: use consistent naming for different domain object in vz_driver.c
Nikolay Shirokovskiy [Fri, 3 Jun 2016 07:11:43 +0000 (10:11 +0300)]
vz: use consistent naming for different domain object in vz_driver.c

Naming scheme is next:

virDomainPtr domain;
virDomainObjPtr dom;

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agodomain_conf: silence gcc warnings
Pavel Hrdina [Fri, 10 Jun 2016 17:09:29 +0000 (19:09 +0200)]
domain_conf: silence gcc warnings

../../src/conf/domain_conf.c:10949: error: declaration of 'socket'
shadows a global declaration [-Wshadow]

../../src/conf/domain_conf.c:24373: error: declaration of 'listen'
shadows a global declaration [-Wshadow]

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovz: fixed build by including necessary headers
Maxim Nestratov [Fri, 10 Jun 2016 17:21:18 +0000 (20:21 +0300)]
vz: fixed build by including necessary headers

After eaf18f4c2 some functions changed their homes
Pushed under build breaking rule

8 years agoqemuMonitorJSONAttachCharDev: Teach spicevmc
Michal Privoznik [Wed, 8 Jun 2016 13:51:27 +0000 (15:51 +0200)]
qemuMonitorJSONAttachCharDev: Teach spicevmc

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

We have the code for attaching redirdevs for ages now.
Unfortunately, our monitor code that handles talking to the qemu
process was missing a little piece of code that actually enabled
the feature.

BTW: it really is called "type" on the monitor, even though it's
called "name" on the cmd line. Don't ask.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoExport virDomainRedirdevDefFree
Michal Privoznik [Thu, 9 Jun 2016 09:56:46 +0000 (11:56 +0200)]
Export virDomainRedirdevDefFree

In the 162efa1a commit the function was introduced, but the
commit forgot to update livirt_private.syms accordingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirt-login-shell: add ability to join the container cgroups
Daniel P. Berrange [Wed, 13 Apr 2016 10:00:11 +0000 (11:00 +0100)]
virt-login-shell: add ability to join the container cgroups

Prior to joining the namespaces of the container, move the
process into the containers' cgroups, so that the shell that
is subsequently launched is under the container resource
constraints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: add ability to auto-detect shell from container
Daniel P. Berrange [Tue, 12 Apr 2016 16:01:39 +0000 (17:01 +0100)]
virt-login-shell: add ability to auto-detect shell from container

Currently the shell must be looked up from the config setting in
/etc/libvirt/virt-login-shell.conf. This is inflexible if there
are containers where different users need different shells. Add
add a new 'auto-shell' config parameter which instructs us to
query the containers' /etc/passwd for the shell to be exec'd.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: fully reset container environment
Daniel P. Berrange [Tue, 12 Apr 2016 15:52:58 +0000 (16:52 +0100)]
virt-login-shell: fully reset container environment

The virt-login-shell environment will be initialized with
an arbitrary number of environment variables determined
by the SSH daemon and PAM configuration. Most of these are
not relevant inside the container, and at best they are
noise and at worst they'll break apps. For example if
XDG_RUNTIME_DIR is leaked to the container, it'll break
any apps using it, since  the directory it points to is
only visible to the host OS filesystem, not the container
FS.

Use clearenv() to blank out everything and then set known
good values for PATH, SHELL, USER, LOGNAME HOME and TERM.
Everything else is left up to the login shell to initialize.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: avoid loosing error during cleanup
Daniel P. Berrange [Tue, 12 Apr 2016 15:48:19 +0000 (16:48 +0100)]
virt-login-shell: avoid loosing error during cleanup

The virDomainFree / virConnectClose methods will reset the
last error handle, so we must save the error during cleanup

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: allow shell to be a simple string argument
Daniel P. Berrange [Tue, 12 Apr 2016 14:31:54 +0000 (15:31 +0100)]
virt-login-shell: allow shell to be a simple string argument

Currently the shell config file parameter must be a list
giving the shell path and args. Allow it to be a plain
string argument as well.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: change way we request a login shell
Daniel P. Berrange [Tue, 12 Apr 2016 14:45:48 +0000 (15:45 +0100)]
virt-login-shell: change way we request a login shell

Currently we request a login shell by passing the -l argument
to the shell. This is either hardcoded, or required to be
specified by the user in the virt-login-shell.conf file.

The standard way for login programs to request a shell run
as a login shell is to modify the argv passed to execve()
so that argv[0] contains the relative shell filename
prefixed with a zero. eg instead of doing

  const char **shellargs = ["/bin/bash", "-l", NULL];
  execve(shellargs[0], shellargs, env);

We should be doing

  const char **shellargs = ["-bash", NULL];
  execve("/bin/bash", shellargs, env);

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: honour the -c option to launch commands
Daniel P. Berrange [Tue, 12 Apr 2016 14:18:04 +0000 (15:18 +0100)]
virt-login-shell: honour the -c option to launch commands

The virt-login-shell program is supposed to look like a
regular shell to clients. Login services like sshd
expect the shell to accept a '-c cmdstring' argument to
specify a command to launch instead of presenting an
interactive prompt.

We can implement this by simply passing the '-c cmdstring'
data straight through to the real shell we use. This does
not open any security holes, since the command is not run
until we're inside the container namespaces. This allows
scp to work for users with virt-login-shell.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirsh: make lxc-enter-namespace also join the cgroups
Daniel P. Berrange [Thu, 14 Apr 2016 14:19:56 +0000 (15:19 +0100)]
virsh: make lxc-enter-namespace also join the cgroups

Extend the lxc-enter-namespace command so that it joins the
containers' cgroups before starting new namespaces. This
ensures that the commands run have the normal resource
limits applied

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt-lxc: add virDomainLxcEnterCGroup API
Daniel P. Berrange [Thu, 14 Apr 2016 14:16:22 +0000 (15:16 +0100)]
libvirt-lxc: add virDomainLxcEnterCGroup API

Add the virDomainLxcEnterCGroup API to the libvirt-lxc.so
file. This method moves the calling process into the cgroups
associated with the container.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoutil: add function for looking up the user shell
Daniel P. Berrange [Tue, 12 Apr 2016 17:11:20 +0000 (18:11 +0100)]
util: add function for looking up the user shell

Add a virGetUserShell wrapper around virGetUserEnt, that
returns the shell field.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: move host memory APIs out into virhostmem file
Daniel P. Berrange [Wed, 13 Apr 2016 17:53:02 +0000 (18:53 +0100)]
nodeinfo: move host memory APIs out into virhostmem file

Move all APIs with a virHostMEM name prefix out into new
util/virhostmem.h & util/virhostmem.c files

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: move host CPU APIs out into virhostcpu.c file
Daniel P. Berrange [Wed, 13 Apr 2016 17:53:02 +0000 (18:53 +0100)]
nodeinfo: move host CPU APIs out into virhostcpu.c file

Move all APIs with a virHostCPU name prefix out into new
util/virhostcpu.h & util/virhostcpu.c files

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: rename all CPU APIs to have a virHostCPU prefix
Daniel P. Berrange [Wed, 13 Apr 2016 17:16:16 +0000 (18:16 +0100)]
nodeinfo: rename all CPU APIs to have a virHostCPU prefix

In preparation for moving all the CPU related APIs out of
the nodeinfo file, give them a virHostCPU name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: rename all memory APIs to have a virHostMem prefix
Daniel P. Berrange [Wed, 13 Apr 2016 17:16:16 +0000 (18:16 +0100)]
nodeinfo: rename all memory APIs to have a virHostMem prefix

In preparation for moving all the memory related APIs out of
the nodeinfo file, give them a virHostMem name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: split CPU info retrieval out of nodeGetInfo
Daniel P. Berrange [Wed, 13 Apr 2016 16:45:22 +0000 (17:45 +0100)]
nodeinfo: split CPU info retrieval out of nodeGetInfo

Instead of having platform specific code in nodeGetInfo to
fetch CPU topology, split it all out into a new method
nodeGetCPUInfo.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: remove FreeBSD specific code for getting memory
Daniel P. Berrange [Wed, 27 Apr 2016 15:30:21 +0000 (16:30 +0100)]
nodeinfo: remove FreeBSD specific code for getting memory

The GNULIB physmem module already provides support for
the FreeBSD platform, so there's no reason to re-implement
FreeBSD portability code in libvirt. If there are bugs in
the GNULIB code, we should fix GNULIB rather than workaround
it in libvirt.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: make nodeGetInfo() call nodeGetMemory for memory size
Daniel P. Berrange [Wed, 13 Apr 2016 16:28:10 +0000 (17:28 +0100)]
nodeinfo: make nodeGetInfo() call nodeGetMemory for memory size

The nodeGetInfo() method currently has its own code for getting
memory size in KB, that basically just re-invents what nodeGetMemory
already does. Remove it and just call nodeGetMemory, converting its
result from bytes to KB, allowing removal of more platform specific
conditional code.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: remove sysfs_prefix from all methods
Daniel P. Berrange [Wed, 13 Apr 2016 14:28:55 +0000 (15:28 +0100)]
nodeinfo: remove sysfs_prefix from all methods

Nearly all the methods in the nodeinfo file are given a
'const char *sysfs_prefix' parameter to override the
default sysfs path (/sys/devices/system). Every single
caller passes in NULL for this, except one use in the
unit tests. Furthermore this parameter is totally
Linux-specific, when the APIs are intended to be cross
platform portable.

This removes the sysfs_prefix parameter and instead gives
a new method linuxNodeInfoSetSysFSSystemPath for use by
the test suite.

For two of the methods this hardcodes use of the constant
SYSFS_SYSTEM_PATH, since the test suite does not need to
override the path for thos methods.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoqemu: Yet another check for blkdeviotune values
Martin Kletzander [Tue, 7 Jun 2016 13:24:13 +0000 (15:24 +0200)]
qemu: Yet another check for blkdeviotune values

If you want to set block device I/O tuning values that end with '_max'
and there is nothing else set, libvirt emits an error.  In particular:

  error: internal error: Unexpected error

That's an unknown error.  That is because *_max values depend on their
respective non-_max values.  QEMU even says that in the error message
sent as a response to the monitor command:

  "error": {"class": "GenericError", "desc": "bps_max/iops_max require
  corresponding bps/iops values"}

the problem was that we didn't know that and there was no check for it.
Adding such check makes sure that there will be less confused users.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovnc: add support for listen type none
Pavel Hrdina [Wed, 8 Jun 2016 13:15:54 +0000 (15:15 +0200)]
vnc: add support for listen type none

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agospice: introduce listen type none
Pavel Hrdina [Wed, 18 May 2016 06:33:28 +0000 (08:33 +0200)]
spice: introduce listen type none

This new listen type is currently supported only by spice graphics.
It's introduced to make it easier and clearer specify to not listen
anywhere in order to start a guest with OpenGL support.

The old way to do this was set spice graphics autoport='no' and don't
specify any ports.  The new way is to use <listen type='none'/>.  In
order to be able to migrate to old libvirt the migratable XML will be
generated without the listen element and with autoport='no'.  Also the
old configuration will be automatically converted to the this listen
type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agospice: introduce spice_auto_unix_socket config option
Pavel Hrdina [Wed, 18 May 2016 12:11:20 +0000 (14:11 +0200)]
spice: introduce spice_auto_unix_socket config option

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agospice: add support for listen type socket
Pavel Hrdina [Wed, 8 Jun 2016 13:18:59 +0000 (15:18 +0200)]
spice: add support for listen type socket

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_capabilites: add QEMU_CAPS_SPICE_UNIX
Pavel Hrdina [Tue, 7 Jun 2016 22:21:29 +0000 (00:21 +0200)]
qemu_capabilites: add QEMU_CAPS_SPICE_UNIX

Add a new capability to detect support of unix sockets for spice
graphics.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovnc: add support for listen type 'socket'
Pavel Hrdina [Wed, 8 Jun 2016 13:18:25 +0000 (15:18 +0200)]
vnc: add support for listen type 'socket'

VNC graphics already supports sockets but only via 'socket' attribute.
This patch coverts that attribute into listen type 'socket'.

For backward compatibility we need to handle listen type 'socket' and 'socket'
attribute properly to support old XMLs and new XMLs.  If both are provided they
have to match, if only one of them is provided we need to be able to parse that
configuration too.

To not break migration back to old libvirt if the socket is provided by user we
need to generate migratable XML without the listen element and use only 'socket'
attribute.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agographics: introduce new listen type 'socket'
Pavel Hrdina [Wed, 8 Jun 2016 08:35:37 +0000 (10:35 +0200)]
graphics: introduce new listen type 'socket'

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovnc: move generation of socket path to qemuProcessGraphicsSetupListen
Pavel Hrdina [Wed, 8 Jun 2016 11:30:20 +0000 (13:30 +0200)]
vnc: move generation of socket path to qemuProcessGraphicsSetupListen

This moves the socket generation if "vnc_auto_unix_socket" is set.

It also fixes a bug with this config option that we should auto-generate
socket path only if listen type is address and there is no address
specified.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovnc: rename socketAutogenerated to socketFromConfig
Pavel Hrdina [Wed, 8 Jun 2016 11:24:52 +0000 (13:24 +0200)]
vnc: rename socketAutogenerated to socketFromConfig

Even though it's auto-generated it's based on qemu.conf option and listen type
address already uses "fromConfig" to carry this information.  Following commits
will convert the socket to listen element so this rename is required because
there will be also an option to get socket auto-generated independently on the
qemu.conf option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_command: move websocket code into else part for address listen
Pavel Hrdina [Tue, 7 Jun 2016 22:14:24 +0000 (00:14 +0200)]
qemu_command: move websocket code into else part for address listen

There is no need to check again for vnc socket.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu: Generate channel target paths on hotplug as well
Martin Kletzander [Wed, 30 Mar 2016 14:43:28 +0000 (16:43 +0200)]
qemu: Generate channel target paths on hotplug as well

Since commit 714080791778e3dfbd484ccb3953bffd820b8ba9, qemu agent
channel cannot be plugged in because we won't generate its path
automatically.  Let's not only fix that, but also add tests for it so
next time it's checked for.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemuhotplugtest: Test live data
Martin Kletzander [Wed, 30 Mar 2016 07:01:11 +0000 (09:01 +0200)]
qemuhotplugtest: Test live data

Until now, the only hot thing in this test was the name.  That's because
we set the id to '-1' before every test.  With this change, we test the
hotplug on live domains as the name suggests and as it should be.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Move channel path generation out of command creation
Martin Kletzander [Wed, 30 Mar 2016 14:34:17 +0000 (16:34 +0200)]
qemu: Move channel path generation out of command creation

Put it into separate function called qemuDomainPrepareChannel() and call
it from the new qemuProcessPrepareDomain().

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agocputest: Rename nehalem-force to penryn-force
Jiri Denemark [Thu, 2 Jun 2016 08:17:22 +0000 (10:17 +0200)]
cputest: Rename nehalem-force to penryn-force

The actual CPU model in the data files is Penryn which makes the file
name look rather strange. Well, one of them contains Nehalem, but that's
a bug which will be fixed soon.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Add ARAT x86 CPU feature
Jiri Denemark [Wed, 1 Jun 2016 13:50:32 +0000 (15:50 +0200)]
cpu: Add ARAT x86 CPU feature

Implemented in QEMU by commit 28b8e4d0bf93ba176b4b7be819d537383c5a9060.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Add x86 feature flags for CPUID leaf 0xd, sub leaf 1
Jiri Denemark [Mon, 23 May 2016 15:57:39 +0000 (17:57 +0200)]
cpu: Add x86 feature flags for CPUID leaf 0xd, sub leaf 1

This was implemented in QEMU by commit 0bb0b2d2fe7f645dda.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Sort CPU map features on eax_in
Jiri Denemark [Wed, 1 Jun 2016 13:40:09 +0000 (15:40 +0200)]
cpu: Sort CPU map features on eax_in

As a side effect this changes the order of CPU features in XMLs
generated by libvirt, but that's not a big deal since the order there is
insignificant.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Shorten eax_in values in CPU map
Jiri Denemark [Wed, 1 Jun 2016 13:38:09 +0000 (15:38 +0200)]
cpu: Shorten eax_in values in CPU map

For two reasons:
- 0x00000001 is very similar to 0x80000001, but 0x01 is visually
  different
- 0x01 format is consistent with CPUID manual

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Add full support for ecx_in CPUID parameter
Jiri Denemark [Mon, 23 May 2016 15:45:40 +0000 (17:45 +0200)]
cpu_x86: Add full support for ecx_in CPUID parameter

This patch makes our CPUID handling code up-to-date with the current
specification found in

Intel® 64 and IA-32 Architectures Developer's Manual: Vol. 2A
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Prepare for ecx_in CPUID parameter
Jiri Denemark [Fri, 20 May 2016 08:59:13 +0000 (10:59 +0200)]
cpu_x86: Prepare for ecx_in CPUID parameter

CPUID instruction normally takes its parameter from EAX, but sometimes
ECX is used as an additional parameter. This patch prepares the x86 CPU
driver code for the new 'ecx_in' CPUID parameter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemumonitorjsontest: Add getcpu test data
Jiri Denemark [Fri, 20 May 2016 09:17:11 +0000 (11:17 +0200)]
qemumonitorjsontest: Add getcpu test data

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Xeon X5460
Jiri Denemark [Wed, 1 Jun 2016 15:52:56 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Xeon X5460

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Xeon W3520
Jiri Denemark [Wed, 1 Jun 2016 15:52:55 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Xeon W3520

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Xeon E7-4820
Jiri Denemark [Wed, 1 Jun 2016 15:52:55 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Xeon E7-4820

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Xeon E5-2650
Jiri Denemark [Wed, 1 Jun 2016 15:52:55 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Xeon E5-2650

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Xeon E5-2630
Jiri Denemark [Wed, 1 Jun 2016 15:52:55 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Xeon E5-2630

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Xeon E3-1245
Jiri Denemark [Wed, 1 Jun 2016 15:52:55 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Xeon E3-1245

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Xeon 5110
Jiri Denemark [Wed, 1 Jun 2016 15:52:54 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Xeon 5110

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for AMD Phenom II X4 B95
Jiri Denemark [Wed, 1 Jun 2016 15:52:54 +0000 (17:52 +0200)]
tests: Add CPU detection test for AMD Phenom II X4 B95

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Pentium P6100
Jiri Denemark [Wed, 1 Jun 2016 15:52:54 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Pentium P6100

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for AMD Opteron 6282 SE
Jiri Denemark [Wed, 1 Jun 2016 15:52:54 +0000 (17:52 +0200)]
tests: Add CPU detection test for AMD Opteron 6282 SE

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for AMD Opteron 6234
Jiri Denemark [Wed, 1 Jun 2016 15:52:54 +0000 (17:52 +0200)]
tests: Add CPU detection test for AMD Opteron 6234

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for AMD Opteron 2350
Jiri Denemark [Wed, 1 Jun 2016 15:52:53 +0000 (17:52 +0200)]
tests: Add CPU detection test for AMD Opteron 2350

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for AMD Opteron 1352
Jiri Denemark [Wed, 1 Jun 2016 15:52:53 +0000 (17:52 +0200)]
tests: Add CPU detection test for AMD Opteron 1352

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for AMD FX 8150
Jiri Denemark [Wed, 1 Jun 2016 15:52:53 +0000 (17:52 +0200)]
tests: Add CPU detection test for AMD FX 8150

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core2 Quad Q9500
Jiri Denemark [Wed, 1 Jun 2016 15:52:53 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core2 Quad Q9500

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core2 Duo E6850
Jiri Denemark [Wed, 1 Jun 2016 15:52:53 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core2 Duo E6850

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i7-5600U
Jiri Denemark [Wed, 1 Jun 2016 15:52:53 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i7-5600U

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i7-4600U
Jiri Denemark [Wed, 1 Jun 2016 15:52:52 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i7-4600U

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i7-3770
Jiri Denemark [Wed, 1 Jun 2016 15:52:52 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i7-3770

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i7-3740QM
Jiri Denemark [Wed, 1 Jun 2016 15:52:52 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i7-3740QM

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i7-3520M
Jiri Denemark [Wed, 1 Jun 2016 15:52:52 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i7-3520M

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i7-2600
Jiri Denemark [Wed, 1 Jun 2016 15:52:52 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i7-2600

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i5-6600
Jiri Denemark [Wed, 1 Jun 2016 15:52:51 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i5-6600

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i5-4670T
Jiri Denemark [Wed, 1 Jun 2016 15:52:51 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i5-4670T

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i5-2540M
Jiri Denemark [Wed, 1 Jun 2016 15:52:51 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i5-2540M

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Core i5-2500
Jiri Denemark [Wed, 1 Jun 2016 15:52:51 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Core i5-2500

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Atom N450
Jiri Denemark [Wed, 1 Jun 2016 15:52:51 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Atom N450

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for Intel Atom D510
Jiri Denemark [Wed, 1 Jun 2016 15:52:51 +0000 (17:52 +0200)]
tests: Add CPU detection test for Intel Atom D510

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection test for AMD A10-5800K
Jiri Denemark [Mon, 6 Jun 2016 12:43:07 +0000 (14:43 +0200)]
tests: Add CPU detection test for AMD A10-5800K

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add CPU detection tests
Jiri Denemark [Wed, 1 Jun 2016 13:57:00 +0000 (15:57 +0200)]
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>
8 years agocpu_x86: Refactor internal KVM features
Jiri Denemark [Tue, 7 Jun 2016 10:09:41 +0000 (12:09 +0200)]
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>
8 years agocpu_ppc64: Avoid unnecessary pointer to virCPUppc64Data
Jiri Denemark [Tue, 7 Jun 2016 10:04:13 +0000 (12:04 +0200)]
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>
8 years agocpu_x86: Avoid unnecessary pointers to virCPUx86Data
Jiri Denemark [Tue, 7 Jun 2016 07:38:53 +0000 (09:38 +0200)]
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>
8 years agotests: Create simple monitor in qemuMonitorTestNewFromFile
Jiri Denemark [Mon, 6 Jun 2016 14:55:05 +0000 (16:55 +0200)]
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>
8 years agotests: Fix "Reponse" typo
Jiri Denemark [Tue, 7 Jun 2016 11:46:01 +0000 (13:46 +0200)]
tests: Fix "Reponse" typo

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Introduce qemuMonitorTestNewFromFile
Jiri Denemark [Mon, 6 Jun 2016 11:46:41 +0000 (13:46 +0200)]
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>
8 years agoqemu: Refactor qemuMonitorJSONGetCPUx86Data
Jiri Denemark [Fri, 3 Jun 2016 14:59:59 +0000 (16:59 +0200)]
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>
8 years agocpu_x86: Rename CPUID function to eax_in
Jiri Denemark [Fri, 20 May 2016 07:48:21 +0000 (09:48 +0200)]
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>
8 years agocpu: Detect arch when parsing CPU data
Jiri Denemark [Mon, 29 Jun 2015 09:08:30 +0000 (11:08 +0200)]
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>
8 years agocpu_x86: Fix CPU data parser
Jiri Denemark [Mon, 29 Jun 2015 09:07:25 +0000 (11:07 +0200)]
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>
8 years agocpu_x86: Propagate vendor to guest's virCPUData
Jiri Denemark [Wed, 1 Jun 2016 08:55:36 +0000 (10:55 +0200)]
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>
8 years agovirsh-domain: fix memory leak in cmdDomDisplay
Pavel Hrdina [Thu, 9 Jun 2016 07:05:35 +0000 (09:05 +0200)]
virsh-domain: fix memory leak in cmdDomDisplay

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoFix typo in virNetDevGetEthtoolGFeatures stub
Ján Tomko [Thu, 9 Jun 2016 06:35:32 +0000 (08:35 +0200)]
Fix typo in virNetDevGetEthtoolGFeatures stub

s/ATTRIBUGE/ATTRIBUTE/

Reported-by: Olaf Hering <olaf@aepfle.de>
8 years agotests: Rename virtTestMain to virTestMain. osstest/frozen/xen-4.7-testing
Tomáš Ryšavý [Thu, 26 May 2016 15:02:08 +0000 (17:02 +0200)]
tests: Rename virtTestMain to virTestMain.

This function doesn't follow our convention of naming functions.