Re: [PATCH v3 2/7] migration/dirtyrate: set up framwork of domainGetDirtyRateInfo API

2020-10-27 Thread Hao Wang
Greate thanks for your suggestions, Daniel. I'll fix that and update my patchset later. BR, Hao On 2020/10/28 3:14, Daniel Henrique Barboza wrote: > > This patch does not compile/test successfully in my env. There are > at least 2 things going wrong here: > >

[PATCH] node_device: fix leak of DIR*

2020-10-27 Thread Laine Stump
Commit 53aec799fa31 introduced the function udevGetVDPACharDev(), which scans a directory using virDirOpenIfExists() and virDirRead(). It unfortunately forgets to close the DIR* when it is finished with it. This patch fixes that omission. Signed-off-by: Laine Stump ---

[PATCH 12/12] remove unnecessary cleanup labels and unused return variables

2020-10-27 Thread Laine Stump
After converting all DIR* to g_autoptr(DIR), many cleanup: labels ended up just having "return ret", and every place that set ret would just immediately goto cleanup. Remove the cleanup label and its return, and just return the set value immediately, thus eliminating the need for the return

[PATCH 11/12] util: refactor function to simplify and remove label

2020-10-27 Thread Laine Stump
Once the DIR* in virPCIGetName() was made g_autoptr, the cleanup: label just had a "return ret;", but the rest of the function was more compilcated than it needed to be, doing funky things with the value of ret inside multi-level conditionals and a while loop that might exit early via a break with

[PATCH 07/12] util: declare g_autoptr cleanup function to auto-close DIR*

2020-10-27 Thread Laine Stump
Signed-off-by: Laine Stump --- src/util/virfile.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virfile.h b/src/util/virfile.h index 6fde4f88ca..6973fbd54a 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -271,6 +271,7 @@ int virDirRead(DIR *dirp, struct dirent **ent,

[PATCH 06/12] util: change virDirClose to take a DIR* instead of DIR**.

2020-10-27 Thread Laine Stump
In order to make a usable g_autoptr(DIR), we need to have a close function that is a NOP when the pointer is NULL, but takes a simple DIR*. But virDirClose() (candidate to be the g_autoptr cleanup function) currently takes a DIR**, not DIR*. It does this so that it can clear the pointer, thus

[PATCH 10/12] util: remove unused VIR_DIR_CLOSE() macro

2020-10-27 Thread Laine Stump
Since every single use of DIR* was converted to use g_autoptr, this function is not currently needed. Even if someone comes up with a usage for a non-g_autoptr DIR* in the future, they can just use virDirClose(), since there is no longer a semantic difference between the two (VIR_DIR_CLOSE()

[PATCH 05/12] util: manually set dirp to NULL after closing in virCapabilitiesInitCache()

2020-10-27 Thread Laine Stump
In all uses of VIR_DIR_CLOSE() except one, the DIR* is never referenced after closing all the way until it goes out of scope. virCapabilitiesInitCaches(), however, reuses the same DIR* over and over in a loop, but due to having many error conditions that result in a goto out of the loop, it's not

[PATCH 08/12] change DIR* int g_autoptr(DIR) where appropriate

2020-10-27 Thread Laine Stump
All of these conversions are trivial - VIR_DIR_CLOSE() (aka virDirClose()) is called only once on the DIR*, and it happens just before going out of scope. Signed-off-by: Laine Stump --- src/bhyve/bhyve_capabilities.c | 3 +-- src/conf/virdomainobjlist.c | 3 +--

[PATCH 09/12] conf: convert final DIR* to g_autoptr

2020-10-27 Thread Laine Stump
This use of DIR* was re-using the same function-scope DIR* each time through a for loop, and due to multiple error gotos in the loop, it needed to have the scope of the DIR* reduced to just the loop at the same time as switching to g_autoptr. That's what this patch does. Signed-off-by: Laine

[PATCH 03/12] storage: remove extraneous call to VIR_DIR_CLOSE()

2020-10-27 Thread Laine Stump
VIR_DIR_CLOSE(dir) is called in the middle of virStorageBackendRefreshLocal(), which is okay, but redundant - there is no reference to dir between that call and the end of the function, where VIR_DIR_CLOSE() is called again. Remove the extra call in the middle to simplify the function and make the

[PATCH 01/12] consistently use VIR_DIR_CLOSE() instead of virDirClose()

2020-10-27 Thread Laine Stump
This will make it easier to review upcoming patches that use g_autoptr to auto-close all DIRs. Signed-off-by: Laine Stump --- src/qemu/qemu_interop_config.c | 2 +- src/security/security_selinux.c | 6 ++ src/util/virdevmapper.c | 2 +- src/util/virfile.c | 3 +--

[PATCH 02/12] tools: reduce scope of a DIR* in virHostValidateIOMMU()

2020-10-27 Thread Laine Stump
This will make the trivial nature of a conversion to g_autoptr (in a later patch) more obvious. Signed-off-by: Laine Stump --- tools/virt-host-validate-common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/virt-host-validate-common.c

[PATCH 04/12] util: reduce scope of a DIR * in virCgroupV1SetOwner()

2020-10-27 Thread Laine Stump
DIR *dh is being re-used each time through the for loop of this function, so it must be closed and then re-opened, which means we can't convert it to g_autoptr. By moving the definition of dh inside the for loop, we make it possible to trivially convert to g_autoptr (which will happen in a

[PATCH 00/12] use g_autoptr for all DIR*

2020-10-27 Thread Laine Stump
I don't even remember why I started looking at this. I think that again I was considering changing some function, and making the DIR* in that function autoclose was a prerequisite for a reasonably clean addition to the function. I eventually gave up on the other plan (probably because it was a bad

[PULL 06/12] nbd: Update qapi to support exporting multiple bitmaps

2020-10-27 Thread Eric Blake
Since 'block-export-add' is new to 5.2, we can still tweak the interface; there, allowing 'bitmaps':['str'] is nicer than 'bitmap':'str'. This wires up the qapi and qemu-nbd changes to permit passing multiple bitmaps as distinct metadata contexts that the NBD client may request, but the actual

Re: [PATCH v3 2/7] migration/dirtyrate: set up framwork of domainGetDirtyRateInfo API

2020-10-27 Thread Daniel Henrique Barboza
On 10/27/20 9:47 AM, Hao Wang wrote: Introduce DomainGetDirtyRateInfo API for domain's memory dirty rate calculation and query. Signed-off-by: Hao Wang Signed-off-by: Zhou Yimin Reviewed-by: Chuan Zheng --- This patch does not compile/test successfully in my env. There are at least 2

Re: [PATCH] re-add cscope db files to .gitignore

2020-10-27 Thread Michal Privoznik
On 10/27/20 5:39 PM, Laine Stump wrote: Commit f7114e61db removed these lines as being "old and obsolete". cscope may be old, but it is still very much useful and used (i.e. *not* obsolete), and having the files show up as "Untracked files:" every time git status is run is annoying.

[PATCH] re-add cscope db files to .gitignore

2020-10-27 Thread Laine Stump
Commit f7114e61db removed these lines as being "old and obsolete". cscope may be old, but it is still very much useful and used (i.e. *not* obsolete), and having the files show up as "Untracked files:" every time git status is run is annoying. Signed-off-by: Laine Stump --- I'm not sure why I

[PATCH v2] cpu_ppc64: compare CPU function is ignoring return value

2020-10-27 Thread Julio Faracco
Function to compare CPU on 64-bits PowerPC is ignoring the flag to avoid failure in case of CPUs (host and guest) are incompatible. Basically, the function is returning -1 even if it is set to continue. Signed-off-by: Julio Faracco --- src/cpu/cpu_ppc64.c | 8 1 file changed, 4

Re: [PATCH] cpu_ppc64: compare CPU function is ignoring return value

2020-10-27 Thread Julio Faracco
Hi Jano, Your suggestion makes more sense. Let me send a V2 then. Tks :-) -- Julio Cesar Faracco Em ter., 27 de out. de 2020 às 12:24, Ján Tomko escreveu: > > On a Tuesday in 2020, Julio Faracco wrote: > >Function to compare CPU on 64-bit PowerPC is ignoring the flag to avoid > >failure in

Re: [PATCH] cpu_ppc64: compare CPU function is ignoring return value

2020-10-27 Thread Ján Tomko
On a Tuesday in 2020, Julio Faracco wrote: Function to compare CPU on 64-bit PowerPC is ignoring the flag to avoid failure in case of CPUs (host and guest) are incompatible. Basically, the function is returning -1 even if it is set to continue. Signed-off-by: Julio Faracco ---

Re: [PATCH v6 04/11] nbd: Update qapi to support exporting multiple bitmaps

2020-10-27 Thread Vladimir Sementsov-Ogievskiy
27.10.2020 08:05, Eric Blake wrote: Since 'block-export-add' is new to 5.2, we can still tweak the interface; there, allowing 'bitmaps':['str'] is nicer than 'bitmap':'str'. This wires up the qapi and qemu-nbd changes to permit passing multiple bitmaps as distinct metadata contexts that the NBD

[PATCH] cpu_ppc64: compare CPU function is ignoring return value

2020-10-27 Thread Julio Faracco
Function to compare CPU on 64-bit PowerPC is ignoring the flag to avoid failure in case of CPUs (host and guest) are incompatible. Basically, the function is returning -1 even if it is set to continue. Signed-off-by: Julio Faracco --- src/cpu/cpu_ppc64.c | 4 ++-- 1 file changed, 2

Re: [PATCH] util: Avoid double free in virProcessSetAffinity

2020-10-27 Thread Peter Krempa
On Tue, Oct 27, 2020 at 13:59:17 +0100, Martin Kletzander wrote: > The cpu mask was free()'d immediately on any error and at the end of the > function, where it was expected that it would either error out and return or > goto another allocation if the code was to fail. However since commit >

Re: [PATCH] news: Mention nodedev support for CSS on S390

2020-10-27 Thread Andrea Bolognani
On Tue, 2020-10-27 at 13:52 +0100, Boris Fiuczynski wrote: > Signed-off-by: Boris Fiuczynski > --- > NEWS.rst | 6 ++ > 1 file changed, 6 insertions(+) Reviewed-by: Andrea Bolognani and pushed. -- Andrea Bolognani / Red Hat / Virtualization

Re: [PATCH] news: Mention nodedev support for CSS on S390

2020-10-27 Thread Cornelia Huck
On Tue, 27 Oct 2020 13:52:04 +0100 Boris Fiuczynski wrote: > Signed-off-by: Boris Fiuczynski > --- > NEWS.rst | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/NEWS.rst b/NEWS.rst > index 5bd8ed1c91..2fef3f706c 100644 > --- a/NEWS.rst > +++ b/NEWS.rst > @@ -13,6 +13,12 @@ v6.9.0

[PATCHv2 10/13] util: hash: Reimplement virHashTable using GHashTable

2020-10-27 Thread Peter Krempa
Glib's hash table provides basically the same functionality as our hash table. In most cases the only thing that remains in the virHash* wrappers is NULL-checks of '@table' argument as glib's hash functions don't tolerate NULL. In case of iterators, we adapt the existing API of iterators to

Re: [PATCH] Revert "spec: Simplify setting features off by default"

2020-10-27 Thread Andrea Bolognani
On Tue, 2020-10-27 at 14:05 +0100, Andrea Bolognani wrote: > I'm not convinced reverting this was the right call. > > The way RPM conditional macros work is that, if you have > > %{!?macro:value} > > that will expand to 'value' if 'macro' is *not* defined, and to > nothing otherwise. So if

Re: [PATCH] Revert "spec: Simplify setting features off by default"

2020-10-27 Thread Andrea Bolognani
On Tue, 2020-10-27 at 11:07 +0100, Michal Privoznik wrote: > On 10/26/20 10:53 PM, Neal Gompa wrote: > > As it turns out, the rather complicated structure that is > > currently used for enabling or disabling features in the libvirt > > build does not cleanly map well to RPM's bcond feature. > > >

[PATCH] util: Avoid double free in virProcessSetAffinity

2020-10-27 Thread Martin Kletzander
The cpu mask was free()'d immediately on any error and at the end of the function, where it was expected that it would either error out and return or goto another allocation if the code was to fail. However since commit 9514e24984ee the error path did not return in one new case which caused

[PATCH] news: Mention nodedev support for CSS on S390

2020-10-27 Thread Boris Fiuczynski
Signed-off-by: Boris Fiuczynski --- NEWS.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 5bd8ed1c91..2fef3f706c 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -13,6 +13,12 @@ v6.9.0 (unreleased) * **New features** + * nodedev: Add support for channel

[PATCH v3 2/7] migration/dirtyrate: set up framwork of domainGetDirtyRateInfo API

2020-10-27 Thread Hao Wang
Introduce DomainGetDirtyRateInfo API for domain's memory dirty rate calculation and query. Signed-off-by: Hao Wang Signed-off-by: Zhou Yimin Reviewed-by: Chuan Zheng --- include/libvirt/libvirt-domain.h | 5 src/driver-hypervisor.h | 7 + src/libvirt-domain.c |

migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2020-10-27 Thread Hao Wang
V2 -> V3: reorganize patchset to fix compile warning V1 -> V2: replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY Sometimes domain's memory dirty rate is expected by user in order to decide whether it's proper to be migrated out or not. We have already completed the QEMU part of the capability:

[PATCH v3 3/7] migration/dirtyrate: Implement qemuDomainGetDirtyRateInfo

2020-10-27 Thread Hao Wang
Implement qemuDomainGetDirtyRateInfo: using flags to control behaviors -- calculate and/or query dirtyrate. Signed-off-by: Hao Wang Reviewed-by: Chuan Zheng --- include/libvirt/libvirt-domain.h | 11 +++ src/qemu/qemu_driver.c | 51 ++-- 2 files

[PATCH v3 6/7] migration/dirtyrate: Implement qemuMonitorJSONExtractDirtyRateInfo

2020-10-27 Thread Hao Wang
Implement qemuMonitorJSONExtractDirtyRateInfo to deal with the return from qmp "query-dirty-rate", and store them in virDomainDirtyRateInfo. Signed-off-by: Hao Wang Reviewed-by: Chuan Zheng --- include/libvirt/libvirt-domain.h | 16 + src/qemu/qemu_monitor_json.c | 58

[PATCH v3 4/7] migration/dirtyrate: Implement qemuDomainCalculateDirtyRate

2020-10-27 Thread Hao Wang
Implement qemuDomainCalculateDirtyRate which calculates domain's memory dirty rate calling qmp "calc-dirty-rate". Signed-off-by: Hao Wang Signed-off-by: Zhou Yimin Reviewed-by: Chuan Zheng --- src/qemu/qemu_driver.c | 6 +- src/qemu/qemu_migration.c| 28

[PATCH v3 7/7] migration/dirtyrate: Introduce getdirtyrate virsh api

2020-10-27 Thread Hao Wang
Signed-off-by: Hao Wang Signed-off-by: Zhou Yimin Reviewed-by: Chuan Zheng --- tools/virsh-domain.c | 112 +++ 1 file changed, 112 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ef347585e8..c1361ea6a9 100644 ---

[PATCH v3 5/7] migration/dirtyrate: Implement qemuDomainCalculateDirtyRate

2020-10-27 Thread Hao Wang
Implement qemuDomainCalculateDirtyRate which calculates domain's memory dirty rate calling qmp "calc-dirty-rate". Signed-off-by: Hao Wang Signed-off-by: Zhou Yimin Reviewed-by: Chuan Zheng --- src/qemu/qemu_driver.c | 6 +- src/qemu/qemu_migration.c| 31

[PATCH v3 1/7] migration/dirtyrate: Introduce virDomainDirtyRateInfo structure

2020-10-27 Thread Hao Wang
Introduce virDomainDirtyRateInfo structure used for domain's memory dirty rate query. Signed-off-by: Hao Wang Reviewed-by: Chuan Zheng --- include/libvirt/libvirt-domain.h | 24 1 file changed, 24 insertions(+) diff --git a/include/libvirt/libvirt-domain.h

Re: [PATCH v6 04/11] nbd: Update qapi to support exporting multiple bitmaps

2020-10-27 Thread Peter Krempa
On Tue, Oct 27, 2020 at 00:05:49 -0500, Eric Blake wrote: > Since 'block-export-add' is new to 5.2, we can still tweak the > interface; there, allowing 'bitmaps':['str'] is nicer than > 'bitmap':'str'. This wires up the qapi and qemu-nbd changes to permit > passing multiple bitmaps as distinct

Re: [PATCH 10/13] util: hash: Reimplement virHashTable using GHashTable

2020-10-27 Thread Daniel P . Berrangé
On Tue, Oct 27, 2020 at 01:09:38PM +0100, Peter Krempa wrote: > On Tue, Oct 27, 2020 at 10:04:33 +, Daniel Berrange wrote: > > On Tue, Oct 27, 2020 at 10:53:12AM +0100, Peter Krempa wrote: > > > On Mon, Oct 26, 2020 at 16:08:34 +, Daniel Berrange wrote: > > > > On Mon, Oct 26, 2020 at

Re: [PATCH 10/13] util: hash: Reimplement virHashTable using GHashTable

2020-10-27 Thread Peter Krempa
On Tue, Oct 27, 2020 at 10:04:33 +, Daniel Berrange wrote: > On Tue, Oct 27, 2020 at 10:53:12AM +0100, Peter Krempa wrote: > > On Mon, Oct 26, 2020 at 16:08:34 +, Daniel Berrange wrote: > > > On Mon, Oct 26, 2020 at 04:45:50PM +0100, Peter Krempa wrote: > > > > Glib's hash table provides

Re: [PATCH] rpm: Fix handling of SOURCE_DATE_EPOCH

2020-10-27 Thread Neal Gompa
On Tue, Oct 27, 2020 at 6:24 AM Michal Privoznik wrote: > > On 10/26/20 11:08 PM, Neal Gompa wrote: > > Contemporary versions of Fedora automatically set SOURCE_DATE_EPOCH > > based on the changelog entry date stamp. In scenarios where it already > > is defined, we do not want to redefine it. > >

Re: [PATCH 0/6] Hyper-V code cleanup

2020-10-27 Thread Michal Privoznik
On 10/22/20 6:38 PM, Matt Coleman wrote: Here's a draft GitLab MR if you'd prefer to review the changes there: https://gitlab.com/iammattcoleman/libvirt/-/merge_requests/3/diffs Matt Coleman (6): hyperv: reformat WQL query strings hyperv: remove duplicate function hypervGetVSSDFromUUID()

Re: [PATCH] rpm: Fix handling of SOURCE_DATE_EPOCH

2020-10-27 Thread Michal Privoznik
On 10/26/20 11:08 PM, Neal Gompa wrote: Contemporary versions of Fedora automatically set SOURCE_DATE_EPOCH based on the changelog entry date stamp. In scenarios where it already is defined, we do not want to redefine it. This part is okay. Additionally, when building the libvirt package in

Re: [PATCH] Revert "spec: Simplify setting features off by default"

2020-10-27 Thread Michal Privoznik
On 10/26/20 10:53 PM, Neal Gompa wrote: As it turns out, the rather complicated structure that is currently used for enabling or disabling features in the libvirt build does not cleanly map well to RPM's bcond feature. Consequently, we need these back in order to support trivially activating

Re: [PATCH 10/13] util: hash: Reimplement virHashTable using GHashTable

2020-10-27 Thread Daniel P . Berrangé
On Tue, Oct 27, 2020 at 10:53:12AM +0100, Peter Krempa wrote: > On Mon, Oct 26, 2020 at 16:08:34 +, Daniel Berrange wrote: > > On Mon, Oct 26, 2020 at 04:45:50PM +0100, Peter Krempa wrote: > > > Glib's hash table provides basically the same functionality as our hash > > > table. > > > > > >

Re: [PATCH 10/13] util: hash: Reimplement virHashTable using GHashTable

2020-10-27 Thread Peter Krempa
On Mon, Oct 26, 2020 at 16:08:34 +, Daniel Berrange wrote: > On Mon, Oct 26, 2020 at 04:45:50PM +0100, Peter Krempa wrote: > > Glib's hash table provides basically the same functionality as our hash > > table. > > > > In most cases the only thing that remains in the virHash* wrappers is > >

Re: [libvirt PATCH 0/2] rpc: Fix virt-ssh-helper detection

2020-10-27 Thread Daniel P . Berrangé
On Tue, Oct 27, 2020 at 12:28:43AM +0100, Andrea Bolognani wrote: > See patch 1 for details. > > Andrea Bolognani (2): > rpc: Fix virt-ssh-helper detection > news: Mention virt-ssh-helper detection fix Reviewed-by: Daniel P. Berrangé Regards, Daniel -- |: https://berrange.com -o-

Re: [PATCH] util: Add phys_port_name support on virPCIGetNetName

2020-10-27 Thread Dmytro Linkin
On Mon, Sep 28, 2020 at 12:56:12PM +0300, Dmytro Linkin wrote: > On Tue, Sep 22, 2020 at 08:31:15AM -0400, Laine Stump wrote: > > On 8/28/20 6:53 AM, Dmytro Linkin wrote: > > >Current virPCIGetNetName() logic is to get net device name by checking > > >it's phys_port_id, if caller provide it, or by