]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agodocs: Fix version number
Andrea Bolognani [Tue, 5 Mar 2019 16:08:47 +0000 (17:08 +0100)]
docs: Fix version number

virtio-(non-)transitional device models have been introduced
in 5.2.0, not 5.1.0.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agocpu_map: Add more signatures for Skylake-Client CPU models
Jiri Denemark [Tue, 26 Feb 2019 20:02:49 +0000 (21:02 +0100)]
cpu_map: Add more signatures for Skylake-Client CPU models

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for Broadwell CPU models
Jiri Denemark [Fri, 22 Feb 2019 13:45:24 +0000 (14:45 +0100)]
cpu_map: Add more signatures for Broadwell CPU models

This fixes several CPUs which were incorrectly detected as
Skylake-Client.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for Haswell CPU models
Jiri Denemark [Tue, 26 Feb 2019 11:06:05 +0000 (12:06 +0100)]
cpu_map: Add more signatures for Haswell CPU models

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for IvyBridge CPU models
Jiri Denemark [Tue, 26 Feb 2019 11:22:00 +0000 (12:22 +0100)]
cpu_map: Add more signatures for IvyBridge CPU models

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for SandyBridge CPU models
Jiri Denemark [Tue, 26 Feb 2019 19:26:35 +0000 (20:26 +0100)]
cpu_map: Add more signatures for SandyBridge CPU models

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for Westmere CPU model
Jiri Denemark [Mon, 25 Feb 2019 15:44:11 +0000 (16:44 +0100)]
cpu_map: Add more signatures for Westmere CPU model

This fixes several CPUs which were incorrectly detected as a different
CPU model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for Nehalem CPU models
Jiri Denemark [Tue, 26 Feb 2019 11:59:37 +0000 (12:59 +0100)]
cpu_map: Add more signatures for Nehalem CPU models

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for Penryn CPU model
Jiri Denemark [Tue, 26 Feb 2019 11:59:50 +0000 (12:59 +0100)]
cpu_map: Add more signatures for Penryn CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add more signatures for Conroe CPU model
Jiri Denemark [Tue, 26 Feb 2019 09:45:56 +0000 (10:45 +0100)]
cpu_map: Add more signatures for Conroe CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Test CPU signatures
Jiri Denemark [Mon, 25 Feb 2019 09:05:34 +0000 (10:05 +0100)]
cputest: Test CPU signatures

The signature computation code is not too complicated and it will likely
never change so testing it is not very important. We do it mostly for a
nice side effect of easily accessible signature numbers for all CPU
data files.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add hex representation of signatures
Jiri Denemark [Tue, 26 Feb 2019 08:22:36 +0000 (09:22 +0100)]
cpu_map: Add hex representation of signatures

The family/model numbers are nice for humans or for comparing with
/proc/cpuinfo, but sometimes there's a need to see the CPUID
representation of the signature. Let's add it into a comment for each
signature in out cpu_map XMLs as the conversion is not exactly
straightforward.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Add virCPUx86DataGetSignature for tests
Jiri Denemark [Mon, 25 Feb 2019 09:04:21 +0000 (10:04 +0100)]
cpu_x86: Add virCPUx86DataGetSignature for tests

The function exports the functionality of x86DataToSignatureFull and
x86MakeSignature to the test suite.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu_capabilities: Use virQEMUCapsGetCPUModelInfo
Jiri Denemark [Mon, 25 Feb 2019 09:00:53 +0000 (10:00 +0100)]
qemu_capabilities: Use virQEMUCapsGetCPUModelInfo

Most places in qemu_capabilities.c which call virQEMUCapsGetHostCPUData
actually need qemuMonitorCPUModelInfoPtr from QEMU caps. Let's use the
wrapper introduced in the previous commit instead.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu_capabilities: Introduce virQEMUCapsGetCPUModelInfo
Jiri Denemark [Mon, 25 Feb 2019 09:01:34 +0000 (10:01 +0100)]
qemu_capabilities: Introduce virQEMUCapsGetCPUModelInfo

This is a simple wrapper around virQEMUCapsGetHostCPUData usable in
tests for getting qemuMonitorCPUModelInfoPtr from QEMU caps.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu_capabilities: Inroduce virQEMUCapsGetCPUModelX86Data
Jiri Denemark [Mon, 25 Feb 2019 08:39:17 +0000 (09:39 +0100)]
qemu_capabilities: Inroduce virQEMUCapsGetCPUModelX86Data

The code for transforming qemuMonitorCPUModelInfo data from QEMU into
virCPUDefPtr consumable by virCPU* APIs was hidden inside
virQEMUCapsInitCPUModelX86. This patch moves it into a new function to
make it usable in tests.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Log decoded CPU model and signatures
Jiri Denemark [Mon, 4 Mar 2019 15:37:31 +0000 (16:37 +0100)]
cpu_x86: Log decoded CPU model and signatures

The log message may be useful when debugging why a specific CPU model
was selected for a given set of CPUID data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Allow multiple signatures for a CPU model
Jiri Denemark [Fri, 22 Feb 2019 16:20:59 +0000 (17:20 +0100)]
cpu_x86: Allow multiple signatures for a CPU model

CPU signatures in the cpu_map serve as a hint for CPUID to CPU model
matching algorithm. If the CPU signatures matches any CPU model in the
cpu_map, this model will be the preferred one.

This works out well and solved several mismatches, but in real world
CPUs which should match a single CPU model may be produced with several
different signatures. For example, low voltage Broadwell CPUs for
laptops and Broadwell CPUs for servers differ in CPU model numbers while
we should detect them all as Broadwell CPU model.

This patch adds support for storing several signatures for a single CPU
model to make this hint useful for more CPUs. Later commits will provide
additional signatures for existing CPU models, which will correct some
results in our CPU test suite.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Store CPU signature in an array
Jiri Denemark [Mon, 4 Mar 2019 15:36:33 +0000 (16:36 +0100)]
cpu_x86: Store CPU signature in an array

In preparation for storing several CPU signatures in a single CPU model,
we need to turn virCPUx86Model's signature into an array of signatures.

The parser still hardcodes the number of signatures to 1, but the
following patch will drop this limit.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Add x86ModelCopySignatures helper
Jiri Denemark [Mon, 4 Mar 2019 15:18:42 +0000 (16:18 +0100)]
cpu_x86: Add x86ModelCopySignatures helper

Introduce a helper for copying CPU signature between two CPU models.

It's not very useful until the way we store signatures is changed in the
next patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Make sure CPU model names are unique in cpu_map
Jiri Denemark [Tue, 26 Feb 2019 07:33:08 +0000 (08:33 +0100)]
cpu_x86: Make sure CPU model names are unique in cpu_map

Having multiple CPU model definitions with the same name could result in
unexpected behavior.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Separate feature list parsing from x86ModelParse
Jiri Denemark [Fri, 22 Feb 2019 15:36:02 +0000 (16:36 +0100)]
cpu_x86: Separate feature list parsing from x86ModelParse

The code is separated into a new x86ModelParseFeatures function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Separate vendor parsing from x86ModelParse
Jiri Denemark [Fri, 22 Feb 2019 14:33:53 +0000 (15:33 +0100)]
cpu_x86: Separate vendor parsing from x86ModelParse

The code is separated into a new x86ModelParseVendor function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Separate signature parsing from x86ModelParse
Jiri Denemark [Fri, 22 Feb 2019 14:32:44 +0000 (15:32 +0100)]
cpu_x86: Separate signature parsing from x86ModelParse

The code is separated into a new x86ModelParseSignature function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Separate ancestor model parsing from x86ModelParse
Jiri Denemark [Fri, 22 Feb 2019 14:22:29 +0000 (15:22 +0100)]
cpu_x86: Separate ancestor model parsing from x86ModelParse

The code is separated into a new x86ModelParseAncestor function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add data for Intel(R) Core(TM) i7-8700
Jiri Denemark [Mon, 4 Mar 2019 15:45:48 +0000 (16:45 +0100)]
cputest: Add data for Intel(R) Core(TM) i7-8700

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add data for Intel(R) Xeon(R) CPU E5-2650
Jiri Denemark [Wed, 27 Feb 2019 08:49:36 +0000 (09:49 +0100)]
cputest: Add data for Intel(R) Xeon(R) CPU E5-2650

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add data for Intel(R) Xeon(R) CPU E7540
Jiri Denemark [Tue, 26 Feb 2019 20:22:25 +0000 (21:22 +0100)]
cputest: Add data for Intel(R) Xeon(R) CPU E7540

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add data for Intel(R) Core(TM) i7-7600U
Jiri Denemark [Thu, 21 Feb 2019 21:14:53 +0000 (22:14 +0100)]
cputest: Add data for Intel(R) Core(TM) i7-7600U

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add data for Intel(R) Xeon(R) CPU E5-2630 v4
Jiri Denemark [Thu, 21 Feb 2019 20:51:58 +0000 (21:51 +0100)]
cputest: Add data for Intel(R) Xeon(R) CPU E5-2630 v4

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Make sure generated files pass syntax-check
Jiri Denemark [Wed, 27 Feb 2019 08:43:23 +0000 (09:43 +0100)]
cputest: Make sure generated files pass syntax-check

The tests/cputestdata/cpu-parse.sh would produce JSON files with QEMU
replies which wouldn't pass syntax-check. Let's fix this by not emitting
an extra new line after reformatting the JSON file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Add -inactive suffix when appropriate for qemuxml2xml
Andrea Bolognani [Thu, 28 Feb 2019 16:25:18 +0000 (17:25 +0100)]
tests: Add -inactive suffix when appropriate for qemuxml2xml

Some test cases are only executed using WHEN_INACTIVE, and the
output file name should reflect this for clarity.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Use WHEN_BOTH in qemuxml2xml whenever possible
Andrea Bolognani [Thu, 28 Feb 2019 16:10:17 +0000 (17:10 +0100)]
tests: Use WHEN_BOTH in qemuxml2xml whenever possible

There are a few cases where we are using either WHEN_ACTIVE
or WHEN_INACTIVE even though WHEN_BOTH would work perfectly
fine: for those, start using the simpler DO_TEST() macro.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Rename some qemuxml2xml output files for clarity
Andrea Bolognani [Thu, 28 Feb 2019 15:51:52 +0000 (16:51 +0100)]
tests: Rename some qemuxml2xml output files for clarity

disk-mirror-old has different output file for the active and
inactive parts, which should be named accordingly; on the other
hand, both output files for disk-backing-chains-noindex are
identical, so it makes sense to only keep around one and remove
the (in-)active suffix.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoFix the recent CI build failures
Erik Skultety [Tue, 5 Mar 2019 08:41:25 +0000 (09:41 +0100)]
Fix the recent CI build failures

After commits e2087c2 and ec0793de older GCC started act very smart and
complain about potentially uninitialized variable, which existed prior
to these patches + even if the affected vars were left uninitialized the
function responsible for filling them in would have failed with NULL
being returned which the caller has always handled carefully.
Although GCC complained only about a single variable, let's initialize
all of them so as to prevent any further potential breakages.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agovirsh: Add event name completion to 'network-event' command
Lin Ma [Tue, 5 Mar 2019 03:17:39 +0000 (11:17 +0800)]
virsh: Add event name completion to 'network-event' command

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh-network: Introduce virshNetworkEventCallback to handle network events
Lin Ma [Tue, 5 Mar 2019 03:17:38 +0000 (11:17 +0800)]
virsh-network: Introduce virshNetworkEventCallback to handle network events

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh: Add device name completion for target option of detach-disk command
Lin Ma [Tue, 5 Mar 2019 03:17:37 +0000 (11:17 +0800)]
virsh: Add device name completion for target option of detach-disk command

Signed-off-by: Lin Ma <lma@suse.com>
6 years agoqemu: domcaps: Report disk <enum name="model">
Cole Robinson [Wed, 20 Feb 2019 19:18:40 +0000 (14:18 -0500)]
qemu: domcaps: Report disk <enum name="model">

This generates new XML like:

    <disk>
      <enum name='model'>
        <value>virtio</value>
        <value>virtio-transitional</value>
        <value>virtio-non-transitional</value>
      </enum>
    </disk>

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: domcaps: Add qemu 4.0.0 test case
Cole Robinson [Thu, 17 Jan 2019 17:52:45 +0000 (12:52 -0500)]
tests: domcaps: Add qemu 4.0.0 test case

Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support scsi controller model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:43 +0000 (12:52 -0500)]
qemu: Support scsi controller model=virtio-{non-}transitional

Add <controller type='scsi' model handling for virtio transitional
devices. Ex:

  <controller type='scsi' model='virtio-transitional'/>

* "virtio-transitional" maps to qemu "virtio-scsi-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-scsi-non-transitional"

The naming here doesn't match the pre-existing model=virtio-scsi.
The prescence of '-scsi' there seems kind of redundant as we have
type='scsi' already, so I decided to follow the pattern of other
patches and use virtio-transitional etc.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support virtio-serial controller model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:44 +0000 (12:52 -0500)]
qemu: Support virtio-serial controller model=virtio-{non-}transitional

Add controller type='virtio-serial' model handling for virtio
transitional devices. Ex:

  <controller type='virtio-serial' model='virtio-transitional'/>

* "virtio-transitional" maps to qemu "virtio-serial-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-serial-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support input model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:42 +0000 (12:52 -0500)]
qemu: Support input model=virtio-{non-}transitional

Add <input> model handling for virtio transitional devices. Ex:

  <input type='passthrough' bus='virtio' model='virtio-transitional'>
    ...
  </input>

* "virtio-transitional" maps to qemu "virtio-input-host-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-input-host-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoconf: Add <input model='virtio-{non-}transitional'/>
Cole Robinson [Thu, 17 Jan 2019 17:52:41 +0000 (12:52 -0500)]
conf: Add <input model='virtio-{non-}transitional'/>

<input> devices lack the model= attribute which is used by
most other device types. To eventually support
virtio-input-host-pci-{non-}traditional in qemu, let's add
a standard model= attribute. This just adds the domain_conf
wiring

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support vsock model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:40 +0000 (12:52 -0500)]
qemu: Support vsock model=virtio-{non-}transitional

Add <vsock> model handling for virtio transitional devices. Ex:

  <vsock model='virtio-transitional'>
    ...
  </vsock>

* "virtio-transitional" maps to qemu "vhost-vsock-pci-transitional"
* "virtio-non-transitional" maps to qemu "vhost-vsock-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support memballoon model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:39 +0000 (12:52 -0500)]
qemu: Support memballoon model=virtio-{non-}transitional

Add new <memballoon> model values for virtio transitional devices. Ex:

  <memballoon model='virtio-transitional'/>

* "virtio-transitional" maps to qemu "virtio-balloon-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-balloon-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support filesystem model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:37 +0000 (12:52 -0500)]
qemu: Support filesystem model=virtio-{non-}transitional

Add <filesystem> model handling for virtio transitional devices. Ex:

  <filesystem type='mount' model='virtio-transitional'>
    ...
  </filesystem

* "virtio-transitional" maps to qemu "virtio-9p-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-9p-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoconf: Add <filesystem model='virtio-{non-}transitional'/>
Cole Robinson [Thu, 17 Jan 2019 17:52:36 +0000 (12:52 -0500)]
conf: Add <filesystem model='virtio-{non-}transitional'/>

<filesystem> devices lack the model= attribute which is used by
most other device types. To eventually support
virtio-9p-pci-{non-}traditional in qemu, let's add a standard
model= attribute. The accepted values are:

- virtio
- virtio-transitional
- virtio-non-transitional

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support rng model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:35 +0000 (12:52 -0500)]
qemu: Support rng model=virtio-{non-}transitional

Add new <rng> model values for virtio transitional devices. Ex:

  <rng model='virtio-transitional'>
    ...
  </rng>

* "virtio-transitional" maps to qemu "virtio-rng-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-rng-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support hostdev model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:34 +0000 (12:52 -0500)]
qemu: Support hostdev model=virtio-{non-}transitional

Add <hostdev> protocol=vhost model handling for virtio transitional
devices. Ex:

  <hostdev mode='subsystem' type='scsi_host' model='virtio-transitional'>
    <source protocol='vhost' wwpn=X/>
  </hostdev>

* "virtio-transitional" maps to qemu "vhost-scsi-pci-transitional"
* "virtio-non-transitional" maps to qemu "vhost-scsi-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoconf: Add <hostdev model='virtio-{non-}transitional'/>
Cole Robinson [Thu, 17 Jan 2019 17:52:33 +0000 (12:52 -0500)]
conf: Add <hostdev model='virtio-{non-}transitional'/>

qemu vhost-scsi devices map to XML roughly like:

    <hostdev mode='subsystem' type='scsi_host'>
      <source protocol='vhost' wwpn=X/>
    </hostdev>

To support vhost-scsi-pci-{non-}traditional in qemu, we
need to to extend the SCSI Host hostdev XML to handle
model= value. This matches the XML model= format used
for mediated devices. This is just the domain_conf bits
and some XML test cases.

Use of virtio-X naming here does not match the hostdev
protocol=vhost nor does it match the qemu vhost-X device
naming, however it's more consistent with all other
model= names in this area, and also matches the
inconsistency of <vsock> devices which use model=virtio
but map to vhost-vsock on the qemu commandline

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support interface model=virtio-{non-}transitional
Cole Robinson [Thu, 17 Jan 2019 17:52:32 +0000 (12:52 -0500)]
qemu: Support interface model=virtio-{non-}transitional

Add new <interface> model handling for virtio transitional devices. Ex:

<interface>
  <model type='virtio-transitional'/>
</interface>

* "virtio-transitional" maps to qemu "virtio-net-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-net-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Support disk model=virtio-{non-}transitional
Cole Robinson [Fri, 11 Jan 2019 21:30:10 +0000 (16:30 -0500)]
qemu: Support disk model=virtio-{non-}transitional

Add new <disk> model values for virtio transitional devices. When
combined with bus='virtio':

* "virtio-transitional" maps to qemu "virtio-blk-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-blk-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoconf: Add <disk model='virtio-{non-}transitional'/>
Cole Robinson [Fri, 11 Jan 2019 20:06:05 +0000 (15:06 -0500)]
conf: Add <disk model='virtio-{non-}transitional'/>

<disk> devices lack the model= attribute which is used by
most other device types. bus= mostly acts as one, but it
serves other purposes too like determing what target=
prefix to use, and for matching against controller type=
values.

Extending bus= to handle additional virtio transitional
devices will complicate apps lives, and it isn't a clean
mapping anyways. So let's bite the bullet and add a new
<disk model=X/> attribute, and wire up common handling
for virtio and virtio-{non-}transitional

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: capabilities: Add virtio/vhost {non-}transitional
Cole Robinson [Tue, 22 Jan 2019 18:17:06 +0000 (13:17 -0500)]
qemu: capabilities: Add virtio/vhost {non-}transitional

Add a single QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL that
will be set if any of the following qemu devices are found:

    virtio-blk-pci-transitional
    virtio-blk-pci-non-transitional
    virtio-net-pci-transitional
    virtio-net-pci-non-transitional
    vhost-scsi-pci-transitional
    vhost-scsi-pci-non-transitional
    virtio-rng-pci-transitional
    virtio-rng-pci-non-transitional
    virtio-9p-pci-transitional
    virtio-9p-pci-non-transitional
    virtio-balloon-pci-transitional
    virtio-balloon-pci-non-transitional
    vhost-vsock-pci-transitional
    vhost-vsock-pci-non-transitional
    virtio-input-host-pci-transitional
    virtio-input-host-pci-non-transitional
    virtio-scsi-pci-transitional
    virtio-scsi-pci-non-transitional
    virtio-serial-pci-transitional
    virtio-serial-pci-non-transitional

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: command: Add qemuCaps to BuildVirtioStr
Cole Robinson [Wed, 23 Jan 2019 13:10:22 +0000 (08:10 -0500)]
qemu: command: Add qemuCaps to BuildVirtioStr

It will be used in future patches

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agovirDomainDiskTranslateSourcePool: Don't set @mode of iscsi-direct
Michal Privoznik [Fri, 1 Mar 2019 15:05:16 +0000 (16:05 +0100)]
virDomainDiskTranslateSourcePool: Don't set @mode of iscsi-direct

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

This function is called when a domain is starting up (in qemu
driver that is when qemu cmd line is generated). It is used to
translate <disk type='volume'/> to something usable by filling in
virStorageSource (e.g. fetching disk path, or some connection URI
for a network FS). But some of these info are not stored in
status XML and thus the function is called on
qemuProcessReconnect too to reconstruct runtime data. But this
poses a problem because after the first run the mode is set to
'direct', but in the second run this triggers a failure because
mode is valid only for 'iscsi' volumes and not 'iscsi-direct'
ones.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Rework virDomainKeyWrapDefParseXML
John Ferlan [Fri, 1 Mar 2019 16:00:48 +0000 (11:00 -0500)]
conf: Rework virDomainKeyWrapDefParseXML

Rewrite the code to make usage of some VIR_AUTOFREE logic.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Clean up some unnecessary goto paths
John Ferlan [Fri, 15 Feb 2019 13:47:35 +0000 (08:47 -0500)]
conf: Clean up some unnecessary goto paths

Now that we're using VIR_AUTOFREE there's quite a bit of clean up
possible for now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Use VIR_AUTOUNREF in domain_conf
John Ferlan [Fri, 1 Mar 2019 15:34:50 +0000 (10:34 -0500)]
conf: Use VIR_AUTOUNREF in domain_conf

Let's make use of the auto __cleanup capabilities for virObjectUnref
consumers.

Signed-off-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Use VIR_AUTOFREE in domain_conf
John Ferlan [Wed, 20 Feb 2019 16:25:10 +0000 (11:25 -0500)]
conf: Use VIR_AUTOFREE in domain_conf

Let's make use of the auto __cleanup capabilities for VIR_FREE consumers.
In some cases adding or removing blank lines for readability.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Remove a few unused variables in domain_conf
John Ferlan [Wed, 20 Feb 2019 16:18:28 +0000 (11:18 -0500)]
conf: Remove a few unused variables in domain_conf

In preparation for VIR_AUTOFREE usage, let's remove a couple
of unused variables so that clang compilations won't fail.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Clean up some unnecessary goto paths
John Ferlan [Fri, 15 Feb 2019 12:04:13 +0000 (07:04 -0500)]
conf: Clean up some unnecessary goto paths

Now that we're using VIR_AUTOPTR(virBitmap) there's a couple of methods
that we can clean up some now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Use VIR_AUTOPTR(virBitmap) in domain_conf
John Ferlan [Wed, 20 Feb 2019 16:04:47 +0000 (11:04 -0500)]
conf: Use VIR_AUTOPTR(virBitmap) in domain_conf

Let's make use of the auto __cleanup capabilities for virBitmapPtr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Rework virDomainEmulatorPinDefParseXML
John Ferlan [Wed, 20 Feb 2019 16:07:07 +0000 (11:07 -0500)]
conf: Rework virDomainEmulatorPinDefParseXML

In preparation for using auto free mechanism, change to using the
VIR_STEAL_PTR on @def to @ret and of course be sure to properly clean
up @def in cleanup.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Use VIR_XPATH_NODE_AUTORESTORE when XPath context is modified
Peter Krempa [Tue, 26 Feb 2019 16:42:25 +0000 (17:42 +0100)]
qemu: Use VIR_XPATH_NODE_AUTORESTORE when XPath context is modified

Use the new helper when moving around the current node of the XPath
context.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: XML: Introduce automatic reset of XPath's current node
Peter Krempa [Tue, 26 Feb 2019 16:34:57 +0000 (17:34 +0100)]
util: XML: Introduce automatic reset of XPath's current node

Quite a few parts modify the XPath context current node to shift the
scope and allow easier queries. This also means that the node needs
to be restored afterwards.

Introduce a macro based on 'VIR_AUTOCLEAN' which adds a local structure
on the stack remembering the original node along with a function which
will make sure that the node is reset when the local structure leaves
scope.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: alloc: Clarify docs for VIR_DEFINE_AUTOCLEAN_FUNC
Peter Krempa [Tue, 26 Feb 2019 16:46:57 +0000 (17:46 +0100)]
util: alloc: Clarify docs for VIR_DEFINE_AUTOCLEAN_FUNC

Document that @func must take pointer to @type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: object: Reset pointer when unrefing object in virObjectAutoUnref
Peter Krempa [Tue, 26 Feb 2019 16:07:42 +0000 (17:07 +0100)]
util: object: Reset pointer when unrefing object in virObjectAutoUnref

The helper function is used by the VIR_AUTOUNREF macro. Prior art is to
clear the pointer even if the variable goes out of scope.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agosyntax-check: require intialization for new VIR_AUTO macros
Peter Krempa [Tue, 26 Feb 2019 16:02:58 +0000 (17:02 +0100)]
syntax-check: require intialization for new VIR_AUTO macros

The syntax-check should also check the new ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: alloc: Note that VIR_AUTOPTR/VIR_AUTOCLEAN must not be used with vectors
Peter Krempa [Fri, 22 Feb 2019 15:32:11 +0000 (16:32 +0100)]
util: alloc: Note that VIR_AUTOPTR/VIR_AUTOCLEAN must not be used with vectors

We'd free only the first element of the vector leaking the rest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: string: Remove the 'virString' type
Peter Krempa [Tue, 26 Feb 2019 15:17:54 +0000 (16:17 +0100)]
util: string: Remove the 'virString' type

We don't need it as there's a separate macro for auto-freeing of string
lists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: string: Use VIR_AUTOSTRINGLIST instead of VIR_AUTOPTR(virString)
Peter Krempa [Fri, 22 Feb 2019 14:01:02 +0000 (15:01 +0100)]
util: string: Use VIR_AUTOSTRINGLIST instead of VIR_AUTOPTR(virString)

Use of VIR_AUTOPTR and virString is confusing as it's a list and not a
single pointer. Replace it by VIR_AUTOSTRINGLIST as string lists are
basically the only sane NULL-terminated list we can have.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: string: Introduce macro for automatic string lists
Peter Krempa [Tue, 26 Feb 2019 15:10:17 +0000 (16:10 +0100)]
util: string: Introduce macro for automatic string lists

Similar to VIR_AUTOPTR, VIR_AUTOSTRINGLIST defines a list of strings
which will be freed if the pointer is leaving scope.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: Use VIR_AUTOUNREF for virstoragefile
John Ferlan [Tue, 12 Feb 2019 18:17:44 +0000 (13:17 -0500)]
util: Use VIR_AUTOUNREF for virstoragefile

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agomaint: Post-release version bump to 5.1.0
Peter Krempa [Mon, 4 Mar 2019 11:42:24 +0000 (12:42 +0100)]
maint: Post-release version bump to 5.1.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoRelease of libvirt-5.1.0
Daniel Veillard [Mon, 4 Mar 2019 09:58:02 +0000 (10:58 +0100)]
Release of libvirt-5.1.0

* docs/news.xml: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
6 years agonews: More 5.1 updates
Eric Blake [Thu, 28 Feb 2019 15:37:36 +0000 (09:37 -0600)]
news: More 5.1 updates

Mention my snapshot bug fixes, and the corresponding virsh command-line
parse tweak I added while working on the snapshot bug fixes.

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoqemu: Fix snapshot redefine vs. domain state bug
Eric Blake [Wed, 27 Feb 2019 19:38:18 +0000 (13:38 -0600)]
qemu: Fix snapshot redefine vs. domain state bug

The existing qemu snapshot code has a slight bug: if the domain
is currently pmsuspended, you can't use the _REDEFINE flag even
though the current domain state should have no bearing on being
able to recreate metadata state; and conversely, you can use the
_REDEFINE flag to create snapshot metadata claiming to be
pmsuspended as a bypass to the normal restrictions that you can't
create an original qemu snapshot in that state (the restriction
against pmsuspend is specific to qemu, rather than part of the
driver-agnostic snapshot_conf code).

Fix this by checking the snapshot state (when redefining) instead
of the domain state (which is a subset of snapshot states).

Fixes the second problem mentioned in https://bugzilla.redhat.com/1680304

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agostorage: Fix iscsi-direct volume size for volumes > 4GiB
Jiri Denemark [Thu, 28 Feb 2019 14:12:31 +0000 (15:12 +0100)]
storage: Fix iscsi-direct volume size for volumes > 4GiB

Both block_size and nb_block are unit32_t and multiplying them overflows
at 4GiB.

Moreover, the iscsi_*10_* APIs use 32bit number of blocks and thus they
can only address images up to 2TiB with 512B blocks. Let's use 64b
iscsi_*16_* APIs instead.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agovirISCSIDirectRefreshVol: Don't clear volumes in each run
Michal Privoznik [Thu, 28 Feb 2019 14:08:19 +0000 (15:08 +0100)]
virISCSIDirectRefreshVol: Don't clear volumes in each run

When fetching LUNs from iscsi server the
virISCSIDirectReportLuns() is called. This function does some
libiscsi calls and then calls virISCSIDirectRefreshVol() over
each LUN found. It's unfortunate that the latter calls
virStoragePoolObjClearVols() as we lose all LUNs processed
in previous iterations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agonews: Trivial style fixes
Andrea Bolognani [Thu, 28 Feb 2019 14:22:46 +0000 (15:22 +0100)]
news: Trivial style fixes

Some of the recent entries deviated from the established
style used throughout the file, so let's fix them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agonews: Update for 5.1.0 release
Michal Privoznik [Thu, 28 Feb 2019 10:16:51 +0000 (11:16 +0100)]
news: Update for 5.1.0 release

Not exhaustive list of new features, improvements and bugfixes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoiscsi_direct: Reset pool capacity and allocation just before refresh
Michal Privoznik [Thu, 28 Feb 2019 11:02:06 +0000 (12:02 +0100)]
iscsi_direct: Reset pool capacity and allocation just before refresh

Jirka reported a bug that with every 'virsh pool-refresh' an
iscsi-direct pool would grow and grow. The problem is that
virISCSIDirectRefreshVol() only adds to def->capacity and
def->allocation but nothing clears it out to begin with.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6 years agosnapshot: Improve message for VIR_ERR_INVALID_DOMAIN_SNAPSHOT
Eric Blake [Mon, 25 Feb 2019 16:37:58 +0000 (10:37 -0600)]
snapshot: Improve message for VIR_ERR_INVALID_DOMAIN_SNAPSHOT

For consistency with other error messages, and the fact that
the object is always called a virDomainSnapshot rather than
a mere virSnapshot, include the word "domain" in the error
message.

Suggested-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodomain: Document VIR_DOMAIN_XML_MIGRATABLE
Eric Blake [Wed, 13 Feb 2019 23:07:32 +0000 (17:07 -0600)]
domain: Document VIR_DOMAIN_XML_MIGRATABLE

Commit 28f8dfdc (1.0.0) added a flag to virDomainGetXMLDesc, but
failed to document its effects.  And considering that the
MIGRATABLE flag has been the source of past bugs (CVE-2014-7823,
fixed in commit b1674ad5 (1.2.11), or even cf2d4c60 (1.2.13) where
flag mismatch broke virsh edit), make the wording wishy-washy
enough to discourage using the flag casually, by mentioning that
the resulting XML is more for internal use than for validation
against the schema.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agosnapshot: Permit redefine of offline external snapshot
Eric Blake [Sat, 23 Feb 2019 19:21:38 +0000 (13:21 -0600)]
snapshot: Permit redefine of offline external snapshot

Due to historical back-compat, bare 'virsh snapshot-create-as'
favors internal snapshots (but can't be used on domains with raw
storage), while 'virsh snapshot-create-as --disk-only' favors
external snapshots.  What's more, snapshots created with
--disk-only while the domain was running are marked as snapshot
state 'disk-snapshot', while snapshots created while the domain
was offline are marked as snapshot state 'shutdown' (a
'disk-snapshot' image might not be quiescent, while a 'shutdown'
snapshot always is).

But this leads to some interesting problems: if we create a
--disk-only snapshot of an offline guest, and then immediately try
to 'virsh snapshot-create --redefine' using the resulting XML to
overwrite the existing snapashot in place, things silently succeed,
but 'virsh snapshot-create --redefine --disk-only' fails with an
error message that the snapshot state is not 'disk-only'.  Worse,
if we delete the snapshot metadata first and then try to recreate
things, omitting --disk-only fails because the verification code
wants to force the default of an internal snapshot (which doesn't
work with raw disks), and using --disk-only still fails because the
snapshot XML is not 'disk-only' - making it impossible to recreate
the snapshot metadata (or to transfer it from one libvirtd host to
another).  Ideally, the presence or absence of the --disk-only
flag, and the presence or absence of an existing snapshot being
overwritten, shouldn't matter; if the XML is valid for one
situation, it should always be valid to redefine the metadata for
that snapshot.

Fix things by uniformly using virDomainSnapshotDefIsExternal()
(caching the results up front, and eliminating other 'if' clauses
now rendered redundant) when deciding whether the XML being
requested for redefinition should permit external or force internal
state capture (we got it right in only one out of three places in
the function).

See also https://bugzilla.redhat.com/1680304; this fixes the
domain-agnostic problems mentioned there, but another patch is
needed to fix further oddities with the qemu driver.  I did not
check for sure when the problems were introduced (git blame puts
some affected hunks as far back as 1.0.0), but it was definitely
been broken even before when commit 670e86bf (1.1.4) factored
redefine prep out of qemu code into the common snapshot_conf code.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agosnapshots: Avoid term 'checkpoint' for full system snapshot
Eric Blake [Mon, 11 Jun 2018 13:59:10 +0000 (08:59 -0500)]
snapshots: Avoid term 'checkpoint' for full system snapshot

Upcoming patches plan to introduce virDomainCheckpointPtr as a new
object for use in incremental backups, along with documentation on
how incremental backups differ from snapshots.  But first, we need
to rename any existing mention of a 'system checkpoint' to instead
be a 'full system snapshot', so that we aren't overloading
the term checkpoint.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirsh: Elide backslash-newline in batch mode
Eric Blake [Tue, 26 Feb 2019 18:49:25 +0000 (12:49 -0600)]
virsh: Elide backslash-newline in batch mode

The previous patch made it possible to split multiple commands by
adding newline, but not to split a long single command. The sequence
backslash-newline was being used as if it were a quoted newline
character, rather than completely elided the way the shell does.

Again, add more tests, although this time it seems more like I am
suffering from a leaning-toothpick syndrome with all the \.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirsh: Treat \n like ; in batch mode
Eric Blake [Thu, 21 Feb 2019 18:36:32 +0000 (12:36 -0600)]
virsh: Treat \n like ; in batch mode

I wanted to do a demonstration with virsh batch mode, which
takes multiple commands all packed into a single argument:

$ virsh -c test:///default 'echo a; echo b;'
a
b

but that produced a really long line, so I tried to make it
more legible:

$ virsh -c test:///default '
   echo a;
   echo b;
'
error: unknown command: '
'

Let's be more like the shell, and treat unquoted newline as a
command separator just as we do for semicolon.  In fact, with
that, I can even now mix styles:

$ virsh -c test:///default '
   echo a; echo b
   echo c
'
a
b
c

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: fix vcpu pinning when not all vcpus are enabled
Yi Wang [Tue, 26 Feb 2019 02:01:28 +0000 (10:01 +0800)]
qemu: fix vcpu pinning when not all vcpus are enabled

vcpupin will fail when maxvcpus is larger than current
vcpu:

virsh vcpupin win7 --vcpu 0 --cpulist 5-6
error: Requested operation is not valid: cpu affinity is not supported

win7 xml in the command above is like below:
...
<vcpu current="3" placement="static">8</vcpu>
...

The reason is vcpu[3] and vcpu[4] have zero tids and should not been
compared as valid situation in qemuDomainRefreshVcpuInfo().

This issue is introduced by commit 34f7743, which fix recording of vCPU
pids for MTTCG.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirfile: added GPFS as shared fs
Diego Michelotto [Mon, 25 Feb 2019 18:19:03 +0000 (19:19 +0100)]
virfile: added GPFS as shared fs

Added GPFS as shared file system recognized during live migration
security checks.

GPFS is 'IBM General Parallel File System' also called
'IBM Spectrum Scale'

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

Signed-off-by: Diego Michelotto <diego.michelotto@cnaf.infn.it>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agolxc: Converting 'if, else' logic into a 'switch, case'
Julio Faracco [Mon, 18 Feb 2019 19:09:10 +0000 (16:09 -0300)]
lxc: Converting 'if, else' logic into a 'switch, case'

The structure used to handle network entries was based on 'if,else'
conditions. This commit converts this ugly structure into a switch to
clearify each option of the handler.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agolxc: Introduce lxcNetworkParseDataType
Julio Faracco [Mon, 18 Feb 2019 19:09:09 +0000 (16:09 -0300)]
lxc: Introduce lxcNetworkParseDataType

Extract out the network "type" processing into it's own method
rather than inline within lxcNetworkParseDataSuffix.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agolxc: Introduce lxcNetworkParseDataSuffix
Julio Faracco [Mon, 18 Feb 2019 19:09:07 +0000 (16:09 -0300)]
lxc: Introduce lxcNetworkParseDataSuffix

This commit removes the full network entry setting: "lxc.network.X" to
type only. Like "type", "name", "flags", etc. This will handle entries
regardless of whether they are prefixed by "lxc.network." (today) or
"lxc.net.X." (the future).

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agolxc: Introduce lxcNetworkParseDataEntry
Julio Faracco [Mon, 18 Feb 2019 19:09:06 +0000 (16:09 -0300)]
lxc: Introduce lxcNetworkParseDataEntry

Refactor lxcNetworkWalkCallback to be a simple method to handle
both possible network settings with indexes or the simple one. It is
better the decouple the whole algorithm to parse data to only parse
which entry type libvirt is handling.

The new method is responsible to verify is the settings correspond to
network entry. Right now, it is only verifying "lxc.network.", but in
the future, it can be used to verify "lxc.net.X." too. Any other case
would be rejected.

On the other hand, the idea here is working only with types. If we know
that entry is part of network settings, after we just need to know which
type is. It keeps the handler simple.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agolxc: Create a separate method to handle IPv{4, 6} outside parser
Julio Faracco [Mon, 18 Feb 2019 19:09:05 +0000 (16:09 -0300)]
lxc: Create a separate method to handle IPv{4, 6} outside parser

The new method called lxcNetworkParseDataIPs() is responsible to handle
IPv{4,6} settings now. The idea is let lxcNetworkWalkCallback() method
handle all entries related to network definition only.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoutil: Report error in virFileWrapperFdClose()
Andrea Bolognani [Tue, 19 Feb 2019 16:20:41 +0000 (17:20 +0100)]
util: Report error in virFileWrapperFdClose()

libvirt_iohelper is used internally by the virFileWrapperFd APIs;
more specifically, in the QEMU driver we have the doCoreDump() and
qemuDomainSaveMemory() helper functions as users, and those in turn
end up being called by the implementation of several driver APIs.

By calling virReportError() if libvirt_iohelper has failed, we
overwrite whatever generic error message QEMU might have raised
with the more useful one generated by the helper program.

After this commit, the user will be able to see the error directly
instead of having to dig in the journal or libvirtd log.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Move error reporting back to virFileWrapperFdClose()
Andrea Bolognani [Wed, 20 Feb 2019 13:16:46 +0000 (14:16 +0100)]
util: Move error reporting back to virFileWrapperFdClose()

virFileWrapperFdFree(), like all free functions, is supposed
to only release allocated resources, so error reporting is
better suited for virFileWrapperFdClose().

This reverts commit b0c3e931804a86cd7146db0164ab4843039c410b.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Always call virFileWrapperFdClose()
Andrea Bolognani [Tue, 19 Feb 2019 16:18:07 +0000 (17:18 +0100)]
qemu: Always call virFileWrapperFdClose()

Right now we're reporting errors in virFileWrapperFdFree(),
but that's hardly the appropriate place to do so, as free
functions are supposed to do nothing more than release
allocated resources.

We want to move that code back into virFileWrapperFdClose(),
but before we can do that we need to make sure the function
is actually called every time we're done processing the
wrapped file. The cleanup path is the obvious candidate.

In a couple of cases we can just move the call, but for the
remaining ones we need to duplicate it instead in order not
to alter the existing behavior. We do, however, make sure
that in all cases a failure to properly close the wrapper
results in the overall operation being reported as failed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>