]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
3 years agoUse virInterfaceObjEndAPI() more
Michal Privoznik [Wed, 10 Nov 2021 08:56:29 +0000 (09:56 +0100)] 
Use virInterfaceObjEndAPI() more

Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj)
combo the virInterfaceObjEndAPI() can be used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoUse virDomainObjEndAPI() more
Michal Privoznik [Wed, 10 Nov 2021 08:52:23 +0000 (09:52 +0100)] 
Use virDomainObjEndAPI() more

Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj)
combo the virDomainObjEndAPI() can be used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agolibxl: Free data returned from libxl_userdata_retrieve
Jim Fehlig [Thu, 28 Oct 2021 21:58:16 +0000 (15:58 -0600)] 
libxl: Free data returned from libxl_userdata_retrieve

Found via valgrind

==15016== 3,701 bytes in 2 blocks are definitely lost in loss record 975 of 1,009
==15016==    at 0x4C2A2AF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15016==    by 0x1FCD30CB: libxl_read_file_contents (in /usr/lib64/libxenlight.so.4.12.0)
==15016==    by 0x1FCCA58A: ??? (in /usr/lib64/libxenlight.so.4.12.0)
==15016==    by 0x1FCCA6C2: libxl_userdata_retrieve (in /usr/lib64/libxenlight.so.4.12.0)
==15016==    by 0x1FA42A5A: libxlReconnectDomain (libxl_driver.c:394)
==15016==    by 0x53BAC99: virDomainObjListHelper (virdomainobjlist.c:802)
==15016==    by 0x530842F: virHashForEach (virhash.c:575)
==15016==    by 0x53BC0E0: virDomainObjListForEach (virdomainobjlist.c:817)
==15016==    by 0x1FA423C4: libxlReconnectDomains (libxl_driver.c:468)
==15016==    by 0x1FA423C4: libxlStateInitialize (libxl_driver.c:778)
==15016==    by 0x54E8E9E: virStateInitialize (libvirt.c:657)
==15016==    by 0x12DBFA: daemonRunStateInit (remote_daemon.c:797)
==15016==    by 0x535BF79: virThreadHelper (virthread.c:206)

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_process: continue to process fakereboot after restarting libvirtd
Bihong Yu [Mon, 25 Oct 2021 09:04:55 +0000 (17:04 +0800)] 
qemu_process: continue to process fakereboot after restarting libvirtd

During the vm rebooting, the vm could be paused if the libvirtd is
restarted for some reason, which is not expected. We need continue
fakereboot process if fakereboot flags is true and the vm is in
paused-user status.

Signed-off-by: Bihong Yu <yubihong@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_process: set fakereboot flags false after processing fakereboot over
Bihong Yu [Mon, 25 Oct 2021 09:04:54 +0000 (17:04 +0800)] 
qemu_process: set fakereboot flags false after processing fakereboot over

During the vm rebooting, the vm could be shut down if the libvirtd is
restarted for some reason, which is not expected. We move set
fakereboot flags false after processing fakereboot over, so we can
ensure that fakereboot process have been executed.

Signed-off-by: Bihong Yu <yubihong@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_block: Refactor qemuBlockExportAddNBD()
Kristina Hanicova [Tue, 26 Oct 2021 15:19:37 +0000 (17:19 +0200)] 
qemu_block: Refactor qemuBlockExportAddNBD()

This patch improves readability of the function and makes the
code look cleaner by removing the 'else' branches after return
and reordering of the 'if' branches.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_command: do not use host-nodes for system memory
Pavel Hrdina [Tue, 9 Nov 2021 14:00:53 +0000 (15:00 +0100)] 
qemu_command: do not use host-nodes for system memory

Commit 88957116c9d3cb4705380c3702c9d4315fb500bb switched to use
memory-backend-* for regular VM memory as well. That change indirectly
started using 'host-nodes' for system memory which results in QEMU
calling mbind() to bind the system memory to specific NUMA node if the
VM XML contains the configuration similar to this:

  ...
  <numatune>
    <memory mode='strict' nodeset='0'/>
  </numatune>
  ...

Once the VM was started with that configuration it was no longer
possible to change the memory NUMA nodeset.

Fixes: 677c90cc1d1fcb3aba09b5d4f0f8f83099911775
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetsocket: pass HOME and XDG_RUNTIME_DIR to ssh
Дамјан Георгиевски [Tue, 2 Nov 2021 15:01:03 +0000 (16:01 +0100)] 
virnetsocket: pass HOME and XDG_RUNTIME_DIR to ssh

openssh supports environment variable expansion in its ssh_config
file[1]. These two environment variables can be used to
expand paths for ssh sockets and other files.

Ex.
```
Host *
 ControlMaster auto
 ControlPath ${XDG_RUNTIME_DIR}/ssh-%C.ctl
 IdentityAgent ${XDG_RUNTIME_DIR}/ssh-agent.socket
```

see also:
[1] https://man7.org/linux/man-pages/man5/ssh_config.5.html#ENVIRONMENT_VARIABLES
[2] https://gitlab.com/libvirt/libvirt/-/issues/232

Signed-off-by: Дамјан Георгиевски <gdamjan@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: add minor clarifications for librbd encryption
Or Ozeri [Sun, 31 Oct 2021 12:08:40 +0000 (07:08 -0500)] 
docs: add minor clarifications for librbd encryption

This should make the documentation less confusing mainly for
Ceph people.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotestVshTableHeader: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:49:16 +0000 (12:49 +0100)] 
testVshTableHeader: Cleanup

Remove unnecessary label and goto. This also fixes a bug where a
failure to create the table would result in the test passing.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotestLXCCapsInit: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:44:11 +0000 (12:44 +0100)] 
testLXCCapsInit: Cleanup

Remove unnecessary label and goto. Cleanup line breaks.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agofillXenCaps: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:25:45 +0000 (12:25 +0100)] 
fillXenCaps: Cleanup

Rework to remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirSCSIVHostOpenVhostSCSI: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:03:43 +0000 (12:03 +0100)] 
virSCSIVHostOpenVhostSCSI: Cleanup

Remove unnecessary label, goto, and closing of not-open file descriptor.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirBufferAddBuffer: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:34:54 +0000 (11:34 +0100)] 
virBufferAddBuffer: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirSaveCookieParse: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:19:15 +0000 (11:19 +0100)] 
virSaveCookieParse: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNetworkEventDispatchDefaultFunc: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:17:09 +0000 (11:17 +0100)] 
virNetworkEventDispatchDefaultFunc: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirDomainCapsCPUModelsCopy: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:12:34 +0000 (11:12 +0100)] 
virDomainCapsCPUModelsCopy: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirCHDomainObjBeginJob: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:09:37 +0000 (11:09 +0100)] 
virCHDomainObjBeginJob: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoadminConnectListServers: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:05:29 +0000 (11:05 +0100)] 
adminConnectListServers: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobridge_driver: Drop needless fwd declarations
Michal Privoznik [Mon, 8 Nov 2021 10:04:37 +0000 (11:04 +0100)] 
bridge_driver: Drop needless fwd declarations

Some forward declarations in bridge_driver.c are not needed
really. They only create a noise when trying to jump onto the
correct tag. Drop them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: Invalidate capabilities cache on host cpuid mismatch
Tim Wiederhake [Mon, 2 Aug 2021 14:44:30 +0000 (16:44 +0200)] 
qemu: Invalidate capabilities cache on host cpuid mismatch

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

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirQEMUCapsCachePriv: Add host cpuid information
Tim Wiederhake [Fri, 15 Oct 2021 15:28:00 +0000 (17:28 +0200)] 
virQEMUCapsCachePriv: Add host cpuid information

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirQEMUCaps: Add host cpuid information
Tim Wiederhake [Mon, 2 Aug 2021 14:44:22 +0000 (16:44 +0200)] 
virQEMUCaps: Add host cpuid information

Many things can affect the availability of cpu flags (e.g. software
upgrades, kernel versions, kernel command line, etc.) and invalidate the
cached capabilities without notice. Add CPUID information to the
capabilities cache.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Implement virCPUDataGetHost for x86
Tim Wiederhake [Thu, 4 Nov 2021 13:43:31 +0000 (14:43 +0100)] 
cpu_x86: Implement virCPUDataGetHost for x86

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Add virCPUDataGetHost
Tim Wiederhake [Wed, 3 Nov 2021 16:26:58 +0000 (17:26 +0100)] 
cpu_x86: Add virCPUDataGetHost

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirhostcpu: Add virHostCPUGetCPUID
Tim Wiederhake [Thu, 4 Nov 2021 13:27:08 +0000 (14:27 +0100)] 
virhostcpu: Add virHostCPUGetCPUID

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_ppc64: Implement virCPUDataNewCopy for ppc64
Tim Wiederhake [Mon, 11 Oct 2021 10:34:23 +0000 (12:34 +0200)] 
cpu_ppc64: Implement virCPUDataNewCopy for ppc64

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_arm: Implement virCPUDataNewCopy for arm
Tim Wiederhake [Mon, 11 Oct 2021 10:31:36 +0000 (12:31 +0200)] 
cpu_arm: Implement virCPUDataNewCopy for arm

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Implement virCPUDataNewCopy for x86
Tim Wiederhake [Thu, 7 Oct 2021 11:56:53 +0000 (13:56 +0200)] 
cpu_x86: Implement virCPUDataNewCopy for x86

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Add virCPUDataNewCopy
Tim Wiederhake [Thu, 7 Oct 2021 11:46:44 +0000 (13:46 +0200)] 
cpu: Add virCPUDataNewCopy

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_ppc64: Implement virCPUDataIsIdentical for ppc64
Tim Wiederhake [Mon, 11 Oct 2021 10:21:04 +0000 (12:21 +0200)] 
cpu_ppc64: Implement virCPUDataIsIdentical for ppc64

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_arm: Implement virCPUDataIsIdentical for arm
Tim Wiederhake [Mon, 11 Oct 2021 09:52:22 +0000 (11:52 +0200)] 
cpu_arm: Implement virCPUDataIsIdentical for arm

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_arm: No need to protect macro definitions
Tim Wiederhake [Mon, 11 Oct 2021 09:51:55 +0000 (11:51 +0200)] 
cpu_arm: No need to protect macro definitions

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Implement virCPUDataIsIdentical for x86
Tim Wiederhake [Wed, 6 Oct 2021 13:16:11 +0000 (15:16 +0200)] 
cpu_x86: Implement virCPUDataIsIdentical for x86

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Add virCPUDataIsIdentical
Tim Wiederhake [Wed, 6 Oct 2021 12:53:05 +0000 (14:53 +0200)] 
cpu: Add virCPUDataIsIdentical

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Split up virCPUDataParse
Tim Wiederhake [Wed, 13 Oct 2021 10:56:51 +0000 (12:56 +0200)] 
cpu: Split up virCPUDataParse

This makes it possible to call virCPUDataParse with a xmlNodePtr,
which will be required by a later patch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Change virCPUArchDataParse to take xmlNodePtr
Tim Wiederhake [Wed, 13 Oct 2021 10:53:43 +0000 (12:53 +0200)] 
cpu: Change virCPUArchDataParse to take xmlNodePtr

The function does not need a full xmlXPathContextPtr any longer and a
later patch will require a call to this function with only a xmlNodePtr
available.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Add x86ParseDataItemList
Tim Wiederhake [Tue, 12 Oct 2021 17:51:04 +0000 (19:51 +0200)] 
cpu_x86: Add x86ParseDataItemList

Factor out duplicated code from x86FeatureParse and virCPUx86DataParse.
This also consolidates error messages.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Simplify x86ParseMSR
Tim Wiederhake [Tue, 12 Oct 2021 15:45:32 +0000 (17:45 +0200)] 
cpu_x86: Simplify x86ParseMSR

... by using virXMLProp*() helpers. These only require a xmlNodePtr and
do not need a xmlXPathContextPtr. Reflect that in the function signature.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Simplify x86ParseCPUID
Tim Wiederhake [Tue, 12 Oct 2021 15:39:14 +0000 (17:39 +0200)] 
cpu_x86: Simplify x86ParseCPUID

... by using virXMLProp*() helpers. These only require a xmlNodePtr and
do not need a xmlXPathContextPtr. Reflect that in the function signature.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosyntax-check: Fix regex for sc_require_attribute_cleanup_initialization
Peter Krempa [Fri, 5 Nov 2021 09:13:07 +0000 (10:13 +0100)] 
syntax-check: Fix regex for sc_require_attribute_cleanup_initialization

When I was cleaning up the regex after we removed most of our custom
autofree helpers I've forgot to delete one closing brace, thus the regex
was not matching anything.

Fixes: 65f702020e8
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoremote_daemon: Validate tcp_min_ssf value only if found in config
Michal Privoznik [Fri, 5 Nov 2021 13:25:09 +0000 (14:25 +0100)] 
remote_daemon: Validate tcp_min_ssf value only if found in config

If there is no tcp_min_ssf value set in daemon config we still
compare it against the default (56 which corresponds to DES) and
if the value is below our expected minimum (112 which corresponds
to 3DES) an error is reported and the daemon refuses to start.
This is not what we want. What we want is to check the value iff
the value was specified in the config file.

Fixes: 58a48cff840
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoNEWS: add guest interface information in 'virDomainGetGuestInfo'
zhanglei [Fri, 15 Oct 2021 10:07:51 +0000 (18:07 +0800)] 
NEWS: add guest interface information in 'virDomainGetGuestInfo'

Signed-off-by: zhanglei <zhanglei@smartx.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: add guest interface information in 'qemuDomainGetGuestInfo'
zhanglei [Fri, 15 Oct 2021 10:07:50 +0000 (18:07 +0800)] 
qemu: add guest interface information in 'qemuDomainGetGuestInfo'

Support return guest interface information from guest agent

Signed-off-by: zhanglei <zhanglei@smartx.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: refactor 'qemuAgentGetInterfaces'
zhanglei [Fri, 15 Oct 2021 10:07:49 +0000 (18:07 +0800)] 
qemu: refactor 'qemuAgentGetInterfaces'

Add report_unsupported parameter to qemuAgentGetInterfaces

Signed-off-by: zhanglei <zhanglei@smartx.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: add interface information to guestinfo command
zhanglei [Fri, 15 Oct 2021 10:07:48 +0000 (18:07 +0800)] 
virsh: add interface information to guestinfo command

The new parameter group returns information about network interfaces

Signed-off-by: zhanglei <zhanglei@smartx.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agodomain: add interface information to 'virDomainGetGuestInfo'
zhanglei [Fri, 15 Oct 2021 10:07:47 +0000 (18:07 +0800)] 
domain: add interface information to 'virDomainGetGuestInfo'

Signed-off-by: zhanglei <zhanglei@smartx.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuTPMEmulatorReconfigure: Fix two build issues
Peter Krempa [Fri, 5 Nov 2021 08:48:52 +0000 (09:48 +0100)] 
qemuTPMEmulatorReconfigure: Fix two build issues

1) 'activePcrBanksStr' is not initialized:

../../../libvirt/src/qemu/qemu_tpm.c: In function ‘qemuExtTPMStart’:
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘activePcrBanksStr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
../../../libvirt/src/qemu/qemu_tpm.c:613:22: note: ‘activePcrBanksStr’ was declared here
  613 |     g_autofree char *activePcrBanksStr;
      |                      ^~~~~~~~~~~~~~~~~

2) 'pwdfile_fd' is unused:

../../../libvirt/src/qemu/qemu_tpm.c:615:19: error: unused variable 'pwdfile_fd' [-Werror,-Wunused-variable]
        VIR_AUTOCLOSE pwdfile_fd = -1;

Fixes: a5bbe1a8b63
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Do not pass negative ncpus to virCapabilitiesClearHostNUMACellCPUTopology
Jiri Denemark [Thu, 4 Nov 2021 18:49:36 +0000 (19:49 +0100)] 
qemu: Do not pass negative ncpus to virCapabilitiesClearHostNUMACellCPUTopology

It won't cause any harm as cpus is NULL when we pass a negative ncpus,
but doing so when the function expects unsigned value is not right.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: Check return value of virJSONValueObjectAdd
Jiri Denemark [Thu, 4 Nov 2021 17:21:35 +0000 (18:21 +0100)] 
qemu: Check return value of virJSONValueObjectAdd

The return value was not properly checked in the code for input type
evdev.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: Avoid null pointer dereference when setting QoS on OVS
Jiri Denemark [Fri, 29 Oct 2021 09:13:33 +0000 (11:13 +0200)] 
util: Avoid null pointer dereference when setting QoS on OVS

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: tpm: Extend TPM domain XML with PCR banks to activate
Stefan Berger [Wed, 3 Nov 2021 17:04:23 +0000 (13:04 -0400)] 
qemu: tpm: Extend TPM domain XML with PCR banks to activate

Extend the TPM backend XML with a node 'active_pcr_banks' that allows a
user to specify the PCR banks to activate before starting a VM. Valid
choices for PCR banks are sha1, sha256, sha384 and sha512. When the XML
node is provided, the set of active PCR banks is 'enforced' by running
swtpm_setup before every start of the VM. The activation requires that
swtpm_setup v0.7 or later is installed and may not have any effect
otherwise.

<tpm model='tpm-tis'>
  <backend type='emulator' version='2.0'>
    <active_pcr_banks>
      <sha256/>
      <sha384/>
    </active_pcr_banks>
  </backend>
</tpm>

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2016599
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agomeson: Stop looking up ZFS programs at build time
Andrea Bolognani [Wed, 3 Nov 2021 09:32:14 +0000 (10:32 +0100)] 
meson: Stop looking up ZFS programs at build time

At this point, we're no longer using the availability of the
ZFS programs at build time to decide whether to enable ZFS
support, so the only purpose of these find_program() calls is
to record their absolute paths.

However, the virCommand facilities that we're ultimately using
to run them are already capable of performing this lookup at
runtime, and in fact that's exactly what we already do in the
case of, for example, vstorage.

Drop the build time lookups and always perform them at runtime.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agomeson: Enable ZFS storage backend even more often
Andrea Bolognani [Wed, 3 Nov 2021 09:57:41 +0000 (10:57 +0100)] 
meson: Enable ZFS storage backend even more often

Commit 73a2ff36163e already improved the situation a lot. This
pushes things even further.

If the user or, more likely, the distro packager explicitly
asked for ZFS support to be enabled, then we should comply with
that request regardless of whether the necessary programs are
available at build time.

This is particularly important in the context of Debian, where
ZFS cannot be a build dependency of libvirt due to licensing
issues but it can still be an optional runtime dependency.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agodaemon: add tcp_min_ssf option
Ján Tomko [Tue, 4 Jun 2019 09:20:41 +0000 (11:20 +0200)] 
daemon: add tcp_min_ssf option

Add an option to allow the admin to requet a higher minimum SSF
for connections than the built-in default.

The current default is 56 (single DES equivalent, to support
old kerberos) and will be raised to 112 in the future.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodaemon: virNetSASLContext: store tcpMinSSF
Ján Tomko [Mon, 3 Jun 2019 13:50:06 +0000 (15:50 +0200)] 
daemon: virNetSASLContext: store tcpMinSSF

Store the minimum SSF value for TCP connections
in virNetSASLContext and introduce a getter for it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoremote: warn on low SSF
Ján Tomko [Wed, 16 Jan 2019 15:29:44 +0000 (16:29 +0100)] 
remote: warn on low SSF

Prepare for deprecating old kerberos ciphers by warning users
with a SSF lower than 112.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoTranslated using Weblate (Korean)
simmon [Tue, 2 Nov 2021 23:05:22 +0000 (00:05 +0100)] 
Translated using Weblate (Korean)

Currently translated at 100.0% (10441 of 10441 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>
3 years agoqemu: retire QEMU_CAPS_SPICE_UNIX
Ján Tomko [Tue, 2 Nov 2021 15:23:19 +0000 (16:23 +0100)] 
qemu: retire QEMU_CAPS_SPICE_UNIX

It is now unused.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: always assume QEMU_CAPS_SPICE_UNIX
Ján Tomko [Tue, 2 Nov 2021 15:17:36 +0000 (16:17 +0100)] 
qemu: always assume QEMU_CAPS_SPICE_UNIX

The presence of this capability depends on QEMU being compiled
with spice that has the SPICE_ADDR_FLAG_UNIX_ONLY constant.
It was added by spice commit 5365caeaae released in spice v0.12.6,
which is older than the spice version on our supported architectures.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agotests: convert name-escape to use real caps
Ján Tomko [Tue, 2 Nov 2021 15:09:09 +0000 (16:09 +0100)] 
tests: convert name-escape to use real caps

For later QEMUs than 2.11 we do FD passing for character devices,
so lock the capabilites to this exact version.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agotests: qemuxml2argv: use latest caps for spice tests
Ján Tomko [Tue, 2 Nov 2021 14:29:30 +0000 (15:29 +0100)] 
tests: qemuxml2argv: use latest caps for spice tests

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agotests: qemuxml2xml: use latest caps for spice tests
Ján Tomko [Wed, 13 Oct 2021 15:03:33 +0000 (17:03 +0200)] 
tests: qemuxml2xml: use latest caps for spice tests

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agotests: qemuxml2xmltest: move graphics-spice-timeout
Ján Tomko [Wed, 13 Oct 2021 15:09:16 +0000 (17:09 +0200)] 
tests: qemuxml2xmltest: move graphics-spice-timeout

Move the test closer to other graphics-spice tests.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agotests: remove disks from spice tests
Ján Tomko [Wed, 13 Oct 2021 13:13:50 +0000 (15:13 +0200)] 
tests: remove disks from spice tests

Reduce the churn in following patches.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirt-aa-helper: Purge profile if corrupted
Ioanna Alifieraki [Tue, 2 Nov 2021 14:04:45 +0000 (16:04 +0200)] 
virt-aa-helper: Purge profile if corrupted

This commit aims to address the bug reported in [1] and [2].
If the profile is corrupted (0-size) the VM cannot be launched.
To overcome this, check if the profile exists and if it has 0 size
remove it.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890084
[2] https://bugs.launchpad.net/bugs/1927519

Signed-off-by: Ioanna Alifieraki <ioanna-maria.alifieraki@canonical.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainGetStatsBlockExportDisk: Report stats also for helper images
Peter Krempa [Fri, 29 Oct 2021 14:04:45 +0000 (16:04 +0200)] 
qemuDomainGetStatsBlockExportDisk: Report stats also for helper images

Add stat entries also for the mirror destination and the backup job
scratch/target file. This is possible with '-blockdev' as we use unique
index for the entries.

The stats are reported when the VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING
is used.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2017928
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONQueryBlockstats: query stats for helper images
Peter Krempa [Mon, 1 Nov 2021 10:35:41 +0000 (11:35 +0100)] 
qemuMonitorJSONQueryBlockstats: query stats for helper images

Use the 'query-nodes' flag to return all stats. The flag was introduced
prior to qemu-2.11 so we can always use it, but we invoke it only when
querying stats. The other invocation is used for detecting the nodenames
which is fragile code.

The images without a frontend don't have the device field so the
extraction code checks need to be relaxed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemustatusxml2xmldata: backup-pull: Add private data for scratch image
Peter Krempa [Mon, 1 Nov 2021 13:31:42 +0000 (14:31 +0100)] 
qemustatusxml2xmldata: backup-pull: Add private data for scratch image

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainBackupDefFormat: Propagate private data callbacks
Peter Krempa [Mon, 1 Nov 2021 11:42:39 +0000 (12:42 +0100)] 
virDomainBackupDefFormat: Propagate private data callbacks

The formatter for the backup job data didn't pass the virDomainXMLOption
struct to the disk formatter which meant that the private data of the
disk source were not formatted.

This didn't pose a problem for now as the blockjob list remembered the
nodenames for the jobs, but the backup source lost them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: fix documentation for nodedev-start
Jonathon Jongsma [Wed, 3 Nov 2021 19:05:39 +0000 (14:05 -0500)] 
docs: fix documentation for nodedev-start

Presumably the result of a copy/paste mistake, the the argument for the
`nodedev-start` command was described as a 'network' rather than a
'device'.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
3 years agoscripts: Properly declare g_auto() stub for cocci
Michal Privoznik [Tue, 2 Nov 2021 16:32:54 +0000 (17:32 +0100)] 
scripts: Properly declare g_auto() stub for cocci

While being great semantic patching tool, coccinelle fails to
understand some of macros we use (including those provided by
glib). What they have in common is use of __attribute__ under the
hood. We store a list of such macros in a file. But in there,
g_auto() macro is not defined properly. Indeed, g_auto(type)
declares a local variable of given type, for instance from
cocci's POV:

  g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
  virBuffer buf = VIR_BUFFER_INITIALIZER;

are both the same declaration. Fix declaration of g_auto() stub.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agolib: Use G_N_ELEMENTS instead of sizeof()/sizeof()
Michal Privoznik [Tue, 2 Nov 2021 16:32:43 +0000 (17:32 +0100)] 
lib: Use G_N_ELEMENTS instead of sizeof()/sizeof()

For statically declared arrays one can use G_N_ELEMENTS() instead
of explicit sizeof(array) / sizeof(item). I've noticed couple of
places where the latter was used.

I am not fixing every occurrence because we have some places
which do not use glib (examples and NSS module).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agovirpcivpdtest: Declare variables at multiple lines
Michal Privoznik [Tue, 2 Nov 2021 16:26:48 +0000 (17:26 +0100)] 
virpcivpdtest: Declare variables at multiple lines

In testPCIVPDResourceCustomCompareIndex() there are two variables
declared at one line. They are both g_autoptr() decorated which
makes it worse, because coccinelle fails to parse that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agovirpcivpd: Bring variables into loops
Michal Privoznik [Tue, 2 Nov 2021 16:23:41 +0000 (17:23 +0100)] 
virpcivpd: Bring variables into loops

I've noticed one function inside virpcivpd.c, namely
virPCIVPDParseVPDLargeResourceFields() that declares some
variables at the top level even though they are used only inside
a loop in which they have to be freed explicitly.

Bringing variable declarations into the loop allows us to make
the code nicer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agonode_device_conf: Bring variables into loops
Michal Privoznik [Tue, 2 Nov 2021 16:16:16 +0000 (17:16 +0100)] 
node_device_conf: Bring variables into loops

I've noticed three functions inside node_device_conf.c, namely:
 - virNodeDeviceCapVPDParseCustomFields()
 - virNodeDeviceCapVPDParseReadOnlyFields()
 - virNodeDeviceCapVPDParseXML()

that have strange attitude towards g_auto* variables. The first
problem is that variables are declared at the top level despite
being used inside a loop. The second problem is use of g_free()
in combination with g_steal_pointer() even though we have
VIR_FREE() which does exactly that.

Bringing variable declarations into their respective loops allows
us to make the code nicer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agomeson: Fix rst2html5 detection
Andrea Bolognani [Wed, 3 Nov 2021 12:43:34 +0000 (13:43 +0100)] 
meson: Fix rst2html5 detection

The first part of the version string contains the name that the
rst2html5 command was invoked as, which can differ based on the
operating system: on FreeBSD, for example, it's rst2html5.py
instead of just rst2html5.

Fix our detection logic so that it works regardless of the
specific name used for the docutils-provided rst2html5 command.

Fixes: cf0c9e186565e886a0016b2b269088b3eed3d26d
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agotests: qemuxml2argv: remove validation warning
Ján Tomko [Wed, 3 Nov 2021 08:25:20 +0000 (09:25 +0100)] 
tests: qemuxml2argv: remove validation warning

This warning is emitted for pretty much every test case,
making it hard to see what the actual error is.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agomeson: Detect and reject invalid rst2html5 command
Andrea Bolognani [Mon, 9 Aug 2021 15:04:08 +0000 (17:04 +0200)] 
meson: Detect and reject invalid rst2html5 command

The version coming from the rst2html5 package instead of the
docutils package is unable to successfully generate the libvirt
documentation.

Examples of users encountering build issues because of the wrong
version of rst2html5 being installed on their systems:

  https://gitlab.com/libvirt/libvirt/-/issues/40
  https://gitlab.com/libvirt/libvirt/-/issues/139
  https://gitlab.com/libvirt/libvirt/-/issues/169
  https://gitlab.com/libvirt/libvirt/-/issues/195

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoPCI VPD: Fix a wrong return code in a test case
Dmitrii Shcherbakov [Fri, 29 Oct 2021 18:57:18 +0000 (21:57 +0300)] 
PCI VPD: Fix a wrong return code in a test case

The test case should return -1, not 0 in case a valid resource could
not be parsed successfully but the ret value is initialized to 0.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoPCI VPD: Skip fields with invalid values
Dmitrii Shcherbakov [Fri, 29 Oct 2021 18:57:17 +0000 (21:57 +0300)] 
PCI VPD: Skip fields with invalid values

While invalid values need to be ignored when presenting VPD data to the
user, it would be good to attempt to parse a valid portion of the VPD
instead of marking it invalid as a whole.

Based on a mailing list discussion, the set of accepted characters is
extended to the set of printable ASCII characters.

https://listman.redhat.com/archives/libvir-list/2021-October/msg01043.html

The particular example encountered on real hardware was multi-faceted:

* "N/A" strings present in read-only fields. This would not be a useful
  valid value for a field (especially if a unique serial number is
  expected), however, it was decided to delegate handling of those kinds
  of values to higher-level software;
* "4W/1W PCIeG2x4" - looks like some vendors use even more printable
  characters in the ASCII range than we currently allow. Since the
  PCI/PCIe VPD specs mention alphanumeric characters without specifying
  the full character set, it looks like this is ambiguous for vendors
  and they tend to use printable ASCII characters;
* 0xFF bytes present in VPD-W field values. Those bytes do not map to
  printable ASCII code points and were probably used by the vendor as
  placeholders. Ignoring the whole VPD because of that would be too
  strict.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoPCI VPD: handle additional edge cases
Dmitrii Shcherbakov [Fri, 29 Oct 2021 18:57:16 +0000 (21:57 +0300)] 
PCI VPD: handle additional edge cases

* RV and RW fields must be at the last position in their respective
  section (per the conditions in the spec). Therefore, the parser now
  stops iterating over fields as soon as it encounters one of those
  fields and checks whether the end of the resource has been reached;
* The lack of the RW field is not treated as a parsing error since we
  can still extract valid data even though this is a PCI/PCIe VPD spec
  violation;
* Individual fields must have a valid length - the parser needs to check
  for invalid length values that violate boundary conditions of the
  resource.
* A zero-length field may be the last one in the resource, however, the
  boundary check is currently too strict to allow that.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agolib: Introduce and use g_autoptr() for virInterfaceDef
Michal Privoznik [Thu, 23 Sep 2021 12:32:24 +0000 (14:32 +0200)] 
lib: Introduce and use g_autoptr() for virInterfaceDef

There are a lot of places where we call virInterfaceDefFree()
explicitly. We can define autoptr cleanup macro and annotate
declarations with g_autoptr() and remove plenty of those explicit
free calls.

This also fixes a memory leak in udevInterfaceGetXMLDesc() which
called virInterfaceDefFree() only in successful path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu: Move code to add encryption options for swtpm_setup into function
Stefan Berger [Mon, 1 Nov 2021 17:23:39 +0000 (13:23 -0400)] 
qemu: Move code to add encryption options for swtpm_setup into function

Move the code that adds encryption options for the swtpm_setup command
line into its own function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: qemu: add kvm-pv-ipi off test
zhenwei pi [Tue, 2 Nov 2021 06:27:51 +0000 (14:27 +0800)] 
tests: qemu: add kvm-pv-ipi off test

Since b2757b697e29fa86972a4638a5879dccc8add2ad
(qemu: support kvm-pv-ipi off), libvirt supports xml definition like:

      <features>
        <kvm>
          <pv-ipi state='off'/>
        </kvm>
      </features>

Add test case for this feature.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: qemu: use domain type 'kvm' for kvm-features-off
zhenwei pi [Tue, 2 Nov 2021 06:27:50 +0000 (14:27 +0800)] 
tests: qemu: use domain type 'kvm' for kvm-features-off

KVM features off test cases should be tested for a KVM domain, so
keep align kvm-features-off test with kvm-features except KVM
features on/off.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotestQEMUSchemaValidateEnum: Validate deprecated members
Peter Krempa [Fri, 17 Sep 2021 14:38:11 +0000 (16:38 +0200)] 
testQEMUSchemaValidateEnum: Validate deprecated members

Starting from QEMU-6.2 enum members can be deprecated. Add support to
the validator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQEMUSchemaValidateDeprecated: Move to the top
Peter Krempa [Fri, 17 Sep 2021 14:37:10 +0000 (16:37 +0200)] 
testQEMUSchemaValidateDeprecated: Move to the top

Move the function to the top of the file so other functions placed
towards the top will be able to reuse it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQEMUSchemaValidateEnum: Use new 'members' for 'enum' meta type
Peter Krempa [Fri, 17 Sep 2021 14:26:09 +0000 (16:26 +0200)] 
testQEMUSchemaValidateEnum: Use new 'members' for 'enum' meta type

Switch to the new more featured way to report enum members which will
also allow us to detect use of deprecated members.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQEMUSchemaValidateEnum: Refactor logic to simplify switching to new QMP schema...
Peter Krempa [Fri, 17 Sep 2021 14:21:43 +0000 (16:21 +0200)] 
testQEMUSchemaValidateEnum: Refactor logic to simplify switching to new QMP schema format

QEMU-6.2 is reporting enum values in the new 'members' array which we'll
be switching to. Rewrite the logic so that adding the new checker is
more straightforward.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirQEMUQAPISchemaTraverseEnum: Allow query of enume type features
Peter Krempa [Mon, 20 Sep 2021 13:22:36 +0000 (15:22 +0200)] 
virQEMUQAPISchemaTraverseEnum: Allow query of enume type features

QEMU-6.2 added feature flags for enum types. Add support for querying
them into our QMP schema query language.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirQEMUQAPISchemaTraverseEnum: Use the modern 'members' array
Peter Krempa [Fri, 17 Sep 2021 14:13:49 +0000 (16:13 +0200)] 
virQEMUQAPISchemaTraverseEnum: Use the modern 'members' array

Starting from QEMU-6.2 enum members are reported as an array of objects
under new name "values" so that extra data can be reported for each
member.

Modify the code so that we prefer 'members' and skip 'values' completely
if we've used 'members'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirQEMUQAPISchemaTraverseEnum: Move helper variables into loop
Peter Krempa [Fri, 17 Sep 2021 14:09:59 +0000 (16:09 +0200)] 
virQEMUQAPISchemaTraverseEnum: Move helper variables into loop

Move them closer to where they are actually used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemucapabilitiestest: Update capability probe for qemu-6.2 on x86_64
Peter Krempa [Fri, 29 Oct 2021 09:26:46 +0000 (11:26 +0200)] 
qemucapabilitiestest: Update capability probe for qemu-6.2 on x86_64

Update to v6.1.0-1735-gc52d69e7db which has Markus' patches for
improvements of enum probing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: Fix ambiguous output in metadata-change event
Han Han [Wed, 27 Oct 2021 08:52:33 +0000 (16:52 +0800)] 
virsh: Fix ambiguous output in metadata-change event

When you set metadata with type element like the following:
dom.setMetadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT, "<test/>", 'abc', "HAHAH", 0)

Then for `virsh event --all`, then it will output this message:
event 'metadata-change' for domain 'rhel9': element HAHAH

The message is ambiguous since it looks like the params for
metadata-change event is the element HAHAH. Actually that means the type is
element while the url is HAHAH. Let's make it more clear.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuMonitorJSONSave[Physical|Virtual]Memory: Reformat function headers
Peter Krempa [Wed, 13 Oct 2021 14:40:31 +0000 (16:40 +0200)] 
qemuMonitorJSONSave[Physical|Virtual]Memory: Reformat function headers

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorEjectMedia: Remove stale comment
Peter Krempa [Wed, 13 Oct 2021 14:32:59 +0000 (16:32 +0200)] 
qemuMonitorEjectMedia: Remove stale comment

The QMP implementation didn't use any new approach. The command itself
is now only used with legacy qemu versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: monitor: Remove unused qemuMonitorSetCPU
Peter Krempa [Fri, 29 Oct 2021 13:08:24 +0000 (15:08 +0200)] 
qemu: monitor: Remove unused qemuMonitorSetCPU

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainHotplugAddVcpu: Remove legacy hotplug branch
Peter Krempa [Wed, 13 Oct 2021 14:28:20 +0000 (16:28 +0200)] 
qemuDomainHotplugAddVcpu: Remove legacy hotplug branch

Report an error if the new hotplug is not supported and remove the
alternate code paths.

The modern cpu-hotplug code was introduced in qemu-2.7. We keep the
capability so that proper errors are reported in case a platform doesn't
support hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuhotplugtest: Remove tests for legacy cpu hotplug on x86
Peter Krempa [Wed, 13 Oct 2021 14:26:11 +0000 (16:26 +0200)] 
qemuhotplugtest: Remove tests for legacy cpu hotplug on x86

Modern cpu hotplug was introduced in qemu-2.7, thus all qemu versions
actually support it. Remove the tests for the legacy hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>