]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agostorage: Create accessor API's for virStoragePoolObj
John Ferlan [Sun, 7 May 2017 11:56:03 +0000 (07:56 -0400)]
storage: Create accessor API's for virStoragePoolObj

In preparation for making a private object, create accessor API's for
consumer storage functions to use:

    virStoragePoolObjGetDef
    virStoragePoolObjSetDef
    virStoragePoolObjGetNewDef
    virStoragePoolObjDefUseNewDef
    virStoragePoolObjGetConfigFile
    virStoragePoolObjSetConfigFile
    virStoragePoolObjGetAutostartLink
    virStoragePoolObjIsActive
    virStoragePoolObjSetActive
    virStoragePoolObjIsAutostart
    virStoragePoolObjSetAutostart
    virStoragePoolObjGetAsyncjobs
    virStoragePoolObjIncrAsyncjobs
    virStoragePoolObjDecrAsyncjobs

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: man: Describe the 'create' command a bit more
Erik Skultety [Fri, 8 Sep 2017 12:52:44 +0000 (14:52 +0200)]
virsh: man: Describe the 'create' command a bit more

So we refer to the terms 'persistent' and 'transient' across the whole
man page, without describing it further, but more importantly, how the
create command affects it, i.e. explicitly stating that domain created
via the 'create' command are going to be transient or persistent,
depending on whether there is an existing persistent domain with a
matching <name> and <uuid>, in which case it will remain persistent, but
will run using a one-time configuration, otherwise it's going to be
transient and will vanish once destroyed.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoiohelper: reduce zero-out in align case
Nikolay Shirokovskiy [Thu, 7 Sep 2017 07:44:15 +0000 (10:44 +0300)]
iohelper: reduce zero-out in align case

We only need to zero-out bytes that will be written.
May be we even don't need to zero-out at all because
of immediate truncate.

7 years agoiohelper: simplify last direct write alignment
Nikolay Shirokovskiy [Thu, 7 Sep 2017 07:44:14 +0000 (10:44 +0300)]
iohelper: simplify last direct write alignment

Make alignment of last direct write more straightforward. Using
additionally two flags 'end' and 'shortRead' looks complicated.

7 years agoiohelper: drop unused operation length limit
Nikolay Shirokovskiy [Thu, 7 Sep 2017 07:44:13 +0000 (10:44 +0300)]
iohelper: drop unused operation length limit

7 years agoapparmor: cater for new AAVMF image location
Guido Günther [Fri, 15 Sep 2017 16:04:21 +0000 (18:04 +0200)]
apparmor: cater for new AAVMF image location

Things moved again, sigh.

Reviewed-By: Jamie Strandboge <jamie@canonical.com>
Michal Privoznik <mprivozn@redhat.com>

7 years agoapparmor: add attach_disconnected
Guido Günther [Fri, 15 Sep 2017 15:13:16 +0000 (17:13 +0200)]
apparmor: add attach_disconnected

Otherwise we fail to reconnect to /dev/net/tun opened by libvirtd
like

    [ 8144.507756] audit: type=1400 audit(1505488162.386:38069121): apparmor="DENIED" operation="file_perm" info="Failed name lookup - disconnected path" error=-13 profile="libvirt-5dfcc8a7-b79a-4fa9-a41f-f6271651934c" name="dev/net/tun" pid=9607 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=117 ouid=0

Reviewed-By: Jamie Strandboge <jamie@canonical.com>
Acked-By: Michal Privoznik <mprivozn@redhat.com>
7 years agocpu: Add new Skylake-Server CPU model
Jiri Denemark [Wed, 13 Sep 2017 11:27:03 +0000 (13:27 +0200)]
cpu: Add new Skylake-Server CPU model

Available since QEMU 2.10.0 (specifically commit
v2.9.0-2233-g53f9a6f45f).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add clwb/pcommit CPU features
Jiri Denemark [Wed, 13 Sep 2017 11:27:10 +0000 (13:27 +0200)]
cpu: Add clwb/pcommit CPU features

The features were added to QEMU by commit v2.4.0-1690-gf7fda28094 as
Skylake Server features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agotests: Add CPUID data for Intel(R) Xeon(R) Gold 6148 CPU
Jiri Denemark [Wed, 13 Sep 2017 11:07:50 +0000 (13:07 +0200)]
tests: Add CPUID data for Intel(R) Xeon(R) Gold 6148 CPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agodocs: Update news.xml to describe switchdev offloading
John Ferlan [Sat, 26 Aug 2017 13:22:25 +0000 (09:22 -0400)]
docs: Update news.xml to describe switchdev offloading

7 years agonodedev: add switchdev to NIC capabilities
Edan David [Mon, 21 Aug 2017 09:19:53 +0000 (05:19 -0400)]
nodedev: add switchdev to NIC capabilities

Adding functionality to libvirt that will allow querying the interface
for the availability of switchdev Offloading NIC capabilities.

The switchdev mode was introduced in kernel 4.8, the iproute2-devlink
command to retrieve the switchdev NIC feature with command example:

    devlink dev eswitch show pci/0000:03:00.0

This feature is needed for Openstack so we can do a scheduling decision
if the NIC is in Hardware Offload (switchdev) or regular SR-IOV (legacy) mode.
And select the appropriate hypervisors with the requested capability see [1].

[1] - https://specs.openstack.org/openstack/nova-specs/specs/pike/approved/enable-sriov-nic-features.html

Reviewed-by: Laine Stump <laine@laine.org>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Implement usernet address
Michal Privoznik [Wed, 13 Sep 2017 09:16:04 +0000 (11:16 +0200)]
qemu: Implement usernet address

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

Apart from generic checks, we need to constrain netmask/prefix
length a bit. Thing is, with current implementation QEMU needs to
be able to 'assign' some IP addresses to the virtual network. For
instance, the default gateway is at x.x.x.2, dns is at x.x.x.3,
the default DHCP range is x.x.x.15-x.x.x.30. Since we don't
expose these settings yet, it's safer to require shorter prefix
to have room for the defaults.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: laine@laine.org
7 years agoconf: Allow usernet to have an address
Michal Privoznik [Wed, 13 Sep 2017 08:47:52 +0000 (10:47 +0200)]
conf: Allow usernet to have an address

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

Currently, all that users can specify for an interface type of
'user' is the common attributes: PCI address, NIC model (and
that's basically it). However, some need to configure other
address range than the default one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: laine@laine.org
7 years agocpu_x86: Implement virCPUValidateFeatures
Jiri Denemark [Thu, 14 Sep 2017 14:14:40 +0000 (16:14 +0200)]
cpu_x86: Implement virCPUValidateFeatures

The function checks whether all CPU features used in a CPU definition
are specified in cpu_map.xml.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agocpu_s390: Implement virCPUValidateFeatures
Jiri Denemark [Thu, 14 Sep 2017 14:09:35 +0000 (16:09 +0200)]
cpu_s390: Implement virCPUValidateFeatures

Only feature policy is checked on s390, which was previously done in
virCPUUpdate, but that's not the correct place for the check once we
have virCPUValidateFeatures.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Validate guest CPU features before starting a domain
Jiri Denemark [Thu, 14 Sep 2017 14:07:59 +0000 (16:07 +0200)]
qemu: Validate guest CPU features before starting a domain

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agocpu: Introduce virCPUValidateFeatures
Jiri Denemark [Thu, 14 Sep 2017 14:04:13 +0000 (16:04 +0200)]
cpu: Introduce virCPUValidateFeatures

This new API may be used to check whether all features used in a CPU
definition are valid (e.g., libvirt knows their name, their policy is
supported, etc.). Leaving this API unimplemented in an arch subdriver
means libvirt does not restrict CPU features usable on the associated
architectures.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Filter CPU features returned by qemuConnectBaselineCPU
Jiri Denemark [Wed, 13 Sep 2017 15:28:48 +0000 (17:28 +0200)]
qemu: Filter CPU features returned by qemuConnectBaselineCPU

The host CPU definitions reported in the capabilities XML may contain
CPU features unknown to QEMU, but the result of virConnectBaselineCPU is
supposed to be directly usable as a guest CPU definition and thus it
should only contain features QEMU knows about.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Publish virQEMUCapsCPUFilterFeatures
Jiri Denemark [Wed, 13 Sep 2017 15:28:13 +0000 (17:28 +0200)]
qemu: Publish virQEMUCapsCPUFilterFeatures

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Pass virArch * to virQEMUCapsCPUFilterFeatures
Jiri Denemark [Wed, 13 Sep 2017 15:26:07 +0000 (17:26 +0200)]
qemu: Pass virArch * to virQEMUCapsCPUFilterFeatures

The filter only needs to know the CPU architecture. Passing
virQEMUCapsPtr as opaque is a bit overkill.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agocpu: Drop cpuBaselineXML
Jiri Denemark [Wed, 13 Sep 2017 14:27:15 +0000 (16:27 +0200)]
cpu: Drop cpuBaselineXML

The implementation of virConnectBaselineCPU may be different for each
hypervisor. Thus it shouldn't really be implmented in the cpu code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agocpu: Don't log CPU models in cpuBaselineXML
Jiri Denemark [Wed, 13 Sep 2017 14:05:15 +0000 (16:05 +0200)]
cpu: Don't log CPU models in cpuBaselineXML

They are logged in cpuBaseline anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agocpu: Use virCPUDefListParse in cpuBaselineXML
Jiri Denemark [Wed, 13 Sep 2017 13:38:31 +0000 (15:38 +0200)]
cpu: Use virCPUDefListParse in cpuBaselineXML

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agocpu_conf: Introduce virCPUDefList{Parse,Free}
Jiri Denemark [Wed, 13 Sep 2017 13:23:43 +0000 (15:23 +0200)]
cpu_conf: Introduce virCPUDefList{Parse,Free}

For parsing a list of CPU XMLs into a NULL-terminated list of CPU defs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agovirsh: Enhance documentation of --rdma-pin-all option
Jiri Denemark [Fri, 8 Sep 2017 19:31:29 +0000 (21:31 +0200)]
virsh: Enhance documentation of --rdma-pin-all option

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agospec: Fix %license compat on RHEL6
Cole Robinson [Fri, 15 Sep 2017 17:04:18 +0000 (13:04 -0400)]
spec: Fix %license compat on RHEL6

The macro needs to be defined closer to its usage

7 years agospec: Use %license when available
Cole Robinson [Thu, 14 Sep 2017 21:21:29 +0000 (17:21 -0400)]
spec: Use %license when available

This is required by the fedora packaging guidelines:

https://fedoraproject.org/wiki/Packaging:LicensingGuidelines

This macro isn't available on stock RHEL6 so provide a backcompat
definition

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

Reported-by: Ville Skyttä <ville.skytta@iki.fi>
7 years agospec: Own %{_libdir}/libvirt{,/connection-driver} dirs
Ville Skyttä [Sun, 27 Aug 2017 16:35:07 +0000 (12:35 -0400)]
spec: Own %{_libdir}/libvirt{,/connection-driver} dirs

Owning all created directories is a requirement of the Fedora
packaging guidelines

https://bugzilla.redhat.com/show_bug.cgi?id=1483293
Signed-off-by: Cole Robinson <crobinso@redhat.com>
7 years agoqemu: Fix return check on virHashAddEntry call
John Ferlan [Fri, 15 Sep 2017 11:36:55 +0000 (07:36 -0400)]
qemu: Fix return check on virHashAddEntry call

Luckily it only returns 0 or -1

7 years agoconf: Use virXMLFormatElement to format disk source network
John Ferlan [Wed, 13 Sep 2017 20:45:51 +0000 (16:45 -0400)]
conf: Use virXMLFormatElement to format disk source network

Commit id 'e02ff020cac' neglected to use the attrBuf and childBuf
in the virDomainDiskSourceFormatNetwork call.

So make the necessary alterations to allow usage.

7 years agoconf: Move <disk> encryption validation
John Ferlan [Thu, 14 Sep 2017 15:01:40 +0000 (11:01 -0400)]
conf: Move <disk> encryption validation

Rather than checking during XML processing, move the check for
valid <encryption> into virDomainDiskDefParseValidate and alter
the text of the message slightly to be a bit more correct.

7 years agoconf: Add invalid domain disk encryption test
John Ferlan [Thu, 14 Sep 2017 15:14:57 +0000 (11:14 -0400)]
conf: Add invalid domain disk encryption test

Add a test to prove checking for invalid luks disk formatting check.
The error message will indicate supplying the <cipher> element is
unnecessary.

7 years agoconf: Move <disk> authdef validation
John Ferlan [Wed, 13 Sep 2017 15:00:28 +0000 (11:00 -0400)]
conf: Move <disk> authdef validation

Rather than checking during XML processing, move the checks for correct
and valid auth into virDomainDiskDefParseValidate. This will introduce
virDomainDiskSourceDefParseAuthValidate to validate that the authdef
stored for the virStorageSource is valid. This can then be expanded
to service backingStore sources as well.

Alter the message text slightly as well to distinguish between an
unknown name and an incorrectly used name.  Since type is not a
mandatory field, add the NULLSTR() around the output of the unknown
error. NB, a config using unknown formatting would fail virschematest
since it only accepts 'iscsi' and 'ceph' as "valid" types.

7 years agoconf: Add invalid secrettype checks
John Ferlan [Wed, 13 Sep 2017 19:24:41 +0000 (15:24 -0400)]
conf: Add invalid secrettype checks

Add a couple of tests to "validate" checks in domain_conf that either
a missing secrettype (CONFIG_UNSUPPORTED) or an mismatched secrettype
of ceph for an iSCSI disk (INTERNAL_ERROR) will cause a parsing error.

7 years agodocs: Remove unnecessary <auth> example for iscsi disk type='volume'
John Ferlan [Wed, 13 Sep 2017 18:22:55 +0000 (14:22 -0400)]
docs: Remove unnecessary <auth> example for iscsi disk type='volume'

Alter the example to remove the <auth> from:

  <disk type='volume' device='disk'>
    <driver name='qemu' type='raw'/>
    <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
    <auth username='myuser'>
      <secret type='iscsi' usage='libvirtiscsi'/>
    </auth>
    <target dev='vdb' bus='virtio'/>
  </disk>

and

  <disk type='volume' device='disk'>
    <driver name='qemu' type='raw'/>
    <source pool='iscsi-pool' volume='unit:0:0:2' mode='direct'/>
    <auth username='myuser'>
      <secret type='iscsi' usage='libvirtiscsi'/>
    </auth>
    <target dev='vdc' bus='virtio'/>
  </disk>

The reality is, it's not even used. For a <source pool> the authdef
from the storage source pool will supercede whatever is in the <disk>
definition during virStorageTranslateDiskSourcePool processing. In fact,
if the pool doesn't have/need authentication, then the authdef would
be removed anyway as the storage pool would be handling things.

The "proof" for this is in the adjustment to the test to add an
<auth> for a disk. The resulting .args file won't add what normally
would be added "myname:encodedpassword@" prior to the hostname in
the IQN (e.g. iscsi://myname:encodedpassword@iscsi.example.org:3260/...

7 years agoqemu: Restore errors when rolling back disk image state
Peter Krempa [Mon, 11 Sep 2017 13:28:15 +0000 (15:28 +0200)]
qemu: Restore errors when rolling back disk image state

Some operations done to rollback disk image labelling and locking might
overwrite (or clear) the actual error. Remember the original error when
tearing down disk access so that it's not obscured.

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

7 years agoqemu: hotplug: Use new helpers for storing libvirt errors
Peter Krempa [Tue, 12 Sep 2017 08:32:27 +0000 (10:32 +0200)]
qemu: hotplug: Use new helpers for storing libvirt errors

The helpers allow to simplify restoring original errors in most cases.

7 years agoutil: error: Add helpers for saving and restoring of last error
Peter Krempa [Fri, 1 Sep 2017 14:19:56 +0000 (16:19 +0200)]
util: error: Add helpers for saving and restoring of last error

Some cleanup paths overwrite a usefull error message with a less useful
one and we then try to preserve the original message. The handlers added
in this patch will simplify the operations since they are designed right
for the purpose.

7 years agonews: document spice rendernode DAC changes
Cole Robinson [Tue, 12 Sep 2017 16:31:29 +0000 (12:31 -0400)]
news: document spice rendernode DAC changes

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agotravis: Shuffle sections around
Andrea Bolognani [Thu, 14 Sep 2017 11:31:17 +0000 (13:31 +0200)]
travis: Shuffle sections around

Order them more logically and make sure that stuff that doesn't
need to be modified frequently if at all, such as the notification
settings, are out of the way.

Perform other very minor tweaks as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
7 years agotravis: Install more build dependencies
Andrea Bolognani [Fri, 8 Sep 2017 14:42:28 +0000 (16:42 +0200)]
travis: Install more build dependencies

Since configure automatically picks up as many optional dependencies
as possible, installing more packages allows us to improve our test
coverage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotravis: Improve test matrix
Andrea Bolognani [Wed, 6 Sep 2017 14:08:26 +0000 (16:08 +0200)]
travis: Improve test matrix

The default distribution is apparently ignored if an explicit test
matrix is provided, so we haven't actually been testing the precise
plus gcc combo.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotravis: Don't have a separate script definition for macOS
Andrea Bolognani [Wed, 6 Sep 2017 13:58:22 +0000 (15:58 +0200)]
travis: Don't have a separate script definition for macOS

Make parts of the build command OS-dependent instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotravis: Don't abort build due to -Wvariadic-macros
Andrea Bolognani [Fri, 8 Sep 2017 16:42:49 +0000 (18:42 +0200)]
travis: Don't abort build due to -Wvariadic-macros

The openwsman header files are at fault here, but precise is entirely
unmaintained at this point so the issue will never be fixed.

Better to ignore the error and have coverage over the Hyper-V driver
than disabling it: if code that would trigger the warning will be
added to libvirt, the CentOS CI will catch it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotravis: Move variables to 'env' section
Andrea Bolognani [Wed, 6 Sep 2017 13:57:47 +0000 (15:57 +0200)]
travis: Move variables to 'env' section

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotravis: Limit git depth to 5 commits
Andrea Bolognani [Wed, 6 Sep 2017 13:53:25 +0000 (15:53 +0200)]
travis: Limit git depth to 5 commits

We don't need 50 commits for our purposes, so might as well save some
bandwidth and possibly some time by making the clone shallower.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoqemu: Add QEMU 2.10 x86_64 the generated capabilities
John Ferlan [Tue, 29 Aug 2017 22:34:57 +0000 (18:34 -0400)]
qemu: Add QEMU 2.10 x86_64 the generated capabilities

For reference, these were generated by updating a local qemu git
repository to the latest upstream, making sure the latest dependencies
were met via "dnf builddep qemu" from my sufficiently privileged root
account, checking out the v2.10.0 tag, and building in order to generate
an "x86_64-softmmu/qemu-system-x86_64" image.

Then using a clean libvirt tree updated to master and built, the image
was then provided as input:

    tests/qemucapsprobe /path/to/x86_64-softmmu/qemu-system-x86_64 > \
       tests/qemucapabilitiesdata/caps_2.10.0.x86_64.replies

With the .replies file in place and the DO_TEST line added and build,
then running the following commands:

    touch tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
    VIR_TEST_REGENERATE_OUTPUT=1 ./tests/qemucapabilitiestest

to generate tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml and both
were added to the commit.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: caps: Deprecate QEMU_CAPS_BLOCKJOB_SYNC
Peter Krempa [Wed, 13 Sep 2017 13:42:22 +0000 (15:42 +0200)]
qemu: caps: Deprecate QEMU_CAPS_BLOCKJOB_SYNC

Interestingly, none of the qemus we have caps for supported it ...

Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoqemu: monitor: Remove support for "legacy" block jobs
Peter Krempa [Wed, 13 Sep 2017 13:40:46 +0000 (15:40 +0200)]
qemu: monitor: Remove support for "legacy" block jobs

Drop all the monitor code necessary to do the downstream block jobs.

Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoqemu: Remove support for legacy block jobs
Peter Krempa [Wed, 13 Sep 2017 13:28:46 +0000 (15:28 +0200)]
qemu: Remove support for legacy block jobs

Block job QMP commands with underscores rather than dashes were never
released in upstream qemu, (they were added, but modified in the same
release [1]), but a certain distro managed to backport the version in the
middle.

The change also slightly modified semantics for the abort command, which
made us have a lot of code which was only ever present in certain
downstream distros.

Clean the upstream code from the legacy cruft and support only the
upstream implementations.

[1] See qemu commit v1.0-2176-gdb58f9c060

Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoqemu: Clean up qemuDomainSecretPrepare
John Ferlan [Wed, 30 Aug 2017 19:40:58 +0000 (15:40 -0400)]
qemu: Clean up qemuDomainSecretPrepare

No need to pass a @driver parameter since all that's done is deref
the @cfg especially since the only caller can just pass an already
referenced @cfg.

Also, looks like commit id '0298531b' at one time had a different
name for the API, so I took the liberty of fixing the comments too
since I would already be updating them for the @cfg variable.

7 years agovirsh.pod: Fix units for dommemstat and domstats
Michal Privoznik [Tue, 12 Sep 2017 13:47:14 +0000 (15:47 +0200)]
virsh.pod: Fix units for dommemstat and domstats

The documentation mistakenly states that the unit for returned
values is kB (multiple of 1000), while in fact we are returning
KiB (multiple of 1024).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agosecurity: dac: relabel spice rendernode
Cole Robinson [Mon, 17 Jul 2017 12:57:57 +0000 (08:57 -0400)]
security: dac: relabel spice rendernode

For a logged in user this a path like /dev/dri/renderD128 will have
default ownership root:video which won't work for the qemu:qemu user,
so we need to chown it.

We only do this when mount namespaces are enabled in the qemu driver,
so the chown'ing doesn't interfere with other users of the shared
render node path

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

7 years agosecurity: add MANAGER_MOUNT_NAMESPACE flag
Cole Robinson [Sun, 27 Aug 2017 15:23:47 +0000 (11:23 -0400)]
security: add MANAGER_MOUNT_NAMESPACE flag

The VIR_SECURITY_MANAGER_MOUNT_NAMESPACE flag informs the DAC driver
if mount namespaces are in use for the VM. Will be used for future
changes.

Wire it up in the qemu driver

7 years agostorage: Adjust expected format for Disk startup processing
John Ferlan [Mon, 11 Sep 2017 21:11:25 +0000 (17:11 -0400)]
storage: Adjust expected format for Disk startup processing

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

If a Disk pool was defined/created using XML that either didn't
specify a specific format or specified format type='unknown', then
restarting a pool after an initial disk backend build with overwrite
would fail after a libvirtd restart for a non-autostarted pool.

This is because the persistent pool data is not updated during pool
build w/ overwrite processing to have the VIR_STORAGE_POOL_DISK_DOS
default format.

So in addition to the alteration done during disk build processing,
alter the default expectation for disk startup to be DOS if nothing
has been defined yet. That will either succeed if the pool had been
successfully built previously using the default DOS format or fail
with a message indicating the format is something else that does not
match the expect format 'dos'.

7 years agoqemu: Provide default LUN=0 for iSCSI if not provided
John Ferlan [Mon, 11 Sep 2017 23:18:21 +0000 (19:18 -0400)]
qemu: Provide default LUN=0 for iSCSI if not provided

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

If the "/#" is missing from the provided iSCSI path, then we need
to provide the default LUN of /0; otherwise, QEMU will fail to parse
the URL causing a failure to either create the guest or hotplug
attach the storage.

During post parse, for any iSCSI disk or hostdev, scan the source
path looking for the presence of '/', if found, then we can assume
the LUN is provided.  If not found, alter the input XML to add the
"/0".  This will cause the generated XML to have the generated
value when the domain config is saved after post parse.

7 years agoqemu: blockcopy: Probe image format only with VIR_DOMAIN_BLOCK_COPY_REUSE_EXT
Peter Krempa [Tue, 12 Sep 2017 12:53:59 +0000 (14:53 +0200)]
qemu: blockcopy: Probe image format only with VIR_DOMAIN_BLOCK_COPY_REUSE_EXT

Commit 703abf1d7 changed the logic so that we don't attempt to re-create
the image if it's a block device. This was done by modifying the
'reuse' variable. Unfortunately after modifying it one of the uses was
to infer whether we should probe the disk format. After changes in the
commit mentioned above we would attempt the probe if the target of the
copy is a block device and the format was not provided explicitly rather
than using the format of the disk.

Fix it by explicitly checking whether the user requested a reuse of the
disk rather than the modified boolean flag.

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

7 years agoqemu: cold-unplug of watchdog
Michal Privoznik [Tue, 5 Sep 2017 08:13:05 +0000 (10:13 +0200)]
qemu: cold-unplug of watchdog

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

Again, no special here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: cold-plug of watchdog
Michal Privoznik [Tue, 5 Sep 2017 07:51:46 +0000 (09:51 +0200)]
qemu: cold-plug of watchdog

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

With this patch users can cold plug a watchdog. Things are pretty
simple because a domain can have at most one watchdog device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemuBuildHostNetStr: Don't leak buffer
Michal Privoznik [Mon, 11 Sep 2017 08:48:33 +0000 (10:48 +0200)]
qemuBuildHostNetStr: Don't leak buffer

If there was an error when constructing the buffer, NULL is
returned. The buffer is never freed though.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agorng: Fix formatting
Michal Privoznik [Thu, 7 Sep 2017 10:16:04 +0000 (12:16 +0200)]
rng: Fix formatting

Some elements are offset just one space compared to their parent,
some are misaligned completely, and so on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agorng: Drop useless <choice/>
Michal Privoznik [Thu, 7 Sep 2017 09:58:26 +0000 (11:58 +0200)]
rng: Drop useless <choice/>

If we have <choice/> with just one value to chose from, it's no
choice.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirnetserver: fix mesage vs message typo
Guido Günther [Fri, 8 Sep 2017 14:28:38 +0000 (16:28 +0200)]
virnetserver: fix mesage vs message typo

7 years agoqemu_driver: fix existance vs existence typo
Guido Günther [Fri, 8 Sep 2017 14:27:41 +0000 (16:27 +0200)]
qemu_driver: fix existance vs existence typo

7 years agostoragefile: fix defintion vs definition typo
Guido Günther [Fri, 8 Sep 2017 14:25:40 +0000 (16:25 +0200)]
storagefile: fix defintion vs definition typo

7 years agoqemu: Don't report failure to destroy a destroyed domain
Jiri Denemark [Fri, 8 Sep 2017 18:44:34 +0000 (20:44 +0200)]
qemu: Don't report failure to destroy a destroyed domain

When destroying a domain libvirt marks it internally with a
beingDestroyed flag to make sure the qemuDomainDestroyFlags API itself
cleans up after the domain rather than letting an uninformed EOF handler
do it. However, when the domain is being started at the moment libvirt
was asked to destroy it, only the starting thread can properly clean up
after the domain and thus it ignores the beingDestroyed flag. Once
qemuDomainDestroyFlags finally gets a job, the domain may not be running
anymore, which should not be reported as an error if the domain has been
starting up.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
7 years agovirsh: migrate --timeout-postcopy requires --postcopy
Jiri Denemark [Fri, 8 Sep 2017 16:15:13 +0000 (18:15 +0200)]
virsh: migrate --timeout-postcopy requires --postcopy

Requesting an automated switch to a post-copy migration (using
--timeout-postcopy) without actually enabling post-copy migration (using
--postcopy) doesn't really do anything. Let's make this dependency
explicit to avoid unexpected behavior.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoconf: validate IOMMU interrupt remapping setting
Ján Tomko [Wed, 23 Aug 2017 17:15:06 +0000 (19:15 +0200)]
conf: validate IOMMU interrupt remapping setting

This option requires:
  <ioapic driver='qemu'/>

Report an error in case someone tries to combine
it with different ioapic setting.

Setting 'eim' on without enabling 'intremap' does not make sense.

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

7 years agotests: merge iommu tests
Ján Tomko [Tue, 29 Aug 2017 15:23:19 +0000 (17:23 +0200)]
tests: merge iommu tests

Using intremap without <ioapic driver='qemu'/> does not work.
Merge the tests to avoid a duplicit test once we start validating it.

7 years agoconf: use virXMLFormatElement for <iommu>
Ján Tomko [Tue, 29 Aug 2017 16:37:39 +0000 (18:37 +0200)]
conf: use virXMLFormatElement for <iommu>

Simplify the formatting function even further.

7 years agoconf: use virXMLFormatElement for <iommu><driver>
Ján Tomko [Tue, 29 Aug 2017 16:20:48 +0000 (18:20 +0200)]
conf: use virXMLFormatElement for <iommu><driver>

Use the new helper to simplify the code.
This also fixes the bug of not formatting 'eim' in the useless
case if it's the only enabled attribute.

7 years agovirsh: man: Document the --validate option for create and define cmds
Erik Skultety [Thu, 7 Sep 2017 13:48:14 +0000 (15:48 +0200)]
virsh: man: Document the --validate option for create and define cmds

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
7 years agodocs: Update --timeout description in libvirtd's man page
Erik Skultety [Thu, 7 Sep 2017 13:47:51 +0000 (15:47 +0200)]
docs: Update --timeout description in libvirtd's man page

Since commit @ae2163f8, only active client connections or running
domains are allowed to inhibit daemon shutdown. The man page however
wasn't updated appropriately.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoqemu: Clean up qemuBuildControllerDevCommandLine()
Andrea Bolognani [Mon, 4 Sep 2017 16:05:43 +0000 (18:05 +0200)]
qemu: Clean up qemuBuildControllerDevCommandLine()

Add a 'cleanup' label and improve the readability of one of the
checks by making it conform to our formatting standard and moving
the corresponding comment.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
7 years agotpm: Use /dev/null for cancel path if none was found
Stefan Berger [Thu, 29 Jun 2017 18:01:11 +0000 (14:01 -0400)]
tpm: Use /dev/null for cancel path if none was found

TPM 2 does not implement sysfs files for cancellation of commands.
We therefore use /dev/null for the cancel path passed to QEMU.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agocpu: Add new EPYC CPU model
Brijesh Singh [Wed, 23 Aug 2017 18:49:41 +0000 (13:49 -0500)]
cpu: Add new EPYC CPU model

Add a new CPU model called 'EPYC' to model processors from AMD EPYC
family (which includes EPYC 76xx,75xx,74xx, 73xx and 72xx).

The following features bits have been added/removed compare to Opteron_G5

Added: monitor, movbe, rdrand, mmxext, ffxsr, rdtscp, cr8legacy, osvw,
       fsgsbase, bmi1, avx2, smep, bmi2, rdseed, adx, smap, clfshopt, sha
       xsaveopt, xsavec, xgetbv1, arat

Removed: xop, fma4, tbm

The patch is depend on EPYC CPU model supported introduced in qemu [1]

[1] https://patchwork.kernel.org/patch/9902205/

Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agotests: Add CPUID data for AMD EPYC 7601 32-Core Processor
Jiri Denemark [Thu, 7 Sep 2017 10:58:41 +0000 (12:58 +0200)]
tests: Add CPUID data for AMD EPYC 7601 32-Core Processor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agotests: Add CPUID data for AMD Ryzen 7 1800X Eight-Core Processor
Jiri Denemark [Fri, 28 Apr 2017 12:09:45 +0000 (14:09 +0200)]
tests: Add CPUID data for AMD Ryzen 7 1800X Eight-Core Processor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: migration: don't expose incomplete job as complete
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:31 +0000 (09:49 +0300)]
qemu: migration: don't expose incomplete job as complete

In case of real migration (not migrating to file on save, dump etc)
migration info is not complete at time qemu finishes migration
in normal (non postcopy) mode. We need to update disks stats,
downtime info etc. Thus let's not expose this job status as
completed.

To archive this let's set status to 'qemu completed' after
qemu reports migration is finished. It is not visible as complete
job to clients. Cookie code on confirm phase will finally turn
job into completed. As we don't need more things to do when
migrating to file status is set to 'completed' as before
in this case.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: migrate: add mirror stats to migration stats
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:30 +0000 (09:49 +0300)]
qemu: migrate: add mirror stats to migration stats

When getting job info in case mirror does not reach ready phase
fetch mirror stats from qemu. Otherwise mirror stats are already
saved in current job.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: always get job condition on getting job stats
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:29 +0000 (09:49 +0300)]
qemu: always get job condition on getting job stats

Looks like it is more simple to drop this optimization as we are
going to add getting disks stats during migration via quering qemu
process and checking if we have to acquire job condition becomes
more complicate.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: introduce migrating job status
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:28 +0000 (09:49 +0300)]
qemu: introduce migrating job status

Instead of checking stat.status let's set status to migrating
as soon as migrate command is send (waiting for completion
is a good place too).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: start all async job with job status active
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:27 +0000 (09:49 +0300)]
qemu: start all async job with job status active

Setting status to none has little value - getting job status
will not return even elapsed time.

After this patch getting job stats stays correct in a sence
it will not fetch migration stats because it consults
stats.status before doing the fetch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: fail querying destination migration statistics always
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:26 +0000 (09:49 +0300)]
qemu: fail querying destination migration statistics always

Querying destination migration statistics may result in getting
a failure or getting a elapsed time value depending on stats.status
value which is odd. Instead let's always fail. Clients should
be ready to handle this as currently getting failure period
can be considerable.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: simplify getting completed job stats
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:25 +0000 (09:49 +0300)]
qemu: simplify getting completed job stats

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: refactor fetching migration stats
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:24 +0000 (09:49 +0300)]
qemu: refactor fetching migration stats

qemuMigrationFetchJobStatus is rather inconvinient. Some of its
callers don't need status to be updated, some don't need to update
elapsed time right away. So let's update status or elapsed time
in callers instead.

This patch drops updating job status on getting job stats by
client. This way we will not provide status 'completed' while
it is not yet updated by migration routine.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: drop excessive zero-out in qemuMigrationFetchJobStatus
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:23 +0000 (09:49 +0300)]
qemu: drop excessive zero-out in qemuMigrationFetchJobStatus

qemuMonitorGetMigrationStats will do it for us anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: drop QEMU_MIGRATION_COMPLETED_UPDATE_STATS
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:22 +0000 (09:49 +0300)]
qemu: drop QEMU_MIGRATION_COMPLETED_UPDATE_STATS

This way we get stats only in one place. The former code waits for
complete/postcopy status basically and don't need to mess with stats.

The patch drops raising an error on stats updates failure. This
does not make much sense anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: introduce QEMU_DOMAIN_JOB_STATUS_POSTCOPY
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:21 +0000 (09:49 +0300)]
qemu: introduce QEMU_DOMAIN_JOB_STATUS_POSTCOPY

Let's introduce QEMU_DOMAIN_JOB_STATUS_POSTCOPY state for job.current->status
instead of checking job.current->stats.status. The latter can be changed
when fetching migration statistics. Moving state function from the variable
and leave only store function seems more managable.

This patch removes all state checking usage of stats except for
qemuDomainGetJobStatsInternal. This place will be handled separately.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: introduce qemu domain job status
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:20 +0000 (09:49 +0300)]
qemu: introduce qemu domain job status

This patch simply switches code from using VIR_DOMAIN_JOB_* to
introduced QEMU_DOMAIN_JOB_STATUS_*. Later this gives us freedom
to introduce states for postcopy and mirroring phases.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: drop code for VIR_DOMAIN_JOB_BOUNDED and timeRemaining
Nikolay Shirokovskiy [Fri, 1 Sep 2017 06:49:19 +0000 (09:49 +0300)]
qemu: drop code for VIR_DOMAIN_JOB_BOUNDED and timeRemaining

qemu driver does not have VIR_DOMAIN_JOB_BOUNDED jobs and
timeRemaining is always 0.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agotravis: Install gettext
Andrea Bolognani [Wed, 6 Sep 2017 12:48:48 +0000 (14:48 +0200)]
travis: Install gettext

msgmerge(1) and friends are required to build libvirt, so the
corresponding package should be installed in the Travis worker.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agotravis: Sort build dependencies
Andrea Bolognani [Wed, 6 Sep 2017 12:46:07 +0000 (14:46 +0200)]
travis: Sort build dependencies

Keeping the list of build dependencies sorted alphabetically
makes it way easier to visually scan it for issues.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoconf: Validate device on update-device
Michal Privoznik [Tue, 5 Sep 2017 14:24:14 +0000 (16:24 +0200)]
conf: Validate device on update-device

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

Whenever a device is being updated via
virDomainUpdateDeviceFlags() API, we parse the device XML and
ideally run some generic checks to validate the configuration
(e.g. if device defines per-device boot order but the domain has
os/boot element already). Well, that's the theory - due to a
missing check we've jumped early from that check function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agom4: Disable -Wdisabled-optimization
Andrea Bolognani [Tue, 5 Sep 2017 14:37:50 +0000 (16:37 +0200)]
m4: Disable -Wdisabled-optimization

After b4f7793ce269, qemuxml2xmltest has apparently become big enough
to trigger a compilation error when using --enable-test-coverage on
aarch64:

    CC       qemuxml2xmltest.o
  qemuxml2xmltest.c: In function 'mymain':
  qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
   }
   ^
  qemuxml2xmltest.c:1216:1: error: PRE disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
  qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
  qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]

However, as the GCC documentation states, this warning is not really
caused by issues in our code, so it makes sense to disable it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoqemu: Remove unused params from qemuDomainDeviceDefValidate
John Ferlan [Fri, 1 Sep 2017 17:16:17 +0000 (13:16 -0400)]
qemu: Remove unused params from qemuDomainDeviceDefValidate

Neither @cfg nor (now) @driver is used in the API, so remove them
and mark @opaque as UNUSED.

NB: Commit id 'fa3c558596' dropped the unused @qemuCaps which was the
last consumer of @driver other than @cfg, but even @cfg was never used
even in the original implementation from commit id 'd987f63a'.

7 years agoqemu: Default to video type=virtio for machvirt
Cole Robinson [Sun, 27 Aug 2017 15:04:42 +0000 (11:04 -0400)]
qemu: Default to video type=virtio for machvirt

arm/aarch64 -M virt on KVM doesn't and will never work with standard
VGA card emulation. The recommended method is to use type=virtio, so
let's make it the default for video devices without an explicit type
set by the user.

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
7 years agoqemu: Set default video type in qemu PostParse
Cole Robinson [Sun, 27 Aug 2017 15:04:41 +0000 (11:04 -0400)]
qemu: Set default video type in qemu PostParse

And not generic domain_conf code. We will need qemu private functions
in a bit.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
7 years agoconf: domain: move video type validation to DeviceDefValidate
Cole Robinson [Sun, 27 Aug 2017 15:04:40 +0000 (11:04 -0400)]
conf: domain: move video type validation to DeviceDefValidate

This allows drivers to set their own default. But if a driver neglects
to fill one in, we still error like we previously would at parse time.

Signed-off-by: Cole Robinson <crobinso@redhat.com>