]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agonwfilterxml2firewalltest.c: testCompareXMLToArgvFiles: `virHashNew` cannot return...
Tim Wiederhake [Mon, 5 Jul 2021 14:20:04 +0000 (16:20 +0200)] 
nwfilterxml2firewalltest.c: testCompareXMLToArgvFiles: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuMonitorGetMemoryDeviceInfo: `virHashNew` cannot return NULL
Tim Wiederhake [Mon, 5 Jul 2021 14:03:19 +0000 (16:03 +0200)] 
qemuMonitorGetMemoryDeviceInfo: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuMonitorGetMemoryDeviceInfo: Use automatic memory management
Tim Wiederhake [Mon, 5 Jul 2021 14:02:40 +0000 (16:02 +0200)] 
qemuMonitorGetMemoryDeviceInfo: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuMonitorGetMemoryDeviceInfo: Assign hash table only on success
Tim Wiederhake [Mon, 5 Jul 2021 14:01:00 +0000 (16:01 +0200)] 
qemuMonitorGetMemoryDeviceInfo: Assign hash table only on success

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoiptablesPrivateChainCreate: Remove superfluous `goto`s
Tim Wiederhake [Mon, 5 Jul 2021 13:46:54 +0000 (15:46 +0200)] 
iptablesPrivateChainCreate: Remove superfluous `goto`s

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoiptablesPrivateChainCreate: Use automatic memory management
Tim Wiederhake [Mon, 5 Jul 2021 13:45:17 +0000 (15:45 +0200)] 
iptablesPrivateChainCreate: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoiptablesPrivateChainCreate: `virHashNew` cannot return NULL
Tim Wiederhake [Mon, 5 Jul 2021 13:44:20 +0000 (15:44 +0200)] 
iptablesPrivateChainCreate: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirNWFilterRuleDefToRuleInst: `virHashNew` cannot return NULL
Tim Wiederhake [Tue, 6 Jul 2021 11:26:10 +0000 (13:26 +0200)] 
virNWFilterRuleDefToRuleInst: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirNWFilterCreateVarsFrom: Remove superfluous `goto`s
Tim Wiederhake [Tue, 6 Jul 2021 08:18:57 +0000 (10:18 +0200)] 
virNWFilterCreateVarsFrom: Remove superfluous `goto`s

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirNWFilterCreateVarsFrom: Use automatic memory management
Tim Wiederhake [Tue, 6 Jul 2021 08:18:24 +0000 (10:18 +0200)] 
virNWFilterCreateVarsFrom: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirNWFilterCreateVarsFrom: `virHashNew` cannot return NULL
Tim Wiederhake [Tue, 6 Jul 2021 08:17:22 +0000 (10:17 +0200)] 
virNWFilterCreateVarsFrom: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoAUTHORS: Add myself to the list of commiters
Tim Wiederhake [Wed, 14 Jul 2021 12:37:02 +0000 (14:37 +0200)] 
AUTHORS: Add myself to the list of commiters

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirt-aa-helper: Allow swtpm to fsync on dir
Stefan Berger [Tue, 13 Jul 2021 18:38:32 +0000 (14:38 -0400)] 
virt-aa-helper: Allow swtpm to fsync on dir

Allow swtpm (0.7.0 or later) to fsync on the directory where it writes
its state files into so that "the entry in the directory containing the
file has also reached disk" (fsync(2)).

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetChardevInfo: `virHashNew` cannot return NULL
Tim Wiederhake [Tue, 6 Jul 2021 12:37:59 +0000 (14:37 +0200)] 
qemuMonitorGetChardevInfo: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetChardevInfo: Use automatic memory management
Tim Wiederhake [Tue, 6 Jul 2021 12:37:58 +0000 (14:37 +0200)] 
qemuMonitorGetChardevInfo: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetChardevInfo: Remove superfluous variable "ret"
Tim Wiederhake [Tue, 6 Jul 2021 12:37:57 +0000 (14:37 +0200)] 
qemuMonitorGetChardevInfo: Remove superfluous variable "ret"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetBlockInfo: `virHashNew` cannot return NULL
Tim Wiederhake [Tue, 6 Jul 2021 12:37:56 +0000 (14:37 +0200)] 
qemuMonitorGetBlockInfo: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetBlockInfo: Use automatic memory management
Tim Wiederhake [Tue, 6 Jul 2021 12:37:55 +0000 (14:37 +0200)] 
qemuMonitorGetBlockInfo: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetBlockInfo: Remove superfluous variable "ret"
Tim Wiederhake [Tue, 6 Jul 2021 12:37:54 +0000 (14:37 +0200)] 
qemuMonitorGetBlockInfo: Remove superfluous variable "ret"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetAllBlockStatsInfo: `virHashNew` cannot return NULL
Tim Wiederhake [Tue, 6 Jul 2021 12:37:53 +0000 (14:37 +0200)] 
qemuMonitorGetAllBlockStatsInfo: `virHashNew` cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetAllBlockStatsInfo: Use automatic memory management
Tim Wiederhake [Tue, 6 Jul 2021 12:37:52 +0000 (14:37 +0200)] 
qemuMonitorGetAllBlockStatsInfo: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetAllBlockStatsInfo: Assign hash table only on success
Tim Wiederhake [Tue, 6 Jul 2021 12:37:51 +0000 (14:37 +0200)] 
qemuMonitorGetAllBlockStatsInfo: Assign hash table only on success

`virHashNew` cannot return NULL, the check is not needed.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetAllBlockStatsInfo: Remove superfluous variable initialization
Tim Wiederhake [Tue, 6 Jul 2021 12:37:50 +0000 (14:37 +0200)] 
qemuMonitorGetAllBlockStatsInfo: Remove superfluous variable initialization

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorGetAllBlockStatsInfo: Clean up line break
Tim Wiederhake [Tue, 6 Jul 2021 12:37:49 +0000 (14:37 +0200)] 
qemuMonitorGetAllBlockStatsInfo: Clean up line break

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Fix the order of format arguments in doDump
Han Han [Tue, 13 Jul 2021 08:04:12 +0000 (16:04 +0800)] 
virsh: Fix the order of format arguments in doDump

According to definition of virDomainCoreDumpFormat, the "elf" should be
the first argument in VIR_ENUM_*.

Fixes: 84cc4543be
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1981625

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agolibxl: Add helper function for running the hook script
Jim Fehlig [Wed, 30 Jun 2021 00:11:29 +0000 (18:11 -0600)] 
libxl: Add helper function for running the hook script

The same pattern of retrieving the domXML, running the hook script, and
checking for error is used throughout the libxl driver. Remove some
repetitive code by adding a helper function to perform these tasks.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: Introduce libxlDomainStartPerform
Jim Fehlig [Tue, 29 Jun 2021 23:47:41 +0000 (17:47 -0600)] 
libxl: Introduce libxlDomainStartPerform

Introduce libxlDomainStartPerform as part of decomposing libxlDomainStart.
Perform all operations that are part of starting a domain. On error the
domain is destroyed from libxl's perspective, but the operations perfomed
in libxlDomainStartPrepare must be unwound by libxlDomainStart.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: Introduce libxlDomainStartPrepare
Jim Fehlig [Tue, 29 Jun 2021 23:32:37 +0000 (17:32 -0600)] 
libxl: Introduce libxlDomainStartPrepare

Introduce libxlDomainStartPrepare as part of decomposing libxlDomainStart.
Perform all prepratory operations such as hostdevs, network devs, etc.
Also ensure all such operations are properly unwound on error.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: Add a helper function to unprepare network devices
Jim Fehlig [Wed, 17 Feb 2021 22:24:58 +0000 (15:24 -0700)] 
libxl: Add a helper function to unprepare network devices

Move network device cleanup code from libxlDomainCleanup to a helper
function for use in a subsequent patch.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: Move managed save logic to libxlDomainStartNew
Jim Fehlig [Wed, 17 Feb 2021 21:13:24 +0000 (14:13 -0700)] 
libxl: Move managed save logic to libxlDomainStartNew

the logic to check for existence of a managed save image and use it to
start the VM can be moved to libxlDomainStartNew. libxlDomainStart has
become unwieldy and this is a small step to make it more manageable.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: Drop unused 'cfg' parameter from libxlDomainSaveImageOpen
Jim Fehlig [Wed, 17 Feb 2021 21:19:54 +0000 (14:19 -0700)] 
libxl: Drop unused 'cfg' parameter from libxlDomainSaveImageOpen

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoNEWS: Mention implications of the bug in migration code
Peter Krempa [Fri, 2 Jul 2021 12:17:58 +0000 (14:17 +0200)] 
NEWS: Mention implications of the bug in migration code

Wrong flag use could have user-visible implications. Mention the fix.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: migration: Use correct flag constant for enabling storage migration
Peter Krempa [Fri, 2 Jul 2021 12:17:57 +0000 (14:17 +0200)] 
qemu: migration: Use correct flag constant for enabling storage migration

The 'storageMigration' flag is supposed to be true if storage migration
is requested, which is based on VIR_MIGRATE_NON_SHARED_DISK or
VIR_MIGRATE_NON_SHARED_INC flags. The assignment to the variable used
QEMU_MONITOR_MIGRATE_NON_SHARED_INC (0x04) instead of
VIR_MIGRATE_NON_SHARED_INC (0x80), caused libvirtd to skip the actual
copy of data.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1978526
Fixes: da69f4b2084bff140238e450e264d6036ebef898
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSetBlockThreshold: Document that two events are fired when index isn't used
Peter Krempa [Thu, 1 Jul 2021 14:03:58 +0000 (16:03 +0200)] 
virDomainSetBlockThreshold: Document that two events are fired when index isn't used

Libvirt started emitting two threshold events, once with index and once
withouth when the index isn't registered. Document this caveat.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Prevent two threshold events when it was registered with index
Peter Krempa [Thu, 1 Jul 2021 14:03:57 +0000 (16:03 +0200)] 
qemu: Prevent two threshold events when it was registered with index

Remember whether the user passed an explicit index when registering the
event so that we can avoid the top level event when it isn't needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agostorage_source: Add flag storing whether threshold event was registered with index
Peter Krempa [Thu, 1 Jul 2021 14:03:56 +0000 (16:03 +0200)] 
storage_source: Add flag storing whether threshold event was registered with index

When users register the threshold event for the top level image with an
explicit index (e.g. vda[3]) they are clearly expecting the index in the
event.

This flag will help avoiding emission of the second event without the
index when the client clearly requested one with the index.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: interface: check and use ovs command to set qos of ovs managed port
zhangjl02 [Wed, 7 Jul 2021 09:18:19 +0000 (17:18 +0800)] 
qemu: interface: check and use ovs command to set qos of ovs managed port

When qos is set or delete, we have to check if the port is an ovs managed
port. If true, call the virNetDevOpenvswitchInterfaceSetQos function when qos
is set, and call the virNetDevOpenvswitchInterfaceClearQos function when
the interface is to be destroyed.

Signed-off-by: Jinsheng Zhang <zhangjl02@inspur.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: interface: remove setting noqueue for ovs port
zhangjl02 [Wed, 7 Jul 2021 09:18:18 +0000 (17:18 +0800)] 
qemu: interface: remove setting noqueue for ovs port

Return 0 directly if the port is ovs managed. When the ovs port is set
noqueue, qos config on this port will not work.

Signed-off-by: Jinsheng Zhang <zhangjl02@inspur.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomain: interface: add virNetDevOpenvswitchInterfaceSetQos and virNetDevOpenvswitc...
zhangjl02 [Wed, 7 Jul 2021 09:18:17 +0000 (17:18 +0800)] 
virDomain: interface: add virNetDevOpenvswitchInterfaceSetQos and virNetDevOpenvswitchInterfaceClearQos

Introduce qos setting and cleaning method. Use ovs command to set qos
parameters on specific interface of qemu virtual machine.

When an ovs port is created, we add 'ifname' to external-ids. When setting
qos on an ovs port, query its qos and queue. If found, change qos on queried
queue and qos, otherwise create new queue and qos. When cleaning qos, query
and clean queues and qos in ovs table record by 'ifname' and 'vmid'.

Signed-off-by: Jinsheng Zhang <zhangjl02@inspur.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomain: interface: add virDomainNetDefIsOvsport
zhangjl02 [Wed, 7 Jul 2021 09:18:16 +0000 (17:18 +0800)] 
virDomain: interface: add virDomainNetDefIsOvsport

Tell whether a port definition is an ovs managed virtual port

Signed-off-by: Jinsheng Zhang <zhangjl02@inspur.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: remove default audio backend for migratable XML
Daniel P. Berrangé [Wed, 7 Jul 2021 18:45:51 +0000 (19:45 +0100)] 
qemu: remove default audio backend for migratable XML

When seeing a guest with a sound device, and no audio backend, we
automatically add an audio backend XML element based on the historical
QEMU driver behaviour. Unfortunately when we live migrate back to an
old libvirt, it may not understand the audio driver type we configured.
We thus need to strip the default audio backend when migrating.

Fixes https://gitlab.com/libvirt/libvirt/-/issues/179
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agolib: Specify domain redefinition requirements
Roman Bolshakov [Wed, 30 Jun 2021 16:16:33 +0000 (19:16 +0300)] 
lib: Specify domain redefinition requirements

There might be misunderstanding [1] when libvirt permits domain
redefinition and if it's a valid case at all.

1. https://github.com/ansible-collections/community.libvirt/blob/b973d7c4b405818b9fe77bbb0432c67acc12e82f/plugins/modules/virt.py#L533

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: Improve virCgroupControllerAvailable wrt to CGroupsV2
Michal Privoznik [Thu, 8 Jul 2021 14:44:21 +0000 (16:44 +0200)] 
vircgroup: Improve virCgroupControllerAvailable wrt to CGroupsV2

It all started as a simple bug: trying to move domain memory
between NUMA nodes (e.g. via virsh numatune) did not work. I've
traced the problem to qemuProcessHook() because that's where we
decide whether to rely on CGroups or use numactl APIs to satisfy
<numatune/>. The problem was that virCgroupControllerAvailable()
was telling us that cpuset controller is unavailable. This is
CGroupsV2, and pretty weird because CGroupsV2 definitely do
support cpuset controller and I had them mounted in a standard
way. What I found out (with Pavel's help) was that
virCgroupNewSelf() was looking into the following path to detect
supported controllers:

  /sys/fs/cgroup/system.slice/cgroup.controllers

However, if there's no other VM running then the system.slice
only has 'memory' and 'pids' controllers. Therefore, we saw
'cpuset' as not available. The fix is to look at the top most
path, which has the full set of controllers:

  /sys/fs/cgroup/cgroup.controllers

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1976690
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoschemas: Allow cache attribute for bandwidth element for HMAT
Michal Privoznik [Wed, 7 Jul 2021 14:00:49 +0000 (16:00 +0200)] 
schemas: Allow cache attribute for bandwidth element for HMAT

Turns out, when introducing HMAT support in v6.6.0-rc1~249
I've forgot to allow "cache" attribute for <bandwidth/> element
in RNG. It's parsed and formatted, but schema does not allow it.

Fixes: a89bbbac86383a10be0cec5a93feb7ed820871eb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1980162
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirtlockd: Don't report error if lockspace exists
Jim Fehlig [Wed, 30 Jun 2021 22:36:42 +0000 (16:36 -0600)] 
virtlockd: Don't report error if lockspace exists

When the qemu or libxl driver is configured to use lockd and
file_lockspace_dir is set, virtlockd emits an error when libvirtd
is retarted

May 25 15:44:31 virt81 virtlockd[7723]: Requested operation is not
valid: Lockspace for path /data/libvirtd/lockspace already exists

There is really no need to fail when the lockspace already exists,
paricularly since the user is expected to create the lockspace
specified in file_lockspace_dir. Failure to do so will prevent
starting any domains

virsh start test
error: Failed to start domain 'test'
error: Unable to open/create resource /data/libvirtd/lockspace/de22c4bf931e7c48b49e8ca64b477d44e78a51543e534df488b05ccd08ec5caa: No such file or directory

Also, virLockManagerLockDaemonSetupLockspace already has logic to ignore
the error. Since callers are not interested in the error, change
virtlockd to not report or return an error when the specified lockspace
already exists.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: Don't use memory-backend-memfd for NVDIMMs
Michal Privoznik [Mon, 21 Jun 2021 15:14:15 +0000 (17:14 +0200)] 
qemu: Don't use memory-backend-memfd for NVDIMMs

If guest is configured to use memfd then the function that build
memory-backend-* part of command line will put
memory-backend-memfd, always. Even for NVDIMMs. This is not
correct, because NVDIMMs need a backing path (usually to a real
host NVDIMM device). Therefore, regardless of memfd being
requested, we have to stick with memory-backend-file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirDomainMachineNameAppendValid: Handle special characters better
Michal Privoznik [Fri, 25 Jun 2021 13:51:52 +0000 (15:51 +0200)] 
virDomainMachineNameAppendValid: Handle special characters better

When constructing guest name for machined we have to be very
cautious as machined expects a name that's basically a valid URI.
Therefore, if there's a dot it has to be followed by a letter or
a number. And if there's a sequence of two or more dashes they
should be joined into a single dash. These rules are implemented
in virDomainMachineNameAppendValid(). There's the @skip variable
which is supposed to track whether it is safe to append a dot or
a dash into name. However, the variable is set to false (meaning
it is safe to append a dot or a dash) even if the current
character we are processing is not in the set of allowed
characters (and thus skipped over).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1948433
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirresctrl: Fix updating the mask for a cache resource
Vinayak Kale [Fri, 2 Jul 2021 07:23:15 +0000 (12:53 +0530)] 
virresctrl: Fix updating the mask for a cache resource

In 'virResctrlAllocUpdateMask', mask is updated only if 'previous mask' is NULL.

By default, the bitmask for a cache resource for a VM is initialized with
'default-resctrl-group' bitmask. So the 'previous mask' would not be NULL and
mask won't get updated if cachetune is configured for a VM. This causes libvirt
to use same bitmask as 'default-resctrl-group' bitmask for a cache resource for
a VM. This patch fixes the issue.

Fixes: d8a354954aba9cd45ab0317915a0a2be27c04767
Signed-off-by: Vinayak Kale <vkale@nvidia.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSEVDefParseXML: Remove superfluous variable initialization
Tim Wiederhake [Mon, 5 Jul 2021 10:46:54 +0000 (12:46 +0200)] 
virDomainSEVDefParseXML: Remove superfluous variable initialization

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSEVDefParseXML: Remove superfluous `goto`s
Tim Wiederhake [Mon, 5 Jul 2021 10:46:53 +0000 (12:46 +0200)] 
virDomainSEVDefParseXML: Remove superfluous `goto`s

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSEVDefParseXML: Use automatic memory management
Tim Wiederhake [Mon, 5 Jul 2021 10:46:52 +0000 (12:46 +0200)] 
virDomainSEVDefParseXML: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSEVDefParseXML: Use virXMLPropEnum
Tim Wiederhake [Mon, 5 Jul 2021 10:46:51 +0000 (12:46 +0200)] 
virDomainSEVDefParseXML: Use virXMLPropEnum

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: virDomainSEVDef: Change type of "sectype" to virDomainLaunchSecurity
Tim Wiederhake [Mon, 5 Jul 2021 10:46:50 +0000 (12:46 +0200)] 
conf: virDomainSEVDef: Change type of "sectype" to virDomainLaunchSecurity

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: Add AUTOPTR_CLEANUP_FUNC for virDomainSEVDef
Tim Wiederhake [Mon, 5 Jul 2021 10:46:49 +0000 (12:46 +0200)] 
conf: Add AUTOPTR_CLEANUP_FUNC for virDomainSEVDef

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agomeson: check for `XDR` and `driver_remote` early
Pavel Hrdina [Wed, 7 Jul 2021 11:00:12 +0000 (13:00 +0200)] 
meson: check for `XDR` and `driver_remote` early

We have several other options that depend on result of `driver_remote`
option check so we need to do it early to have the result available.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/185
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoTranslated using Weblate (Indonesian)
Didik Supriadi [Tue, 6 Jul 2021 16:04:27 +0000 (18:04 +0200)] 
Translated using Weblate (Indonesian)

Currently translated at 3.1% (326 of 10342 strings)

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

Co-authored-by: Didik Supriadi <didiksupriadi41@gmail.com>
Signed-off-by: Didik Supriadi <didiksupriadi41@gmail.com>
4 years agoTranslated using Weblate (Korean)
simmon [Tue, 6 Jul 2021 16:04:26 +0000 (18:04 +0200)] 
Translated using Weblate (Korean)

Currently translated at 45.0% (4655 of 10342 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agoTranslated using Weblate (Finnish)
Ricky Tigg [Tue, 6 Jul 2021 16:04:25 +0000 (18:04 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 22.2% (2302 of 10342 strings)

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

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
4 years agodocs: add go-import meta tags for new go modules
Daniel P. Berrangé [Fri, 2 Jul 2021 10:54:03 +0000 (11:54 +0100)] 
docs: add go-import meta tags for new go modules

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: point go imports to gitlab.com repos
Daniel P. Berrangé [Fri, 2 Jul 2021 10:50:20 +0000 (11:50 +0100)] 
docs: point go imports to gitlab.com repos

The gitlab.com repos are the primary source, with libvirt.org just a
read-only mirror.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirSetUIDGIDWithCaps: Assume PR_CAPBSET_DROP is always defined
Michal Privoznik [Thu, 24 Jun 2021 14:58:53 +0000 (16:58 +0200)] 
virSetUIDGIDWithCaps: Assume PR_CAPBSET_DROP is always defined

Bounding set capabilities were introduced in kernel commit of
v2.6.25-rc1~912. I guess it is safe to assume that all Linux
hosts we ran on have at least that version or newer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agonodedev: improve error message when destroying an inactive device
Jonathon Jongsma [Tue, 22 Jun 2021 19:53:36 +0000 (14:53 -0500)] 
nodedev: improve error message when destroying an inactive device

When trying to destroy a node device that is not active, we end up with
a confusing error message:

  # nodedev-destroy mdev_88a6b868_46bd_4015_8e5b_26107f82da38
  error: Failed to destroy node device 'mdev_88a6b868_46bd_4015_8e5b_26107f82da38'
  error: failed to access '/sys/bus/mdev/devices/88a6b868-46bd-4015-8e5b-26107f82da38/iommu_group': No such file or directory

With this patch, the error is more clear:

  # nodedev-destroy mdev_88a6b868_46bd_4015_8e5b_26107f82da38
  error: Failed to destroy node device 'mdev_88a6b868_46bd_4015_8e5b_26107f82da38'
  error: Requested operation is not valid: Device 'mdev_88a6b868_46bd_4015_8e5b_26107f82da38' is not active

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
4 years agonodedev: handle mdevctl errors consistently
Jonathon Jongsma [Tue, 22 Jun 2021 19:53:35 +0000 (14:53 -0500)] 
nodedev: handle mdevctl errors consistently

Currently, we have three different types of mdevctl errors:
 1. the command cannot be constructed ecause of unsatisfied
    preconditions
 2. the command cannot be executed due to some error
 3. the command is executed, but returns an error status

These different failures are handled differently. Some cases set an
error and return and error status, and some return a error message but
do not set an error.

This means that the caller has to check both whether the return value is
negative and whether the errmsg parameter is non-NULL before deciding
whether to report the error or not. The situation is further complicated
by the fact that there are occasional instances where mdevctl exits with
an error status but does not print an error message.  This results in
errmsg being an empty string "" (i.e. non-NULL).

Simplify the situation by ensuring that virReportError() is called for
all error conditions rather than returning an error message back to the
calling function.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
4 years agonodedev: add macro to handle command errors
Jonathon Jongsma [Tue, 22 Jun 2021 19:53:34 +0000 (14:53 -0500)] 
nodedev: add macro to handle command errors

This macro will be utilized in the following patch. Since mdevctl
commands can fail with or without an error message, this macro makes it
easy to print a fallback error in the case that the error message is not
set.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
4 years agonodedev: Handle NULL command variable
Jonathon Jongsma [Tue, 22 Jun 2021 19:53:33 +0000 (14:53 -0500)] 
nodedev: Handle NULL command variable

In commit 68580a51, I removed the checks for NULL cmd variables because
virCommandRun() already handles the case where it is called with a NULL
cmd. Unfortunately, it handles this case by raising a generic error
which is both unhelpful and overwrites our existing error message. So
for example, when I attempt to create a mediated device with an invalid
parent, I get the following output:

    virsh # nodedev-create mdev-test.xml
    error: Failed to create node device from mdev-test.xml
    error: internal error: invalid use of command API

With this patch, I now get a useful error message again:

    virsh # nodedev-create mdev-test.xml
    error: Failed to create node device from mdev-test.xml
    error: internal error: unable to find parent device 'pci_0000_00_03_0'

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
4 years agonodedev: Remove useless device name from error message
Jonathon Jongsma [Tue, 22 Jun 2021 19:53:32 +0000 (14:53 -0500)] 
nodedev: Remove useless device name from error message

At the point where the error message is emitted, the field def->name is
still set to "new device", so the error message becomes:

  Unable to start mediated device 'new device': ...

Since the name doesn't contain anything useful, just omit it from the
error message altogether.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
4 years agonodedev: handle mdevs from multiple parents
Jonathon Jongsma [Thu, 10 Jun 2021 18:15:37 +0000 (13:15 -0500)] 
nodedev: handle mdevs from multiple parents

Due to a rather unfortunate misunderstanding, we were parsing the list
of defined devices from mdevctl incorrectly. Since my primary
development machine only has a single device capable of mdevs, I
apparently neglected to test multiple parent devices and made some
assumptions based on reading the mdevctl code. These assumptions turned
out to be incorrect, so the parsing failed when devices from more than
one parent device were returned.

The details: mdevctl returns an array of objects representing the
defined devices. But instead of an array of multiple objects (with each
object representing a parent device), the array always contains only a
single object. That object has a separate property for each parent
device.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: verify for duplicate hostdevs
Shalini Chellathurai Saroja [Fri, 18 Jun 2021 10:46:12 +0000 (12:46 +0200)] 
conf: verify for duplicate hostdevs

It is possible to define/edit(in shut off state) a domain XML with
same hostdev device repeated more than once, as shown below. This
behavior is not expected. So, this patch fixes it.

vser1:
<domain type='kvm'>
[...]
  <devices>
 [...]
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-ccw'>
      <source>
        <address uuid='8e782fea-e5f4-45fa-a0f9-024cf66e5009'/>
      </source>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0005'/>
    </hostdev>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-ccw'>
      <source>
        <address uuid='8e782fea-e5f4-45fa-a0f9-024cf66e5009'/>
      </source>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0006'/>
    </hostdev>
[...]
  </devices>
</domain>

$ virsh define vser1
Domain 'vser1' defined from vser1

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Reject TPM 1.2 for ARM virt guests
Andrea Bolognani [Fri, 25 Jun 2021 13:33:33 +0000 (15:33 +0200)] 
qemu: Reject TPM 1.2 for ARM virt guests

We already reject TPM 1.2 in a number of scenarios; let's add
ARM virt guests to the list.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Test the defaults for TPM on ARM virt guests
Andrea Bolognani [Fri, 25 Jun 2021 13:57:50 +0000 (15:57 +0200)] 
tests: Test the defaults for TPM on ARM virt guests

Instead of providing the configuration explicitly, let libvirt
fill in the blanks. After the recent changes, this results in a
working configuration without the need for user input.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Default to TPM 2.0 for ARM virt guests
Andrea Bolognani [Fri, 25 Jun 2021 13:57:38 +0000 (15:57 +0200)] 
qemu: Default to TPM 2.0 for ARM virt guests

The TPM 2.0 specification predates ARM virtualization, and so
implementing TPM 1.2 support on ARM was not considered a useful
endeavor.

This is technically a breaking change, but TPM support on ARM was
only introduced fairly recently (libvirt 7.1.0) and the previous
default resulted in non working TPM devices; anyone who has a
working configuration is not going to be affected.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Add aarch64-tpm test to qemuxml2xml
Andrea Bolognani [Fri, 25 Jun 2021 13:31:35 +0000 (15:31 +0200)] 
tests: Add aarch64-tpm test to qemuxml2xml

We're going to change the input file later, and having this
additional coverage will demonstrate that such a change does not
alter the behavior.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Fix information for default TPM version
Andrea Bolognani [Fri, 25 Jun 2021 13:16:30 +0000 (15:16 +0200)] 
docs: Fix information for default TPM version

The current information is not accurate, because the default
is 2.0 instead of 1.2 for the tpm-crb and tpm-spapr models.

Any detailed list will surely become obsolete and out of sync
with reality over time, so let's just document that the default
model depends on a number of factors and avoid getting any more
specific than that.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS: Fix spacing between releases
Andrea Bolognani [Thu, 1 Jul 2021 14:11:17 +0000 (16:11 +0200)] 
NEWS: Fix spacing between releases

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
4 years agoPost-release version bump to 7.6.0
Jiri Denemark [Thu, 1 Jul 2021 13:44:22 +0000 (15:44 +0200)] 
Post-release version bump to 7.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-7.5.0 v7.5.0
Jiri Denemark [Thu, 1 Jul 2021 13:40:26 +0000 (15:40 +0200)] 
Release of libvirt-7.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoAdd news item for sVirt CVE fix
Daniel P. Berrangé [Thu, 1 Jul 2021 11:38:45 +0000 (12:38 +0100)] 
Add news item for sVirt CVE fix

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agosecurity: fix SELinux label generation logic
Daniel P. Berrangé [Mon, 28 Jun 2021 12:09:04 +0000 (13:09 +0100)] 
security: fix SELinux label generation logic

A process can access a file if the set of MCS categories
for the file is equal-to *or* a subset-of, the set of
MCS categories for the process.

If there are two VMs:

  a) svirt_t:s0:c117
  b) svirt_t:s0:c117,c720

Then VM (b) is able to access files labelled for VM (a).

IOW, we must discard case where the categories are equal
because that is a subset of many other valid category pairs.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/153
CVE-2021-3631
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoNEWS: Update for 7.5.0
Peter Krempa [Mon, 28 Jun 2021 09:44:35 +0000 (11:44 +0200)] 
NEWS: Update for 7.5.0

Mention fixing of disk iothread validation and the disk serial
truncation state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoTranslated using Weblate (Ukrainian) v7.5.0-rc2
Yuri Chornoivan [Mon, 28 Jun 2021 06:04:36 +0000 (08:04 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10342 of 10342 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
4 years agoTranslated using Weblate (Korean)
simmon [Mon, 28 Jun 2021 06:04:35 +0000 (08:04 +0200)] 
Translated using Weblate (Korean)

Currently translated at 44.9% (4644 of 10342 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agoTranslated using Weblate (Italian)
Nathan [Mon, 28 Jun 2021 06:04:34 +0000 (08:04 +0200)] 
Translated using Weblate (Italian)

Currently translated at 23.3% (2411 of 10342 strings)

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

Co-authored-by: Nathan <nathan95@live.it>
Signed-off-by: Nathan <nathan95@live.it>
4 years agoUpdate translation files
Weblate [Mon, 28 Jun 2021 06:04:32 +0000 (08:04 +0200)] 
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Mon, 28 Jun 2021 06:04:28 +0000 (08:04 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 21.8% (2255 of 10314 strings)

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

Translated using Weblate (Finnish)

Currently translated at 21.8% (2249 of 10314 strings)

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

Translated using Weblate (Finnish)

Currently translated at 21.0% (2176 of 10314 strings)

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

Translated using Weblate (Finnish)

Currently translated at 21.0% (2170 of 10314 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
4 years agoTranslated using Weblate (Korean)
simmon [Mon, 28 Jun 2021 06:04:27 +0000 (08:04 +0200)] 
Translated using Weblate (Korean)

Currently translated at 44.8% (4624 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4618 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4614 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4613 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4613 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4611 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.5% (4593 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.5% (4590 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.4% (4582 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.3% (4577 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.3% (4570 of 10314 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agovirSetUIDGIDWithCaps: Don't drop CAP_SETPCAP right away
Michal Privoznik [Thu, 24 Jun 2021 14:58:09 +0000 (16:58 +0200)] 
virSetUIDGIDWithCaps: Don't drop CAP_SETPCAP right away

There are few cases where we execute a virCommand with all caps
cleared (virCommandClearCaps()). For instance
dnsmasqCapsRefreshInternal() does just that. This means, that
after fork() and before exec() the virSetUIDGIDWithCaps() is
called. But since the caller did not want to change anything,
just drop capabilities, these are the values of arguments:

  virSetUIDGIDWithCaps (uid=-1, gid=-1, groups=0x0, ngroups=0,
                        capBits=0, clearExistingCaps=true)

This means that indeed all capabilities will be dropped,
including CAP_SETPCAP. But this capability controls whether
capabilities can be set, IOW whether capng_apply() succeeds.

There are two calls of capng_apply() in the function. The
CAP_SETPCAP is dropped after the first call and thus the other
call (capng_apply(CAPNG_SELECT_BOUNDS);) fails.

The solution is to keep the capability for as long as needed
(just like CAP_SETGID and CAP_SETUID) and drop it only at the
very end (just like CAP_SETGID and CAP_SETUID).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1949388
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agospec: avoid rpm warning about macro in comment
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 07:37:38 +0000 (09:37 +0200)] 
spec: avoid rpm warning about macro in comment

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
4 years agospec: avoid repeated calls to systemd macros and binaries
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 07:37:19 +0000 (09:37 +0200)] 
spec: avoid repeated calls to systemd macros and binaries

The macro can take multiple arguments, and the calls are more efficient
if done in one go.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
4 years agospec: drop/update dependencies on systemd-{units,sysv}
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 07:20:03 +0000 (09:20 +0200)] 
spec: drop/update dependencies on systemd-{units,sysv}

-sysv was probably a left-over, and the -units deps was outdated and not
necessary, see
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_dependencies_on_the_systemd_package.

Only for 'systemctl mask' which is executed in %post, we want to make
sure that /usr/bin/systemctl is installed, so keep that dependency.
(A file dep is used to avoid issues if the systemd package is further
split later on.)

Ferried over from https://src.fedoraproject.org/rpms/libvirt/pull-request/7.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
4 years agopo: Refresh potfile for v7.5.0 v7.5.0-rc1
Jiri Denemark [Fri, 25 Jun 2021 09:26:54 +0000 (11:26 +0200)] 
po: Refresh potfile for v7.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoApparmor: Allow reading /etc/ssl/openssl.cnf
Jim Fehlig [Wed, 16 Jun 2021 21:25:33 +0000 (15:25 -0600)] 
Apparmor: Allow reading /etc/ssl/openssl.cnf

I noticed the following denial when running confined VMs with the QEMU
driver

type=AVC msg=audit(1623865089.263:865): apparmor="DENIED" operation="open" \
profile="virt-aa-helper" name="/etc/ssl/openssl.cnf" pid=12503 \
comm="virt-aa-helper" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Allow reading the file by including the openssl abstraction in the
virt-aa-helper profile.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agoApparmor: Allow reading libnl's classid file
Jim Fehlig [Wed, 16 Jun 2021 21:11:14 +0000 (15:11 -0600)] 
Apparmor: Allow reading libnl's classid file

I noticed the following denial messages from apparmor in audit.log when
starting confined VMs via the QEMU driver

type=AVC msg=audit(1623864006.370:837): apparmor="DENIED" operation="open" \
profile="virt-aa-helper" name="/etc/libnl/classid" pid=11265 \
comm="virt-aa-helper" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

type=AVC msg=audit(1623864006.582:849): apparmor="DENIED" operation="open" \
profile="libvirt-0ca2720d-6cff-48bb-86c2-61ab9a79b6e9" \
name="/etc/libnl/classid" pid=11270 comm="qemu-system-x86" \
requested_mask="r" denied_mask="r" fsuid=107 ouid=0

It is possible for site admins to assign names to classids in this file,
which are then used by all libnl tools, possibly those used by libvirt.
To be on the safe side, allow read access to the file in the virt-aa-helper
profile and the libvirt-qemu abstraction.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agotests: qemucapabilities: Bump test data for qemu-6.1 on x86_64
Peter Krempa [Mon, 21 Jun 2021 08:52:32 +0000 (10:52 +0200)] 
tests: qemucapabilities: Bump test data for qemu-6.1 on x86_64

Update the caps data for the upcoming qemu version.

Notable changes are:

- 'query-sev-attestation-report' command added
- 'sample-pages' members for dirty rate calculation added
- 'qtest' device added
- 'share' member added to query-memdev and 'reserve' members added to
  query-memdev/memory-backend-[file,memfd,ram]
- 'qemu-vdagent' chardev added
- 'mptcp' toggle added to inet servers
- 'zstd' compression for qcow2
- new cpu models: - "Snowridge-v3"
                  - "Skylake-Server-v5"
                  - "Skylake-Client-v4"
                  - "Icelake-Server-v5"
                  - "Icelake-Client-v3"
                  - "Dhyana-v2"
                  - "Denverton-v3"
                  - "Cooperlake-v2"
                  - "Cascadelake-Server-v5"
- 'avx-vnni' added to some existing cpu models
- 'model-id' is now being reported as the host cpu again rather than
  QEMU TCG as I've noted in previous bump

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agospec: Drop libiscsi support in RHEL-9
Jiri Denemark [Thu, 24 Jun 2021 08:18:17 +0000 (10:18 +0200)] 
spec: Drop libiscsi support in RHEL-9

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoci: Also perform package upgrades on macOS and FreeBSD
Martin Kletzander [Tue, 15 Jun 2021 08:15:39 +0000 (10:15 +0200)] 
ci: Also perform package upgrades on macOS and FreeBSD

The base OS image might include outdated contents, and we don't
want to get spurious failures caused by bugs that have already been
fixed in the respective packages.

This is particularly important on macOS, because 'brew install foo'
will fail if 'foo' is already installed but outdated: upgrading all
packages first ensures we never run into this scenario.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agobuild: fix logic for enabling libssh/libssh2 checks
Daniel P. Berrangé [Wed, 23 Jun 2021 11:31:53 +0000 (12:31 +0100)] 
build: fix logic for enabling libssh/libssh2 checks

When 'driver_remote' is 'auto', the 'enabled()' method does not
evaluate to true, causing the libssh/libssh2 checks to be skipped.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: prefer SHA256 host key fingerprint with new libssh
Daniel P. Berrangé [Wed, 23 Jun 2021 09:46:48 +0000 (10:46 +0100)] 
rpc: prefer SHA256 host key fingerprint with new libssh

The host key fingerprint for SSH servers is used in a scenario where
cryptographic strength is important. We should thus be defaulting to
use of SHA256 where available. We only need SHA1 for Ubuntu 18.04
which does not have libssh >= 0.8.1

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirDomainFeaturesDefParse: Simplify APIC parsing
Tim Wiederhake [Tue, 22 Jun 2021 12:22:57 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Simplify APIC parsing

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesCapabilitiesDefParse: Remove ctxt
Tim Wiederhake [Tue, 22 Jun 2021 12:22:56 +0000 (14:22 +0200)] 
virDomainFeaturesCapabilitiesDefParse: Remove ctxt

Iterating over all child elements of a node does not require xpath.
By doing away with xpath for this code, the code can be simplified.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesDefParse: Factor out capabilities parsing into separate function
Tim Wiederhake [Tue, 22 Jun 2021 12:22:55 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Factor out capabilities parsing into separate function

Cleanup to follow. This removes the last re-use of `nodes` in this function,
eliminating two VIR_FREEs.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>