Commit Graph

27344 Commits

Author SHA1 Message Date
Erik Skultety
bc92770aba 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>
2017-09-08 11:07:45 +02:00
Andrea Bolognani
1a81722921 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>
2017-09-07 14:13:40 +02:00
Stefan Berger
dfbb15b754 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>
2017-09-07 14:00:46 +02:00
Brijesh Singh
a0b628432a 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>
2017-09-07 13:53:32 +02:00
Jiri Denemark
5c83b3603c 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>
2017-09-07 13:53:32 +02:00
Jiri Denemark
92bd87a239 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>
2017-09-07 13:53:32 +02:00
Nikolay Shirokovskiy
3f2d6d829e 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>
2017-09-07 12:52:36 +02:00
Nikolay Shirokovskiy
8c46658337 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>
2017-09-07 11:18:10 +02:00
Nikolay Shirokovskiy
defc87901e 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>
2017-09-07 11:17:28 +02:00
Nikolay Shirokovskiy
5a274d4fdc 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>
2017-09-07 11:15:43 +02:00
Nikolay Shirokovskiy
b6868c3cdd 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>
2017-09-07 11:15:01 +02:00
Nikolay Shirokovskiy
78107f8537 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>
2017-09-07 11:13:04 +02:00
Nikolay Shirokovskiy
c9cd4b4add qemu: simplify getting completed job stats
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-09-07 11:09:41 +02:00
Nikolay Shirokovskiy
6a2a80c653 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>
2017-09-07 10:38:10 +02:00
Nikolay Shirokovskiy
e796747092 qemu: drop excessive zero-out in qemuMigrationFetchJobStatus
qemuMonitorGetMigrationStats will do it for us anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-09-07 09:41:45 +02:00
Nikolay Shirokovskiy
e87d4b9e2f 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>
2017-09-07 09:41:45 +02:00
Nikolay Shirokovskiy
09f57f9aac 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>
2017-09-07 09:41:45 +02:00
Nikolay Shirokovskiy
751a1c7f0a 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>
2017-09-07 09:41:45 +02:00
Nikolay Shirokovskiy
16bf7619b8 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>
2017-09-07 09:41:45 +02:00
Andrea Bolognani
01f3ea6488 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>
2017-09-06 15:09:45 +02:00
Andrea Bolognani
b023feeca3 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>
2017-09-06 15:09:03 +02:00
Michal Privoznik
c57f3fd2f8 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>
2017-09-06 11:19:30 +02:00
Andrea Bolognani
fbe315bdc8 m4: Disable -Wdisabled-optimization
After b4f7793ce2, 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>
2017-09-06 09:06:26 +02:00
John Ferlan
d143837bd1 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'.
2017-09-05 10:56:58 -04:00
Cole Robinson
dda0da14cd 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>
2017-09-05 10:41:32 -04:00
Cole Robinson
ef08a54538 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>
2017-09-05 10:41:32 -04:00
Cole Robinson
29a90f071d 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>
2017-09-05 10:41:32 -04:00
Cole Robinson
a2ca7ca52e conf: domain: add VIDEO_TYPE_DEFAULT
Will be needed for future patches to pull the default video type
setting out of XML parsing routines.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-09-05 10:41:32 -04:00
Erik Skultety
4c248e938a maint: Fix incorrect parenthesis placement causing true/false assignment
There were a few places in our code where the following pattern in 'if'
condition occurred:

if ((foo = bar() < 0))
    do something;

This patch adjusts the conditions to the expected format:

if ((foo = bar()) < 0)
    do something;

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2017-09-05 11:27:12 +02:00
Andrea Bolognani
a2b240e60e Makefile.nonreentrant: Rebuild against Fedora 26
According to the comments in the file and the git history, the
list of forbidden symbols was originally built against Fedora 9
in 2009 (!) and pretty much never refreshed afterwards.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-04 16:12:10 +02:00
Andrea Bolognani
bc0108845c docs: Fix typo deamon -> daemon
Suggested-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2017-09-04 15:07:17 +02:00
Daniel P. Berrange
5f5c515bbd event: ignore attempts to replace the event loop impl
Although not previously explicitly documented, the expectation for
the libvirt event loop is that an implementation is registered early
in application startup, before calling any libvirt APIs and then
run forever after. Replacing a previously registered event loop is
not safe & subject to races even if virConnectClose has been called
on open handles, due to delayed deregistration of callbacks during
conenction close.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-04 13:06:24 +01:00
Daniel P. Berrange
5a1a649dcf Add libxslt as build requires for mingw RPMs
The libxslt package is needed since:

  commit 94d2d6429d
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed Jul 26 17:40:44 2017 +0100

    docs: make xmllint & xsltproc compulsory

The native RPM had it already, but mingw build was missing it.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-04 13:05:24 +01:00
Michal Privoznik
e703039c20 lxcStateInitialize: Don't leak driver's caps
Funny thing. So when initializing LXC driver's capabilities,
firstly the virLXCDriverGetCapabilities() is called. This creates
new capabilities, stores them under driver->caps, ref() them and
return them. However, the return value is ignored. Secondly, the
function is called yet again and since we have driver->caps set,
they are ref()-ed again an returned. So in the end, driver's
capabilities have refcount of three when in fact they should have
refcount of one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-09-04 12:40:44 +02:00
Michal Privoznik
e8a9929229 Post-release version bump to 3.8.0
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-09-04 12:40:41 +02:00
Daniel Veillard
d83dac00d9 Release of libvirt-3.7.0
* docs/news.xml: update for release
* po/*.po*: regenerated
2017-09-04 12:14:11 +02:00
Richard W.M. Jones
4c10c38275 vmx: Expose VMware Managed Object Reference (moref) in XML.
If you use the VDDK library to access virtual machines remotely, you
really need to know the Managed Object Reference ("moref") of the VM.
This must be passed each time you connect to the API.

For example nbdkit's VDDK plugin requires a moref to be passed to
mount up a VM's disk remotely:

 nbdkit vddk user=root password=+/tmp/rootpw \
             server=esxi.example.com thumbprint=xx:xx:xx:... \
             vm=moref=2 \
             file="[datastore1] Fedora/Fedora.vmdk"

Getting the moref is a huge pain.  To get some idea of what it is, why
it is needed, and how much trouble it is to get it, see:
https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-1-overview.html
https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-2-technical.html

However the moref is available conveniently in the internals of the
libvirt VMX driver.  This patch exposes it as a custom XML element
using the same "vmware:" namespace which was previously used for the
datacenterpath (see libvirt commit 636a990587).

It appears in the XML like this:

<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>Fedora</name>
...
  <vmware:datacenterpath>ha-datacenter</vmware:datacenterpath>
  <vmware:moref>2</vmware:moref>
</domain>

Note that the moref can appear as either a simple ID (for esx://
connections) or as a "vm-<ID>" (for vpx:// connections).  It should be
treated by users as an opaque string.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2017-09-04 09:48:32 +01:00
John Ferlan
4ee36c33ed docs: Remove <code> from <summary> entries due to RNG error
commit '96e55048' caused make check failure for virschematest:

1929) Checking ../docs/news.xml against ../news.rng                     ... libvirt: XML Util error : XML document failed to validate against schema: Unable to validate doc against /home/jferlan/git/libvirt.work/docs/schemas/../news.rng
Datatype element summary has child elements
Element summary failed to validate content
Datatype element summary has child elements
Element summary failed to validate content
^[[31m^[[1mFAILED^[[0m

That's because <code> elements don't appear to be allowed in the schema.
Rather than attempt to fix the schema, figured it was simpler to just
remove them and let the schema fix happen later.
2017-09-02 08:06:59 -04:00
Andrea Bolognani
96e55048c3 news: Prepare for 3.7.0 release
Documents some changes that have slipped through the cracks
during the development cycle.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-09-02 11:09:06 +02:00
Kothapally Madhu Pavan
21b2c3772f docs: Document managedsave-edit commands support
This patch documents support for managedsave-dumpxml,
managedsave-define and managedsave-edit commands.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2017-09-02 10:54:28 +02:00
Peter Krempa
3507dabcd1 news: Add stuff for 3.7.0 2017-09-01 14:57:01 +02:00
Michal Privoznik
054c6d2721 virnetdaemon: Don't deadlock when talking to D-Bus
https://bugzilla.redhat.com/show_bug.cgi?id=1487322

In ace45e67ab I tried to fix a problem that we get the reply to
a D-Bus call while we were sleeping. In that case the callback
was never set. So I changed the code that the callback is called
directly in this case. However, I hadn't realized that since the
callback is called out of order it locks the virNetDaemon.
Exactly the very same virNetDaemon object that we are dealing
with right now and that we have locked already (in
virNetDaemonAddShutdownInhibition())

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-09-01 13:21:33 +02:00
Nikolay Shirokovskiy
9820756cd3 qemu: handle -1 for pid in qemuDomainGetMachineName
We call qemuDomainGetMachineName on domain start. On first
start (after daemon start) pid is 0 and virSystemdGetMachineNameByPID
don't get called. But after domain shutting down pid became -1 so
on next start virSystemdGetMachineNameByPID is called and returned an error.
Error is ignored so it is not critical. But at least on my system
(systemd-219 with extra patches) systemd-machined is crashed on
this request.

This behaviour is triggered by eaf2c9f89.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-01 10:49:44 +02:00
Michal Privoznik
f0607f394c qemu: Forbid rx/tx_queue_size change explicitly
https://bugzilla.redhat.com/show_bug.cgi?id=1484230

When updating a virtio enabled vNIC and trying to change either
of rx_queue_size or tx_queue_size success is reported although no
operation is actually performed. Moreover, there's no way how to
change these on the fly. This is due to way we check for changes:
explicitly for each struct member. Therefore it's easy to miss
one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-09-01 09:50:44 +02:00
Shuang He
46ee76daa6 docs: Add entry for ZStack to apps page
Signed-off-by: Shuang He <shuang.he@zstack.io>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2017-08-31 16:39:16 +02:00
Pavel Hrdina
8af2c431c6 news: add an entry for chardev reconnect feature
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-08-31 12:32:35 +02:00
John Ferlan
d16f803d78 storage: Use virStorageBackendRefreshVolTargetUpdate after wipeVol
https://bugzilla.redhat.com/show_bug.cgi?id=1437797

Rather than using refreshVol which essentially only updates the
allocation, capacity, and permissions for the volume, but not
the format which does get updated in a pool refresh - let's use
the same helper that pool refresh uses in order to update the
volume target.
2017-08-30 15:32:13 -04:00
John Ferlan
7c2945b854 storage: Introduce virStorageBackendRefreshVolTargetUpdate
Create a separate function to handle the volume target update
via probe processing.
2017-08-30 15:32:13 -04:00
Pavel Hrdina
be6a415e51 qemu: set bind mode for chardev while parsing XML
Currently while parsing domain XML we clear the UNIX path if it matches
one of the auto-generated paths by libvirt.  After that when the guest
is started new path is generated but the mode is also changed to "bind".

In the real-world use-case the mode should not change, it only happens
if a user provides a mode='connect' and path that matches one of the
auto-generated path or not provides a path at all.

Before *reconnect* feature was introduced there was no issue, but with
the new feature we need to make sure that it's used only with "connect"
mode, therefore we need to move the mode change into parsing in order
to have a proper error reported by validation code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-08-30 17:47:56 +02:00
Pavel Hrdina
8646b1253c tests: don't use unix socket path that matches auto-generated path
The test was introduced by 60135b22db.

The auto-generated path is removed by post-parse callback which
also changes the mode from "connect" to "bind" since the auto-generated
path makes sense only for "bind" mode.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-08-30 13:34:35 +02:00