Commit Graph

42656 Commits

Author SHA1 Message Date
Peter Krempa
1ee09b5d4b qemu: Remove return value from qemuMonitorDomainSpiceMigratedCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:48 +02:00
Peter Krempa
6e8289585b qemu: Remove return value from qemuMonitorDomainSerialChangeCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:48 +02:00
Peter Krempa
f3d62ee3a5 qemu: Remove return value from qemuMonitorDomainNicRxFilterChangedCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:48 +02:00
Peter Krempa
cc121412fc qemu: Remove return value from qemuMonitorDomainDeviceDeletedCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:48 +02:00
Peter Krempa
81db1e75b3 qemu: Remove return value from qemuMonitorDomainGuestPanicCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
05a6da5862 qemu: Remove return value from qemuMonitorDomainPMSuspendDiskCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
e8502f79db qemu: Remove return value from qemuMonitorDomainBalloonChangeCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
fa0af946d8 qemu: Remove return value from qemuMonitorDomainPMSuspendCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
86a5925edd qemu: Remove return value from qemuMonitorDomainPMWakeupCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
f4b36cd87c qemu: Remove return value from qemuMonitorDomainTrayChangeCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
9b69147c05 qemu: Remove return value from qemuMonitorDomainJobStatusChangeCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
5bc4f8dd0f qemu: Remove return value from qemuMonitorDomainBlockJobCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
b0487ba754 qemu: Remove return value from qemuMonitorDomainGraphicsCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
96d98a4b19 qemu: Remove return value from qemuMonitorDomainIOErrorCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
bd9a14cf6e qemu: Remove return value from qemuMonitorDomainWatchdogCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
8ed88fe9a0 qemu: Remove return value from qemuMonitorDomainRTCChangeCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
1b5097172b qemu: Remove return value from qemuMonitorDomainResumeCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
e57a537ad2 qemu: Remove return value from qemuMonitorDomainStopCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
8e95b76b1a qemu: Remove return value from qemuMonitorDomainResetCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
40950f60fc qemu: Remove return value from qemuMonitorDomainShutdownCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
b2bf8d5bab qemu: Remove return value from qemuMonitorDomainEventCallback
Change the callback prototype and fix the callback registered in the
process code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
7a1b07925c qemu: monitor: Remove return value from qemuMonitorEmit* functions
The callers in the monitor code invoking the callbacks after events are
received don't actually check the return value from the callbacks and
there isn't really anything we could do on failure.

Remove the return value from the intermediary functions so we can later
remove them from the callback prototypes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
a49e50f84d qemu: monitor: Remove handlers for the 'POWERDOWN' event
The qemu process code doesn't register a callback for it so we don't
need to be handling it at all.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 10:01:47 +02:00
Peter Krempa
447f69dec4 storage_driver: Unlock object on ACL fail in storagePoolLookupByTargetPath
'virStoragePoolObjListSearch' returns a locked and refed object, thus we
must release it on ACL permission failure.

Fixes: 7aa0e8c0cb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1984318
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-23 09:59:40 +02:00
Peter Krempa
af013aa14c syntax-check: Prohibit 'vir' prefix for enum implementations in virsh
Avoid potential conflict of enum helpers declared in virsh.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 09:59:12 +02:00
Peter Krempa
b12a0e62f0 virsh-volume: Avoid 'vir' prefix for locally declared VIR_ENUM* helpers
Stuff used in virsh should use 'virsh'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 09:59:12 +02:00
Peter Krempa
0c038aeffc virsh-network: Avoid 'vir' prefix for locally declared VIR_ENUM* helpers
Stuff used in virsh should use 'virsh'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 09:59:12 +02:00
Peter Krempa
9e7f32790a virsh-domain: Avoid 'vir' prefix for locally declared VIR_ENUM* helpers
Stuff used in virsh should use 'virsh'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 09:59:12 +02:00
Peter Krempa
cc530c4557 virsh-host: Avoid 'vir' prefix for locally declared VIR_ENUM* helpers
Stuff used in virsh should use 'virsh'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-07-23 09:59:12 +02:00
Boris Fiuczynski
19b088cfb9 nodedev: fix internal error when no defined mdevs exist
Commit e9b534905f introduced an error when parsing an empty list
returned from mdevctl.

This occurs e.g. if nodedev-undefine is used to undefine the last
defined mdev which causes the following error messages

 libvirtd[33143]: internal error: Unexpected format for mdevctl response
 libvirtd[33143]: internal error: failed to query mdevs from mdevctl:
 libvirtd[33143]: mdevctl failed to updated mediated devices

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2021-07-22 10:53:44 -05:00
Pavel Hrdina
299174c532 qemuxml2argvmock: drop virQEMUCapsGetKVMSupportsSecureGuest
It is actually not needed because in qemuxml2argvtest we preload
domaincapsmock as well.

Reported-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-22 15:55:26 +02:00
Pavel Hrdina
e7934a7a6d tests: fix compiling tests with minGW
We need to mock virQEMUCapsGetKVMSupportsSecureGuest only if compiling
with QEMU otherwise compilation will fail with error:

/usr/lib/gcc/i686-w64-mingw32/11.1.1/../../../../i686-w64-mingw32/bin/ld: tests/libdomaincapsmock.dll.p/domaincapsmock.c.obj: in function `virQEMUCapsGetKVMSupportsSecureGuest':
/builds/libvirt/libvirt/build/../tests/domaincapsmock.c:40: undefined reference to `virQEMUCapsGet'
/usr/lib/gcc/i686-w64-mingw32/11.1.1/../../../../i686-w64-mingw32/bin/ld: /builds/libvirt/libvirt/build/../tests/domaincapsmock.c:41: undefined reference to `virQEMUCapsGet'

Fixes: 248a30c0c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-22 15:07:17 +02:00
Tim Wiederhake
94944e38d7 ci: Halt on sanitizer errors
The undefined behaviour sanitizer (UBSAN) defaults to merely printing an
error message if it detects undefined behaviour. These error messages often
end up in captured output and do not fail the tests, effectively hiding
the warning. Make the test cases fail to make the issues visible.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-07-22 13:50:39 +02:00
Tim Wiederhake
2ed93ed979 virFileReadLimFD: Cast maxlen to size_t before adding
If the function is called with maxlen equal to `INT_MAX`, adding
one will trigger a signed integer overflow.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-07-22 13:50:39 +02:00
Boris Fiuczynski
5873037c8e conf: remove unnecessary restore in virDomainSEVDefParseXML
Since commit d399a728f4 placed the restore in the right scope the
restore can get removed in virDomainSEVDefParseXML.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-22 11:14:04 +02:00
Zhenzhong Duan
d399a728f4 conf: Restore ctxt's node in right scope
We just found <qemu:commandline> is ignored in our xml. Further debug
shows that ctxt's node pointer isn't restored in virDomainSecDefParseXML(),
which leads to parsing of remaining elements failed.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-22 09:55:39 +02:00
Kristina Hanicova
bcad39457d genericxml2xmltest: Refactor DO_TEST_FULL() calls
I have added 2 new macros to call tests which are expected to
fail in order to make the code more consistent and readable.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-21 14:40:50 +02:00
Kristina Hanicova
0f4a65874a genericxml2xmltest: Substitute 'inactive' variable with 'active'
Having negation in a name of a bool variable seems a bit
confusing to me. I think the substitution makes the code much
more readable.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-21 14:40:46 +02:00
Boris Fiuczynski
c4caa1e736 qemu: Fix error code for SEV launchSecurity unsupported
When SEV is not supported but specified in the domain XML by a user it
should not result in an internal error (VIR_ERR_INTERNAL_ERROR)
therefore switching to XML error (VIR_ERR_CONFIG_UNSUPPORTED).

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:31:15 +02:00
Boris Fiuczynski
d6ca1ac981 qemu: Use common id lsec0 for launchSecurity
Use the common id 'lsec0' for all launchSecurity types in the QEMU
command line construction.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:30:30 +02:00
Boris Fiuczynski
eca12fbee5 docs: Add s390-pv in domain capabilities documentation
Add documentation for domain capability s390-pv.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:30:30 +02:00
Boris Fiuczynski
248a30c0c0 conf: Add availability of s390-pv in domain capabilities
Adding availability of s390-pv in domain capabilities and adjust tests.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:30:30 +02:00
Boris Fiuczynski
b823f7a781 docs: Add s390-pv documentation
Add documentation for launch security type s390-pv.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:30:30 +02:00
Boris Fiuczynski
9568a4d410 conf: Add s390-pv as launch security type
Add launch security type 's390-pv' as well as some tests.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:30:25 +02:00
Boris Fiuczynski
13f4860c61 qemu: Add s390-pv-guest capability
Add s390-pv-guest capability.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:30:24 +02:00
Boris Fiuczynski
96bc8312aa conf: Refactor launch security to allow more types
Adding virDomainSecDef for general launch security data
and moving virDomainSEVDef as an element for SEV data.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:30:14 +02:00
Boris Fiuczynski
08850a2a06 qemu: Make KVMSupportsSecureGuest capability available
Expose existing KVMSupportsSecureGuest capability.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:07:04 +02:00
Boris Fiuczynski
f7bc6febd0 conf: Rework SEV XML parse and format methods
Make use of virDomainLaunchSecurity enum.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:06:39 +02:00
Boris Fiuczynski
001b482e30 schemas: Refactor launch security
Change launch security to make it reusable for other types.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-21 13:04:31 +02:00
Michal Privoznik
bab44aa963 qemu_migration: Unregister close callback only if connection still exists
When doing a peer-to-peer migration it may happen that the
connection to the destination disappears. If that happens,
there's no point in trying to unregister the close callback
because the connection is closed already. It results only in
polluting logs with this message:

  error : virNetSocketReadWire:1814 : End of file while reading data: : Input/output error

and the reason for that is unregistering a connection callback
results in RPC (among other things).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1918211
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-07-21 10:24:09 +02:00