Commit Graph

41941 Commits

Author SHA1 Message Date
Michal Privoznik
e0c6691e78 meson: Declare GLIB_VERSION_* macros at configure
So far we have three places where glib version is recorded:
meson.build and then in config.h. The latter is so well hidden
that it's easy to miss when bumping minimal glib version in the
former. With a bit of python^Wmeson string magic
GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED macros can
be defined to match glib_version from meson.build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-05-03 12:08:26 +02:00
Michal Privoznik
5966310b3c qemu_domainjob: Drop 'const' from strings in _qemuDomainJobObj
These strings are not constant really. They are allocated in
qemuDomainObjBeginJobInternal() and freed in
qemuDomainReset*Job(). Freeing a pointer to const looks weird.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-05-03 12:08:26 +02:00
Tim Wiederhake
8b901da616 virDomainAudioSDLParse: Use virXMLProp*
This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `bufferCount`.

`bufferCount` does not benefit from being referable as e.g. "-7" for
requesting 4294967289 buffers, as this value is distinctly out of range
for normal use.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:17:40 +02:00
Tim Wiederhake
4fc365934a virDomainFeaturesDefParse: Use virXMLPropEnum
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:17:40 +02:00
Tim Wiederhake
54635ea592 virDomainFeaturesDefParse: Use virXMLPropTristateSwitch
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:17:40 +02:00
Tim Wiederhake
f45937c9cf virDomainFeaturesDefParse: Use virXMLPropUInt
This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `retries`. UINT_MAX holds no
special significance for this attribute and is distinctly out of range
for normal use.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:17:40 +02:00
Tim Wiederhake
47896e0ba2 virDomainSoundDefParseXML: Use virXMLProp*
This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `id`.

`id` must be greater than 0 and does not benefit from being referable as
e.g. "-7" for host audio backend 4294967289, as this value is distinctly
out of range for normal use.

Additionally, this patch fixes a use of NULL string with printf's %s
modifier if the `model` attribute is absent.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:17:40 +02:00
Jiri Denemark
241c22a9a5 virnetdevbridge: Ignore EEXIST when adding an entry to fdb
When updating entries in a bridge forwarding database (i.e., when
macTableManager='libvirt' is configured for the bridge), we may end up
in a situation when the entry we want to add is already present. Let's
just ignore the error in such a case.

This fixes an error to resume a domain when fdb entries were not
properly removed when the domain was paused:

    virsh # resume test
    error: Failed to resume domain test
    error: error adding fdb entry for vnet2: File exists

For some reason, fdb entries are only removed when libvirt explicitly
stops CPUs, but nothing happens when we just get STOP event from QEMU.
An alternative approach would be to make sure we always remove the
entries regardless on why a domain was paused (e.g., during migration),
but that would be a significantly more disruptive change with possible
side effects.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-05-03 11:12:58 +02:00
Tim Wiederhake
b13f801d6f virDomainActualNetDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:11:39 +02:00
Tim Wiederhake
e78776e117 virDomainControllerDefParseXML: Cosmetic changes
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:11:39 +02:00
Tim Wiederhake
020dd80ecb virDomainControllerDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-05-03 11:11:39 +02:00
Jiri Denemark
f953e37846 Post-release version bump to 7.4.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-05-03 11:08:50 +02:00
Jiri Denemark
31800cd23d Release of libvirt-7.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-05-03 11:02:29 +02:00
Andrea Bolognani
c607266619 meson: Fix compatibility with Meson 0.58
Builds failed with

  tests/meson.build:690:0: ERROR: List item must be one
  of <class 'str'>, not <class 'list'>

before this change.

https://gitlab.com/libvirt/libvirt/-/issues/158

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-05-03 10:30:56 +02:00
Peter Krempa
6dca93e4bc conf: Fix heap corruption when hot-adding a lease
Commit 28a8699316 ( v6.9.0-179-g28a8699316 ) incorrectly replaced
VIR_EXPAND_N by g_renew.

VIR_EXPAND_N has these two extra effects apart from reallocating memory:

1) The newly allocated memory is zeroed out
2) The number of elements in the array which is passed to VIR_EXPAND_N
   is increased.

This comes into play when used with virDomainLeaseInsertPreAlloced,
which expects that the array element count already includes the space
for the added 'lease', by plainly just assigning to
'leases[nleases - 1]'

Since g_renew does not increase the number of elements in the array
any existing code which calls virDomainLeaseInsertPreAlloced thus either
overwrites a lease definition or corrupts the heap if there are no
leases to start with.

To preserve existing functionality we revert the code back to using
VIR_EXPAND_N which at this point doesn't return any value, so other
commits don't need to be reverted.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1953577
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-05-03 08:42:01 +02:00
Michal Privoznik
ec2e3336b8 NEWS: Mention stuff I've dealt with for this release
Crème de la crème of my work for this release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-28 14:13:06 +02:00
Peter Krempa
77bc347c49 NEWS: Mention notable changes
Add entries for deprecation_behavior, improving of errors from virsh's
snapshot helpers and other bugfixes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2021-04-28 08:42:20 +02:00
Jonathon Jongsma
16042d6849 NEWS: mention persistent mediated devices
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-27 13:13:01 -05:00
Ján Tomko
716494368a NEWS: qemu: add socket for virtiofs filesystems
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2021-04-27 19:08:09 +02:00
Ján Tomko
eacf8978e9 docs: virtiofs: add section about externally-launched virtiofsd
Provide an exmple in a place more visible than formatdomain.html.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2021-04-27 19:08:09 +02:00
Ján Tomko
4920678f40 docs: document new socket attribute for virtiofs
Describe the attribute and add an example.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2021-04-27 19:08:09 +02:00
Weblate
0f79a9abf6 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2021-04-27 11:34:02 +02:00
Göran Uddeborg
de0048b34d Translated using Weblate (Swedish)
Currently translated at 24.5% (2595 of 10581 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 24.3% (2575 of 10581 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2021-04-27 11:33:59 +02:00
simmon
cc75cf9fb8 Translated using Weblate (Korean)
Currently translated at 41.4% (4389 of 10581 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
2021-04-27 11:33:58 +02:00
Jiri Denemark
49ea08e6d9 po: Refresh potfile for v7.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-04-27 11:28:54 +02:00
Jonathon Jongsma
68580a5176 nodedev: remove unnecessary checks for NULL cmd
virCommandRun() already handles the case where the cmd argument is NULL,
so there's no need for the caller to check. Make all callers consistent
and remove unnecessary NULL checks.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 12:24:22 -05:00
Jonathon Jongsma
2d847765d2 nodedev: handle failure to generate mdevctl cmd
Coverity complained that the 'default' case of the switch in
nodeDeviceGetMdevctlCommand() was falling through without initializing
'cmd'. Return NULL in this case even though it should never happen.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 12:24:22 -05:00
Jonathon Jongsma
d0913302a8 nodedev: fix potential leak of command
When returning early due to errors, cmd will be leaked. Use an autoptr
to handle these early returns without leaking memory.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 12:24:22 -05:00
Peter Krempa
2384b6cade qemu: monitor: Remove qemuMonitorJobCancel
The API is unused since last commit. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
ced56f780e qemuMigrationSrcNBDCopyCancelled: Use do-while loop instead of jumping back
Jumping back in the code is an anti-pattern that should be avoided if
possible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
bc816ae5eb qemuMigrationSrcNBDCopyCancelOne: Force-cancel disk copy jobs when aborting migration
We don't require that the data is consistent on the destination if
aborting the migration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
8c066031f8 qemuMigrationSrcNBDCopyCancel*: Rename 'check' to 'abortMigration'
Rename the parameter so that it's more clear what state we are in and
fix all callees.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
5d31f5e7a7 qemuBlockJobRefreshJobs: Replace qemuMonitorJobCancel by qemuMonitorBlockJobCancel
We want to unify on one block job cancellation API. Use
qemuMonitorBlockJobCancel which has more features.

In case of job refresh, we are killing off any unknown jobs so we don't
care about their fate.

Another difference is that an possible error from the block job
cancellation might be reported, but we don't really care here ince
it's a very unlikely scenario and we also report a warning.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
c83d7775cb qemuBackupJobCancelBlockjobs: Replace qemuMonitorJobCancel by qemuMonitorBlockJobCancel
We want to unify on one block job cancellation API. Use
qemuMonitorBlockJobCancel which has more features.

In case of backup jobs we can cancel the jobs forcefully since the code
is on a cleanup path when the job fails.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
59543dfad6 qemuDomainBlockJobAbort: Don't use 'job-cancel' instead of 'block-job-cancel'
'block-job-cancel' has one very important semantic difference to
'job-cancel', docummented in qemu as:

  Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
  (via the event BLOCK_JOB_READY) that the source and destination are
  synchronized, then the event triggered by this command changes to
  BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
  destination now has a point-in-time copy tied to the time of the cancellation.

Since libvirt advertises the block copy job as having the synchronous
abort feature we must not use 'job-cancel' here.

Fixes: 4817b5ca1d
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
2716d53ee6 qemu: monitor: Add 'force' argument for 'block-job-cancel' QMP command
In certain cases such as when aborting migration we don't really care
for completion of the blockjob. Add 'force' as parameter of
'block-job-cancel'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
2587f825de qemuMonitorJSONBlockJobCancel: Refactor cleanup
Use automatic memory freeing and remove the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
1320a87ba2 qemumonitorjsontest: Add test for 'qemuMonitorJSONBlockJobCancel'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:52 +02:00
Peter Krempa
53c49c88f0 qemuMigrationSrcBeginPhase: Don't offer 'nbd' in cookie if there are no disks to migrate
Don't try to setup disk migration and the NBD stuff if we end up
migrating nothing.

The destination side has luckily no setup for the non-NBD cases so
omitting the element fully is okay.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:30 +02:00
Peter Krempa
763a88a358 qemuMigrationSrcRun: Don't attempt any storage migration if no disks will be migrated
Don't even try to setup storage migration if there are no eligible
disks.

This also fixes migration from older libvirts which didn't format an
empty <nbd/> element in the migration cookie if there weren't any disks
to migrate.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:30 +02:00
Peter Krempa
da69f4b208 qemuMigrationSrcRun: Sanitize setting of cookieFlags and migrate_flags on storage migration
Base the decision on the main API flags (VIR_MIGRATE_NON_SHARED_DISK,
QEMU_MONITOR_MIGRATE_NON_SHARED_INC) via a boolean 'storageMigration'
rather than juggling everything trhough 'migration_flags'.

After this patch 'migration_flags' is updated to contain the legacy
storage migration flags only when we'll be about to use it rather than
setting it and then resetting it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:30 +02:00
Peter Krempa
a9c1d5657d qemuMigrationSrcNBDStorageCopy: Don't pass migrate_flags
'migrate_flags' can be updated in the only caller and since
qemuMigrationSrcNBDStorageCopy already takes @flags which contains
VIR_MIGRATE_NON_SHARED_INC (used to set
 QEMU_MONITOR_MIGRATE_NON_SHARED_INC) we can completely remove the
parameter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:30 +02:00
Peter Krempa
652ea8083b qemuMigrationSrcNBDStorageCopy: Return error code on error
In case the 'nbdURI' schema is not known the code would report an error
but wouldn't return failure.

Fixes: 49186372db
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:30 +02:00
Peter Krempa
7c6d462aae qemuMigrationCookieNBDXMLFormat: Format empty <nbd/> element
Commit 518be41aaa refactored qemuMigrationCookieNBDXMLFormat to use
virXMLFormatElement which in comparison to the previous code doesn't
format the element if it's empty.

Unfortunately some crusty bits of our migration code use questionable
logic to assert use of the old-style storage migration parameters which
breaks if no disks are being migrated and the <nbd/> element is not
present.

While later patches will fix the code, re-instate formatting of empty
<nbd/> for increased compatibility.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:30 +02:00
Peter Krempa
1ac21ab7ea util: xml: Introduce virXMLFormatElementEmpty
Add a helper which will format an XML element with attributes and
children, but compared to virXMLFormatElement it also formats an empty
element if both buffers are empty.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-04-26 17:22:30 +02:00
Tim Wiederhake
6c7faa2720 virDomainDef: Change type of xen_passthrough_mode to virDomainXenPassthroughMode
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-04-26 13:43:32 +02:00
Tim Wiederhake
e4550c74a6 virDomainDef: Change type of hyperv_stimer_direct to virTristateSwitch
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-04-26 13:43:32 +02:00
Tim Wiederhake
fa88832b8f virDomainSoundDef: Change type of model to virDomainSoundModel
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-04-26 13:43:32 +02:00
Tim Wiederhake
7e07c50dc0 virDomainGraphicsDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-04-26 13:43:32 +02:00
Tim Wiederhake
b975a8a755 virDomainGraphicsDefParseXMLDesktop: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-04-26 13:43:32 +02:00