Commit Graph

42486 Commits

Author SHA1 Message Date
Luke Yue
3ea1ec7fa2 test_driver: Implement virDomainGetControlInfo and add test
As test driver won't have real background job running, in order to get
all possible states, the time is used here to decide which state to be
returned. The default time will get `ok` as return value.

Note that using `virsh domtime fc4 200` won't take effect for the test
driver, to get other states, you have to enter virsh interactive
terminal and set time.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-19 11:42:00 +02:00
Peter Krempa
e7ad645a8e qemu: Fix crash in virQEMUCapsProbeQMPTPM
If the queried QMP command doesn't exist qemuMonitorGetTPMModels returns
0 but sets the string list to NULL which isn't accepted by
g_strv_contains.

Fixes: a5bc5f0ecf
Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-07-19 11:33:46 +02:00
Jonathon Jongsma
26136e3b86 virsh: allow nodedev-list --all --tree
Allow the tree view with --all so that we can see all inactive mdevs in
a tree structure nested under their parent devices.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-19 11:32:12 +02:00
Jonathon Jongsma
51fbbfdce8 nodedev: fix parent device of inactive mdevs
Inactive mdevs were simply formatting their parent name as the value
received from mdevctl rather than looking up the libvirt nodedev name of
the parent device. This resulted in a parent value of e.g.
'0000:5b:00.0' instead of 'pci_0000_5b_00_0'. This prevented defining a
new mdev device from the output of nodedev-dumpxml.

Unfortunately, it's not simple to fix this comprehensively due to the
fact that mdevctl supports defining (inactive) mdevs for parent devices
that do not actually exist on the host (yet). So for those persistent
mdev definitions that do not have a valid parent in the device list, the
parent device will be set to the root "computer" device.

Unfortunately, because the value of the 'parent' field now depends on
the configuration of the host, the mdevctl parsing test will output
'computer' for all test devices. Fixing this would require a more
extensive mock test environment.

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-19 11:25:43 +02:00
Tim Wiederhake
00d34a085c virNWFilterDHCPSnoopInit: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
420f5204cf virNWFilterBuildAll: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
0609995d43 virNWFilterBindingObjListNew: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
ac184eea7c virNWFilterBindingDefForNet: Remove superfluous gotos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
9c1a29c75b virNWFilterBindingDefForNet: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
7426512799 virNWFilterBindingDefForNet: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
e9109f3135 virNWFilterBindingDefCopy: Remove superfluous gotos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
c8efa1d223 virNWFilterBindingDefCopy: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
3f2dcd7f14 virNWFilterBindingDefCopy: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Tim Wiederhake
f7e30a49cc conf: Add AUTOPTR_CLEANUP_FUNC for virNWFilterBindingDef
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-19 09:39:15 +02:00
Peter Krempa
16cb11a66a network: Allow adding DNS entries sharing hostname for multiple addreses
Having multiple addresses having same hostname is a common config either
to have IPv4 and IPv6 address for the same hostname or even for DNS
round robin. The validation in the network update code didn't allow
adding such entries despite the fact that it is possible to define a
network with them.

Don't check hostname duplicity when adding a DNS entry.

The update of the test case adds another entry for the 'pudding'
hostname which is added in one of the networkxml2xmlupdate test cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-16 14:50:57 +02:00
Peter Krempa
21ad1dcd32 networkxml2xmltest: Add example of multiple addresses having the same hostname
Having multiple addresses for the same hostname is a legitimate
configuration in DNS. Add test data to cover this case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-16 14:50:45 +02:00
Kristina Hanicova
133d05a15e qemu: capabilities: fill in domcaps <memoryBacking>
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-15 15:13:04 +02:00
Kristina Hanicova
e27e22585a conf: domcaps: Report <memoryBacking>
We need to report via domcapabilities if specifying shared memory
is supported without hugepages or numa config in order to find
out if domain has suitable setup to make virtiofs work.
The solution is to report source types of memory backing to
determine if memfd is a valid option.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-15 15:13:04 +02:00
Martin Kletzander
439eaf6399 whitespace clean-ups
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2021-07-15 14:50:48 +02:00
Martin Kletzander
e2bc2dfa1e util: Make one debug message nicer
This was bothering someone as the debug message looked like there was an issue
despite it being just a debug message.  Change it to what is actually happening
and why the name is being skipped.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2021-07-15 14:50:48 +02:00
Daniel P. Berrangé
b9533b5ecf ci: refresh cirrus variables for FreeBSD python rename
All the python packages got renamed from py37- to py38-

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-07-15 11:10:52 +01:00
Kristina Hanicova
c39757f700 qemu: Do not erase duplicate devices from namespace if error occurs
If the attempt to attach a device failed, we erased the
unattached device from the namespace. This resulted in erasing an
already attached device in case of a duplicate. We need to check
for existing file in the namespace in order to determine erasing
it in case of a failure.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-15 12:00:24 +02:00
Kristina Hanicova
cbcde4df3b virprocess: Return retval of the child on success, not 0
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-15 12:00:21 +02:00
Kristina Hanicova
b0ef407c65 qemu: Check for existing file in namespace
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-15 12:00:17 +02:00
Jim Fehlig
3c18bc304e Apparmor: Add profile for virtxend
A new apparmor profile initially derived from the libvirtd profile.
All rules were prefixed with the 'audit' qualifier to verify they
are actually used by virtxend. It turns out that several, beyond
the obvious ones, can be dropped in the resulting virtxend profile.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2021-07-14 09:16:58 -06:00
Jim Fehlig
ccba72b414 Apparmor: Add profile for virtqemud
A new apparmor profile derived from the libvirtd profile, with non-QEMU
related rules removed. Adopt the libvirt-qemu abstraction to work with
the new profile.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2021-07-14 09:16:58 -06:00
Olaf Hering
75803d16ee apparmor: Allow /usr/libexec for private xen-tools binaries
This is a followup for commit e906c4d02b
("apparmor: Allow /usr/libexec for libxl-save-helper and pygrub"):

In recent rpm versions --libexecdir changed from /usr/lib64 to
/usr/libexec. A plain rpmbuild %configure in xen.git will install all
files, including the private copies of qemu, into /usr/libexec/xen/bin.
Expand the existing pattern to cover also this libexecdir variant.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-14 17:07:22 +02:00
Michal Privoznik
bfca889122 virfile: Update example use of virDirRead()
We have an example in virDirRead() documentation on how to use
the function. In there, the directory structure is plain DIR, but
that won't work anymore. Switch over to g_autoptr(DIR) which is
what we use now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 17:03:19 +02:00
Michal Privoznik
1678a34f47 syntax-check: s/VIR_DIR_CLOSE/g_autoptr(DIR)/
We have a syntax-check rule that forbids explicit closedir().
However, the error message suggest using VIR_DIR_CLOSE() which
was removed a few releases ago (v6.10.0-rc1~389).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 17:03:12 +02:00
Tim Wiederhake
a856f5d0fc testQemuMonitorJSONqemuMonitorJSONGetChardevInfo: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
70f32d5ece testQemuMonitorJSONqemuMonitorJSONGetChardevInfo: Remove superfluous gotos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
831568e831 testQemuMonitorJSONqemuMonitorJSONGetChardevInfo: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
091f22223b testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
92c35f5590 testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: Remove superfluous gotos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
cca44e5298 testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
5866c30c40 testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
6356ff86ae testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo: Remove superfluous gotos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
efb30a055c testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
531a1fa84f nwfilterxml2firewalltest.c: testCompareXMLToArgvFiles: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:37:07 +02:00
Tim Wiederhake
00f4820951 qemuMonitorGetMemoryDeviceInfo: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:44 +02:00
Tim Wiederhake
0ed26fca81 qemuMonitorGetMemoryDeviceInfo: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:41 +02:00
Tim Wiederhake
927c9969b9 qemuMonitorGetMemoryDeviceInfo: Assign hash table only on success
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
78f47cba9b iptablesPrivateChainCreate: Remove superfluous gotos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
534874f705 iptablesPrivateChainCreate: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
7bf435fbb0 iptablesPrivateChainCreate: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
1ae0067c77 virNWFilterRuleDefToRuleInst: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
0c209b39c9 virNWFilterCreateVarsFrom: Remove superfluous gotos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
b658836529 virNWFilterCreateVarsFrom: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
a51af3d030 virNWFilterCreateVarsFrom: virHashNew cannot return NULL
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 15:36:27 +02:00
Tim Wiederhake
8a7c2f9936 AUTHORS: Add myself to the list of commiters
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-07-14 14:51:19 +02:00