Commit Graph

27347 Commits

Author SHA1 Message Date
Jiri Denemark
b0b5c9c620 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>
2017-09-18 10:40:12 +02:00
Jiri Denemark
abec725ab1 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>
2017-09-18 10:40:12 +02:00
Jiri Denemark
7816de498b cpu: Don't log CPU models in cpuBaselineXML
They are logged in cpuBaseline anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-09-18 10:40:12 +02:00
Jiri Denemark
50234e4eaf cpu: Use virCPUDefListParse in cpuBaselineXML
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-09-18 10:40:12 +02:00
Jiri Denemark
57f3999d72 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>
2017-09-18 10:40:12 +02:00
Jiri Denemark
440838472d 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>
2017-09-18 10:30:47 +02:00
Cole Robinson
11b0e889b5 spec: Fix %license compat on RHEL6
The macro needs to be defined closer to its usage
2017-09-15 13:04:18 -04:00
Cole Robinson
6cf1475a1c 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>
2017-09-15 08:43:54 -04:00
Ville Skyttä
6966a8cd18 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>
2017-09-15 08:43:54 -04:00
John Ferlan
1f8528c2b8 qemu: Fix return check on virHashAddEntry call
Luckily it only returns 0 or -1
2017-09-15 08:34:57 -04:00
John Ferlan
304e0f6d16 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.
2017-09-15 08:17:32 -04:00
John Ferlan
fae7a7354c 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.
2017-09-15 08:12:26 -04:00
John Ferlan
411cdb6150 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.
2017-09-15 08:07:42 -04:00
John Ferlan
c09c93cf57 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.
2017-09-15 07:52:04 -04:00
John Ferlan
fbad3ed0fa 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.
2017-09-15 07:37:50 -04:00
John Ferlan
4775ca27e9 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/...
2017-09-15 07:37:50 -04:00
Peter Krempa
a823d0a62e 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
2017-09-15 05:28:21 +02:00
Peter Krempa
6f18150f7b qemu: hotplug: Use new helpers for storing libvirt errors
The helpers allow to simplify restoring original errors in most cases.
2017-09-15 05:28:21 +02:00
Peter Krempa
8333e7455e 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.
2017-09-15 05:28:21 +02:00
Cole Robinson
1f085acb81 news: document spice rendernode DAC changes
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2017-09-14 16:20:32 -04:00
Andrea Bolognani
8d56815ef1 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>
2017-09-14 17:34:08 +02:00
Andrea Bolognani
05ff29a7fd 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>
2017-09-14 16:59:24 +02:00
Andrea Bolognani
e5ae4fe929 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>
2017-09-14 16:59:24 +02:00
Andrea Bolognani
fa6eea60f0 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>
2017-09-14 16:59:24 +02:00
Andrea Bolognani
73b760c75a 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>
2017-09-14 16:59:24 +02:00
Andrea Bolognani
2e2e44b6ac travis: Move variables to 'env' section
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-14 16:59:24 +02:00
Andrea Bolognani
2e975abdc9 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>
2017-09-14 16:59:18 +02:00
John Ferlan
3358bfb286 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>
2017-09-14 08:39:25 -04:00
Peter Krempa
1666d10793 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>
2017-09-14 10:03:47 +02:00
Peter Krempa
771a38609d 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>
2017-09-14 10:03:38 +02:00
Peter Krempa
2350d10149 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>
2017-09-14 10:03:25 +02:00
John Ferlan
23706c1708 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.
2017-09-13 06:22:52 -04:00
Michal Privoznik
13264dfd23 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>
2017-09-13 09:29:53 +02:00
Cole Robinson
98931187ee 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
2017-09-12 12:27:42 -04:00
Cole Robinson
321031e482 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
2017-09-12 12:27:42 -04:00
John Ferlan
239781e03a 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'.
2017-09-12 10:52:06 -04:00
John Ferlan
f64f03b5b1 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.
2017-09-12 10:33:25 -04:00
Peter Krempa
4fc3051258 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
2017-09-12 16:03:56 +02:00
Michal Privoznik
607a00d170 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>
2017-09-12 15:59:38 +02:00
Michal Privoznik
50c1dbafae 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>
2017-09-12 15:59:32 +02:00
Michal Privoznik
891b3c119e 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>
2017-09-12 13:41:31 +02:00
Michal Privoznik
ff5c5a9bbb 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>
2017-09-12 13:41:21 +02:00
Michal Privoznik
40df36eb10 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>
2017-09-12 13:41:15 +02:00
Guido Günther
cdecfbed02 virnetserver: fix mesage vs message typo 2017-09-11 18:17:22 +02:00
Guido Günther
175710b6f2 qemu_driver: fix existance vs existence typo 2017-09-11 18:17:22 +02:00
Guido Günther
9c0d66bb07 storagefile: fix defintion vs definition typo 2017-09-11 18:17:22 +02:00
Jiri Denemark
c5d1dcbcd9 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>
2017-09-11 16:32:15 +02:00
Jiri Denemark
ecd53ca43a 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>
2017-09-11 16:29:05 +02:00
Ján Tomko
90cd99a42e 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
2017-09-11 14:56:07 +02:00
Ján Tomko
190a5bc127 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.
2017-09-11 09:45:34 +02:00