Commit Graph

39865 Commits

Author SHA1 Message Date
Daniel Henrique Barboza
5a5fde03bb qemu_domain.c: modernize qemuDomainFixupCPUs()
Use g_autoptr() to deprecate the 'cleanup' label.

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:44 -03:00
Daniel Henrique Barboza
f17de6c173 qemu_domain.c: remove unneeded cleanup labels
Remove obsolete 'cleanup' labels after the changes from the
previous patch.

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:44 -03:00
Daniel Henrique Barboza
c269d7ad2d qemu_domain.c: use g_autoptr() with virDomainDef pointers
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:44 -03:00
Daniel Henrique Barboza
0ea83f7ebb qemu_snapshot.c: remove uneeded 'cleanup' label in qemuSnapshotDelete()
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:44 -03:00
Daniel Henrique Barboza
269dffd0ce qemu_driver.c: remove unneeded 'cleanup' labels
Some labels became deprecated after the previous patches.

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:44 -03:00
Daniel Henrique Barboza
9c215628d6 qemu_driver.c: use g_autoptr() with virDomainDeviceDefPtr
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:44 -03:00
Daniel Henrique Barboza
94196ba605 qemu_driver.c: use g_autoptr() with qemuMigrationParams pointers
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:43 -03:00
Daniel Henrique Barboza
74b2834333 qemu_driver.c: use g_autoptr() with virDomainDef pointers
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 12:11:43 -03:00
Thomas Huth
6f0ee50be2 migration.html: Fix the spelling of the --persistent parameter
"--persist" is missing the "ent" at the end.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 15:58:52 +01:00
Thomas Huth
0b6d0e2046 migration.html: Fix the spelling of the --undefinesource parameter
There is no dash between "undefine" and "source" in this parameter.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 15:22:37 +01:00
Nikolay Shirokovskiy
b814d499a7 qemu: remove possible garbage left from previous rename/undefine
Due to failures to unlink on previous rename/undefine we can already have
autolink etc files for the domain to be defined. Remove them.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:50 +03:00
Nikolay Shirokovskiy
773c7c4361 qemu: qemuDomainDefineXMLFlags: move cleanup logic to cleanup section
Let's move objlist restoring to cleanup section so that we can handle failure
of actions between virDomainObjListAdd and virDomainDefSave. We are going
to add such actions in next patch.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:50 +03:00
Nikolay Shirokovskiy
e2738b2bd7 qemu: rename: remove snapshot/checkpoint restriction
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:50 +03:00
Nikolay Shirokovskiy
a3259e47d2 qemu: update name on reverting from snapshot
If domain name is changed since snapshot we need to update it to current in
config taken from snapshot.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:50 +03:00
Nikolay Shirokovskiy
3b1244bffd qemu: rename: support renaming checkpoints directory
This is basically just saves checkpoints metadata on disk after name is changed
in memory as path to domain checkpoints directory depends on name. After that
old checkpoint directory is deleted with checkpoint metadata files.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:50 +03:00
Nikolay Shirokovskiy
4770a96c66 qemu: rename: support renaming snapshots directory
This is basically just saves snapshots metadata on disk after name is changed
in memory as path to domain snapshot directory depends on name. After that
old snapshot directory is deleted with snapshot metadata files.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:50 +03:00
Nikolay Shirokovskiy
1f209eac1d qemu: remove duplicate code for removing remnant files
This patch also changes functionality a bit.

First if unlinking of old config file is failed we rollback and return error
previously and now we return success. I don't think this makes much difference.
I guess in both cases on libvirtd restart we have to deal with both new and old
config existing on disk with different names but same uuid.

Second if unlinking of old autolink is failed we rollback previously which
was not right as at this point we already unlink old config file. So this
is fixed now.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:50 +03:00
Nikolay Shirokovskiy
a6c3b5e6a1 qemu: rename: return instead of goto if no cleanup required
Going to cleanup label is mere return -1 thus let's just return
instead of goto to this label.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:49 +03:00
Nikolay Shirokovskiy
9a5ac61c4e qemu: rename: send events only on success
We can simplify cleanup section by moving sending events to success path only
because only on sucess path events are not NULL.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:49 +03:00
Nikolay Shirokovskiy
8afbd34ba9 qemu: qemuDomainRenameCallback: fix sending false undefined event
For example if saving config file with new name fails we send false undefine
event currently.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 14:49:49 +03:00
Olaf Hering
f76f6d1556 meson: fix yajl detection
yajl_tree_parse is declared in yajl/yajl_tree.h
autoconf is more forgiving, the error did not trigger because
yajl_tree_parse is not actually used.

Fixes: 44b8df4cb4
Fixes: 88ab32a4e5
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-11-13 11:23:13 +01:00
Peter Krempa
d2d23aa2a6 tools: virsh: Reset error when keepalive registration fails
We try to enable keepalive oportunistically. If it's not supported by
the connection driver and it was not explicitly requested we keep the
error object set and can report it in some cases accidentally:

 --- stdout ---
 TEST: /home/pipo/libvirt/tests/virsh-self-test
       !                                        1   FAILED
 --- stderr ---
 error: parameter 'target' of command 'attach-disk' must be listed before optional parameters
 error: this function is not supported by the connection driver: virConnectSetKeepAlive
 -------

Clear the stored libvirt error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:30 +01:00
Peter Krempa
a1ed7f37ce tools: vshCmddefOptParse: Remove return value
The function can't fail so there's no need to return a value or check it
in the callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:30 +01:00
Peter Krempa
fde5b4cf9d tools: vshCmddefHelp: Don't call vshCmddefOptParse
The help formatter called vshCmddefOptParse just for validation
purposes. Since vshCmddefOptParse no longer validates the command itself
and we don't need the bitmaps returned by it we can drop the call
entirely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:30 +01:00
Peter Krempa
cd0602290a tools: vshCmddefOptParse: Remove 'optional' command validation
Since vshCmddefCheckInternals now has this check we no longer need it in
vshCmddefOptParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:29 +01:00
Peter Krempa
0d00e95298 tools: cmdSelfTest: Drop misleading comment
We no longer print help for every command to validate the args.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:29 +01:00
Peter Krempa
fa7265e127 tools: vshCmddefCheckInternals: Port mandatory options check from vshCmddefOptParse
'vshCmddefCheckInternals' is the go-to place for all checks related to
the definition of parameters for commands, but the check that all
mandatory parameters must be ordered before optional parameters was
still only in vshCmddefOptParse.

Adding a non-compliant option would not be caught by our test suite as
'virsh self-test' doesn't call vshCmddefOptParse.

Re-implement the check in vshCmddefCheckInternals.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:29 +01:00
Peter Krempa
b070332261 tools: vshCmddefCheckInternals: Add parameter name to error message
If a parameter definition is invalid we can include the name of the
parameter for simpler debugging.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:29 +01:00
Peter Krempa
f2a602f5a3 tools: vsh: Unexport vshCmddefHelp
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:29 +01:00
Peter Krempa
0956edee37 tests: qemucapabilities: Update latest qemu caps to qemu v5.2.0-rc1
Synchronize with the latest release candidate.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-11-13 11:12:29 +01:00
Michal Privoznik
4895a3e55d kbase: Document minimal libvirt version for NUMA-less virtiofs
Using virtiofs without NUMA was implemented in v6.9.0-rc1~161 but
our kbase document only mentions QEMU version which may confuse
users.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-13 10:02:56 +01:00
Matt Coleman
09ba97ad6b news: implement vCPU APIs in the Hyper-V driver
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
0b27822472 hyperv: implement domainSetVcpus and domainSetVcpusFlags
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
30525b759b hyperv: implement domainGetMaxVcpus
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
b516400976 hyperv: implement domainGetVcpusFlags
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
01a93d55a0 hyperv: implement domainGetVcpus
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
265e3244c2 domain: introduce constants for virVcpuInfo->cpu state values
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Jiri Denemark
d8e5b45600 qemu: Do not require TSC frequency to strictly match host
Some CPUs provide a way to read exact TSC frequency, while measuring it
is required on other CPUs. However, measuring is never exact and the
result may slightly differ across reboots. For this reason both Linux
kernel and QEMU recently started allowing for guests TSC frequency to
fall into +/- 250 ppm tolerance interval around the host TSC frequency.

Let's do the same to avoid unnecessary failures (esp. during migration)
in case the host frequency does not exactly match the frequency
configured in a domain XML.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-12 17:29:16 +01:00
Andrea Bolognani
6c1ad2735a Fix capitalization "CLang" -> "Clang"
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2020-11-12 15:01:42 +01:00
Daniel P. Berrangé
b3710e9a2a Set -Wno-incompatible-pointer-types-discards-qualifiers
With Clang we're getting failures from casts in GLib macros

../dist-unpack/libvirt-6.10.0/src/util/vireventthread.c:35:1:
  error: passing 'typeof (*(&g_define_type_id__volatile)) *'
  (aka 'volatile unsigned long *') to parameter of type
  'gsize *' (aka 'unsigned long *') discards qualifiers
  [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
G_DEFINE_TYPE(virEventThread, vir_event_thread, G_TYPE_OBJECT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The cast is valid and there's no way for libvirt to workaround
the issue, so we must disable this Clang warning flag.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-12 11:21:26 +00:00
Matt Coleman
db98d17709 news: some memory and scheduler Hyper-V APIs
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:59 +01:00
Matt Coleman
08aed0888f hyperv: implement domainGetScheduler*
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:57 +01:00
Matt Coleman
16fb99c7a1 hyperv: refactor hypervDomainSetMemoryProperty
* use hypervMsvmVSMSModifyResourceSettings()
* improve the error message: say which property it failed to set
* remove usage of VIR_FREE()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:54 +01:00
Matt Coleman
5df9f9dadf hyperv: add hypervMsvmVSMSModifyResourceSettings
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:52 +01:00
Matt Coleman
5f3915a334 hyperv: implement domainSetMaxMemory
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:42 +01:00
Matt Coleman
5b389613e6 hyperv: move hypervDomainSetMemory and hypervDomainSetMemoryFlags
This matches their placement in struct _virHypervisorDriver.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:39 +01:00
Matt Coleman
14951313d9 hyperv: implement domainGetMaxMemory
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:33 +01:00
Michal Privoznik
2d5b106cf8 virnetdevopenvswitch: Simplify OVS_VSCTL cmd creation
Every time we create new virCommand of OVS_VSCTL it must be
followed by virNetDevOpenvswitchAddTimeout() call which adds the
--timeout=X argument to freshly created cmd. Instead of having
this as two separate function calls it can be just one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-12 08:24:43 +01:00
Michal Privoznik
e4c29e2904 virnetdevopenvswitch: Get names for dpdkvhostuserclient too
There are two types of vhostuser ports:

  dpdkvhostuser - OVS creates the socket and QEMU connects to it
  dpdkvhostuserclient - QEMU creates the socket and OVS connects to it

But of course ovs-vsctl syntax for fetching ifname is different.
So far, we've implemented the former. The lack of implementation
for the latter means that we are not detecting the interface name
and thus not reporting it in domain XML, or failing to get
interface statistics.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-12 08:24:43 +01:00
Jiri Denemark
3c7c7cd4d8 conf: Use unsigned long long for timer frequency
Although the code in qemuProcessStartValidateTSC works as if the
timer frequency was already unsigned long long (by using an appropriate
temporary variable), the virDomainTimerDef structure actually defines
frequency as unsigned long, which is not guaranteed to be 64b.

Fixes support for frequencies higher than 2^32 - 1 on 32b systems.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2020-11-11 23:06:23 +01:00