[libvirt] [PATCH 2/2] tests: Add test case for empty 'network' cdrom

2019-10-15 Thread Peter Krempa
We don't allow such config in the schema but the code can handle that so add a test case supporting it. Signed-off-by: Peter Krempa --- ...m-empty-network-invalid.x86_64-latest.args | 34 +++ .../disk-cdrom-empty-network-invalid.xml | 30

[libvirt] [PATCH 0/2] conf: Fix up empty 'network' cdroms

2019-10-15 Thread Peter Krempa
Peter Krempa (2): conf: Reset disk type if element is completely missing tests: Add test case for empty 'network' cdrom src/conf/domain_conf.c| 4 +++ ...m-empty-network-invalid.x86_64-latest.args | 34 +++ .../disk-cdrom-empty-network-invalid.xml

[libvirt] [PATCH 1/2] conf: Reset disk type if element is completely missing

2019-10-15 Thread Peter Krempa
The disk type is not part of source and thus it's parsed earlier. This bypasses the checks when parsing a disk type='network' if it's completely missing the source. Since there are possible active users of this (it was reported as a problem with openstack) fix it by resetting the disk type to

Re: [libvirt] [PATCH] qemu: fix EFI nvram removal on domain undefine

2019-10-15 Thread Michal Privoznik
On 10/15/19 3:15 PM, Pavel Mores wrote: On Tue, Oct 15, 2019 at 01:51:32PM +0200, Michal Privoznik wrote: On 10/15/19 10:31 AM, Pavel Mores wrote: When undefining a UEFI domain its nvram file has to be properly handled as well. It's mandatory to use one of --nvram and --keep-nvram options

Re: [libvirt] [RFC 0/1] convert virStorageSource to GObject

2019-10-15 Thread Daniel Henrique Barboza
On 10/15/19 9:55 AM, Daniel P. Berrangé wrote: On Tue, Oct 15, 2019 at 09:42:45AM -0300, Daniel Henrique Barboza wrote: I was hoping to quickly re-send the qemu_driver cleanups I've sent some time ago, now using Glib. I started by attempting to change the first VIR_AUTOUNREF() call in

Re: [libvirt] [PATCH 0/8] Use even morer of GLib's macros (glib chronicles)

2019-10-15 Thread Michal Privoznik
On 10/15/19 2:21 PM, Ján Tomko wrote: Ján Tomko (8): > Reviewed-by: Michal Privoznik Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 7/8] examples: Use G_N_ELEMENTS instead of ARRAY_CARDINALITY

2019-10-15 Thread Andrea Bolognani
On Tue, 2019-10-15 at 14:21 +0200, Ján Tomko wrote: > We try to keep the example programs independent of libraries > other than libvirt. > > Rename the locally defined ARRAY_CARDINALITY macro to G_N_ELEMENTS > which GLib provides, even though we don't actually include GLib. [...] > -#define

Re: [libvirt] [PATCH 0/2] conf: Fix up empty 'network' cdroms

2019-10-15 Thread Michal Privoznik
On 10/15/19 3:35 PM, Peter Krempa wrote: Peter Krempa (2): conf: Reset disk type if element is completely missing tests: Add test case for empty 'network' cdrom src/conf/domain_conf.c| 4 +++ ...m-empty-network-invalid.x86_64-latest.args | 34

Re: [libvirt] [PATCH] qemu: fix EFI nvram removal on domain undefine

2019-10-15 Thread Pavel Mores
On Tue, Oct 15, 2019 at 03:45:55PM +0200, Michal Privoznik wrote: > On 10/15/19 3:15 PM, Pavel Mores wrote: > > On Tue, Oct 15, 2019 at 01:51:32PM +0200, Michal Privoznik wrote: > > > On 10/15/19 10:31 AM, Pavel Mores wrote: > > > > When undefining a UEFI domain its nvram file has to be properly

Re: [libvirt] [PATCH 00/30] storagefile, security: qcow2 data_file support

2019-10-15 Thread Cole Robinson
On 10/15/19 12:29 AM, Han Han wrote: > I find the issue cannot reproduced when `make clean` before build the > source. > It is not proper to build with an unclean source dir, right? > I don't use 'make clean' in libvirt.git but in other projects I have hit issues that required 'make clean', like

[libvirt] [PATCH v3 10/10] qemu_driver.c: use GLib macros

2019-10-15 Thread Daniel Henrique Barboza
Previous patches added VIR_AUTO* facilities in qemu_driver.c to cleanup virObjectUnref() and VIR_FREE() calls. This patch now converts those VIR_AUTO* macros to their GLib alternatives, g_autoptr and g_autofree. After this patch, VIR_AUTO* macros are being used only in three functions: -

[libvirt] [PATCH v3 06/10] qemu_driver: use VIR_AUTOFREE() with strings 1/3

2019-10-15 Thread Daniel Henrique Barboza
Using VIR_AUTOFREE() in all strings of qemu_driver.c make the code a bit tidier and smaller, sparing VIR_FREE() calls and sometimes a whole 'cleanup' label. This is a huge change due to the amount of char * declared in this file, thus let's split it in 3. This is the first part. Signed-off-by:

[libvirt] [PATCH v3 07/10] qemu_driver: use VIR_AUTOFREE() with strings 2/3

2019-10-15 Thread Daniel Henrique Barboza
Using VIR_AUTOFREE() in all strings of qemu_driver.c make the code a bit tidier and smaller, sparing VIR_FREE() calls and sometimes a whole 'cleanup' label. This is a huge change due to the amount of char * declared in this file, thus let's split it in 3. This is the second part. Signed-off-by:

[libvirt] [PATCH v3 08/10] qemu_driver: use VIR_AUTOFREE() with strings 3/3

2019-10-15 Thread Daniel Henrique Barboza
Using VIR_AUTOFREE() in all strings of qemu_driver.c make the code a bit tidier and smaller, sparing VIR_FREE() calls and sometimes a whole 'cleanup' label. This is the last part of this change. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 99

[libvirt] [PATCH v3 01/10] qemu_driver: use VIR_AUTOUNREF() with virQEMUDriverConfigPtr 1/3

2019-10-15 Thread Daniel Henrique Barboza
virQEMUDriverConfigPtr can be auto-unref for the great majority of the uses made in qemu_driver, sparing us a virObjectUnref() call and sometimes a whole 'cleanup' label. This patch changes virQEMUDriverConfigPtr declarations to use VIR_AUTOUNREF(). 'cleanup' labels were deleted when applicable.

[libvirt] [PATCH v3 00/10] use VIR_AUTO*/g_auto* all around qemu_driver.c

2019-10-15 Thread Daniel Henrique Barboza
changes from v2: - rebased with newer master (67e72053c1) - added an extra patch to convert the existing VIR_AUTO* macros to g_auto* ones, all at once, to avoid the case where a method will have both VIR_AUTO* and g_auto* macros at the same time. Note: the conversion in patch 10 wasn't 100% due

[libvirt] [PATCH v3 09/10] qemu_driver: VIR_AUTOFREE on other scalar pointers

2019-10-15 Thread Daniel Henrique Barboza
This patch uses VIR_AUTOFREE on instances of 'unsigned int *' and 'unsigned long long *' found in qemu_driver.c. Suggested-by: Erik Skultety Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git

[libvirt] [PATCH v3 02/10] qemu_driver: use VIR_AUTOUNREF() with virQEMUDriverConfigPtr 2/3

2019-10-15 Thread Daniel Henrique Barboza
virQEMUDriverConfigPtr can be auto-unref for the great majority of the uses made in qemu_driver, sparing us a virObjectUnref() call and sometimes a whole 'cleanup' label. This patch changes virQEMUDriverConfigPtr declarations to use VIR_AUTOUNREF(). 'cleanup' labels were deleted when applicable.

[libvirt] [PATCH v3 05/10] qemu_driver: use VIR_AUTOUNREF() with more pointer types

2019-10-15 Thread Daniel Henrique Barboza
This patch uses VIR_AUTOUNREF() with the following pointer types: - virQEMUCapsPtr - virConnect - qemuDomainSaveCookiePtr - virDomainCapsPtr - qemuBlockJobDataPtr* - virNetworkPtr - virSecurityManagerPtr 'cleanup' labels were deleted when possible. * instances being cleaned up with

[libvirt] [PATCH v3 03/10] qemu_driver: use VIR_AUTOUNREF() with virQEMUDriverConfigPtr 3/3

2019-10-15 Thread Daniel Henrique Barboza
virQEMUDriverConfigPtr can be auto-unref for the great majority of the uses made in qemu_driver, sparing us a virObjectUnref() call and sometimes a whole 'cleanup' label. This patch changes virQEMUDriverConfigPtr declarations to use VIR_AUTOUNREF(). 'cleanup' labels were deleted when applicable.

[libvirt] [PATCH v3 04/10] qemu_driver: use VIR_AUTOUNREF() with virCapsPtr

2019-10-15 Thread Daniel Henrique Barboza
virCapsPtr can be auto-unref for the great majority of the uses made in qemu_driver, sparing us a virObjectUnref() call and sometimes a whole 'cleanup' label. This patch changes virCapsPtr declarations to use VIR_AUTOUNREF(). 'cleanup' labels were deleted when possible. Suggested-by: Erik

[libvirt] [PATCH] qemu: caps: Use unique key for domCaps caching

2019-10-15 Thread Cole Robinson
When searching qemuCaps->domCapsCache for existing domCaps data, we check for a matching pair of arch+virttype+machine+emulator. However for the hash table key we only use the machine string. So if the cache already contains: x86_64 + kvm + pc + /usr/bin/qemu-kvm But a new VM is defined with

Re: [libvirt] [PATCH v2 4/6] qemu: consolidate video validation

2019-10-15 Thread Cole Robinson
On 10/11/19 5:27 PM, Jonathon Jongsma wrote: > Move video validation logic from qemuProcessStartValidateVideo() to > qemuDomainDeviceDefValidateVideo() (which is in fact called from the > aforementioned function). > As mentioned in the other response, this patch adds a lot of test suite

Re: [libvirt] [PATCH 00/30] storagefile, security: qcow2 data_file support

2019-10-15 Thread Cole Robinson
On 10/15/19 3:56 AM, Han Han wrote: > Hello Cole, one issue is found: > The qcow2 data file XTTRs is not cleaned on external snapshot when > -blockdev is not enabled > > Versions: > libvirt v5.8.0-134-g9d03e9adf1 > qemu-kvm-4.1.0-13.module+el8.1.0+4313+ef76ec61.x86_64 > > Steps: > 1. Convert a

[libvirt] [PATCH 02/10] src: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 03/10] libxl: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 04/10] lxc: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 06/10] remote: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 01/10] conf: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 10/10] tools: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 05/10] qemu: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 00/10] Clean up error preservation/restoration

2019-10-15 Thread John Ferlan
I was going through some old git trees and found this one started before I 'altered' my Red Hat career path. Seeing as no one has picked it up from https://wiki.libvirt.org/page/BiteSizedTasks - figured I may as well post it rather than throw it away ;-) The change essentially alters

[libvirt] [PATCH v2 06/31] qemu: Filter models in virQEMUCapsGetCPUDefinitions

2019-10-15 Thread Jiri Denemark
Some callers of virQEMUCapsGetCPUDefinitions will need to filter the returned list of CPU models. Let's add the filtering parameters directly to virQEMUCapsGetCPUDefinitions to avoid copying the CPU models list twice. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version

[libvirt] [PATCH v2 10/31] qemu: Introduce qemuMonitorCPUDefs struct

2019-10-15 Thread Jiri Denemark
It is a container for a CPU models list (qemuMonitorCPUDefInfo) and a number of elements in this list. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - v1 reviewed by Ján Tomko, but the patch had to be changed because of the previous patch

[libvirt] [PATCH v2 15/31] qemu: Introduce virQEMUCapsCPUDefsToModels

2019-10-15 Thread Jiri Denemark
The function translates qemuMonitorCPUDefsPtr (used by QEMU caps probing code) into virDomainCapsCPUModelsPtr used by domain capabilities. Signed-off-by: Jiri Denemark --- Notes: Version 2: - trivial rebase src/qemu/qemu_capabilities.c | 71 +--- 1 file

[libvirt] [PATCH v2 04/31] conf: Drop nameLen parameter from virDomainCapsCPUModelsAdd

2019-10-15 Thread Jiri Denemark
All callers use nameLen == -1 anyway. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - no change src/conf/domain_capabilities.c | 7 +++ src/conf/domain_capabilities.h | 1 - src/qemu/qemu_capabilities.c | 2 +- tests/cputest.c| 4 ++--

[libvirt] [PATCH v2 28/31] qemuxml2*test: Add test cases for default CPU models on ppc64

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch ...ault-cpu-kvm-pseries-2.7.ppc64-latest.args | 38 .../ppc64-default-cpu-kvm-pseries-2.7.xml | 22 + ...ault-cpu-kvm-pseries-3.1.ppc64-latest.args | 38

[libvirt] [PATCH v2 11/31] qemu: Flatten qemuMonitorCPUDefs.cpus

2019-10-15 Thread Jiri Denemark
Let's store qemuMonitorCPUDefInfo directly in the array of CPUs in qemuMonitorCPUDefs rather then using an array of pointers. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - trivial rebase src/qemu/qemu_capabilities.c | 14 +++---

[libvirt] [PATCH v2 08/31] qemu: Use VIR_AUTOPTR in qemuMonitorJSONGetCPUDefinitions

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - no change src/qemu/qemu_monitor_json.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d3447dd2f3..418bdcec92 100644

[libvirt] [PATCH v2 19/31] conf: Drop unused virDomainCapsCPUModelsFilter

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - no change src/conf/domain_capabilities.c | 33 - src/conf/domain_capabilities.h | 3 --- src/libvirt_private.syms | 1 - 3 files changed, 37 deletions(-) diff --git

[libvirt] [PATCH v2 14/31] qemu: Use VIR_AUTOFREE in virQEMUCapsLoadCPUModels

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - no change src/qemu/qemu_capabilities.c | 58 +++- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c

[libvirt] [PATCH v2 24/31] qemu: Drop unused virQEMUCapsGetDefaultMachine

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - no change src/qemu/qemu_capabilities.c | 12 src/qemu/qemu_capabilities.h | 1 - 2 files changed, 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index dd7ea9ae86..bd54c1751c

[libvirt] [PATCH v2 23/31] qemu: Introduce virQEMUCapsGetMachineDefaultCPU

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - fix crash with CPUs without type src/qemu/qemu_capabilities.c | 36 src/qemu/qemu_capabilities.h | 3 +++ 2 files changed, 39 insertions(+) diff --git a/src/qemu/qemu_capabilities.c

[libvirt] [PATCH v3 REBASE 02/12] qemu: track hostdev delete intention

2019-10-15 Thread Nikolay Shirokovskiy
So we are going to support replug of usb device on host. We need to delete device from qemu when the device is unplugged on host and to add device when the device is plugged back. As to deleting let's use same code as when we detach device from domain. But we need to keep the usb hostdev etc in

[libvirt] [PATCH v3 REBASE 08/12] qemu: hotplug: update device list on device deleted event

2019-10-15 Thread Nikolay Shirokovskiy
I guess this is the missing piece for [1]. It did not hurt before (like we didn't even see any errors/warns in logs) because in qemuProcessUpdateDevices function virDomainDefFindDevice does not find device deleted from libvirt config. But now in case of unpluggind usb device from host we leave

[libvirt] [PATCH v3 REBASE 05/12] qemu: handle host usb device add/del udev events

2019-10-15 Thread Nikolay Shirokovskiy
Now when code handling attaching/detaching usb hostdev is appropriately changed use it to handle host usb device udev add/del events. As device adding/deleting needs acquiring job condition it is done in thread pool rather in event loop thread itself where udev events are delivered. However

[libvirt] [PATCH 1/9] util: xml: use g_auto directly for VIR_XPATH_NODE_AUTORESTORE

2019-10-15 Thread Ján Tomko
Since commit 44e7f029159ed701b4a1739ac711507ee53790ed util: rewrite auto cleanup macros to use glib's equivalent VIR_AUTOCLEAN is just an alias for g_auto. Use the GLib macros directly instead of our custom aliases. Signed-off-by: Ján Tomko --- src/util/virxml.h | 6 +++--- 1 file changed,

[libvirt] [PATCH v3 REBASE 03/12] qemu: support host usb device unplug

2019-10-15 Thread Nikolay Shirokovskiy
Handle host usb device unplug in DEVICE_DELETED handle execution path. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 38 +++--- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git

[libvirt] [PATCH v3 REBASE 12/12] conf: parse hostdev missing flag

2019-10-15 Thread Nikolay Shirokovskiy
We want to keep this flag across libvirtd restarts. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d185730023..35006cac8c 100644

[libvirt] [PATCH v3 REBASE 04/12] qemu: support usb hostdev plugging back

2019-10-15 Thread Nikolay Shirokovskiy
We are going to use qemuDomainAttachHostUSBDevice when host usb device is plugged back to node. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git

[libvirt] [PATCH v3 REBASE 01/12] conf: add replug option for usb hostdev

2019-10-15 Thread Nikolay Shirokovskiy
If usb device attached to a domain is unplugged from host and then plugged back then it will no longer be available in guest. We are going to support this case so that device will be detached from qemu on unplug and attached back on replug. As sometimes this behaviour is not desirable and for

[libvirt] [PATCH v3 REBASE 11/12] qemu: handle detaching of unplugged hostdev

2019-10-15 Thread Nikolay Shirokovskiy
If hostdev is unplugged we don't need to delete it's correspondent device from qemu etc. Just remove it from config immediately. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_hotplug.c | 16 +++- src/util/virhostdev.c | 2 ++ 2 files changed, 17 insertions(+), 1

Re: [libvirt] [PATCH 1/1] Add shrink flag to blockresize command

2019-10-15 Thread Cole Robinson
On 10/5/19 2:56 PM, martinsson.pat...@gmail.com wrote: > From: patchon > You probably want to fix this to match your signed-off-by name. > These commits simply adds the '--shrink' flag to the blockresize > command to prevent accidental shrinking of a block device. This > behaviour is already

Re: [libvirt] [PATCH 7/8] examples: Use G_N_ELEMENTS instead of ARRAY_CARDINALITY

2019-10-15 Thread Ján Tomko
On Tue, Oct 15, 2019 at 04:10:55PM +0200, Andrea Bolognani wrote: On Tue, 2019-10-15 at 14:21 +0200, Ján Tomko wrote: We try to keep the example programs independent of libraries other than libvirt. Rename the locally defined ARRAY_CARDINALITY macro to G_N_ELEMENTS which GLib provides, even

[libvirt] [PATCH 0/9] More GLib macro usage (glib chronicles)

2019-10-15 Thread Ján Tomko
Ján Tomko (9): util: xml: use g_auto directly for VIR_XPATH_NODE_AUTORESTORE virbuffer: use g_auto directly for virBuffer Use g_autofree instead of VIR_AUTOFREE Use G_DEFINE_AUTOPTR_CLEANUP_FUNC instead of VIR_DEFINE_AUTOPTR_FUNC Use g_autoptr instead of VIR_AUTOPTR Define

[libvirt] [PATCH v2 18/31] qemu: Switch qemuCaps to use qemuMonitorCPUDefs

2019-10-15 Thread Jiri Denemark
We will need to keep some QEMU-specific data for each CPU model supported by a QEMU binary. Instead of complicating the generic virDomainCapsCPUModelsPtr, we can just directly store qemuMonitorCPUDefsPtr returned by the capabilities probing code. Signed-off-by: Jiri Denemark --- Notes:

[libvirt] [PATCH v2 20/31] conf: Drop virDomainCapsCPUModelsAddSteal

2019-10-15 Thread Jiri Denemark
Both virDomainCapsCPUModelsAdd and virDomainCapsCPUModelsAddSteal are so simple we can just squash the code in a single function. Signed-off-by: Jiri Denemark --- Notes: Version 2: - no change src/conf/domain_capabilities.c | 33 ++---

[libvirt] [PATCH v2 25/31] qemu: Use VIR_AUTOUNREF in qemuDomainDefPostParse

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - no change src/qemu/qemu_domain.c | 28 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c638077aa8..9dcba4ef38

[libvirt] [PATCH v2 27/31] qemuxml2*test: Add test cases for default CPU models on aarch64

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch ...fault-cpu-kvm-virt-4.2.aarch64-latest.args | 38 +++ .../aarch64-default-cpu-kvm-virt-4.2.xml | 20 ++ ...fault-cpu-tcg-virt-4.2.aarch64-latest.args | 38 +++

[libvirt] [PATCH v2 22/31] qemu: Probe for default CPU types

2019-10-15 Thread Jiri Denemark
QEMU 4.2.0 will report default CPU types used by each machine type and we will want to start using it. Signed-off-by: Jiri Denemark --- Notes: Version 2: - no change except for updated test results src/qemu/qemu_capabilities.c | 15 ++- src/qemu/qemu_monitor.c

[libvirt] [PATCH v2 21/31] qemu: Store typename from query-cpu-definitions in qemuCaps

2019-10-15 Thread Jiri Denemark
We need to create a mapping between CPU model names and their corresponding QOM types. Signed-off-by: Jiri Denemark --- Notes: Version 2: - ignore empty typename strings src/qemu/qemu_capabilities.c | 3 + src/qemu/qemu_monitor.c | 2 +

[libvirt] [PATCH v2 07/31] qemu: Use virQEMUCapsGetCPUDefinitions more

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - no change src/qemu/qemu_capabilities.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index

[libvirt] [PATCH v2 00/31] qemu: Store default CPU in domain XML

2019-10-15 Thread Jiri Denemark
When starting a domain without a CPU model specified in the domain XML, QEMU will choose a default one. Which is fine unless the domain gets migrated to another host because libvirt doesn't perform any CPU ABI checks and the virtual CPU provided by QEMU on the destination host can differ from the

[libvirt] [PATCH v2 01/31] tests: Add capabilities for QEMU 4.2.0 on s390x

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch .../caps_4.2.0.s390x.replies | 22414 .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 3345 +++ 2 files changed, 25759 insertions(+) create mode 100644

[libvirt] [PATCH v2 12/31] build: Export virStringListCopy internal API

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - no change src/libvirt_private.syms | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7d62df8086..1af18b880b 100644 --- a/src/libvirt_private.syms +++

[libvirt] [PATCH v2 13/31] qemu: Add qemuMonitorCPUDefsCopy

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - no change src/qemu/qemu_monitor.c | 33 + src/qemu/qemu_monitor.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 87a9d06d45..8d86112f30

[libvirt] [PATCH v2 09/31] qemu: Change return type of virQEMUCapsFetchCPUDefinitions

2019-10-15 Thread Jiri Denemark
The function would return a valid virDomainCapsCPUModelsPtr with empty CPU models list if query-cpu-definitions exists in QEMU, but returns GenericError meaning it's not in fact implemented. This behaviour is a bit strange especially after such virDomainCapsCPUModels structure is stored in

[libvirt] [PATCH v2 16/31] qemu: Rename virQEMUCaps{Get, Fetch}CPUDefinitions

2019-10-15 Thread Jiri Denemark
The functions return virDomainCapsCPUModelsPtr and thus they should be called *CPUModels for consistency. Functions called *CPUDefinitions will work on qemuMonitorCPUDefsPtr. Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch src/qemu/qemu_capabilities.c | 28

[libvirt] [PATCH v2 17/31] qemu: Split virQEMUCapsFetchCPUModels

2019-10-15 Thread Jiri Denemark
Most of the code moved to a new virQEMUCapsFetchCPUDefinitions function and the existing virQEMUCapsFetchCPUModels just becomes a small wrapper around virQEMUCapsFetchCPUDefinitions and virQEMUCapsCPUDefsToModels. Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch

[libvirt] [PATCH v2 05/31] qemu: Copy CPU models in virQEMUCapsGetCPUDefinitions

2019-10-15 Thread Jiri Denemark
Rather than returning a direct pointer the list stored in qemuCaps the function now creates a new copy of the CPU models list. The main purpose of this seemingly useless change is to update callers to free the result returned by virQEMUCapsGetCPUDefinitions because the internals of this function

[libvirt] [PATCH v2 03/31] conf: Use VIR_AUTO* in virDomainCapsCPUModelsAdd

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- Notes: Version 2: - no change src/conf/domain_capabilities.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index

Re: [libvirt] [PATCH 7/8] examples: Use G_N_ELEMENTS instead of ARRAY_CARDINALITY

2019-10-15 Thread Daniel P . Berrangé
On Tue, Oct 15, 2019 at 04:10:55PM +0200, Andrea Bolognani wrote: > On Tue, 2019-10-15 at 14:21 +0200, Ján Tomko wrote: > > We try to keep the example programs independent of libraries > > other than libvirt. > > > > Rename the locally defined ARRAY_CARDINALITY macro to G_N_ELEMENTS > > which

[libvirt] [PATCH v3 REBASE 00/12] hostdev: handle usb detach/attach on node

2019-10-15 Thread Nikolay Shirokovskiy
Diff to v2[1] version: - add 'replug' attribute for hostdev element to allow replug semantics - avoid accuiring domain lock in event loop thread on udev events as suggested by Peter - nit picks after review by Daniel Henrique Barboza * is used to mark patches that were 'Reviewed-by' by Daniel

[libvirt] [PATCH v3 REBASE 09/12] qemu: handle host usb device plug/unplug when libvirtd is down

2019-10-15 Thread Nikolay Shirokovskiy
Somebody can easily unplug usb device from host while libvirtd is being stopped. Also usb device can be plugged or unplugged/plugged back and so forth. Let's handle such cases. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 56

[libvirt] [PATCH v3 REBASE 06/12] qemu: handle libvirtd restart after host usb device unplug

2019-10-15 Thread Nikolay Shirokovskiy
It is possible for libvirtd to go down before DEVICE_DELETED event is delivered upon usb hostdev unplug and to receive the event after the libvirtd is up. In order to handle this case we need to save usb hostdev deleteAction in status file. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel

[libvirt] [PATCH v3 REBASE 10/12] qemu: don't mess with non mandatory hostdevs on reattaching

2019-10-15 Thread Nikolay Shirokovskiy
First I don't want to add code to handle dummy device that is used when host usb device is not present at the moment of starting/migrating etc. Second supporting non mandatory policies would require to handle races when host usb device is plugged to host and libvirtd starts adding device but if in

Re: [libvirt] [PATCH v2 2/6] qemu: use VIR_AUTOUNREF in qemuDomainDeviceDefValidate()

2019-10-15 Thread Cole Robinson
On 10/11/19 5:27 PM, Jonathon Jongsma wrote: > This allows us to simplify the function and avoid jumping to 'cleanup'. > > Signed-off-by: Jonathon Jongsma > --- > src/qemu/qemu_domain.c | 13 + > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git

[libvirt] [PATCH 8/9] Delete virObjectAutoUnref

2019-10-15 Thread Ján Tomko
Signed-off-by: Ján Tomko --- src/libvirt_private.syms | 1 - src/util/virobject.c | 14 -- src/util/virobject.h | 15 --- 3 files changed, 30 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7d62df8086..0da02bb8bd 100644 ---

[libvirt] [PATCH 2/9] virbuffer: use g_auto directly for virBuffer

2019-10-15 Thread Ján Tomko
Since commit 44e7f029159ed701b4a1739ac711507ee53790ed util: rewrite auto cleanup macros to use glib's equivalent VIR_AUTOCLEAN is just an alias for g_auto. Use the GLib macros directly instead of our custom aliases. Signed-off-by: Ján Tomko --- src/conf/domain_conf.c | 100

[libvirt] [PATCH 4/9] Use G_DEFINE_AUTOPTR_CLEANUP_FUNC instead of VIR_DEFINE_AUTOPTR_FUNC

2019-10-15 Thread Ján Tomko
Since commit 44e7f029159ed701b4a1739ac711507ee53790ed util: rewrite auto cleanup macros to use glib's equivalent VIR_AUTOPTR aliases to g_autoptr. Replace all uses of VIR_DEFINE_AUTOPTR_FUNC with G_DEFINE_AUTOPTR_CLEANUP_FUNC in preparation for replacing the rest. Signed-off-by: Ján Tomko

[libvirt] [PATCH 6/9] Define G_DEFINE_AUTOPTR_CLEANUP_FUNC for virDomainCheckpointDef

2019-10-15 Thread Ján Tomko
Allow g_autoptr to be used instead of VIR_AUTOUNREF. Signed-off-by: Ján Tomko --- src/conf/checkpoint_conf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/checkpoint_conf.h b/src/conf/checkpoint_conf.h index 2be041ff56..982096abed 100644 --- a/src/conf/checkpoint_conf.h +++

[libvirt] [PATCH 9/9] Remove virautoclean.h

2019-10-15 Thread Ján Tomko
Now that we no longer use any of the macros from this file, remove it. This also removes a typo. Signed-off-by: Ján Tomko --- src/conf/domain_capabilities.h | 1 - src/conf/storage_conf.h | 1 - src/qemu/qemu_firmware.h | 1 - src/qemu/qemu_migration_params.h | 1 -

[libvirt] [PATCH 7/9] Use g_autoptr instead of VIR_AUTOUNREF

2019-10-15 Thread Ján Tomko
Now that all the types using VIR_AUTOUNREF have a cleanup func defined to virObjectUnref, use g_autoptr instead of VIR_AUTOUNREF. Signed-off-by: Ján Tomko --- src/conf/checkpoint_conf.c | 2 +- src/conf/domain_conf.c | 24

[libvirt] [PATCH v3 REBASE 07/12] qemu: handle race on device deletion and usb host device plugging

2019-10-15 Thread Nikolay Shirokovskiy
Imagine host usb device is unplugged from host and as a result we send command to qemu to delete appropriate device. Then before qemu device is deleted host usb device is plugged back. Currently code supposes there is no remnant device in qemu and will try to add new device and the attempt will

[libvirt] [PATCH v2 30/31] qemuxml2*test: Add test cases for default CPU models on x86_64

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch ...-default-cpu-kvm-pc-4.2.x86_64-latest.args | 36 +++ .../x86_64-default-cpu-kvm-pc-4.2.xml | 24 ...default-cpu-kvm-q35-4.2.x86_64-latest.args | 41 +

[libvirt] [PATCH v2 31/31] qemu: Store default CPU in domain XML

2019-10-15 Thread Jiri Denemark
When starting a domain without a CPU model specified in the domain XML, QEMU will choose a default one. Which is fine unless the domain gets migrated to another host because libvirt doesn't perform any CPU ABI checks and the virtual CPU provided by QEMU on the destination host can differ from the

[libvirt] [PATCH v2 26/31] conf: Define VIR_AUTOPTR for virCPUDef

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - no change src/conf/cpu_conf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 30904fab95..230e75f077 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -151,6 +151,7 @@

[libvirt] [PATCH v2 29/31] qemuxml2*test: Add test cases for default CPU models on s390x

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch ...t-cpu-kvm-ccw-virtio-4.2.s390x-latest.args | 31 +++ .../s390-default-cpu-kvm-ccw-virtio-4.2.xml | 16 ++ ...t-cpu-tcg-ccw-virtio-4.2.s390x-latest.args | 31 +++

[libvirt] [PATCH 08/10] util: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 07/10] storage: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH 09/10] vz: Use consistent error preservation and restoration calls

2019-10-15 Thread John Ferlan
Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and

[libvirt] [PATCH v2 02/31] domcapstest: Add test case for QEMU 4.2.0 on s390x

2019-10-15 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- Notes: Version 2: - new patch .../domaincapsschemadata/qemu_4.2.0.s390x.xml | 202 ++ tests/domaincapstest.c| 4 + 2 files changed, 206 insertions(+) create mode 100644

Re: [libvirt] [RFC 0/1] convert virStorageSource to GObject

2019-10-15 Thread Daniel P . Berrangé
On Tue, Oct 15, 2019 at 10:51:39AM -0300, Daniel Henrique Barboza wrote: > > > On 10/15/19 9:55 AM, Daniel P. Berrangé wrote: > > On Tue, Oct 15, 2019 at 09:42:45AM -0300, Daniel Henrique Barboza wrote: > > > I was hoping to quickly re-send the qemu_driver cleanups I've > > > sent some time ago,

Re: [libvirt] [RFC 0/1] convert virStorageSource to GObject

2019-10-15 Thread Daniel Henrique Barboza
On 10/15/19 2:15 PM, Daniel P. Berrangé wrote: On Tue, Oct 15, 2019 at 10:51:39AM -0300, Daniel Henrique Barboza wrote: On 10/15/19 9:55 AM, Daniel P. Berrangé wrote: On Tue, Oct 15, 2019 at 09:42:45AM -0300, Daniel Henrique Barboza wrote: I was hoping to quickly re-send the qemu_driver

[libvirt] [PATCH 0/3] use virStringParseYesNo helper

2019-10-15 Thread Mao Zhongyi
A function virStringParseYesNo was added to convert string 'yes' to true and 'no' to false, so use this helper to replace 'STREQ(.*, \"yes\")' and 'STREQ(.*, \"no\")' as it allows us to drop several repetitive if-then-else string->bool conversion blocks. Cc: abolo...@redhat.com Cc:

[libvirt] [PATCH 2/3] conf/network_conf: use virStringParseYesNo helper

2019-10-15 Thread Mao Zhongyi
A function virStringParseYesNo was added to convert string 'yes' to true and 'no' to false, so use this helper to replace 'STREQ(.*, \"yes\")' and 'STREQ(.*, \"no\")' as it allows us to drop several repetitive if-then-else string->bool conversion blocks. Cc: g...@czarc.net Cc: crobi...@redhat.com

[libvirt] [PATCH v2 1/3] qemu_process: use VIR_AUTOFREE()

2019-10-15 Thread Daniel Henrique Barboza
Change all strings and scalar pointers to use VIR_AUTOFREE(), clearing up the 'cleanup' labels when possible. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 118 ++-- 1 file changed, 40 insertions(+), 78 deletions(-) diff --git

[libvirt] [PATCH v2 2/3] qemu_process: use VIR_AUTOUNREF()

2019-10-15 Thread Daniel Henrique Barboza
Change all feasible vir*Ptr pointers to be AUTOUNREF(), clearing up the 'cleanup' labels when possible. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 316 +++- 1 file changed, 116 insertions(+), 200 deletions(-) diff --git

[libvirt] [PATCH 1/3] conf/domain_conf: use virStringParseYesNo helper

2019-10-15 Thread Mao Zhongyi
This helper performs a conversion from a "yes|no" string to a corresponding boolean, and several conversions were already done, but there are still some omissions. For most of the remaining usages in domain_conf.c only "yes" is explicitly checked for. This means all other values are implicitly

Re: [libvirt] [PATCH v3] util: Block SIGPIPE until execve in child process

2019-10-15 Thread Eric Blake
On 10/15/19 9:25 PM, Wang Yechao wrote: Libvirtd has set SIGPIPE to ignored, and virFork resets all signal handlers to the defaults. But child process may write logs to stderr/stdout, that may generate SIGPIPE if journald has stopped. So block SIGPIPE in virFork, and unblock it before execve.

  1   2   >