]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoFix coding style issues.
Nitesh Konkar [Mon, 26 Sep 2016 19:01:27 +0000 (00:31 +0530)]
Fix coding style issues.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoconf: Skip post parse callbacks when creating copy
Michal Privoznik [Tue, 20 Sep 2016 12:21:26 +0000 (14:21 +0200)]
conf: Skip post parse callbacks when creating copy

When creating a copy of virDomainDef we save ourselves the
trouble of writing deep-copy functions and just format and parse
back domain/device XML. However, the XML we are parsing was
already fully formatted - there is no reason to run post parse
callbacks (which fill in blanks - there are none!).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodomain_conf: Introduce VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE
Michal Privoznik [Tue, 20 Sep 2016 11:59:52 +0000 (13:59 +0200)]
domain_conf: Introduce VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE

This is an internal flag that prevents our two entry points to
XML parsing (virDomainDefParse and virDomainDeviceDefParse) from
running post parse callbacks. This is expected to be used in
cases when we already have full domain/device XML and we are just
parsing it back (i.e. virDomainDefCopy or virDomainDeviceDefCopy)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainDefAssignAddresses: Fetch caps from domain object
Michal Privoznik [Sat, 17 Sep 2016 05:05:03 +0000 (07:05 +0200)]
qemuDomainDefAssignAddresses: Fetch caps from domain object

Just like we did two commits ago, don't try to fetch capabilities
for non-existing binary. Re-use the ones we have for running
domain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainDeviceDefPostParse: Fetch caps from domain object
Michal Privoznik [Fri, 16 Sep 2016 14:40:22 +0000 (16:40 +0200)]
qemuDomainDeviceDefPostParse: Fetch caps from domain object

Just like we did two commits ago, don't try to fetch capabilities
for non-existing binary. Re-use the ones we have for running
domain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainDefPostParse: Fetch qemuCaps from domain object
Michal Privoznik [Fri, 16 Sep 2016 14:29:41 +0000 (16:29 +0200)]
qemuDomainDefPostParse: Fetch qemuCaps from domain object

We can't rely on def->emulator path. It may be provided by user
as we give them opportunity to provide their own XML for
migration. Therefore the path may point to just whatever binary
(or even to a non-existent file). Moreover, this path is meant
for destination, but the capabilities lookup is done on source.
What we can do is to assume same capabilities for post parse
callbacks as the running domain has. They will be used just to
add some default models/controllers/devices/... anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoconf: Extend virDomainDefAssignAddressesCallback for parseOpaque
Michal Privoznik [Fri, 23 Sep 2016 09:04:39 +0000 (11:04 +0200)]
conf: Extend virDomainDefAssignAddressesCallback for parseOpaque

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoconf: Extend virDomainDeviceDefPostParse for parseOpaque
Michal Privoznik [Fri, 23 Sep 2016 08:53:38 +0000 (10:53 +0200)]
conf: Extend virDomainDeviceDefPostParse for parseOpaque

Just like virDomainDefPostParseCallback has gained new
parseOpaque argument, we need to follow the logic with
virDomainDeviceDefPostParse.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainDefCopy: Introduce @parseOpaque argument
Michal Privoznik [Thu, 22 Sep 2016 15:23:03 +0000 (17:23 +0200)]
virDomainDefCopy: Introduce @parseOpaque argument

We want to pass the proper opaque pointer instead of NULL to
virDomainDefParseString.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainDefParse{File,String}: Introduce @parseOpaque argument
Michal Privoznik [Thu, 22 Sep 2016 15:14:17 +0000 (17:14 +0200)]
virDomainDefParse{File,String}: Introduce @parseOpaque argument

We want to pass the proper opaque pointer instead of NULL to
virDomainDefParse and subsequently virDomainDefParseNode too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainDefParseNode: Introduce @parseOpaque argument
Michal Privoznik [Thu, 22 Sep 2016 14:56:26 +0000 (16:56 +0200)]
virDomainDefParseNode: Introduce @parseOpaque argument

We want to pass the proper opaque pointer instead of NULL to
virDomainDefParseXML and subsequently virDomainDefPostParse too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainDefPostParse: Introduce @parseOpaque argument
Michal Privoznik [Thu, 22 Sep 2016 14:41:33 +0000 (16:41 +0200)]
virDomainDefPostParse: Introduce @parseOpaque argument

Some callers might want to pass yet another pointer to opaque
data to post parse callbacks. The driver generic one is not
enough because two threads executing post parse callback might
want to see different data (e.g. domain object pointer that
domain def belongs to).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agostorage_backend_rbd: remove unnessary translated message marker
Chen Hanxiao [Sat, 24 Sep 2016 03:37:02 +0000 (11:37 +0800)]
storage_backend_rbd: remove unnessary translated message marker

Remove unnessary translated message marker _()
for the VIR_WARN messages.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agoFix various code comment typos
Nitesh Konkar [Sat, 24 Sep 2016 18:43:25 +0000 (00:13 +0530)]
Fix various code comment typos

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoqemu: Get/return compressedpath program
John Ferlan [Tue, 13 Sep 2016 16:05:39 +0000 (12:05 -0400)]
qemu: Get/return compressedpath program

Based upon a patch from Chen Hanxiao <chenhanxiao@gmail.com>, rather than
need to call virFindFileInPath twice, let's just save the path and pass it
along with the compressed type. (NB: the second call would be in virExec as
called from virCommandRunAsync which is called from qemuMigrationToFile
using the argument 'compressor' which up to this point would be the string
from the cfg file that isn't the fully qualified path).

Since we now have the path, we can remove qemuCompressProgramName which
would return NULL or the string representation of the compress type.

8 years agoqemu: Remove qemuCompressProgramAvailable
John Ferlan [Tue, 13 Sep 2016 15:51:54 +0000 (11:51 -0400)]
qemu: Remove qemuCompressProgramAvailable

There's only one caller and the code is duplicitous just converting the
recently converted cfg image name back into it's string value in order to
get/find the path to the image.  A subsequent patch can return this path.

8 years agoqemu: Use qemuGetCompressionProgram for error paths
John Ferlan [Tue, 13 Sep 2016 14:11:00 +0000 (10:11 -0400)]
qemu: Use qemuGetCompressionProgram for error paths

Let's do some more code reuse - there are 3 other callers that care to
check/get the compress program. Each of those though cares whether the
requested cfg image is valid and exists. So, add a parameter to handle
those cases.

NB: We won't need to initialize the returned value in the case where
the cfg image doesn't exist since the called program will handle that.

8 years agoqemu: Alter qemuGetCompressionProgram warning message
John Ferlan [Fri, 23 Sep 2016 11:09:03 +0000 (07:09 -0400)]
qemu: Alter qemuGetCompressionProgram warning message

Add a new parameter 'styleFormat' to be used when printing the
warning message so that it's "clearer" what style of compression
call caused the error. Add that style to both messages as a paremter.

Also a VIR_WARN error message doesn't need to be translated
 (e.g. inside _()), so remove the need for the translation.

8 years agoqemu: Remove getCompressionType
John Ferlan [Tue, 13 Sep 2016 14:31:37 +0000 (10:31 -0400)]
qemu: Remove getCompressionType

There's only one caller now anyway... Besides it's just a shell for
getting the compress type.  Subsequent patches will return the path
to the compression program.

8 years agoqemu: Introduce helper qemuGetCompressionProgram
John Ferlan [Tue, 13 Sep 2016 14:01:47 +0000 (10:01 -0400)]
qemu: Introduce helper qemuGetCompressionProgram

Split out the guts of getCompressionType to perform the same functionality
in the new helper program with a subsequent patch goal to be reusable for
other callers making similar checks/calls to ensure the compression type
is valid and that the compression program cannot be found.

8 years agoqemu: Adjust doCoreDump to call getCompressionType
John Ferlan [Tue, 13 Sep 2016 13:24:48 +0000 (09:24 -0400)]
qemu: Adjust doCoreDump to call getCompressionType

Rather than calling getCompressionType from each of the callers, just call
it from doCoreDump.  A subsequent patch will be adjust the code even more.

8 years agoqemu: Move getCompressionType
John Ferlan [Tue, 13 Sep 2016 13:26:15 +0000 (09:26 -0400)]
qemu: Move getCompressionType

A subsequent patch will adjust the 3 callers to just call from doCoreDump.

8 years agoapparmor: move qemu-bridge-helper to libvirtd profile
Cédric Bosdonnat [Fri, 5 Aug 2016 07:32:54 +0000 (09:32 +0200)]
apparmor: move qemu-bridge-helper to libvirtd profile

qemu-bridge-helper is only called from libvirtd, it has to be moved
from the qemu domain abstraction to the usr.sbin.libvirtd profile.

8 years agolibxl: increase usbdevice list only when finding such an input device
Cédric Bosdonnat [Fri, 23 Sep 2016 12:11:50 +0000 (14:11 +0200)]
libxl: increase usbdevice list only when finding such an input device

If passing an empty usbdevice_list to libxl, qemu will always get an
-usb parameter for HVM guests with only non-USB input devices. This
causes qemu to crash when passing pvusb device on HVM guests.

The solution is to allocate the list only when an item to put in it
is found.

8 years agoqemuBuildHostNetStr: Realign
Michal Privoznik [Tue, 16 Aug 2016 06:51:38 +0000 (08:51 +0200)]
qemuBuildHostNetStr: Realign

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuhelptest: regenerate data for qemu-kvm-1.2.0
Pavel Hrdina [Thu, 22 Sep 2016 14:38:43 +0000 (16:38 +0200)]
qemuhelptest: regenerate data for qemu-kvm-1.2.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemuhelptest: regenerate data for qemu-kvm-0.13.0
Pavel Hrdina [Thu, 22 Sep 2016 14:38:08 +0000 (16:38 +0200)]
qemuhelptest: regenerate data for qemu-kvm-0.13.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemuhelptest: regenerate data for qemu-kvm-0.12.3
Pavel Hrdina [Thu, 22 Sep 2016 14:37:28 +0000 (16:37 +0200)]
qemuhelptest: regenerate data for qemu-kvm-0.12.3

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemuhelptest: regenerate data for qemu-1.2.0
Pavel Hrdina [Thu, 22 Sep 2016 14:36:33 +0000 (16:36 +0200)]
qemuhelptest: regenerate data for qemu-1.2.0

This patch also removes device data for qemu-1.2.0 as it was removed for
qemu-kvm-1.2.0 by commit ae3e29e6e.  They are not required because we
parse only version from help output and return with error that this qemu
is too new to use help parsing.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemuhelptest: regenerate data for qemu-1.1.0
Pavel Hrdina [Thu, 22 Sep 2016 14:36:22 +0000 (16:36 +0200)]
qemuhelptest: regenerate data for qemu-1.1.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemuhelptest: regenerate data for qemu-1.0
Pavel Hrdina [Thu, 22 Sep 2016 14:35:54 +0000 (16:35 +0200)]
qemuhelptest: regenerate data for qemu-1.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemuhelptest: regenerate data for qemu-0.12.1
Pavel Hrdina [Thu, 22 Sep 2016 14:32:08 +0000 (16:32 +0200)]
qemuhelptest: regenerate data for qemu-0.12.1

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemuhelptest: remove downstream test data
Pavel Hrdina [Wed, 21 Sep 2016 08:56:15 +0000 (10:56 +0200)]
qemuhelptest: remove downstream test data

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu: Fix improper indention
John Ferlan [Thu, 22 Sep 2016 20:49:25 +0000 (16:49 -0400)]
qemu: Fix improper indention

Commit id 'ce61c164' indented wrong - not sure how I did that...

8 years agoFix Multiple Typos
Nitesh Konkar [Thu, 22 Sep 2016 10:33:24 +0000 (16:03 +0530)]
Fix Multiple Typos

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoMove CMT feature filtering to QEMU driver
Jiri Denemark [Thu, 21 Jul 2016 15:02:37 +0000 (17:02 +0200)]
Move CMT feature filtering to QEMU driver

It really doesn't belong to the generic CPU driver.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Update guest CPU def in live XML
Jiri Denemark [Wed, 22 Jun 2016 13:53:48 +0000 (15:53 +0200)]
qemu: Update guest CPU def in live XML

Storing the updated CPU definition in the live domain definition saves
us from having to update it over and over when we need it. Not to
mention that we will soon further update the CPU definition according to
QEMU once it's started.

A highly wanted side effect of this patch, libvirt will pass all CPU
features explicitly specified in domain XML to QEMU, even those that are
already included in the host model.

This patch should fix the following bugs:
    https://bugzilla.redhat.com/show_bug.cgi?id=1207095
    https://bugzilla.redhat.com/show_bug.cgi?id=1339680
    https://bugzilla.redhat.com/show_bug.cgi?id=1371039
    https://bugzilla.redhat.com/show_bug.cgi?id=1373849
    https://bugzilla.redhat.com/show_bug.cgi?id=1375524
    https://bugzilla.redhat.com/show_bug.cgi?id=1377913

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Rework cpuCompare* APIs
Jiri Denemark [Tue, 9 Aug 2016 11:26:53 +0000 (13:26 +0200)]
cpu: Rework cpuCompare* APIs

Both cpuCompare* APIs are renamed to virCPUCompare*. And they should now
work for any guest CPU definition, i.e., even for host-passthrough
(trivial) and host-model CPUs. The implementation in x86 driver is
enhanced to provide a hint about -noTSX Broadwell and Haswell models
when appropriate.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Document missing parameters for cpuCompare*
Jiri Denemark [Fri, 16 Sep 2016 09:45:54 +0000 (11:45 +0200)]
cpu: Document missing parameters for cpuCompare*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Introduce virCPUCheckFeature
Jiri Denemark [Fri, 16 Sep 2016 12:13:09 +0000 (14:13 +0200)]
cpu: Introduce virCPUCheckFeature

The function is similar to virCPUDataCheckFeature, but it works directly
on CPU definition rather than requiring it to be transformed into CPU
data first.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Rework virCPUDataCheckFeature
Jiri Denemark [Fri, 16 Sep 2016 12:12:15 +0000 (14:12 +0200)]
cpu: Rework virCPUDataCheckFeature

To match our coding style and to provide better debug and error
messages.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Rename cpuHasFeature to virCPUDataCheckFeature
Jiri Denemark [Mon, 8 Aug 2016 13:48:15 +0000 (15:48 +0200)]
cpu: Rename cpuHasFeature to virCPUDataCheckFeature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Introduce virCPUTranslate
Jiri Denemark [Fri, 17 Jun 2016 07:45:48 +0000 (09:45 +0200)]
cpu: Introduce virCPUTranslate

The API is supposed to make sure the provided CPU definition does not
use a CPU model which is not supported by the hypervisor (if at all
possible, of course).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Set nfeatures_max correctly in x86Decode
Jiri Denemark [Thu, 4 Aug 2016 22:01:42 +0000 (00:01 +0200)]
cpu: Set nfeatures_max correctly in x86Decode

Keeping nfeatures_max set to 0 while nfeatures > 0 and some features are
already stored in features array is just asking for problems once we
want to add a new feature into the array.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Rework cpuUpdate
Jiri Denemark [Thu, 23 Jun 2016 13:27:07 +0000 (15:27 +0200)]
cpu: Rework cpuUpdate

The reworked API is now called virCPUUpdate and it should change the
provided CPU definition into a one which can be consumed by the QEMU
command line builder:

    - host-passthrough remains unchanged
    - host-model is turned into custom CPU with a model and features
      copied from host
    - custom CPU with minimum match is converted similarly to host-model
    - optional features are updated according to host's CPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Add x86FeatureInData
Jiri Denemark [Tue, 28 Jun 2016 10:23:48 +0000 (12:23 +0200)]
cpu: Add x86FeatureInData

The function checks CPUID data for a given feature.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Report error for unknown features in x86HasFeature
Jiri Denemark [Tue, 28 Jun 2016 09:50:50 +0000 (11:50 +0200)]
cpu: Report error for unknown features in x86HasFeature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Make x86ModelFromCPU a bit smarter
Jiri Denemark [Sat, 18 Jun 2016 09:19:17 +0000 (11:19 +0200)]
cpu: Make x86ModelFromCPU a bit smarter

x86ModelFromCPU is used to provide CPUID data for features matching
@policy. This patch allows callers to set @policy to -1 to get combined
CPUID for all CPU features (including those implicitly provided a CPU
model) specified in CPU def.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Make x86ModelFromCPU easier to read
Jiri Denemark [Sat, 18 Jun 2016 08:54:50 +0000 (10:54 +0200)]
cpu: Make x86ModelFromCPU easier to read

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Introduce virQEMUCapsIsCPUModeSupported
Jiri Denemark [Wed, 3 Aug 2016 14:22:30 +0000 (16:22 +0200)]
qemu: Introduce virQEMUCapsIsCPUModeSupported

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Introduce virQEMUCapsGetHostModel
Jiri Denemark [Wed, 22 Jun 2016 10:34:07 +0000 (12:34 +0200)]
qemu: Introduce virQEMUCapsGetHostModel

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoShow host model in domain capabilities
Jiri Denemark [Wed, 15 Jun 2016 14:45:47 +0000 (16:45 +0200)]
Show host model in domain capabilities

The domain capabilities XML is capable of showing whether each guest CPU
mode is supported or not with a possibility to provide additional
details. This patch enhances host-model capability to advertise the
exact CPU model which will be used as a host-model:

    <cpu>
        ...
        <mode name='host-model' supported='yes'>
            <model fallback='allow'>Broadwell</model>
            <vendor>Intel</vendor>
            <feature policy='disable' name='aes'/>
            <feature policy='require' name='vmx'/>
        </mode>
        ...
    </cpu>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Drop false support for ARM cpu-model
Jiri Denemark [Tue, 21 Jun 2016 14:02:07 +0000 (16:02 +0200)]
cpu: Drop false support for ARM cpu-model

The ARM CPU driver wrongly reported host CPU model as "host", which made
host-model to be just an alias for host-passthrough. Let's drop this
insanity.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Store host-model CPU in qemu capabilities
Jiri Denemark [Wed, 15 Jun 2016 12:35:18 +0000 (14:35 +0200)]
qemu: Store host-model CPU in qemu capabilities

Host capabilities provide libvirt's view of the host CPU, but for a
useful support for host-model CPUs we really need a hypervisor's view of
the CPU. And since the view can be differ with emulator, qemu
capabilities is the best place to store the host CPU model.

This patch just copies the CPU model from host capabilities, but this
will change in the future.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoconf: Introduce virCPUDefCopyModelFilter
Jiri Denemark [Tue, 28 Jun 2016 08:44:20 +0000 (10:44 +0200)]
conf: Introduce virCPUDefCopyModelFilter

The function filters all CPU features through a given callback while
copying CPU model related parts of a CPU definition.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoconf: Introduce virCPUDefStealModel
Jiri Denemark [Thu, 23 Jun 2016 10:54:19 +0000 (12:54 +0200)]
conf: Introduce virCPUDefStealModel

The function moves CPU model related parts from one CPU definition to
another. It can be used to avoid unnecessary copies from a temporary CPU
definitions which will be freed anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoconf: Introduce virCPUDefCopyWithoutModel
Jiri Denemark [Fri, 17 Jun 2016 07:44:43 +0000 (09:44 +0200)]
conf: Introduce virCPUDefCopyWithoutModel

Useful for copying a CPU definition without model related parts (i.e.,
without model name, feature list, vendor).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Propagate virCapsPtr to virQEMUCapsNewForBinaryInternal
Jiri Denemark [Wed, 15 Jun 2016 11:48:19 +0000 (13:48 +0200)]
qemu: Propagate virCapsPtr to virQEMUCapsNewForBinaryInternal

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoschema: Separate CPU related definitions into cputypes.rng
Jiri Denemark [Tue, 10 May 2016 14:17:08 +0000 (16:17 +0200)]
schema: Separate CPU related definitions into cputypes.rng

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodomcaps: Add CPU usable flag
Jiri Denemark [Wed, 15 Jun 2016 14:15:44 +0000 (16:15 +0200)]
domcaps: Add CPU usable flag

In case a hypervisor is able to tell us a list of supported CPU models
and whether each CPU models can be used on the current host, we can
propagate this to domain capabilities. This is a better alternative
to calling virConnectCompareCPU for each supported CPU model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodomcaps: Show only CPU models supported by libvirt
Jiri Denemark [Fri, 29 Apr 2016 08:42:56 +0000 (10:42 +0200)]
domcaps: Show only CPU models supported by libvirt

Listing all CPU models supported by QEMU in domain capabilities makes
little sense when libvirt will refuse any model it doesn't know about.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Don't overwrite errors in cpuGetModels
Jiri Denemark [Thu, 16 Jun 2016 14:08:30 +0000 (16:08 +0200)]
cpu: Don't overwrite errors in cpuGetModels

cpuGetSubDriver already reports a useful error.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Special case models == NULL in cpuGetModels
Jiri Denemark [Tue, 14 Jun 2016 09:12:49 +0000 (11:12 +0200)]
cpu: Special case models == NULL in cpuGetModels

Some CPU drivers (such as arm) do not provide list of CPUs libvirt
supports and just pass any CPU model from domain XML directly to QEMU.
Such driver need to return models == NULL and success from cpuGetModels.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Fill in CPU domain capabilities
Jiri Denemark [Fri, 22 Apr 2016 20:22:30 +0000 (22:22 +0200)]
qemu: Fill in CPU domain capabilities

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Introduce virQEMUCapsGuestIsNative
Jiri Denemark [Tue, 14 Jun 2016 15:25:58 +0000 (17:25 +0200)]
qemu: Introduce virQEMUCapsGuestIsNative

To have a single place where we decide whether a guest can run natively
on a host.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Reorder CPU features
Jiri Denemark [Fri, 5 Aug 2016 12:42:15 +0000 (14:42 +0200)]
qemuxml2argvtest: Reorder CPU features

The x86 CPU driver translated each CPU definition from domain XML into
CPUID data and then back to CPU definition. This effectively sorted the
list of CPU features according to their CPUID values. Since this is
going to change, we need to reorder CPU features in a few test files to
make sure the generated QEMU command lines will not change.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Set correct architecture for KVM guests
Jiri Denemark [Thu, 4 Aug 2016 11:19:39 +0000 (13:19 +0200)]
qemuxml2argvtest: Set correct architecture for KVM guests

Testing PPC64/AArch64 KVM domains on x86_64 host only works because we
have a lot of bugs in our code. Since this series is going to fix them,
we need to make sure the host architecture matches guest for KVM
domains.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Properly setup CPU models in qemuCaps
Jiri Denemark [Thu, 4 Aug 2016 11:25:02 +0000 (13:25 +0200)]
qemuxml2argvtest: Properly setup CPU models in qemuCaps

Adding x86 CPU models into a list of supported CPUs for non-x86
architectures is not a very good idea. Each architecture we test needs
to maintain its own list of supported CPU models.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Separate guest CPU validation from command line creation
Jiri Denemark [Thu, 4 Aug 2016 06:25:55 +0000 (08:25 +0200)]
qemu: Separate guest CPU validation from command line creation

qemu_command.c should deal with translating our domain definition into a
QEMU command line and nothing else.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotestutilsqemu: Add default CPU for PPC64 architectures
Jiri Denemark [Tue, 13 Sep 2016 20:27:09 +0000 (22:27 +0200)]
testutilsqemu: Add default CPU for PPC64 architectures

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotestutilsqemu: Helpers for changing host CPU and arch
Jiri Denemark [Thu, 4 Aug 2016 11:16:55 +0000 (13:16 +0200)]
testutilsqemu: Helpers for changing host CPU and arch

Changing a host architecture or a CPU is not as easy as assigning a new
value to the appropriate element in virCaps since there is a relation
between the CPU and host architecture (we don't really want to test
anything on an AArch64 host with core2duo CPU). This patch introduces
qemuTestSetHostArch and qemuTestSetHostCPU helpers which will make sure
the host architecture matches the host CPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Properly initialize qemuCaps->arch
Jiri Denemark [Wed, 3 Aug 2016 10:26:41 +0000 (12:26 +0200)]
qemuxml2argvtest: Properly initialize qemuCaps->arch

qemuCaps->arch should match the guest architecture from domain XML.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Update qemuCaps after parsing domain XML
Jiri Denemark [Wed, 3 Aug 2016 10:21:19 +0000 (12:21 +0200)]
qemuxml2argvtest: Update qemuCaps after parsing domain XML

Some parts of qemuCaps depend on guest architecture, machine type, and
possibly other things that we know only once the domain XML has been
parsed. Let's move all these updates into a dedicated function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Reorder functions
Jiri Denemark [Wed, 3 Aug 2016 08:47:00 +0000 (10:47 +0200)]
qemuxml2argvtest: Reorder functions

testCompareXMLToArgv will soon need to call a few function which are
defined further in the code. Let's move them up a bit.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Get rid of testCompareXMLToArgvHelper
Jiri Denemark [Wed, 3 Aug 2016 08:42:08 +0000 (10:42 +0200)]
qemuxml2argvtest: Get rid of testCompareXMLToArgvHelper

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Rename "out" labels as "cleanup"
Jiri Denemark [Wed, 3 Aug 2016 08:19:10 +0000 (10:19 +0200)]
qemuxml2argvtest: Rename "out" labels as "cleanup"

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuxml2argvtest: Rename extraFlags as qemuCaps
Jiri Denemark [Wed, 3 Aug 2016 07:49:42 +0000 (09:49 +0200)]
qemuxml2argvtest: Rename extraFlags as qemuCaps

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Use virDomainCapsCPUModels for cpuDefinitions
Jiri Denemark [Thu, 21 Apr 2016 10:51:01 +0000 (12:51 +0200)]
qemu: Use virDomainCapsCPUModels for cpuDefinitions

The list of supported CPU models in domain capabilities is stored in
virDomainCapsCPUModels. Let's use the same object for storing CPU models
in QEMU capabilities.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodomcaps: Add support for listing supported CPU models
Jiri Denemark [Fri, 22 Apr 2016 09:08:57 +0000 (11:08 +0200)]
domcaps: Add support for listing supported CPU models

The patch adds <cpu> element to domain capabilities XML:

    <cpu>
        <mode name='host-passthrough' supported='yes'/>
        <mode name='host-model' supported='yes'/>
        <mode name='custom' supported='yes'>
            <model>Broadwell</model>
            <model>Broadwell-noTSX</model>
            ...
        </mode>
    </cpu>

Applications can use it to inspect what CPU configuration modes are
supported for a specific combination of domain type, emulator binary,
guest architecture and machine type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpuGetModels: Switch to virArch
Jiri Denemark [Fri, 29 Apr 2016 08:38:03 +0000 (10:38 +0200)]
cpuGetModels: Switch to virArch

Our internal APIs mostly use virArch rather than strings. Switching
cpuGetModels to virArch will save us from unnecessary conversions in the
future.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agolibxl: support VIR_MIGRATE_PERSIST_DEST migration flag
Jim Fehlig [Mon, 19 Sep 2016 17:34:34 +0000 (11:34 -0600)]
libxl: support VIR_MIGRATE_PERSIST_DEST migration flag

By default, virt-manager (and likely other libvirt-based apps) sets
the VIR_MIGRATE_PERSIST_DEST flag when invoking the migrate API, which
fails in a Xen setup since the libxl driver does not support the flag.

Persisting a domain is a trivial task in the grand scheme of migration,
so be nice to libvirt apps and add support for VIR_MIGRATE_PERSIST_DEST
in the libxl driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agoqemu_process: move graphics validation into separate function
Pavel Hrdina [Tue, 20 Sep 2016 11:49:21 +0000 (13:49 +0200)]
qemu_process: move graphics validation into separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: show shutoff reasons when debug log disabled
Chen Hanxiao [Mon, 19 Sep 2016 08:17:57 +0000 (16:17 +0800)]
qemu_process: show shutoff reasons when debug log disabled

We have a few of senarios that libvirtd would invoke qemuProcessStop
and leave a "shutting down" in /var/log/libvirt/qemu/$DOMAIN.log.

The shutoff reason showing in debug log is also very important
for us to know why VM shutting down in domain log,
as we seldom enable debug log of libvirtd.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agolibvirt-nodedev.c:fix a typo
Nitesh Konkar [Wed, 21 Sep 2016 20:02:52 +0000 (01:32 +0530)]
libvirt-nodedev.c:fix a typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agolibvirt-admin.c:fix a typo
Nitesh Konkar [Wed, 21 Sep 2016 19:31:50 +0000 (01:01 +0530)]
libvirt-admin.c:fix a typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agodriver.c:fix a typo
Nitesh Konkar [Wed, 21 Sep 2016 19:17:30 +0000 (00:47 +0530)]
driver.c:fix a typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agodomain_conf.c:fix the comment.
Nitesh Konkar [Wed, 21 Sep 2016 17:17:30 +0000 (22:47 +0530)]
domain_conf.c:fix the comment.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agodomain_conf.c:fix a typo
Nitesh Konkar [Wed, 21 Sep 2016 19:18:48 +0000 (00:48 +0530)]
domain_conf.c:fix a typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agodomain_conf.c:fix a typo
Nitesh Konkar [Wed, 21 Sep 2016 16:52:02 +0000 (22:22 +0530)]
domain_conf.c:fix a typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agomigration: Document we don't copy storage during offline migration
Michal Privoznik [Wed, 21 Sep 2016 09:25:13 +0000 (11:25 +0200)]
migration: Document we don't copy storage during offline migration

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

During offline migration, no storage is copied. Nor disks, nor
NVRAM file, nor anything. We use qemu for that and because domain
is not running there's nobody to copy that for us.
We should document this to avoid confusing users.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: driver: Don't return automatic NUMA emulator pinning data for persistentDef
Peter Krempa [Wed, 14 Sep 2016 05:37:16 +0000 (07:37 +0200)]
qemu: driver: Don't return automatic NUMA emulator pinning data for persistentDef

Calling virDomainGetEmulatorPinInfo on a live VM with automatic NUMA
pinning and VIR_DOMAIN_AFFECT_CONFIG would return the automatic pinning
data in some cases which is bogus. Use the autoCpuset property only when
called on a live definition.

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

8 years agoqemu: driver: Don't return automatic NUMA vCPU pinning data for persistentDef
Peter Krempa [Wed, 14 Sep 2016 05:37:16 +0000 (07:37 +0200)]
qemu: driver: Don't return automatic NUMA vCPU pinning data for persistentDef

Calling virDomainGetVcpuPinInfo on a live VM with automatic NUMA pinning
and VIR_DOMAIN_AFFECT_CONFIG would return the automatic pinning data
in some cases which is bogus. Use the autoCpuset property only when
called on a live definition.

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

8 years agoqemu: domain: Add macro to simplify access to vm private data
Peter Krempa [Wed, 14 Sep 2016 05:28:18 +0000 (07:28 +0200)]
qemu: domain: Add macro to simplify access to vm private data

Sometimes adding a separate variable to access vm->privateData is not
necessary. Add a macro that will do the typecasting rather than having
to add a temp variable to force the compiler to typecast it.

8 years agoconf: Introduce virDomainObjGetOneDefState
Peter Krempa [Wed, 14 Sep 2016 05:22:40 +0000 (07:22 +0200)]
conf: Introduce virDomainObjGetOneDefState

Return whether the live or persistent definition was returned. Sometimes
it's necessary to base the decisions on this.

8 years agoqemu: Ignore graphics cookie if port == 0
Jiri Denemark [Tue, 20 Sep 2016 15:27:03 +0000 (17:27 +0200)]
qemu: Ignore graphics cookie if port == 0

Old libvirt represents

    <graphics type='spice'>
      <listen type='none'/>
    </graphics>

as

    <graphics type='spice' autoport='no'/>

In this mode, QEMU doesn't listen for SPICE connection anywhere and
clients have to use virDomainOpenGraphics* APIs to attach to the domain.
That is, the client has to run on the same host where the domains runs
and it's impossible to tell the client to reconnect to the destination
QEMU during migration (unless there is some kind of proxy on the host).

While current libvirt correctly ignores such graphics devices when
creating graphics migration cookie, old libvirt just sends

    <graphics type='spice' port='0' listen='0.0.0.0' tlsPort='-1'/>

in the cookie. After seeing this cookie, we happily would call
client_migrate_info QMP command and wait for SPICE_MIGRATE_COMPLETED
event, which is quite pointless since the doesn't know where to connecti
anyway. We should just ignore such cookies.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuDomainOpenGraphics: Start job early
Jiri Denemark [Tue, 20 Sep 2016 13:25:06 +0000 (15:25 +0200)]
qemuDomainOpenGraphics: Start job early

Checking if a domain's definition or if it is active before we got a job
is pointless since the domain might have changed in the meantime.

Luckily libvirtd didn't crash when the API tried to talk to an inactive
domain:

debug : qemuDomainObjBeginJobInternal:2914 : Started job: modify
    (async=none vm=0x7f8f340140c0 name=ble)
debug : qemuDomainObjEnterMonitorInternal:3137 : Entering monitor
    (mon=(nil) vm=0x7f8f340140c0 name=ble)
warning : virObjectLock:319 : Object (nil) ((unknown)) is not a
    virObjectLockable instance
debug : qemuMonitorOpenGraphics:3505 : protocol=spice fd=27
    fdname=graphicsfd skipauth=1
error : qemuMonitorOpenGraphics:3508 : invalid argument: monitor must
    not be NULL
debug : qemuDomainObjExitMonitorInternal:3160 : Exited monitor
    (mon=(nil) vm=0x7f8f340140c0 name=ble)
debug : qemuDomainObjEndJob:3068 : Stopping job: modify (async=none
    vm=0x7f8f340140c0 name=ble)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agostream.c: fix a typo
Nitesh Konkar [Wed, 21 Sep 2016 08:36:09 +0000 (14:06 +0530)]
stream.c: fix a typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoconfig-post.h:fix a typo
Nitesh Konkar [Tue, 20 Sep 2016 18:52:15 +0000 (00:22 +0530)]
config-post.h:fix a typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoqemu: agent: give better error messages whe agent monitor is down
Nikolay Shirokovskiy [Fri, 16 Sep 2016 10:35:36 +0000 (13:35 +0300)]
qemu: agent: give better error messages whe agent monitor is down

We can receive NULL as sync reply in two situations. First
is garbage sync reply and this situation is handled by
resending sync message. Second is different cases
of rebooting guest, destroing domain etc and we can
give more meaningful error message. Actually we have
this error message in qemuAgentCommand already which checks
for the same sitatuion. AFAIK case with mon->running
is just to be safe on adding some future(?) cases of
returning NULL reply.

8 years agoqemu: agent: reissue sync on garbage sync reply
Nikolay Shirokovskiy [Fri, 16 Sep 2016 10:35:35 +0000 (13:35 +0300)]
qemu: agent: reissue sync on garbage sync reply

We can easily handle receiving garbage on sync. We don't
have to make client deal with this situation. We just
need to resend sync command but this time garbage is
not be possible.