[libvirt] [PATCH v2] qemu: fix pr-helper0 remain

Jie Wang posted 1 patch 4 years, 10 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1559288011-60350-1-git-send-email-wangjie88@huawei.com
src/qemu/qemu_hotplug.c | 3 +--
src/qemu/qemu_process.c | 3 ---
2 files changed, 1 insertion(+), 5 deletions(-)
[libvirt] [PATCH v2] qemu: fix pr-helper0 remain
Posted by Jie Wang 4 years, 10 months ago
If libvirt receive DISCONNECTED event and set prDaemonRunning to false,
and qemuDomainRemoveDiskDevice is performing in the meantime.
qemuDomainRemoveDiskDevice will return directly by prDaemonRunning
check, so the pr-helper0 object will remain.
In that case we should try harder and also kill the pr-helper process,
so qemuProcessKillManagedPRDaemon could use the same treatment.

Signed-off-by: Jie Wang <wangjie88@huawei.com>
---
 src/qemu/qemu_hotplug.c | 3 +--
 src/qemu/qemu_process.c | 3 ---
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 34249bd..5e4a929 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -465,8 +465,7 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver,
     virErrorPtr orig_err;
     int ret = -1;
 
-    if (!priv->prDaemonRunning ||
-        virDomainDefHasManagedPR(vm->def))
+    if (virDomainDefHasManagedPR(vm->def))
         return 0;
 
     virErrorPreserveLast(&orig_err);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 47d8ca2..8070a09 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2746,9 +2746,6 @@ qemuProcessKillManagedPRDaemon(virDomainObjPtr vm)
     virErrorPtr orig_err;
     char *pidfile;
 
-    if (!priv->prDaemonRunning)
-        return;
-
     if (!(pidfile = qemuProcessBuildPRHelperPidfilePath(vm))) {
         VIR_WARN("Unable to construct pr-helper pidfile path");
         return;
-- 
2.8.3.windows.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] qemu: fix pr-helper0 remain
Posted by wangjie (P) 4 years, 10 months ago
Ping

On 2019/5/31 15:33, Jie Wang wrote:
> If libvirt receive DISCONNECTED event and set prDaemonRunning to false,
> and qemuDomainRemoveDiskDevice is performing in the meantime.
> qemuDomainRemoveDiskDevice will return directly by prDaemonRunning
> check, so the pr-helper0 object will remain.
> In that case we should try harder and also kill the pr-helper process,
> so qemuProcessKillManagedPRDaemon could use the same treatment.
>
> Signed-off-by: Jie Wang <wangjie88@huawei.com>
> ---
>   src/qemu/qemu_hotplug.c | 3 +--
>   src/qemu/qemu_process.c | 3 ---
>   2 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 34249bd..5e4a929 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -465,8 +465,7 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver,
>       virErrorPtr orig_err;
>       int ret = -1;
>   
> -    if (!priv->prDaemonRunning ||
> -        virDomainDefHasManagedPR(vm->def))
> +    if (virDomainDefHasManagedPR(vm->def))
>           return 0;
>   
>       virErrorPreserveLast(&orig_err);
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 47d8ca2..8070a09 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -2746,9 +2746,6 @@ qemuProcessKillManagedPRDaemon(virDomainObjPtr vm)
>       virErrorPtr orig_err;
>       char *pidfile;
>   
> -    if (!priv->prDaemonRunning)
> -        return;
> -
>       if (!(pidfile = qemuProcessBuildPRHelperPidfilePath(vm))) {
>           VIR_WARN("Unable to construct pr-helper pidfile path");
>           return;

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list