[PATCH] qga/vss-win32: Add VSS provider unregistration retry

Elizabeth Ashurov posted 1 patch 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250617174733.156349-1-eashurov@redhat.com
Maintainers: Konstantin Kostiuk <kkostiuk@redhat.com>, Michael Roth <michael.roth@amd.com>
There is a newer version of this series
qga/vss-win32/install.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
[PATCH] qga/vss-win32: Add VSS provider unregistration retry
Posted by Elizabeth Ashurov 5 months ago
This commit improves the QGA VSS provider installation flow
by attempting to unregister the VSS provider if it's already
found during installation. This allows for a retry of installation
even if a previous unregistration failed or was not performed.

Signed-off-by: Elizabeth Ashurov <eashurov@redhat.com>
---
 qga/vss-win32/install.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 5cea5bcf74..a136d46050 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -263,6 +263,7 @@ STDAPI COMRegister(void)
     qga_debug_begin;
 
     HRESULT hr;
+    HRESULT unregisterHr;
     COMInitializer initializer;
     COMPointer<IUnknown> pUnknown;
     COMPointer<ICOMAdminCatalog2> pCatalog;
@@ -287,9 +288,13 @@ STDAPI COMRegister(void)
 
     chk(QGAProviderFind(QGAProviderCount, (void *)&count));
     if (count) {
-        errmsg(E_ABORT, "QGA VSS Provider is already installed");
-        qga_debug_end;
-        return E_ABORT;
+        qga_debug("QGA VSS Provider is already installed. Attempting to unregister first.");
+        unregisterHr = COMUnregister();
+        if (FAILED(unregisterHr)) {
+            errmsg(unregisterHr, "Failed to unregister existing QGA VSS Provider. Aborting installation.");
+            qga_debug_end;
+            return E_ABORT; 
+        }
     }
 
     chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL, CLSCTX_INPROC_SERVER,
-- 
2.49.0
Re: [PATCH] qga/vss-win32: Add VSS provider unregistration retry
Posted by Kostiantyn Kostiuk 5 months ago
Best Regards,
Konstantin Kostiuk.


On Tue, Jun 17, 2025 at 8:47 PM Elizabeth Ashurov <eashurov@redhat.com>
wrote:

> This commit improves the QGA VSS provider installation flow
> by attempting to unregister the VSS provider if it's already
> found during installation. This allows for a retry of installation
> even if a previous unregistration failed or was not performed.
>

Please add:
This will prevent inconsistencies between QGA and QGA-VSS versions.
Before this commit, QGA can use QGA-VSS from the previous installation.


>
> Signed-off-by: Elizabeth Ashurov <eashurov@redhat.com>
> ---
>  qga/vss-win32/install.cpp | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> index 5cea5bcf74..a136d46050 100644
> --- a/qga/vss-win32/install.cpp
> +++ b/qga/vss-win32/install.cpp
> @@ -263,6 +263,7 @@ STDAPI COMRegister(void)
>      qga_debug_begin;
>
>      HRESULT hr;
> +    HRESULT unregisterHr;
>
extra HRESULT is redundant; you can reuse existing one


>      COMInitializer initializer;
>      COMPointer<IUnknown> pUnknown;
>      COMPointer<ICOMAdminCatalog2> pCatalog;
> @@ -287,9 +288,13 @@ STDAPI COMRegister(void)
>
>      chk(QGAProviderFind(QGAProviderCount, (void *)&count));
>      if (count) {
> -        errmsg(E_ABORT, "QGA VSS Provider is already installed");
> -        qga_debug_end;
> -        return E_ABORT;
> +        qga_debug("QGA VSS Provider is already installed. Attempting to
> unregister first.");
> +        unregisterHr = COMUnregister();
> +        if (FAILED(unregisterHr)) {
> +            errmsg(unregisterHr, "Failed to unregister existing QGA VSS
> Provider. Aborting installation.");
> +            qga_debug_end;
> +            return E_ABORT;
>

.git/rebase-apply/patch:29: trailing whitespace.
            return E_ABORT;
warning: 1 line adds whitespace errors.
please fix

> +        }
>      }
>
>      chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL,
> CLSCTX_INPROC_SERVER,
> --
> 2.49.0
>
>