]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoNEWS: Document 'crypto' device
zhenwei pi [Tue, 17 Jan 2023 01:46:54 +0000 (09:46 +0800)]
NEWS: Document 'crypto' device

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: command: support crypto device
zhenwei pi [Tue, 17 Jan 2023 01:46:53 +0000 (09:46 +0800)]
qemu: command: support crypto device

Support virtio-crypto device, also support cryptodev types:
- builtin
- lkcf

Finally, we can launch a VM(QEMU) with one or more crypto devices by
libvirt.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: alias: support crypto device
zhenwei pi [Tue, 17 Jan 2023 01:46:52 +0000 (09:46 +0800)]
qemu: alias: support crypto device

Support 'cryptoX' alias for a crypto device.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agocapabilities: introduce crypto device
zhenwei pi [Tue, 17 Jan 2023 01:46:51 +0000 (09:46 +0800)]
capabilities: introduce crypto device

Changes in this commit:
- docs: formatdomaincaps.rst
- conf: crypto related domain caps
- 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>
2 years agoconf: introduce crypto device
zhenwei pi [Tue, 17 Jan 2023 01:46:50 +0000 (09:46 +0800)]
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>
2 years agotests: add QEMU RISC-V "virt" machine in domaincapstest
Daniel Henrique Barboza [Wed, 4 Jan 2023 18:39:59 +0000 (15:39 -0300)]
tests: add QEMU RISC-V "virt" machine in domaincapstest

'domaincapstest' is currently skipping RISC-V tests. Let's enable it.

The decision of enabling the "virt" machine is based on the idea that
this is the most used QEMU RISC-V machine in the community and it's the
most likely to be widely supported in the long run.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
2 years agotests: update RISC-V QEMU caps for QEMU 8.0.0
Daniel Henrique Barboza [Wed, 4 Jan 2023 18:23:38 +0000 (18:23 +0000)]
tests: update RISC-V QEMU caps for QEMU 8.0.0

Update RISC-V capabilities for the QEMU 8.0.0 cycle. Changes made are
based on the JSONification of device parameters.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
2 years agosrc/cpu: add a basic RiscV64 cpu driver
Daniel Henrique Barboza [Fri, 6 Jan 2023 16:49:56 +0000 (13:49 -0300)]
src/cpu: add a basic RiscV64 cpu driver

There are tests in qemuxml2argvtest that will fail if we enable RISC-V
testing, with an error like the following:

"cpuGetSubDriver:64 : this function is not supported by the connection
driver: 'riscv64' architecture is not supp orted by CPU driver"

This happens because we don't have a RISC-V driver yet.

Add a barebone RISC-V driver to allow tests to be executed. The only 2
callbacks implemented here are 'compare' and 'validateFeatures', both
acting as a no-op. More callbacks and features will be added in the
future.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
2 years agorpc: Fix error message in virNetServerSetClientLimits
Martin Kletzander [Tue, 24 Jan 2023 12:45:09 +0000 (13:45 +0100)]
rpc: Fix error message in virNetServerSetClientLimits

Commit f007940cb25a tried to change the error message so that it is unified
later in 35afa1d2d6c1, but various rewrites missed this particular error message
which does not make sense.  Fix it so that it is the same as the other two
messages checking the same thing in this file.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Remove 'memAliasOrderMismatch' field from VM private data
Peter Krempa [Thu, 19 Jan 2023 14:18:45 +0000 (15:18 +0100)]
qemu: Remove 'memAliasOrderMismatch' field from VM private data

The field is no longer used so we can remove it and the code filling it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: alias: Remove 'oldAlias' argument of qemuAssignDeviceMemoryAlias
Peter Krempa [Thu, 19 Jan 2023 14:16:58 +0000 (15:16 +0100)]
qemu: alias: Remove 'oldAlias' argument of qemuAssignDeviceMemoryAlias

All callers pass 'false' so we no longer need it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: hotplug: Remove legacy quirk for 'dimm' address generation
Peter Krempa [Thu, 19 Jan 2023 14:06:11 +0000 (15:06 +0100)]
qemu: hotplug: Remove legacy quirk for 'dimm' address generation

Commit b7798a07f93 (in fall of 2016) changed the way we generate aliases
for 'dimm' memory devices as the alias itself is part of the migration
stream section naming and thus must be treated as ABI.

The code added compatibility layer for VMs with memory hotplug started
with the old scheme to prevent from generating wrong aliases. The
compatibility layer broke though later when 'nvdimm' and 'pmem' devices
were introduced as it wrongly detected them as old configuration.

Now rather than attempting to fix the legacy compat layer to treat other
devices properly we'll be better off simply removing it as it's
extremely unlikely that somebody has a VM started in 2016 running with
today's libvirt and attempts to hotplug more memory.

This fixes a corner case when a user hot-adds a 'dimm' into a VM with a
'dimm' and a 'nvdimm' after restart of libvirtd and then attempts to
migrate the VM.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirnetlibsshsession: Don't check return value of 'virNetLibsshSessionAuthMethodNew'
Peter Krempa [Mon, 23 Jan 2023 15:41:55 +0000 (16:41 +0100)]
virnetlibsshsession: Don't check return value of 'virNetLibsshSessionAuthMethodNew'

The function can't return NULL to the callers so it doesn't make sense
to check it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirNetLibsshSessionAuthAddPasswordAuth: Don't access unlocked 'sess'
Peter Krempa [Mon, 23 Jan 2023 15:48:19 +0000 (16:48 +0100)]
virNetLibsshSessionAuthAddPasswordAuth: Don't access unlocked 'sess'

'sess->authPath' is modified before locking the 'sess' object.
Additionally on failure of 'virAuthGetConfigFilePathURI' 'sess' would be
unlocked even when it was not yet locked.

Fixes: 6917467c2b0e8f655999f3e568708c4651811689
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirnetsshsession: Don't check return value of 'virNetSSHSessionAuthMethodNew'
Peter Krempa [Mon, 23 Jan 2023 15:41:55 +0000 (16:41 +0100)]
virnetsshsession: Don't check return value of 'virNetSSHSessionAuthMethodNew'

The function can't return NULL to the callers so it doesn't make sense
to check it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirNetSSHSessionAuthAddPasswordAuth: Don't access unlocked 'sess'
Peter Krempa [Mon, 23 Jan 2023 15:40:00 +0000 (16:40 +0100)]
virNetSSHSessionAuthAddPasswordAuth: Don't access unlocked 'sess'

'sess->authPath' is modified before locking the 'sess' object.
Additionally on failure of 'virAuthGetConfigFilePathURI' 'sess' would be
unlocked even when it was not yet locked.

Fixes: 273745b43122a77adf8c73b2e0a852ac42387349
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: authconfig: Don't check return value of 'g_key_file_new()'
Peter Krempa [Mon, 23 Jan 2023 15:36:43 +0000 (16:36 +0100)]
util: authconfig: Don't check return value of 'g_key_file_new()'

The function can't fail so it's pointless to check its return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovbox: Stop reporting RC in error messages
Michal Privoznik [Sat, 21 Jan 2023 11:11:08 +0000 (12:11 +0100)]
vbox: Stop reporting RC in error messages

As shown in the commit that introduced vboxReportError(), we are
appending the retval of a failed VirtualBox API onto our error
messages. Well, this is no longer needed because
vboxReportError() already appends the VirtualBox error in plain
text.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Move error messages onto a single line
Michal Privoznik [Sat, 21 Jan 2023 10:07:31 +0000 (11:07 +0100)]
vbox: Move error messages onto a single line

Our coding style suggests error messages to be on a single line
for easier git grep. Since I'm touching them anyways, let's make
them follow our own suggestion.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Replace virReportError() with vboxReportError()
Michal Privoznik [Fri, 20 Jan 2023 12:59:55 +0000 (13:59 +0100)]
vbox: Replace virReportError() with vboxReportError()

Now that we have vboxReportError() which reports VirtualBox
errors too, we can switch the code to use the former. And since
the vboxReportError() is designed to behave exactly like
virReportError() we can do that almost everywhere, regardless of
the source of the error.

There are a few exceptions though, for instance, when
initializing VirtualBox SDK (we don't have all the objects needed
for querying exceptions yet), or when invalid combination of
arguments was passed to an API of ours, or when a function from
other module (e.g. src/conf/) failed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Introduce vboxReportError()
Michal Privoznik [Thu, 19 Jan 2023 16:34:12 +0000 (17:34 +0100)]
vbox: Introduce vboxReportError()

When a VirtualBox API fails it produced an exception. Until now,
we did not have correct APIs wired up to get the exception and
its error message. Thus, we were left with plain:

  virReportError("virtualbox API failed, rc=%08x", rc);

This is not very user friendly because those rc values are hard
to parse (e.g. some values are defined as a sum of a base value
and some other value) and also it expects users to know where to
look.

But now that we have all machinery needed for querying
exceptions, vboxReportError() can be introduced. The aim is to
query VirtualBox exceptions and append them after the error
message we intent to report. If the exception can't be queried
successfully, this behaves exactly like virReportError().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Introduce vboxUniformedPFN::ClearException()
Michal Privoznik [Sat, 21 Jan 2023 09:33:07 +0000 (10:33 +0100)]
vbox: Introduce vboxUniformedPFN::ClearException()

The ClearException() method clears the latest exception inside of
VirtualBox. This needed because obtaining an exception via
GetException() does not clear it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Introduce vboxUniformedPFN::GetException()
Michal Privoznik [Thu, 19 Jan 2023 16:34:04 +0000 (17:34 +0100)]
vbox: Introduce vboxUniformedPFN::GetException()

The GetException() method can be used to obtain the latest
exception that occurred in VirtualBox. Calling the method does
not reset the exception though. For that we'll need to call
another method (introduced in following commit).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Introduce IVirtualBoxErrorInfo interface
Michal Privoznik [Fri, 20 Jan 2023 07:59:40 +0000 (08:59 +0100)]
vbox: Introduce IVirtualBoxErrorInfo interface

The IVirtualBoxErrorInfo interface allows us to query error
messages from VirtualBox. Since VirtualBox has stacked errors we
need the GetNext() method too.

The odd one, that sticks out is GetIID() as it is not part of the
interface as defined by VirtualBox header files. BUT, we need to
get the interface UUID (which MAY change across each release) so
that it can be passed to VBOX_QUERY_INTERFACE() introduced
earlier.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Introduce VBOX_QUERY_INTERFACE()
Michal Privoznik [Fri, 20 Jan 2023 10:20:20 +0000 (11:20 +0100)]
vbox: Introduce VBOX_QUERY_INTERFACE()

So far we haven't needed to use a different interface for objects
we are working with. We were happy with calling their respective
vtbl callbacks. Well, this will change soon as we will query an
exception (type of nsIException) but will need to promote it to
IVirtualBoxErrorInfo class. This promoting is done by
QueryInterface() callback which accepts 3 arguments: the original
object, ID of the new interface and address where to store the
promoted object.

As this is very basic operation, available to every object, it is
part of the ISupports interface among with other goodies like
AddRef() and Release().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoNEWS: Document recent vbox changes
Michal Privoznik [Mon, 23 Jan 2023 08:31:27 +0000 (09:31 +0100)]
NEWS: Document recent vbox changes

The support for VirtualBox 5.2 and 6.0 was removed and 7.0 was
added. Reflect these changes in the NEWS file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Add support for version 7.0 SDK
Michal Privoznik [Wed, 18 Jan 2023 14:37:22 +0000 (15:37 +0100)]
vbox: Add support for version 7.0 SDK

As advertised in previous commit that added the SDK header file,
there were some changes to the API:

1) IVirtualBox::OpenMachine() and IVirtualBox::CreateMachine()
   now have @password argument to deal with password protected
   settings files. Well, we don't have that wired now (and we
   don't create such files). If we ever want to support user
   settings files that are password protected (e.g. via
   virSecret) we can wire this argument. For now, just pass NULL.

2) IMachine::GetAudioAdapter() is gone. But it can be replaced
   with IMachine::GetAudioSettings() + IMachine::GetAdapter()
   combo.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/419
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: add version 7.0 CAPI header
Michal Privoznik [Wed, 18 Jan 2023 14:38:34 +0000 (15:38 +0100)]
vbox: add version 7.0 CAPI header

Notable changes in the API:

- Both IVirtualBox::OpenMachine() and
  IVirtualBox::CreateMachine() have new @password argument for
  password protected settings files.

- The IMachine::GetAudioAdapter() function is gone and to be
  replaced with IMachine::GetAudioSettings() +
  IMachine::GetAdapter() combo.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Rename #include guard macro in header files
Michal Privoznik [Thu, 19 Jan 2023 09:00:45 +0000 (10:00 +0100)]
vbox: Rename #include guard macro in header files

To avoid including a header file more than once, either:

  #pragma once

can be used, or the older trick (that vbox still uses):

  #ifndef MACRO
  # define MACRO

Well, vbox still uses the latter and in its 7.0 release the macro
was renamed from ___VirtualBox_CXPCOM_h to ___VirtualBox_CAPI_h.
Now, ideally, we wouldn't touch those header files for older
versions, but we need to use the same macro across all header
files (because vbox_tmpl.c includes corresponding vbox_CAPI_XXX.h
and then includes vbox_XPCOMCGlue.h which in turn includes
vbox_CAPI_v6_1.h to get the basic typedefs).

Instead of changing the newer 7.0 header file (and having to
change all subsequent versions), let's change the old ones and as
we drop support for them, we can forget this ever happened.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop @networkName from UIDHCPServer::Start()
Michal Privoznik [Sun, 22 Jan 2023 12:12:27 +0000 (13:12 +0100)]
vbox: Drop @networkName from UIDHCPServer::Start()

The @networkName argument of UIDHCPServer::Start() callback is
unused. Drop it and also its propagation from parent functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop support for virtualbox-6.0.0
Michal Privoznik [Sat, 21 Jan 2023 12:30:34 +0000 (13:30 +0100)]
vbox: Drop support for virtualbox-6.0.0

According to VirtualBox download page [1], the 6.0.0 release is
no longer supported (the support ended 2020/07). Drop it from
Libvirt too.

1: https://www.virtualbox.org/wiki/Download_Old_Builds

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop support for virtualbox-5.2.0
Michal Privoznik [Sat, 21 Jan 2023 12:16:03 +0000 (13:16 +0100)]
vbox: Drop support for virtualbox-5.2.0

According to VirtualBox download page [1], the 5.2.0 release is
no longer supported (the support ended 2020/07). Drop it from
Libvirt too.

1: https://www.virtualbox.org/wiki/Download_Old_Builds

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop UIUSBCommon::GetEnabled()
Michal Privoznik [Sun, 22 Jan 2023 12:06:31 +0000 (13:06 +0100)]
vbox: Drop UIUSBCommon::GetEnabled()

The UIUSBCommon::GetEnabled() function is not needed really, as
it sets a boolean to true and always succeeds. We can live
without the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop UIUSBCommon::Enable()
Michal Privoznik [Sun, 22 Jan 2023 12:04:52 +0000 (13:04 +0100)]
vbox: Drop UIUSBCommon::Enable()

The UIUSBCommon::Enable() function is no longer needed as it is a
NOP. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop @data and @name from UIHost::CreateHostOnlyNetworkInterface()
Michal Privoznik [Sun, 22 Jan 2023 12:01:41 +0000 (13:01 +0100)]
vbox: Drop @data and @name from UIHost::CreateHostOnlyNetworkInterface()

The @data and @name arguments of
UIHost::CreateHostOnlyNetworkInterface() callback are unused.
Drop them and also their propagation from parent functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop @iid from UISession::OpenExisting()
Michal Privoznik [Sun, 22 Jan 2023 11:49:29 +0000 (12:49 +0100)]
vbox: Drop @iid from UISession::OpenExisting()

The @iid argument of UISession::OpenExisting() callback is
unused. Drop it and also its propagation from parent functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop @iid from UISession::Open()
Michal Privoznik [Sun, 22 Jan 2023 11:51:37 +0000 (12:51 +0100)]
vbox: Drop @iid from UISession::Open()

The @iid argument of UISession::Open() callback is unused. Drop
it and also its propagation from parent functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop @iid from UIMachine::LaunchVMProcess()
Michal Privoznik [Sun, 22 Jan 2023 11:30:02 +0000 (12:30 +0100)]
vbox: Drop @iid from UIMachine::LaunchVMProcess()

The @iid argument of UIMachine::LaunchVMProcess() callback is
unused. Drop it and also its propagation from parent functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop @mediaChangeOnly from vboxDomainAttachDeviceImpl()
Michal Privoznik [Sun, 22 Jan 2023 12:23:32 +0000 (13:23 +0100)]
vbox: Drop @mediaChangeOnly from vboxDomainAttachDeviceImpl()

The @mediaChangeOnly argument of vboxDomainAttachDeviceImpl()
function is unused. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Drop misleading G_GNUC_UNUSED annotation
Michal Privoznik [Sun, 22 Jan 2023 11:26:26 +0000 (12:26 +0100)]
vbox: Drop misleading G_GNUC_UNUSED annotation

There are few cases where a function argument is marked as
unused, but it's used later in the function. The majority of such
occurrences are in vbox_tmpl.c as a residue of older vbox
versions, but a pair was found in vbox_common.c too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agonetwork: Increase max route size when checking IPv6 forwarding
Brooks Swinnerton [Sat, 21 Jan 2023 00:58:05 +0000 (19:58 -0500)]
network: Increase max route size when checking IPv6 forwarding

In d9ee51e, virNetDevIPCheckIPv6Forwarding was updated to walk the
contents of /proc/net/ipv6_route so that it could check to see if the
RTF_ADDRCONF was set on any IPv6 routes to ultimately determine if
enabling forwarding would result in an error due to accept_ra=1 being
set on the interface.

The implementation added in that commit limited the number of routes
that could be read from /proc/net/ipv6_route to 100_000, each with 150
characters. This is problematic for machines that have a full IPv6
routing table, as the IPv6 routing table has now grown to over 160_000
(it was closer to 100_000 at the time of that commit).

This patch increases the maximum route size from 100_000 to 1_000_000.
While a million routes is somewhat arbitrary, it's meant to be a value
that can be supported for the forseeable future. APNIC, one of the five
regional internet registries, recently published a forecast of IPv6
table growth which anticipates a worst-case growth to 1_000_000 in
January of 2029.

Signed-off-by: Brooks Swinnerton <bswinnerton@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemuProcessEventSubmit : Unref event->vm instead of vm
Shaleen Bathla [Tue, 17 Jan 2023 09:22:13 +0000 (14:52 +0530)]
qemuProcessEventSubmit : Unref event->vm instead of vm

In error case, unref event->vm instead of vm. This makes it
easier for the reader to understand as it is the event struct
that's holding the reference.

Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: fix passt example
Laine Stump [Wed, 18 Jan 2023 14:07:53 +0000 (09:07 -0500)]
docs: fix passt example

Somehow the example I neglected to fully update the example for the
interface passt backend when the design changed during
development. This fixes the example to reflect what is in the code.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirAuthGetPasswordPath: Use virAuthAskCredential for callback interaction
Peter Krempa [Thu, 8 Dec 2022 15:28:15 +0000 (16:28 +0100)]
virAuthGetPasswordPath: Use virAuthAskCredential for callback interaction

Replace the open-coded variant by the new helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetLibsshAuthenticatePassword: Use virAuthAskPassword instead of virAuthGetPasswor...
Peter Krempa [Thu, 8 Dec 2022 15:24:19 +0000 (16:24 +0100)]
virNetLibsshAuthenticatePassword: Use virAuthAskPassword instead of virAuthGetPasswordPath

virAuthGetPasswordPath can return the same password over and over if
it's configured in the config. We rather want to try that only the first
time and then ask the user instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetLibsshCheckHostKey: Use virAuthAskCredential
Peter Krempa [Thu, 8 Dec 2022 15:13:16 +0000 (16:13 +0100)]
virNetLibsshCheckHostKey: Use virAuthAskCredential

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agoutil: virauth: Export virAuthGetCredential
Peter Krempa [Thu, 8 Dec 2022 16:03:42 +0000 (17:03 +0100)]
util: virauth: Export virAuthGetCredential

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetLibsshAuthenticatePrivkeyCb: Use virAuthAskCredential
Peter Krempa [Thu, 8 Dec 2022 15:07:43 +0000 (16:07 +0100)]
virNetLibsshAuthenticatePrivkeyCb: Use virAuthAskCredential

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetLibsshAuthenticateKeyboardInteractive: Use virAuthAskCredential
Peter Krempa [Thu, 8 Dec 2022 15:04:13 +0000 (16:04 +0100)]
virNetLibsshAuthenticateKeyboardInteractive: Use virAuthAskCredential

Rework the code to use the new helper instead of open coding the auth
callback interaction.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agoutil: auth: Introduce virAuthAskCredential
Peter Krempa [Thu, 8 Dec 2022 14:55:53 +0000 (15:55 +0100)]
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>
2 years agovirnetsshsession: Pass in username via virNetSSHSessionNew rather than auth functions
Peter Krempa [Thu, 8 Dec 2022 14:18:54 +0000 (15:18 +0100)]
virnetsshsession: Pass in username via virNetSSHSessionNew rather than auth functions

We only ever allow one username so there's no point passing it to each
authentication registration function. Additionally the only caller
(virNetClientNewLibSSH2) always passes a username so all the checks were
pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetSSHAuthMethod: Remove unused 'password' field
Peter Krempa [Thu, 8 Dec 2022 13:20:44 +0000 (14:20 +0100)]
virNetSSHAuthMethod: Remove unused 'password' field

None of the callers actually set it. Remove the field and corresponding
logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetSSHSessionAuthAddPrivKeyAuth: Refactor cleanup
Peter Krempa [Thu, 8 Dec 2022 13:18:16 +0000 (14:18 +0100)]
virNetSSHSessionAuthAddPrivKeyAuth: Refactor cleanup

With g_strdup not failing we can remove all of the 'error' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetSSHSessionAuthAddPrivKeyAuth: Remove unused 'password' argument
Peter Krempa [Thu, 8 Dec 2022 13:16:50 +0000 (14:16 +0100)]
virNetSSHSessionAuthAddPrivKeyAuth: Remove unused 'password' argument

The only caller doesn't pass the password. Remove the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agoutil: authconfig: Use conteporary and consistent header style
Peter Krempa [Thu, 8 Dec 2022 13:08:28 +0000 (14:08 +0100)]
util: authconfig: Use conteporary and consistent header style

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agoutil: authconfig: Use automatic pointer clearing for virAuthConfig
Peter Krempa [Thu, 8 Dec 2022 13:07:19 +0000 (14:07 +0100)]
util: authconfig: Use automatic pointer clearing for virAuthConfig

Fix and clean up the error paths in virAuthConfigNew*.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetLibsshAuthMethod: Drop 'password' field
Peter Krempa [Thu, 8 Dec 2022 12:53:17 +0000 (13:53 +0100)]
virNetLibsshAuthMethod: Drop 'password' field

The field was never populated so we can remove it and all the associated
logic.

Both for password authentication and fetching the password for the
public key we still can use the authentication callbacks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovirNetLibsshSessionAuthAddPrivKeyAuth: Drop 'password' argument
Peter Krempa [Thu, 8 Dec 2022 12:50:16 +0000 (13:50 +0100)]
virNetLibsshSessionAuthAddPrivKeyAuth: Drop 'password' argument

The only caller doesn't actually populate it. Remove it to simplify
internals.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agovbox: Fix starting domains
Michal Privoznik [Sat, 21 Jan 2023 11:46:05 +0000 (12:46 +0100)]
vbox: Fix starting domains

When starting a VirtualBox domain, we try to guess which frontend
to use. While the whole algorithm looks a bit outdated, it may
happen that we tell VirtualBox to use "gui" frontend, but not
which DISPLAY= to use.

I haven't found any documentation on the algorithm we use, but if
I make us fallback onto DISPLAY=:0 when no other configuration is
found then I'm able to start my guests just fine.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovbox: Fix memleak in _virtualboxCreateMachine()
Michal Privoznik [Sat, 21 Jan 2023 09:25:42 +0000 (10:25 +0100)]
vbox: Fix memleak in _virtualboxCreateMachine()

The _virtualboxCreateMachine() function allocates
@createFlagsUtf16 but never frees it.

==12481== 236 bytes in 2 blocks are definitely lost in loss record 2,060 of 2,216
==12481==    at 0x48407E5: malloc (vg_replace_malloc.c:393)
==12481==    by 0xB6C6D1B: RTStrToUtf16Tag (utf-8.cpp:1033)
==12481==    by 0xB4DB500: _virtualboxCreateMachine (vbox_tmpl.c:634)
==12481==    by 0xB4E68A3: vboxDomainDefineXMLFlags (vbox_common.c:1976)
==12481==    by 0x4C7DF83: virDomainDefineXMLFlags (libvirt-domain.c:6666)
==12481==    by 0x13C2DA: remoteDispatchDomainDefineXMLFlags (remote_daemon_dispatch_stubs.h:5271)
==12481==    by 0x13C265: remoteDispatchDomainDefineXMLFlagsHelper (remote_daemon_dispatch_stubs.h:5252)
==12481==    by 0x4AD9DF7: virNetServerProgramDispatchCall (virnetserverprogram.c:428)
==12481==    by 0x4AD9931: virNetServerProgramDispatch (virnetserverprogram.c:302)
==12481==    by 0x4AE28AC: virNetServerProcessMsg (virnetserver.c:135)
==12481==    by 0x4AE2972: virNetServerHandleJob (virnetserver.c:155)
==12481==    by 0x49BC275: virThreadPoolWorker (virthreadpool.c:164)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Provide virDomainGetCPUStats() implementation for session connection
Michal Privoznik [Mon, 16 Jan 2023 11:46:09 +0000 (12:46 +0100)]
qemu: Provide virDomainGetCPUStats() implementation for session connection

We have virDomainGetCPUStats() API which offers querying
statistics on host CPU usage by given guest. And it works in two
modes: getting overall stats (@start_cpu == -1, @ncpus == 1) or
getting per host CPU usage.

For the QEMU driver it is implemented by looking into values
stored in corresponding cpuacct CGroup controller. Well, this
works for system instances, where libvirt has permissions to
create CGroups and place QEMU process into them. But it does not
fly for session connection, where no CGroups are set up.

Fortunately, we can do something similar to v8.8.0-rc1~95 and use
virProcessGetStatInfo() to fill the overall stats. Unfortunately,
I haven't found any source of per host CPU usage, so we just
continue throwing an error in that case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agosrc: Don't use virReportSystemError() on virProcessGetStatInfo() failure
Michal Privoznik [Wed, 18 Jan 2023 08:03:29 +0000 (09:03 +0100)]
src: Don't use virReportSystemError() on virProcessGetStatInfo() failure

Firstly, the virProcessGetStatInfo() does not fail really. But
even if it did, it sets correct errno only sometimes (and even
that is done in a helper it's calling - virProcessGetStat() and
even there it's the case only in very few error paths).

Therefore, using virReportSystemError() to report errors is very
misleading. Use plain virReportError() instead. Luckily, there
are only two places where the former was used:
chDomainHelperGetVcpus() and qemuDomainHelperGetVcpus() (not a
big surprise since CH driver is heavily inspired by QEMU driver).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoconf: clarify some external TPM error messages
Ján Tomko [Fri, 20 Jan 2023 11:56:48 +0000 (12:56 +0100)]
conf: clarify some external TPM error messages

Two of the messages referred to 'backend type' when dealing
with the source type and one mentioned the 'client' attribute
from an earlier iteration of the patches, even though the attribute
was later changed to 'connect'.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_interface: Fix managed='no' case when creating an ethernet interface
Michal Privoznik [Mon, 23 Jan 2023 10:42:18 +0000 (11:42 +0100)]
qemu_interface: Fix managed='no' case when creating an ethernet interface

In a recent commit of v9.0.0-rc1~192 I've tried to forbid case
where a TAP device already exists, but at the same time it's
managed by Libvirt (<interface type='ethernet'> <target
dev='tap0' managed='yes'/> </interface>). NB, if @managed
attribute is missing then it's assumed to be managed by Libvirt.

Anyway, I've mistakenly put setting of
VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag into managed='yes'
branch instead of managed='no' branch in
qemuInterfaceEthernetConnect().

Move the setting of the flag into the correct branch.

Fixes: a2ae3d299cf9c5ada8aa42ec4271748eb479dc27
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirnetdevtap: Clarify virNetDevTapCreate() behavior wrt VIR_NETDEV_TAP_CREATE_ALLOW_E...
Michal Privoznik [Mon, 23 Jan 2023 10:38:03 +0000 (11:38 +0100)]
virnetdevtap: Clarify virNetDevTapCreate() behavior wrt VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING

The VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag is documented as:

  /* The device is allowed to exist before creation */
  VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING     = 1 << 4,

and yet, the documentation to virNetDevTapCreate() documents its
behavior when the flag is passed as:

  *   VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING
  *     - The device creation fails if @ifname already exists

Fortunately, the function is implemented so that it follows the
expected behavior (i.e. the former flag documentation). Fix the
function documentation then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodocs: submitting-patches: remove note about --patience
Ján Tomko [Mon, 9 Jan 2023 17:24:47 +0000 (18:24 +0100)]
docs: submitting-patches: remove note about --patience

Since we don't really say how to send patches using this diff algorithm,
it only clutters the document about *submitting* patches.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodocs: submitting-patches: Remove emphasis on not cc'ing developers
Ján Tomko [Mon, 9 Jan 2023 17:21:16 +0000 (18:21 +0100)]
docs: submitting-patches: Remove emphasis on not cc'ing developers

While some developers prefer to receive patches only on the mailing
list, cc'ing is a common practice in other projects.

Since it's easy enough to set up a mail filter for this, remove
the paragraph for simplicity.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agosrc/tests: use g_autoptr for virNWFilterDef and virNWFilterRuleDef
Jiang Jiacheng [Tue, 10 Jan 2023 11:29:26 +0000 (19:29 +0800)]
src/tests: use g_autoptr for virNWFilterDef and virNWFilterRuleDef

Use g_autoptr() for virNWFilterDef and virNWFilterRuleDef and remove
unnecessary label.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: define g_autoptr for virNWFilterDef and virNWFilterRuleDef
Jiang Jiacheng [Tue, 10 Jan 2023 11:29:25 +0000 (19:29 +0800)]
conf: define g_autoptr for virNWFilterDef and virNWFilterRuleDef

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoNEWS: Mention split of libvirt-daemon subpackage
Jim Fehlig [Thu, 5 Jan 2023 17:59:28 +0000 (10:59 -0700)]
NEWS: Mention split of libvirt-daemon subpackage

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agokbase: Update rpm-deployment.rst with new subpackages
Jim Fehlig [Wed, 14 Dec 2022 00:18:10 +0000 (17:18 -0700)]
kbase: Update rpm-deployment.rst with new subpackages

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Remove libvirt-daemon dependency from hypervisor subpackages
Jim Fehlig [Wed, 14 Dec 2022 00:31:01 +0000 (17:31 -0700)]
spec: Remove libvirt-daemon dependency from hypervisor subpackages

Remove the libvirt-daemon dependency from the various
libvirt-daemon-<hypervisor> subpackages, replacing it with a set of the
new sub subpackages providing similar functionality. When libvirt is build
with modular daemons, the hypervisor subpackages no longer include the
traditional, monolithic libvirt daemon.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agospec: Remove libvirt-daemon dependency from primary drivers
Jim Fehlig [Wed, 11 Jan 2023 21:17:32 +0000 (14:17 -0700)]
spec: Remove libvirt-daemon dependency from primary drivers

To avoid needlessly installing the monolithic daemon, replace the
libvirt-daemon dependency with libvirt-daemon-common in the primary
drivers.

The qemu driver also needs a dependency on libvirt-daemon-log since
the virtqemud systemd service file has a hard dependency on
virtlogd.socket.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoservices: Weaken systemd dependency on virtlockd
Jim Fehlig [Fri, 13 Jan 2023 19:04:28 +0000 (12:04 -0700)]
services: Weaken systemd dependency on virtlockd

The systemd service files of the qemu and libxl driver currently have a
'Requires' dependency on virtlockd, which is too strong since virtlockd
is not enabled by default in either driver. Change the dependency to a
'Wants' to avoid a package dependency between the driver subpackages and
the new libvirt-daemon-lock subpackage.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agospec: Remove libvirt-daemon dependency from secondary drivers
Jim Fehlig [Wed, 14 Dec 2022 00:31:00 +0000 (17:31 -0700)]
spec: Remove libvirt-daemon dependency from secondary drivers

To avoid needlessly installing the monolithic daemon, replace the
libvirt-daemon dependency with libvirt-daemon-common in the secondary
drivers. The common subpackage contains all the utilities and files
needed by the secondary drivers.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Add numad dependency to qemu and lxc drivers
Jim Fehlig [Tue, 20 Dec 2022 04:18:26 +0000 (21:18 -0700)]
spec: Add numad dependency to qemu and lxc drivers

Both drivers use numad via virNumaGetAutoPlacementAdvice. Drop the numad
dependency from libvirt-daemon-common to avoid enforcing it all users of
the subpackage.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Add module-init-tools dependency to nodedev and lxc drivers
Jim Fehlig [Tue, 20 Dec 2022 00:38:31 +0000 (17:38 -0700)]
spec: Add module-init-tools dependency to nodedev and lxc drivers

Only the nodedev and lxc drivers require module-init-tools. Remove the
dependency from libvirt-daemon-common and add it to the nodedev and lxc
drivers. This avoids enforcing the dependency on all users of
libvirt-daemon-common.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Move common files and dependencies to libvirt-daemon-common
Jim Fehlig [Wed, 14 Dec 2022 00:30:59 +0000 (17:30 -0700)]
spec: Move common files and dependencies to libvirt-daemon-common

Introduce a new subpackage libvirt-daemon-common and move virt-admin,
virt-host-validate, virt-ssh-helper, libvirt-guests and miscellaneous
files/directories to it. Also move common dependencies to the new
subpackage. These files, utilities, and dependecies are used by other
core libvirt daemons

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agospec: Rename the libvirt-lock-sanlock subpackage
Jim Fehlig [Wed, 14 Dec 2022 00:30:58 +0000 (17:30 -0700)]
spec: Rename the libvirt-lock-sanlock subpackage

The new name "libvirt-daemon-plugin-sanlock" provides consistency with the
newly introduced "libvirt-daemon-plugin-lockd" subpackage.

It's also a good opportunity to taking ownership of
%{_libdir}/libvirt/lock-driver/, removing the need for a dependency on the
libvirt-daemon package.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agospec: Move lockd plugin to a new subpackage
Jim Fehlig [Fri, 2 Dec 2022 18:24:27 +0000 (11:24 -0700)]
spec: Move lockd plugin to a new subpackage

Introduce the libvirt-daemon-plugin-lockd subpackage to provide the
client-side lockd plugin for virtlockd.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Move virtproxyd to a new subpackage libvirt-daemon-proxy
Jim Fehlig [Thu, 1 Dec 2022 23:24:18 +0000 (16:24 -0700)]
spec: Move virtproxyd to a new subpackage libvirt-daemon-proxy

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Move virtlogd to a new subpackage libvirt-daemon-log
Jim Fehlig [Thu, 1 Dec 2022 23:08:22 +0000 (16:08 -0700)]
spec: Move virtlogd to a new subpackage libvirt-daemon-log

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Move virtlockd to a new subpackage libvirt-daemon-lock
Jim Fehlig [Thu, 1 Dec 2022 22:22:32 +0000 (15:22 -0700)]
spec: Move virtlockd to a new subpackage libvirt-daemon-lock

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoapparmor: Allow umount(/dev)
Andrea Bolognani [Wed, 18 Jan 2023 09:28:04 +0000 (10:28 +0100)]
apparmor: Allow umount(/dev)

Commit 379c0ce4bfed introduced a call to umount(/dev) performed
inside the namespace that we run QEMU in.

As a result of this, on machines using AppArmor, VM startup now
fails with

  internal error: Process exited prior to exec: libvirt:
  QEMU Driver error: failed to umount devfs on /dev: Permission denied

The corresponding denial is

  AVC apparmor="DENIED" operation="umount" profile="libvirtd"
      name="/dev/" pid=70036 comm="rpc-libvirtd"

Extend the AppArmor configuration for virtqemud and libvirtd so
that this operation is allowed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agoch: use CURLOPT_UPLOAD instead of CURLOPT_PUT
Daniel P. Berrangé [Wed, 18 Jan 2023 09:45:52 +0000 (09:45 +0000)]
ch: use CURLOPT_UPLOAD instead of CURLOPT_PUT

The CURLOPT_PUT constant causes a deprecation warning when compiling on
Alpine Edge.  The docs indicate it is deprecated since 7.2.1

  https://curl.se/libcurl/c/CURLOPT_PUT.html

Since 7.87 the deprecation is now exposed at build time via a compiler
warning.

We already use CURLOPT_UPLOAD in the ESX driver, so this brings the CH
driver into line.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoremote: add missing lock guard for secret value API
Daniel P. Berrangé [Wed, 18 Jan 2023 12:53:53 +0000 (12:53 +0000)]
remote: add missing lock guard for secret value API

This fixes a bug in

  commit fda53ab3a536647192dd088672dcb6f4a6820e51
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Thu Dec 22 10:29:32 2022 -0500

    remote: use VIR_LOCK_GUARD in client code

Reviewed-by: Erik Skultety <eskultet@redhat>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoremote: remoteDomainCreate: Add missing struct initializer for 'ret2'
Erik Skultety [Wed, 18 Jan 2023 11:33:57 +0000 (12:33 +0100)]
remote: remoteDomainCreate: Add missing struct initializer for 'ret2'

Fixes: 62448c1a4927682f999fecf55e896de4625e46f6
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoadmin: use struct zero initializer instead of memset
Daniel P. Berrangé [Thu, 22 Dec 2022 15:42:20 +0000 (10:42 -0500)]
admin: use struct zero initializer instead of memset

This is a more concise approach and guarantees there is
no time window where the struct is uninitialized.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoremote: use struct zero initializer instead of memset
Daniel P. Berrangé [Thu, 22 Dec 2022 15:42:20 +0000 (10:42 -0500)]
remote: use struct zero initializer instead of memset

This is a more concise approach and guarantees there is
no time window where the struct is uninitialized.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: use struct zero initializer instead of memset
Daniel P. Berrangé [Thu, 22 Dec 2022 15:42:20 +0000 (10:42 -0500)]
rpc: use struct zero initializer instead of memset

This is a more concise approach and guarantees there is
no time window where the struct is uninitialized.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoadmin: use VIR_LOCK_GUARD in client code
Daniel P. Berrangé [Thu, 22 Dec 2022 15:29:32 +0000 (10:29 -0500)]
admin: use VIR_LOCK_GUARD in client code

Using VIR_LOCK_GUARD enables the 'done' goto label to be
eliminated.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoremote: use VIR_LOCK_GUARD in client code
Daniel P. Berrangé [Thu, 22 Dec 2022 15:29:32 +0000 (10:29 -0500)]
remote: use VIR_LOCK_GUARD in client code

Using VIR_LOCK_GUARD enables the 'done' goto label to be
eliminated.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: use VIR_LOCK_GUARD in remote client code
Daniel P. Berrangé [Thu, 22 Dec 2022 15:28:50 +0000 (10:28 -0500)]
rpc: use VIR_LOCK_GUARD in remote client code

Using VIR_LOCK_GUARD helps to simplify the control flow
logic.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agologging: remove redundant XDR typedef
Daniel P. Berrangé [Mon, 19 Dec 2022 19:14:36 +0000 (14:14 -0500)]
logging: remove redundant XDR typedef

Every enum/struct/union implicitly includes a typedef in the
emitted C code. Furthermore, the syntax used to declare the
redundant typedef is not compliant with the XDR spec.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agolxc: fix XDR protocol compliance
Daniel P. Berrangé [Mon, 19 Dec 2022 19:13:16 +0000 (14:13 -0500)]
lxc: fix XDR protocol compliance

The RFC spec for XDR does not allow enums to omit their
values, they must be explicitly given. Don't rely on this
rpcgen language extension.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoremote: remove redundant initialization of args variable
Daniel P. Berrangé [Thu, 22 Dec 2022 17:20:32 +0000 (12:20 -0500)]
remote: remove redundant initialization of args variable

Every member of the args variable will be initialized
explicitly. A few methods had a redundant call to memset
the args which can be removed.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Fix typo
Andrea Bolognani [Tue, 17 Jan 2023 15:49:44 +0000 (16:49 +0100)]
docs: Fix typo

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: document correct cpu shares limits with both cgroups v1 and v2
Pavel Hrdina [Tue, 17 Jan 2023 09:33:22 +0000 (10:33 +0100)]
docs: document correct cpu shares limits with both cgroups v1 and v2

The limits are different with cgroups v1 and v2 but our XML
documentation and virsh manpage mentioned only cgroups v1 limits without
explicitly saying it only applies to cgroups v1.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_validate: drop cpu.shares cgroup check
Pavel Hrdina [Tue, 17 Jan 2023 09:08:08 +0000 (10:08 +0100)]
domain_validate: drop cpu.shares cgroup check

This check is done when VM is defined but doesn't take into account what
cgroups version is currently used on the host system so it doesn't work
correctly.

To make proper check at this point we would have to figure out cgroups
version while defining a VM but that will still not guarantee that the
VM will start correctly in the future as the host may be rebooted with
different cgroups version.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovircgroupv2: fix cpu.weight limits check
Pavel Hrdina [Tue, 17 Jan 2023 09:02:07 +0000 (10:02 +0100)]
vircgroupv2: fix cpu.weight limits check

The cgroup v2 cpu.weight limits are different than cgroup v1 cpu.shares
limits.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>