]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
18 months agoqemu: command: Use 'format' nodename accessors for 'pflash' backend setup
Peter Krempa [Mon, 16 Oct 2023 14:39:46 +0000 (16:39 +0200)]
qemu: command: Use 'format' nodename accessors for 'pflash' backend setup

The frontend device needs to access the blocks directly so it cares
about the effective nodename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Use 'format' nodename accessors for block dirty bitmap operations
Peter Krempa [Mon, 16 Oct 2023 14:20:27 +0000 (16:20 +0200)]
qemu: Use 'format' nodename accessors for block dirty bitmap operations

In most cases the bitmap operations are relevant only on qcow2 images
thus the 'format' layer will be present. Although in certain specific
cases temporary bitmaps can be created on top of other images as well,
thus we use the 'effective' bitmap name in all cases for bitmap
operations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: driver: Convert disk stats code to use 'format' nodename accessors
Peter Krempa [Mon, 16 Oct 2023 14:12:40 +0000 (16:12 +0200)]
qemu: driver: Convert disk stats code to use 'format' nodename accessors

I case of statistics we're interested in the statistics of the effective
bitmap whatever it happens to be.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Convert disk backend setup code to use 'format' nodename accessors
Peter Krempa [Mon, 16 Oct 2023 14:09:55 +0000 (16:09 +0200)]
qemu: Convert disk backend setup code to use 'format' nodename accessors

The disk backend setup code is concerned only about the effective
nodename. Doing this conversion will also simplify further changes
needed to drop the 'raw' layer in cases when it's not really needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agotests: Use 'format' layer nodename accessors in test code
Peter Krempa [Mon, 16 Oct 2023 13:55:25 +0000 (15:55 +0200)]
tests: Use 'format' layer nodename accessors in test code

The test code cares mostly about the actual layer nodenames thus,
appropriate accessors are used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Use 'format' layer node name accessors for nodename setup code
Peter Krempa [Mon, 16 Oct 2023 13:54:17 +0000 (15:54 +0200)]
qemu: domain: Use 'format' layer node name accessors for nodename setup code

The code setting the nodenames needs to use the 'true' nodename of the
format layer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Use 'format' nodename accessors in '-blockdev' setup code
Peter Krempa [Thu, 4 Mar 2021 13:54:00 +0000 (14:54 +0100)]
qemu: block: Use 'format' nodename accessors in '-blockdev' setup code

Convert the main -blockdev JSON object setup code to use the new
accessors. In these we use mainly the real 'format' layer node name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: blockjob: Use 'format' nodename accessors for job naming
Peter Krempa [Mon, 16 Oct 2023 13:41:12 +0000 (15:41 +0200)]
qemu: blockjob: Use 'format' nodename accessors for job naming

Use the effective nodename for naming the job as we use that one now.
It doesn't matter too much which one we pick, because it's used just for
the name of the job, which we preserve in the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: backup: Use format nodename accessors
Peter Krempa [Mon, 16 Oct 2023 13:36:47 +0000 (15:36 +0200)]
qemu: backup: Use format nodename accessors

Both modified cases in this patch require the effective nodename as they
deal with the data being backed up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuBlockStorageSourceGetFormatProps: Use new frontend name accessor
Peter Krempa [Tue, 12 Sep 2023 14:53:01 +0000 (16:53 +0200)]
qemuBlockStorageSourceGetFormatProps: Use new frontend name accessor

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Add accessors for storage source effective nodename
Peter Krempa [Wed, 20 Sep 2023 13:47:51 +0000 (15:47 +0200)]
qemu: block: Add accessors for storage source effective nodename

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Add accessors for format layer node names
Peter Krempa [Wed, 20 Sep 2023 13:24:14 +0000 (15:24 +0200)]
qemu: block: Add accessors for format layer node names

Introduce a set of accessors, which return node names based on
semantics. This will allow to us to modify how we setup the backing
chain in cases when e.g. the format driver can be omitted, without
breaking all the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoconf: Rename 'nodestorage' field of virStorageSource to 'nodenamestorage'
Peter Krempa [Mon, 11 Sep 2023 13:46:33 +0000 (15:46 +0200)]
conf: Rename 'nodestorage' field of virStorageSource to 'nodenamestorage'

While the name itself doesn't matter, this rename is done to prove that
all places using 'nodestorage' were converted to the appropriate
accessors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuDomainSetBlockThreshold: Use 'storage' node name accessor
Peter Krempa [Mon, 25 Sep 2023 15:14:55 +0000 (17:14 +0200)]
qemuDomainSetBlockThreshold: Use 'storage' node name accessor

We need to keep setting the block threshold on the real storage layer
per semantics of the API. Use the appropriate accessor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuDomainGetStatsBlockExportDisk: Use 'storage' node name accessors
Peter Krempa [Mon, 25 Sep 2023 15:07:27 +0000 (17:07 +0200)]
qemuDomainGetStatsBlockExportDisk: Use 'storage' node name accessors

In all cases we want to probe stats from the 'storage' layer as we're
interested in the 'threshold' value, which we set there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Refactor storage backend 'storage' layer helepr object setup
Peter Krempa [Mon, 25 Sep 2023 15:02:20 +0000 (17:02 +0200)]
qemu: Refactor storage backend 'storage' layer helepr object setup

Use the new nodename accessors for any storage layer helper object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Refactor storage backend attach/detach setup code to use 'storage' nodename...
Peter Krempa [Mon, 25 Sep 2023 15:00:36 +0000 (17:00 +0200)]
qemu: Refactor storage backend attach/detach setup code to use 'storage' nodename accessors

Refactor the code settin up data structures used to attach/detach disks
and SCSI hostdevs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Rework assignment of 'storage' nodenames to use new accessors
Peter Krempa [Mon, 25 Sep 2023 14:57:21 +0000 (16:57 +0200)]
qemu: domain: Rework assignment of 'storage' nodenames to use new accessors

Refactor the code which assigns the 'storage' layer nodenames for disks.
scsi hostdevs and pflash backend.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Convert disk 'storage' backend JSON props generator to new accessors
Peter Krempa [Mon, 25 Sep 2023 14:44:26 +0000 (16:44 +0200)]
qemu: block: Convert disk 'storage' backend JSON props generator to new accessors

We need to use the 'effective' storage nodename (one which includes the
optional storage slice 'raw' intermediate layer) in the code which
formats the 'format' layer props.

All other cases need the real storage driver nodename as they either
generate the 'storage' layer props, or the storage slice, which refers
to the proper storage backend.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Convert the status XML code for 'storage' nodenames to new accessors
Peter Krempa [Mon, 25 Sep 2023 14:34:39 +0000 (16:34 +0200)]
qemu: domain: Convert the status XML code for 'storage' nodenames to new accessors

Use the new accessors in the private XML formatters and parsers and the
recovery code.

Specifically in all instances we use the proper (not effective) storage
nodename. In the virStorageSource private data it is what we need to
store. In blockjobs status XML it simply serves us to find the
appropriate 'virStorageSource' struct so using the storage layer node
name is simpler.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Use proper accessors for image formatting/creation code
Peter Krempa [Mon, 25 Sep 2023 14:24:07 +0000 (16:24 +0200)]
qemu: block: Use proper accessors for image formatting/creation code

Use 'qemuBlockStorageSourceGetEffectiveStorageNodename' in all the JSON
props formatters for setting up a 'blockdev-create' job of a format
layer.

In case of the blockjob name designator we're okay to use just the
storage layer nodename as that serves only to find the appropriate
entry.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuDomainVirStorageSourceFindByNodeName: Use proper accessor
Peter Krempa [Tue, 22 Jun 2021 06:26:01 +0000 (08:26 +0200)]
qemuDomainVirStorageSourceFindByNodeName: Use proper accessor

The lookup by nodename requires the proper storage nodename which we use
also in status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agotests: Use 'storage' layer nodename accessors in tests
Peter Krempa [Mon, 25 Sep 2023 14:19:34 +0000 (16:19 +0200)]
tests: Use 'storage' layer nodename accessors in tests

Convert all places in tests to use the 'storage' layer nodename
accessors instead of (virStorageSource)->nodestorage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Add accessors for protocol/storage node names
Peter Krempa [Mon, 21 Jun 2021 15:01:12 +0000 (17:01 +0200)]
qemu: block: Add accessors for protocol/storage node names

Introduce a set of accessors, which return node names based on
semantics. This will allow to us to modify how we setup the backing
chain in cases when e.g. the format driver can be omitted, without
breaking all the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Rename qemuBlockStorageSourceGetBlockdevProps
Peter Krempa [Tue, 12 Sep 2023 14:43:53 +0000 (16:43 +0200)]
qemu: block: Rename qemuBlockStorageSourceGetBlockdevProps

Use qemuBlockStorageSourceGetFormatProps as it formats the properties of
the 'format' driver in qemu. Adjust the comment which was hinting
otherwise.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Refactor logic in qemuBlockStorageSourceGetBlockdevProps
Peter Krempa [Tue, 12 Sep 2023 14:36:31 +0000 (16:36 +0200)]
qemu: block: Refactor logic in qemuBlockStorageSourceGetBlockdevProps

Restructure the conditions so that we can use virJSONValueObjectAdd with
a clearer logic for backing store control.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Identify blockjobs by storage nodename in VM status XML
Peter Krempa [Thu, 4 Mar 2021 15:12:20 +0000 (16:12 +0100)]
qemu: domain: Identify blockjobs by storage nodename in VM status XML

Use the node name of the storage access driver to identify the block job
volumes. This will prepare the blockjob code for the possibility that the
format layer may be missing. Our lookup code can find either of them,
thus we can safely switch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agotests: qemucapabilitiesdata: Add test data for qemu-8.2 dev cycle on x86_64
Peter Krempa [Mon, 25 Sep 2023 12:58:26 +0000 (14:58 +0200)]
tests: qemucapabilitiesdata: Add test data for qemu-8.2 dev cycle on x86_64

Add the test data based on v8.1.0-1639-g63011373ad

Notable changes in comparison with qemu-8.1 release:
 - new 8.2 machine types added
 - removed machine types: 'pc-i440fx-1.4', 'pc-i440fx-1.5', 'pc-i440fx-1.6', 'pc-i440fx-1.7'
 - 'rom' parameter for 'memory-backend-file' added
 - 'qemu-text-console', 'qemu-graphic-console',
   'qemu-fixed-text-console' QOM types added
 - 'qemu-console' -object removed
 - 'ufs-lu', 'ufs' devices added
 - 'sd-card-spi' device added
 - 'cryptodev-backend-lkcf' added
 - 'calc-dirty-rate' paramters 'calc-time-unit' added
 - 'guest_uso4', 'guest_uso6' 'host_uso' options for 'virtio-net-pci' added
 - new cpu flags: 'vmx-any-errcode', 'gds-no', 'vmx-complex',
   'vmx-enable-user-wait-pause'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agosecurity: apparmor: Use translated disk definitions for disk type=volume
Peter Krempa [Thu, 12 Oct 2023 14:03:41 +0000 (16:03 +0200)]
security: apparmor: Use translated disk definitions for disk type=volume

The 'virt-aa-helper' process gets a XML of the VM it needs to create a
profile for. For a disk type='volume' this XML contained only the
pool and volume name.

The 'virt-aa-helper' needs a local path though for anything it needs to
label. This means that we'd either need to invoke connection to the
storage driver and re-resolve the volume. Alternative which makes more
sense is to pass the proper data in the XML already passed to it via the
new XML formatter and parser flags.

This was indirectly reported upstream in
https://gitlab.com/libvirt/libvirt/-/issues/546

The configuration in the issue above was created by Cockpit on Debian.
Since Cockpit is getting more popular it's more likely that users will
be impacted by this problem.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoconf: Save translated disk definition for disk type='volume' to status XML
Peter Krempa [Thu, 12 Oct 2023 14:08:01 +0000 (16:08 +0200)]
conf: Save translated disk definition for disk type='volume' to status XML

Re-translating the disk source pools when reconnecting to a VM makes no
sense as the volume might have changed or pool became inactive. The VM
still uses the original volume though. Failing to re-translate the pool
also causes the VM to be killed.

Fix this by storing the original translation in the status XML.

Resolves: https://issues.redhat.com/browse/RHEL-7345
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemustatusxml2xmltest: Demonstrate use of VIR_DOMAIN_DEF_(PARSE|FORMAT)_VOLUME_TRANSLATED
Peter Krempa [Thu, 12 Oct 2023 13:56:59 +0000 (15:56 +0200)]
qemustatusxml2xmltest: Demonstrate use of VIR_DOMAIN_DEF_(PARSE|FORMAT)_VOLUME_TRANSLATED

Enable the flags in the status xml2xmtest and add an exaple to the test
data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Allow preserving translated disk type='volume' data into XML if needed
Peter Krempa [Thu, 12 Oct 2023 13:42:29 +0000 (15:42 +0200)]
qemu: domain: Allow preserving translated disk type='volume' data into XML if needed

Re-translating a disk type='volume' definition from a storage pool is
not a good idea in cases when the volume might have changed or we might
not have access to the storage driver.

Specific cases are if a storage pool is not activated on daemon restart,
then re-connecting to a VM fails, or if the virt-aa-helper program tries
to setup labelling for apparmor.

Add a new flag which will preserve the translated data in the
definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirDomainDiskTranslateSourcePool: Don't re-translate already translated defs
Peter Krempa [Thu, 12 Oct 2023 14:18:12 +0000 (16:18 +0200)]
virDomainDiskTranslateSourcePool: Don't re-translate already translated defs

If a disk definition was already translated re-doing it makes no sense.

Skip the translation if the 'actualtype' is already populated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirDomainDiskSourcePoolDefParse: Refactor cleanup
Peter Krempa [Thu, 12 Oct 2023 13:07:52 +0000 (15:07 +0200)]
virDomainDiskSourcePoolDefParse: Refactor cleanup

Register autoptr cleanup function for virStorageSourcePoolDef and
refactor the parser to simplify the logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirStorageSourcePoolDef: Turn 'mode' member into proper enum type
Peter Krempa [Thu, 12 Oct 2023 13:13:52 +0000 (15:13 +0200)]
virStorageSourcePoolDef: Turn 'mode' member into proper enum type

Use proper enum type and refactor the formatter accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoTranslated using Weblate (Korean)
김인수 [Wed, 11 Oct 2023 10:36:12 +0000 (12:36 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10413 of 10413 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
18 months agovirSecretLoad: Simplify cleanup path
Michal Privoznik [Mon, 16 Oct 2023 08:03:28 +0000 (10:03 +0200)]
virSecretLoad: Simplify cleanup path

When loading a secret value fails, the control jumps over to the
'cleanup' label where explicit call to virSecretDefFree()
happens. This is unnecessary as the corresponding variable can be
declared with g_autoptr() after which all error paths can just
return NULL instantly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirSecretLoadAllConfigs: Use g_autofree for @path
Michal Privoznik [Mon, 16 Oct 2023 07:49:02 +0000 (09:49 +0200)]
virSecretLoadAllConfigs: Use g_autofree for @path

When loading virSecret configs, the @path variable holds path to
individual config files. In each iteration it is freed explicitly
using VIR_FREE(). Switch it to g_autofree and remove those
explicit calls.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirfile: Drop virBuildPathInternal()
Michal Privoznik [Mon, 16 Oct 2023 07:43:17 +0000 (09:43 +0200)]
virfile: Drop virBuildPathInternal()

After previous cleanup the virBuildPathInternal() function is no
longer used. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agolib: Replace virBuildPath() with g_build_filename()
Michal Privoznik [Mon, 16 Oct 2023 07:40:58 +0000 (09:40 +0200)]
lib: Replace virBuildPath() with g_build_filename()

Our virBuildPath() constructs a path from given arguments.
Exactly like g_build_filename(), except the latter is more
generic as it uses backslashes on Windows. Therefore, replace the
former with the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirDomainMemoryDefValidate: Skip the same device on validation on memory device update
Michal Privoznik [Fri, 13 Oct 2023 06:38:45 +0000 (08:38 +0200)]
virDomainMemoryDefValidate: Skip the same device on validation on memory device update

In my recent commit of v9.8.0-rc1~7 I've introduced validation
wrt other memory devices. And mostly works, except when doing
memory device update ('virsh update-memory-device') because then
@mem is just parsed <memory/> device XML and thus its pointer is
not in the vm->def->mem, yet. Thus my algorithm which skips over
the same entry fails. Fortunately, we require full device XML on
device update and thus we can use device address and aliases to
detect duplicity.

Fixes: 3fd64fb0e236fc80ffa2cc977c0d471f11fc39bf
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuMonitorJSONHandleTrayChange: Properly handle if 'devAlias' is missing
Sergey Mironov [Wed, 11 Oct 2023 08:19:08 +0000 (11:19 +0300)]
qemuMonitorJSONHandleTrayChange: Properly handle if 'devAlias' is missing

While qemu is still reporting the 'device' field in the tray even the
code was not ready for the possibility of it missing. Fix the condition
for clearing 'devAlias' if qemu doesn't report the 'device' field.

Signed-off-by: Sergey Mironov <mironov@fintech.ru>
18 months agodocs: testtck: Expand the 'Run TCK' section on making use of ci/jobs.sh
Erik Skultety [Wed, 27 Sep 2023 18:45:25 +0000 (20:45 +0200)]
docs: testtck: Expand the 'Run TCK' section on making use of ci/jobs.sh

Ever since commit 6e9bd600d7cf56b16620bf4c453427b01368360d added a new
GitLab job description function handling the integration test suite
process to ci/jobs.sh it should be mentioned in the docs.

This patch splits the 'Run TCK' section in two, giving user the option
to run the integration test suite in their VM environment the same way
as we do in GitLab CI or execute everything manually.
This patch takes the opportunity to also link to the virtiofs kbase
article to give users a different option to get the local libvirt
repositories to be used in testing inside a VM.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 months agodocs: testtck: Add a clear note on libvirt + Perl bindings dependency
Erik Skultety [Wed, 27 Sep 2023 18:41:05 +0000 (20:41 +0200)]
docs: testtck: Add a clear note on libvirt + Perl bindings dependency

It's mentioned in an earlier paragraph that Perl bindings in correct
version are needed, but there's no note about libvirt even though it
should be obvious. So make a clear note on that and while at it, do
mention the possibility to get upstream libvirt RPMs from GitLab CI
artifacts if users don't feel like building everything on their own.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 months agodocs: testing: Adjust the docs on how to run container workloads locally
Erik Skultety [Wed, 27 Sep 2023 12:40:29 +0000 (14:40 +0200)]
docs: testing: Adjust the docs on how to run container workloads locally

The fact that we need ci/helper script to run the workloads remains
true, but the invocation has changed as of commit
eb41e456309dbea5b8b9f647f953ad98985ec1fe . We also extracted GitLab job
specs into a standalone ci/jobs.sh script which allows execution of any
container job we run in upstream CI locally, unlike the original
functionality which only allowed builds, tests and shell (although
important to say it could be adjusted with the right meson/ninja args).

lcitool also became mandatory as it enables the container execution
which replaced a Makefile we used to have for this purpose.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 months agodocs: testtck: Improve the documentation on how to get a VM from lcitool
Erik Skultety [Wed, 27 Sep 2023 10:15:55 +0000 (12:15 +0200)]
docs: testtck: Improve the documentation on how to get a VM from lcitool

While wording is still correct to this day, we have already added more
features to lcitool and documented it properly in its repo. Make sure
that we refer the users to lcitool's doc material for further details
on how VMs can be installed locally.
Use the opportunity to bump the OS distro target from Fedora 36 -> 38.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 months agodocs: testtck: Tweak the Avocado command to run TCK test suite
Erik Skultety [Wed, 27 Sep 2023 10:13:23 +0000 (12:13 +0200)]
docs: testtck: Tweak the Avocado command to run TCK test suite

While we may have needed to run TCK through Avocado by explicitly using
the '--tap' option (still possible), we can get a nice output from
Avocado by default leaving the option out which is exactly what we do
inside GitLab CI environment.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 months agodocs: ci: Update the description on the integration CI GitLab variables
Erik Skultety [Wed, 27 Sep 2023 08:38:57 +0000 (10:38 +0200)]
docs: ci: Update the description on the integration CI GitLab variables

This patch mainly fixes an unfinished sentence that was supposed to
describe the LIBVIRT_CI_INTEGRATION_RUNNER_TAG variable, but took the
opportunity to update the description of the other variable too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 months agodocs: ci-runners: Add a note on a new runner registration process
Erik Skultety [Wed, 27 Sep 2023 08:34:12 +0000 (10:34 +0200)]
docs: ci-runners: Add a note on a new runner registration process

The documented process should be updated to reflect the new process
once GitLab transitions to it completely and drops the old process
involving registration tokens as hinted by the note.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 months agoutil: vircommand: fix redundant if
Dmitry Frolov [Tue, 10 Oct 2023 08:54:14 +0000 (11:54 +0300)]
util: vircommand: fix redundant if

Comparison "if (ret == -1)" is always false.
This statement was forgotten during switching to g_new0()

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0275b06a55fc7b1ec6a9e93f7fb73bea7388f634 ("util: command: use g_new0")
Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agoNEWS: document support for reverting external snapshots
Pavel Hrdina [Wed, 6 Sep 2023 12:49:08 +0000 (14:49 +0200)]
NEWS: document support for reverting external snapshots

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agocapabilities: report full external snapshot support
Pavel Hrdina [Thu, 24 Aug 2023 16:19:52 +0000 (18:19 +0200)]
capabilities: report full external snapshot support

Now that deleting and reverting external snapshots is implemented we can
report that in capabilities so management applications can use that
information and start using external snapshots.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemu_snapshot: correctly load the saved memory state file
Pavel Hrdina [Wed, 30 Aug 2023 15:06:17 +0000 (17:06 +0200)]
qemu_snapshot: correctly load the saved memory state file

Original code assumed that the memory state file is only migration
stream but it has additional metadata stored by libvirt. To correctly
load the memory state file we need to reuse code that is used when
restoring domain from saved image.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemu_snapshot: fix reverting external snapshot when not all disks are included
Pavel Hrdina [Wed, 30 Aug 2023 14:31:55 +0000 (16:31 +0200)]
qemu_snapshot: fix reverting external snapshot when not all disks are included

We need to skip all disks that have snapshot type other than 'external'.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemuProcessStartWithMemoryState: make it possible to use without data
Pavel Hrdina [Wed, 27 Sep 2023 09:41:46 +0000 (11:41 +0200)]
qemuProcessStartWithMemoryState: make it possible to use without data

When used with internal snapshots there is no memory state file so we
have no data to load and decompression is not needed.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemuProcessStartWithMemoryState: add snapshot argument
Pavel Hrdina [Mon, 18 Sep 2023 12:28:45 +0000 (14:28 +0200)]
qemuProcessStartWithMemoryState: add snapshot argument

When called from snapshot code we will need to pass snapshot object in
order to make internal snapshots work correctly.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemuProcessStartWithMemoryState: allow setting reason for audit log
Pavel Hrdina [Mon, 18 Sep 2023 12:26:41 +0000 (14:26 +0200)]
qemuProcessStartWithMemoryState: allow setting reason for audit log

When called by snapshot code we will need to use different reason.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemu_saveimage: move qemuSaveImageStartProcess to qemu_process
Pavel Hrdina [Mon, 18 Sep 2023 13:20:12 +0000 (15:20 +0200)]
qemu_saveimage: move qemuSaveImageStartProcess to qemu_process

The function will no longer be used only when restoring VM as it will
be used when reverting snapshot as well so move it to qemu_process
and rename it accordingly.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemu_saveimage: introduce helpers to decompress memory state file
Pavel Hrdina [Mon, 18 Sep 2023 13:13:48 +0000 (15:13 +0200)]
qemu_saveimage: introduce helpers to decompress memory state file

These new helpers separates the code from the logic used to start new
QEMU process with memory state and will make it easier to move
qemuSaveImageStartProcess() into qemu_process.c file.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agoqemu_saveimage: extract starting process to qemuSaveImageStartProcess
Pavel Hrdina [Thu, 31 Aug 2023 13:01:45 +0000 (15:01 +0200)]
qemu_saveimage: extract starting process to qemuSaveImageStartProcess

Part of qemuSaveImageStartVM() function will be used when reverting
external snapshots. To avoid duplicating code and logic extract the
shared bits into separate function.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
18 months agodocs: Fix typos
Han Han [Mon, 9 Oct 2023 01:18:26 +0000 (09:18 +0800)]
docs: Fix typos

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
18 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sat, 7 Oct 2023 20:36:00 +0000 (22:36 +0200)]
Translated using Weblate (Swedish)

Currently translated at 51.9% (5407 of 10413 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>
19 months agomeson: Improve nbdkit configurability
Andrea Bolognani [Wed, 4 Oct 2023 22:37:09 +0000 (00:37 +0200)]
meson: Improve nbdkit configurability

Currently, nbdkit support will automatically be enabled as long as
the pidfd_open(2) syscall is available. Optionally, libnbd is used
to generate more user-friendly error messages.

In theory this is all good, since use of nbdkit is supposed to be
transparent to the user. In practice, however, there is a problem:
if support for it is enabled at build time and the necessary
runtime components are installed, nbdkit will always be preferred,
with no way for the user to opt out.

This will arguably be fine in the long run, but right now none of
the platforms that we target ships with a SELinux policy that
allows libvirt to launch nbdkit, and the AppArmor policy that we
maintain ourselves hasn't been updated either.

So, in practice, as of today having nbdkit installed on the host
makes network disks completely unusable unless you're willing to
compromise the overall security of the system by disabling
SELinux/AppArmor.

In order to make the transition smoother, provide a convenient
way for users and distro packagers to disable nbdkit support at
compile time until SELinux and AppArmor are ready.

In the process, detection is completely overhauled. libnbd is
made mandatory when nbdkit support is enabled, since availability
across operating systems is comparable and offering users the
option to make error messages worse doesn't make a lot of sense;
we also make sure that an explicit request from the user to
enable/disable nbdkit support is either complied with, or results
in a build failure when that's not possible. Last but not least,
we avoid linking against libnbd when nbdkit support is disabled.

At the RPM level, we disable the feature when building against
anything older than Fedora 40, which still doesn't have the
necessary SELinux bits but will hopefully gain them by the time
it's released. We also allow nbdkit support to be disabled at
build time the same way as other optional features, that is, by
passing "--define '_without_nbdkit 1'" to rpmbuild. Finally, if
nbdkit support has been disabled, installing libvirt will no
longer drag it in as a (weak) dependency.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
19 months agoqemu: DomainGetGuestVcpusParams: reduce scope of tmp
Ján Tomko [Fri, 29 Sep 2023 12:37:47 +0000 (14:37 +0200)]
qemu: DomainGetGuestVcpusParams: reduce scope of tmp

Wrap the macro body in a new block and move the declaration of 'tmp'
into it, to avoid the need to mix g_autofree with manual freeing.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
19 months agovirsh: Account for return values in virNodeGetFreePages
Martin Kletzander [Tue, 26 Sep 2023 13:20:42 +0000 (15:20 +0200)]
virsh: Account for return values in virNodeGetFreePages

The function returns how many array items were filled in, but virsh
never checked for anything other than errors.  Just to make sure this
does not report invalid data, even though the only possibility would be
reporting 0 free pages, check the returned data so that possible errors
are detected.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit c35ba64d18235bfe35617cb3d6d6cc778f6d166d)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
19 months agotest: Fix testNodeGetFreePages
Martin Kletzander [Tue, 26 Sep 2023 12:18:53 +0000 (14:18 +0200)]
test: Fix testNodeGetFreePages

The function is supposed to return the number of items filled into the
array and not zero.  Also change the initialization of the "randomness"
to be based on the startCell so that the values are different for each
cell even for separate calls.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 208569b07b6479e0acd05c5a7e1978b0b641e188)
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
19 months agoutil: fix success return for virProcessKillPainfullyDelay()
Jonathon Jongsma [Fri, 22 Sep 2023 19:42:42 +0000 (14:42 -0500)]
util: fix success return for virProcessKillPainfullyDelay()

virProcessKillPainfullyDelay() currently almost always returns 1 or -1,
even though the documentation indicates that it should return 0 if the
process was terminated gracefully. But the computation of the return
code is faulty and the only case where it currently returns 0 is when it
is called with the pid of a process that does not exist.

Since no callers ever even distinguish between the 0 and 1 response
codes, simply get rid of the distinction and return 0 for both cases.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
19 months agosystemd: Move Documentation lines
Andrea Bolognani [Mon, 25 Sep 2023 14:43:52 +0000 (16:43 +0200)]
systemd: Move Documentation lines

Like the Description, these are intended to be displayed to the
user, so it makes sense to have them towards the top of the file
before all the information that systemd will parse to calculate
dependencies.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Improve and unify unit descriptions
Andrea Bolognani [Mon, 25 Sep 2023 14:06:09 +0000 (16:06 +0200)]
systemd: Improve and unify unit descriptions

Hypervisors are referred to by their user-facing name rather
than the name of their libvirt driver, the monolithic daemon is
explicitly referred to as legacy, and a consistent format is
used throughout.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Add RemoveOnStop=yes to all sockets
Andrea Bolognani [Wed, 27 Sep 2023 15:13:32 +0000 (17:13 +0200)]
systemd: Add RemoveOnStop=yes to all sockets

Currently we only set this for the main sockets, which means
that

  $ systemctl stop virtqemud.socket

will make the socket disappear from the filesystem while

  $ systemctl stop virtqemud-ro.socket

won't. Get rid of this inconsistency.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Add Also between sockets
Andrea Bolognani [Mon, 25 Sep 2023 15:24:34 +0000 (17:24 +0200)]
systemd: Add Also between sockets

This results in all sockets for a service being enabled when a
single one of them is.

The -tcp and -tls sockets are intentionally excluded, because
enabling them should require explicit action on the
administrator's part; moreover, disabling them should not result
in the local sockets being disabled too.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Drop Before=foo.service from sockets
Andrea Bolognani [Mon, 25 Sep 2023 15:18:30 +0000 (17:18 +0200)]
systemd: Drop Before=foo.service from sockets

systemd will automatically infer this dependency based on the
socket's Service=foo.service setting.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Drop Before=libvirtd from virtlogd/virtlockd
Andrea Bolognani [Mon, 25 Sep 2023 15:15:38 +0000 (17:15 +0200)]
systemd: Drop Before=libvirtd from virtlogd/virtlockd

We have already declared the mirror relationship, so this one
is now redundant.

Moreover, this version was incomplete: it only ever worked for
the monolithic daemon, but the modular daemons for QEMU and Xen
also want the sockets to be active.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Augment Requires/Wants with After
Andrea Bolognani [Mon, 25 Sep 2023 15:16:20 +0000 (17:16 +0200)]
systemd: Augment Requires/Wants with After

Requires/Wants only tells systemd that the corresponding unit
should be started when the current one is, but that could very
well happen in parallel. For virtlogd/virtlockd, we want the
socket to be already active when the hypervisor driver is
started.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Downgrade read-only/admin sockets to Wants
Andrea Bolognani [Wed, 27 Sep 2023 13:44:34 +0000 (15:44 +0200)]
systemd: Downgrade read-only/admin sockets to Wants

Only the main socket is actually necessary for the service to be
usable.

In the past, we've had security issues that could be exploited via
access to the read-only socket, so a security-minded administrator
might consider disabling all optional sockets. This change makes
such a setup possible.

Note that the services will still try to activate all their
sockets on startup, even if they have been disabled. To make sure
that the optional sockets are never started, they will have to be
masked.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Replace Requires with BindTo+After for main socket
Andrea Bolognani [Mon, 25 Sep 2023 15:09:37 +0000 (17:09 +0200)]
systemd: Replace Requires with BindTo+After for main socket

This is the strongest relationship that can be declared between
two units, and causes the service to be terminated immediately
if its main socket disappears. This is the behavior we want.

Note that we don't do the same for the read-only/admin sockets,
because those are not as critical for the core functionality of
services as the main socket it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Make modular daemons conflict with libvirtd
Andrea Bolognani [Mon, 25 Sep 2023 15:24:10 +0000 (17:24 +0200)]
systemd: Make modular daemons conflict with libvirtd

We want to make sure that, at any given time, we have either the
modular daemons or the monolithic one running, never both. In
order to achieve that, make every single modular unit conflict
with the corresponding libvirtd unit.

We set both Conflicts=libvirtd.unit and After=libvirtd.unit: this
tells systemd that, whenever virtfood.unit and libvirtd.unit are
part of the same transaction, the former should win out.

Thanks to this, if both the modular daemons and the monolithic
one have been enabled because of outdated automation or a simple
mistake of the administrator, the request to start libvirtd at
boot will be ignored and the result will be a regular modular
deployment.

If the request to start libvirtd is made when the modular daemons
are already running, we have no way to prevent systemd from
complying with that request; however, thanks to the way the
conflict relationship has been declared, they will be shut down
cleanly before libvirtd is started. From the user's point of
view, the transition from modular to monolithic will be
completely transparent: it's basically the same scenario as a
regular package upgrade, just with an extra twist.

Note that, while switching from modular to monolithic at runtime
happens automatically, going back requires manual intervention,
i.e. starting all the necessary sockets one by one. That's okay:
the goal here is to prevent misconfiguration and force of habit
to accidentally disrupt a working setup, not to encourage the
scenario. In a correctly configured and managed host, it should
never occur.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Drop parametrization from libvirtd sockets
Andrea Bolognani [Mon, 25 Sep 2023 14:14:43 +0000 (16:14 +0200)]
systemd: Drop parametrization from libvirtd sockets

Up until now the files have been used as template for most
services, but now that those have been converted to common
templates we can drop parametrization and make it clear that
these files are for libvirtd only.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Drop @deps@
Andrea Bolognani [Tue, 19 Sep 2023 18:49:42 +0000 (20:49 +0200)]
systemd: Drop @deps@

It's no longer used anywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Drop libvirtd_socket*_in values
Andrea Bolognani [Thu, 21 Sep 2023 15:39:43 +0000 (17:39 +0200)]
systemd: Drop libvirtd_socket*_in values

Now that the migration to common templates has been completed,
we no longer need these.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtproxyd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:01:03 +0000 (20:01 +0200)]
systemd: Switch virtproxyd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtqemud to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:41:06 +0000 (20:41 +0200)]
systemd: Switch virtqemud to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtlxcd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:35:54 +0000 (20:35 +0200)]
systemd: Switch virtlxcd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtxend to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:32:50 +0000 (20:32 +0200)]
systemd: Switch virtxend to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtchd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:24:01 +0000 (20:24 +0200)]
systemd: Switch virtchd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtvzd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:26:22 +0000 (20:26 +0200)]
systemd: Switch virtvzd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtvboxd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:19:18 +0000 (20:19 +0200)]
systemd: Switch virtvboxd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtstoraged to common templates
Andrea Bolognani [Tue, 19 Sep 2023 17:54:52 +0000 (19:54 +0200)]
systemd: Switch virtstoraged to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtnetworkd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 17:49:05 +0000 (19:49 +0200)]
systemd: Switch virtnetworkd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtsecretd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:15:56 +0000 (20:15 +0200)]
systemd: Switch virtsecretd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtnwfilterd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 18:14:04 +0000 (20:14 +0200)]
systemd: Switch virtnwfilterd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtinterfaced to common templates
Andrea Bolognani [Tue, 19 Sep 2023 17:57:40 +0000 (19:57 +0200)]
systemd: Switch virtinterfaced to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Switch virtnodedevd to common templates
Andrea Bolognani [Tue, 19 Sep 2023 17:33:45 +0000 (19:33 +0200)]
systemd: Switch virtnodedevd to common templates

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Use common templates by default
Andrea Bolognani [Thu, 21 Sep 2023 15:10:56 +0000 (17:10 +0200)]
systemd: Use common templates by default

All services are still listing their input files explicitly, so
no changes to the output files will occur yet.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Introduce common templates
Andrea Bolognani [Tue, 19 Sep 2023 17:28:55 +0000 (19:28 +0200)]
systemd: Introduce common templates

We already use templating to generate sockets, which are all
based off libvirtd's. Push the idea further, and extend it to
cover services as well.

This is more challenging, as the various modular daemons each have
their own needs in terms of what system services needs to be
available before they can be started, which other components of
libvirt they depend on, and so on.

In order to make this sort of per-service tweaks possible, we
introduce a Python script that can merge two systemd units
together. The script is aware of the semantics of systemd's unit
definition format, so it can intelligently merge sections
together.

This generic systemd unit merging mechanism will also supersede
the extremely ad-hoc @deps@ variable, which is currently used in
a single scenario.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Provide all input files explicitly
Andrea Bolognani [Thu, 21 Sep 2023 15:03:19 +0000 (17:03 +0200)]
systemd: Provide all input files explicitly

We're about to change the defaults and start migrating to common
templates: in order to be able to switch units over one at a
time, make the input files that are currently used explicit
rather than implicit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Introduce temporary libvirtd_socket*_in values
Andrea Bolognani [Thu, 21 Sep 2023 14:15:33 +0000 (16:15 +0200)]
systemd: Introduce temporary libvirtd_socket*_in values

These will be useful during the upcoming migration to common
templates for systemd units and will be dropped as soon as all
services have been converted.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Make @service_in@ optional
Andrea Bolognani [Thu, 21 Sep 2023 15:08:28 +0000 (17:08 +0200)]
systemd: Make @service_in@ optional

It is currently considered required, but we're soon going to
provide a default that will be suitable for most services.

Since all services currently provide a value explicitly, we
can implement a default without breaking anything.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Introduce service_in/service_out variables
Andrea Bolognani [Tue, 26 Sep 2023 17:58:00 +0000 (19:58 +0200)]
systemd: Introduce service_in/service_out variables

They're similar to the existing socket_in/socket_out variables
and will make future changes nicer.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agosystemd: Drop Conflicts from virtproxyd sockets
Andrea Bolognani [Tue, 19 Sep 2023 19:07:28 +0000 (21:07 +0200)]
systemd: Drop Conflicts from virtproxyd sockets

The idea behind these is to prevent running both modular daemons
and monolithic daemon at the same time. We will implement a more
effective solution for that shortly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>