Commit Graph

2471 Commits

Author SHA1 Message Date
Michal Privoznik
28602827e9 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>
2023-10-17 08:32:20 +02:00
Jonathon Jongsma
f3942eece5 util: make virCommandSetSendBuffer testable
Add a private function to peek at the list of send buffers in virCommand
so that it is testable

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-09-19 14:28:50 -05:00
K Shiva Kiran
880274aace conf: Add methods to create Metadata change events
Adds two new private methods to create metadata change events:
- virNetworkEventMetadataChangeNewFromNet()
- virNetworkEventMetadataChangeNewFromObj()

Signed-off-by: K Shiva Kiran <shiva_kr@riseup.net>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-09-18 11:24:49 +02:00
Martin Kletzander
e95b81c2fd conf: Generate MAC address instead of keeping all zeroes
When we parse <mac address="00:00:00:00:00:00"/> we keep that in memory
and pass it down to the hypervisor. However, that MAC address is not
strictly valid as it is not marked as locally administered (bit 0x02)
but it is not even globally unique. It is also used for loopback device
on Linux, for example. And QEMU sees such MAC address just as "not
specified" and generates a new one that libvirt does not even know
about. So to make the overall experience better we now generate it if
the supplied one is all clear.

Resolves: https://issues.redhat.com/browse/RHEL-974

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-09-04 16:01:24 +02:00
K Shiva Kiran
472919d90e Add virNetworkObj Get and Set Methods for Metadata
- Introduces virNetworkObjGetMetadata() and
  virNetworkObjSetMetadata().
- These functions implement common behaviour that can be reused by
  network drivers.
- Introduces virNetworkObjUpdateModificationImpact() among other
  helper functions that resolve the live/persistent state of
  the network before setting metadata.
- Eliminates redundant call of virNetworkObjSetDefTransient() in
  virNetworkConfigChangeSetup() among others.
- Substituted redundant logic in networkUpdate() with a call to
  virNetworkObjUpdateModificationImpact().

Signed-off-by: K Shiva Kiran <shiva_kr@riseup.net>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-08-25 12:36:37 +02:00
Laine Stump
6ce071f609 util: permit existing binding to VFIO variant driver
Before a PCI device can be assigned to a guest with VFIO, that device
must be bound to the vfio-pci driver rather than to the device's
normal host driver. The vfio-pci driver provides APIs that permit QEMU
to perform all the necessary operations to make the device accessible
to the guest.

In the past vfio-pci was the only driver that supplied these APIs, but
there are now vendor/device-specific "VFIO variant" drivers that
provide the basic vfio-pci driver functionality/API while adding
support for device-specific operations (for example these
device-specific drivers may support live migration of certain
devices).  All that is needed to make this functionality available is
to bind the vendor-specific "VFIO variant" driver to the device
(rather than the generic vfio-pci driver, which will continue to work,
just without the extra functionality).

But until now libvirt has required that all PCI devices being assigned
to a guest with VFIO specifically have the "vfio-pci" driver bound to
the device. So even if the user manually binds a shiny new
vendor-specific VFIO variant driver to the device (and puts
"managed='no'" in the config to prevent libvirt from changing the
binding), libvirt will just fail during startup of the guest (or
during hotplug) because the driver bound to the device isn't exactly
"vfio-pci".

Beginning with kernel 6.1, it's possible to determine from the sysfs
directory for a device whether the currently-bound driver is the
vfio-pci driver or a VFIO variant - the device directory will have a
subdirectory called "vfio-dev". We can use that to appropriately widen
the list of drivers that libvirt will allow for VFIO device
assignment.

This patch doesn't remove the explicit check for the exact "vfio-pci"
driver (since that would cause systems with pre-6.1 kernels to behave
incorrectly), but adds an additional check for the vfio-dev directory,
so that any VFIO variant driver is acceptable for libvirt to continue
setting up for VFIO device assignment.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-08-24 23:36:18 -04:00
Laine Stump
222b66974e util: rename virPCIDeviceGetDriverPathAndName
Instead, call it virPCIDeviceGetCurrentDriverPathAndName() to avoid
confusion with the device name that is stored in the virPCIDevice
object - that one is not necessarily the name of the current driver
for the device, but could instead be the driver that we want to be
bound to the device in the future.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-08-24 23:36:18 -04:00
Laine Stump
1bb9617971 util: add stub driver name to virPCIDevice object
There can be many different drivers that are of the type "VFIO", so
add the driver name to the object and allow getting/setting it.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-08-24 23:36:18 -04:00
Laine Stump
cd2843f546 util: use "stubDriverType" instead of just "stubDriver"
In the past we just kept track of the type of the "stub driver" (the
driver that is bound to a device in order to assign it to a
guest). The next commit will add a stubDriverName to go along with
type, so lets use stubDriverType for the existing enum to make it
easier to keep track of whether we're talking about the name or the
type.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-08-24 23:36:18 -04:00
Michal Privoznik
06d0a66292 virfile: Introduce virCloseFrom()
It is handy to close all FDs from given FD to infinity. On
FreeBSD the libc even has a function for that: closefrom(). It
was ported to glibc too, but not musl. At least glibc
implementation falls back to calling:

  close_range(from, ~0U, 0);

Now that we have a wrapper for close_range() we implement
closefrom() trivially.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2023-08-24 12:42:45 +02:00
Michal Privoznik
d69237caa3 virfile: Introduce virCloseRange()
Linux gained new close_range() syscall (in v5.9) that allows
closing a range of FDs in a single syscall. Ideally, we would use
it to close FDs when spawning a process (e.g. via virCommand
module).

Glibc has close_range() wrapper over the syscall, which falls
back to iterative closing of all FDs inside the range if running
under older kernel. We don't wane that as in that case we might
just close opened FDs (see Linux version of
virCommandMassClose()). And musl doesn't have close_range() at
all. Therefore, call syscall directly.

Now, mass close of FDs happens in a fork()-ed off child. While it
could detect whether the kernel does support close_range(), it
has no way of passing this info back to the parent and thus each
child would need to query it again and again.

Since this can't change while we are running we can cache the
information - hence virCloseRangeInit().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2023-08-24 12:41:07 +02:00
Pavel Hrdina
f879eae3e7 virdomainmomentobjlist: introduce virDomainMomentIsAncestor
This new helper will allow us to check if we are able to delete external
snapshot after user did revert to non-leaf snapshot.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-08-22 16:06:32 +02:00
Pavel Hrdina
824e2a4a98 snapshot_conf: export virDomainSnapshotDiskDefClear
We will need to call this function from qemu_snapshot when introducing
external snapshot revert support.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-08-22 16:06:03 +02:00
Pavel Hrdina
aba6f2a941 libvirt_private: list virDomainMomentDefPostParse
We will need to call this function from qemu_snapshot when introducing
external snapshot revert support.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-08-22 16:05:59 +02:00
Michal Privoznik
1b33578854 virfile: Introduce virDirIsEmpty()
There might be cases where we want to know whether given
directory is empty or not. Introduce a helper for that:
virDirIsEmpty().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-07-21 14:55:18 +02:00
Daniel P. Berrangé
c41cc852f6 util: add helper for raising the max files limit
Historically the max files limit for processes has always been 1024,
because going beyond this is incompatible with the select() function.
None the less most apps these days will use poll() so should not be
limited in this way.

Since systemd >= 240, the hard limit will be 500k, while the soft
limit remains at 1k. Applications which don't use select() should
raise their soft limit to match the hard limit during their startup.

This function provides a convenient helper to do this limit raising.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-07-20 10:58:01 +01:00
Martin Kletzander
fd340227a7 util: Remove virStrToLong_l
With the last user gone this function can be abolished.  It is
preferable to use _ll instead since that is not a subject to 32/64 bit
scaling.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-06-14 12:47:54 +02:00
Peter Krempa
dcd49d2cd6 util: xml: Introduce virXMLNodeGetSubelementList
The new helper is similar to virXPathNodeSet list but for cases where we
want to get subelements directly rather than using XPath.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-06-05 13:23:06 +02:00
Andrea Bolognani
ef91f9e52a util: Introduce virFileFindInPathFull()
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-05-10 18:54:08 +02:00
Peter Krempa
111eeba7a7 util: virtypedparam: Introduce virTypedParamsGetUnsigned
Add an internal helper for fetching a typed parameter which can be
either of the '_UINT' or '_ULONG' type and store it in a unsigned long
long variable.

Since this is an internal helper it offers less protections against
invalid use compared to those we expose as public API.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-05-02 14:32:46 +02:00
Peter Krempa
e280e83bff util: typedparam: Introduce virTypedParamListAddUnsigned
The new helper adds a unsigned value, stored as _UINT if it fits into
the type and stored as _ULLONG otherwise.

This is useful for the statistics code which is quite tolerant to
changes in type in cases when we'll need more range for the value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-05-02 14:32:46 +02:00
Peter Krempa
ec3a076c9e util: virtypedparam: Refactor return value of virTypedParamListStealParams
Return the number of parameters via pointer passed as argument to free
up possibility to report errors. Strangely all callers actually use
'int' as type for storing the count of elements, thus this function will
use the same.

The function is also renamed to virTypedParamListSteal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-05-02 14:32:46 +02:00
Peter Krempa
0fac024958 util: virtypedparam: Introduce 'virTypedParamListFetch'
Introduce a helper that fetches the typed parameters from the list while
still preserving ownership of the pointer by the list.

In the future this will be also able to report errors stored in the
list.

Signed-off-by: Peter Krempa <pkrempa@redhat.com
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-05-02 14:32:46 +02:00
Peter Krempa
e3dff704bf util: typedparam: Introduce 'virTypedParamListConcat'
Introduce a helper function to concatenate two virTypedParamLists. This
will allow us to refactor qemuDomainGetStatsBlock to not access the list
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-05-02 14:32:46 +02:00
Peter Krempa
0d09e79b42 util: virtypedparam: Introduce virTypedParamListNew()
Add an allocator function and refactor all allocations to use it. In
upcoming patches 'struct _virTypedParamList' will be made private.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-05-02 14:32:46 +02:00
Michal Privoznik
1a5c864e9f util: Introduce virAcpi module
The aim of this new module is to contain code that's parsing ACPI
tables. For now, only parsing of IORT table is implemented (it's
ARM specific table). And since we only need to check whether the
table contains SMMU record, the code is very simplified.
I've followed the specification published here:

  https://developer.arm.com/documentation/den0049/latest/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-04-06 12:48:22 +02:00
Peter Krempa
b4cd07cc70 virCapabilitiesFreeMachines: Remove unused function
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
cab9e1884d conf: Unexport virDomainHostdevDefClear
Move it before its first usage and make it static.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Or Ozeri
5589a3e1f3 qemu: add luks-any encryption support for RBD images
The newly added luks-any rbd encryption format in qemu
allows for opening both LUKS and LUKS2 encryption formats.
This commit enables libvirt uses to use this wildcard format.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-03-16 15:19:36 +01:00
Michal Privoznik
b6cfd348e9 virnuma: Introduce virNumaCPUSetToNodeset()
So far, we have a function that expands given list of NUMA nodes
into list of CPUs. But soon, we are going to need the inverse -
expand list of CPUs into list of NUMA nodes. Introduce
virNumaCPUSetToNodeset() for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-03-15 12:46:16 +01:00
Laine Stump
a53c1d6f84 util: add an API to retrieve the resolved path to a virCommand's binary
The binary to be exec'ed by virExec() is stored in
virCommand::args[0], and is resolved to a full absolute path (stored
in a local of virExec() just prior to execve().

Since we will have another use for the full absolute path, lets make
an API to resolve/retrieve the absolute path, and cache it in
virCommand::binaryPath so we only have to do the resolution once.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-10 14:09:16 -05:00
Ján Tomko
5af4e467af util: introduce virPidFileAcquirePathFull
For now, add the 'Full' suffix to virPidFileAcquirePath and make
virPidFileAcquirePath a 'wrapper' around it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-08 12:16:56 +01:00
Peter Krempa
6ac7e0a06f util: virfilecache: Introduce virFileCacheClear for usage in tests
In tests we need to be able to populate the cache with a deterministic
set of entries. This means we need to drop the contents of the cache
between runs to prevent spillage between test cases.

virFileCacheClear drops all entries from the hash table used for the
cache.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:49 +01:00
Peter Krempa
3922de0ce2 util: json: Remove unused virJSONValueObjectAppendStringPrintf
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 13:36:57 +01:00
Andrea Bolognani
68b80a705c conf: Export virDomainDefOSValidate()
We're going to need it elsewhere very soon.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:49:56 +01:00
Andrea Bolognani
572ab7cb76 conf: Introduce virDomainLoaderDefNew()
For now we just allocate the object, so the only advantage is
that invocations are shorter and look a bit nicer.

Later on, its introduction will pay off by letting us change
things in a single spot instead of all over the library.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:49:53 +01:00
Michal Privoznik
b4851deb79 libvirt_private.syms: Export virDomainMemoryModelTypeFromString()
The virDomainMemoryModelTypeFromString() is not exported, though
the enum translation functions are declared in
src/conf/domain_conf.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2023-03-01 13:40:40 +01:00
Laine Stump
110d209263 qemu: forbid updating any attributes of an interface <backend> with update-device
Changing any of the attributes of an <interface>'s <backend> would
require removing and re-adding the interface for the new setting to
take effect, so fail any update-device that changes anything in
<backend>

Resolves: https://bugzilla.redhat.com/2169245
Signed-off-by: Laine Stump <laine@redhat.com>
2023-02-21 14:44:54 -05:00
Michal Privoznik
cdb1aa996a viruri: Introduce virURIParamsSetIgnore()
The aim of this helper is to manipulate the .ignore value for
given list of parameters. For instance:

  virURIParamsSetIgnore(uri, false, {"mode", "socket", NULL});

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-02-08 16:50:45 +01:00
Martin Kletzander
1c61bd718a Support multiple watchdog devices
This is already possible with qemu, and actually already happening with
q35 machines and a specified watchdog since q35 already includes a
watchdog we do not include in the XML.  In order to express such
posibility multiple watchdogs need to be supported.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-01-26 16:40:30 +01:00
zhenwei pi
7ba22d21a1 conf: introduce crypto device
Introduce crypto device like:

  <crypto model='virtio' type='qemu'>
    <backend model='builtin' queues='1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
  </crypto>

  <crypto model='virtio' type='qemu'>
    <backend model='lkcf'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
  </crypto>

Currently, crypto model supports virtio only, type supports qemu only
(vhost-user in the plan). For the qemu type, backend supports modle
builtin/lkcf, and the queues is optional.

Changes in this commit:
- docs: formatdomain.rst
- schemas: domaincommon.rng
- conf: crypto related domain conf
- qemu: crypto related
- tests: crypto related test

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-01-25 16:00:42 +01:00
Peter Krempa
d40ff5fef2 util: virauth: Export virAuthGetCredential
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2023-01-23 16:32:26 +01:00
Peter Krempa
95f4879e97 util: auth: Introduce virAuthAskCredential
The helper uses the user-provided auth callbacks to ask the user. The
helper encapsulates the steps we do to query the user in few places into
a common helper which can be then used further.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2023-01-23 16:32:26 +01:00
Laine Stump
a8ee7ae301 conf: parse/format passt-related XML additions
This implements XML config to represent a subset of the features
supported by 'passt' (https://passt.top), which is an alternative
backend for emulated network devices that requires no elevated
privileges (similar to slirp, but "better").

Along with setting the backend to use passt (via <backend
type='passt'/> when the interface type='user'), we also support
passt's --log-file and --interface options (via the <backend>
subelement logFile and upstream attributes) and its --tcp-ports and
--udp-ports options (which selectively forward incoming connections to
the host on to the guest) via the new <portForward> subelement of
<interface>. Here is an example of the config for a network interface
that uses passt to connect:

    <interface type='user'>
      <mac address='52:54:00:a8:33:fc'/>
      <ip address='192.168.221.122' family='ipv4'/>
      <model type='virtio'/>
      <backend type='passt' logFile='/tmp/xyzzy.log' upstream='eth0'/>
      <portForward address='10.0.0.1' proto='tcp' dev='eth0'>
        <range start='2022' to='22'/>
        <range start='5000' end='5099' to='1000'/>
        <range start='5010' end='5029' exclude='yes'/>
      </portForward>
      <portForward proto='udp'>
        <range start='10101'/>
      </portForward>
    </interface>

In this case:

* the guest will be offered address 192.168.221.122 for its interface
  via DHCP

* the passt process will write all log messages to /tmp/xyzzy.log

* routes to the outside for the guest will be derived from the
  addresses and routes associated with the host interface "eth0".

* incoming tcp port 2022 to the host will be forwarded to port 22
  on the guest.

* incoming tcp ports 5000-5099 (with the exception of ports 5010-5029)
  to the host will be forwarded to port 1000-1099 on the guest.

* incoming udp packets on port 10101 will be forwarded (unchanged) to
  the guest.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-01-09 14:24:27 -05:00
Peter Krempa
47b922f3f8 conf: storage_source: Introduce virStorageSourceIsFD
The helper will be used in various places that need to check that a disk
source struct is using FD passing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-09 14:59:43 +01:00
Peter Krempa
e2670a63d2 conf: storage_source: Introduce type for storing FDs associated for storage
For FD-passing of disk sources we'll need to keep the FDs around.
Introduce a data type helper based on a g_object so that we get
reference counting.

One instance will (due to security labelling) will need to be part of
the virStorageSource struct thus it's declared in the storage_source_conf
module.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-09 14:59:42 +01:00
Pavel Hrdina
a784d4076a storage_source: introduce virStorageSourceChainLookupBySource
Looks up disk storage source within storage source chain using storage
source object instead of path to make it work with all disk types.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-01-09 13:32:49 +01:00
Peter Krempa
aa47051bf4 virclosecallbacks: Remove old close callbacks code
Now that all code was refactored to use the new version we can remove
the old code.

For now the new close callbacks code has no error messages so
syntax-check forced me to remove the POTFILES entry for
virclosecallbacks.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-06 15:30:09 +01:00
Peter Krempa
cb195c19b7 virclosecallbacks: Add new close callbacks APIs
The new APIs store the list of callbacks for a VM inside the
virDomainObj and also allow registering multiple callbacks for a single
domain and also for multiple connections.

For now this code is dormant until each driver using the old APIs is not
refactored to use the new APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-06 15:29:08 +01:00
Peter Krempa
2cb13113c2 conf: domain: Add helper infrastructure for new connection close callbacks
The new connect close callbacks for domains will be represented by a
virObject associated with the domain object itself.

To simplify handling the pointer to the close callback data will be done
by an immutable pointer allocated directly when allocating the
corresponding virDomainObj struct.

This patch adds the 'closecallbacks' field to virDomainObj and a
corresponding callback to allocate it into virDomainXMLOption.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-06 15:27:53 +01:00