All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qemu-ga v2] Make QGA VSS provider service run only when needed
@ 2017-03-23 16:26 Sameeh Jubran
  2017-03-23 16:26 ` [Qemu-devel] [PATCH qemu-ga v2] qemu-ga: " Sameeh Jubran
  0 siblings, 1 reply; 4+ messages in thread
From: Sameeh Jubran @ 2017-03-23 16:26 UTC (permalink / raw)
  To: qemu-devel, Michael Roth; +Cc: Yan Vugenfirer

Difference from v1:
Added missing install.h file

Sameeh Jubran (1):
  qemu-ga: Make QGA VSS provider service run only when needed

 qga/vss-win32/install.cpp   | 28 ++++++++++++++++++++++++++--
 qga/vss-win32/install.h     | 20 ++++++++++++++++++++
 qga/vss-win32/requester.cpp |  2 ++
 3 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 qga/vss-win32/install.h

-- 
2.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH qemu-ga v2] qemu-ga: Make QGA VSS provider service run only when needed
  2017-03-23 16:26 [Qemu-devel] [PATCH qemu-ga v2] Make QGA VSS provider service run only when needed Sameeh Jubran
@ 2017-03-23 16:26 ` Sameeh Jubran
  2017-04-02  7:30   ` Sameeh Jubran
  2017-04-04 23:26   ` Michael Roth
  0 siblings, 2 replies; 4+ messages in thread
From: Sameeh Jubran @ 2017-03-23 16:26 UTC (permalink / raw)
  To: qemu-devel, Michael Roth; +Cc: Yan Vugenfirer

Currently the service runs in background on boot even though it is not
needed and once it is running it never stops. The service needs to be
running only during freeze operation and it should be stopped after
executing thaw.

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
---
 qga/vss-win32/install.cpp   | 28 ++++++++++++++++++++++++++--
 qga/vss-win32/install.h     | 20 ++++++++++++++++++++
 qga/vss-win32/requester.cpp |  2 ++
 3 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 qga/vss-win32/install.h

diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index f4160a3..f41fcdf 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -14,7 +14,7 @@
 
 #include "vss-common.h"
 #include <inc/win2003/vscoordint.h>
-#include <comadmin.h>
+#include "install.h"
 #include <wbemidl.h>
 #include <comdef.h>
 #include <comutil.h>
@@ -276,7 +276,7 @@ STDAPI COMRegister(void)
 
     chk(pCatalog->CreateServiceForApplication(
             _bstr_t(QGA_PROVIDER_LNAME), _bstr_t(QGA_PROVIDER_LNAME),
-            _bstr_t(L"SERVICE_AUTO_START"), _bstr_t(L"SERVICE_ERROR_NORMAL"),
+            _bstr_t(L"SERVICE_DEMAND_START"), _bstr_t(L"SERVICE_ERROR_NORMAL"),
             _bstr_t(L""), _bstr_t(L".\\localsystem"), _bstr_t(L""), FALSE));
     chk(pCatalog->InstallComponent(_bstr_t(QGA_PROVIDER_LNAME),
                                    _bstr_t(dllPath), _bstr_t(tlbPath),
@@ -461,3 +461,27 @@ namespace _com_util
         return bstr;
     }
 }
+
+/* Stop QGA VSS provider service from COM+ Application Admin Catalog */
+
+STDAPI StopService(void)
+{
+    HRESULT hr;
+    COMInitializer initializer;
+    COMPointer<IUnknown> pUnknown;
+    COMPointer<ICOMAdminCatalog2> pCatalog;
+
+    int count = 0;
+
+    chk(QGAProviderFind(QGAProviderCount, (void *)&count));
+    if (count) {
+        chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL, CLSCTX_INPROC_SERVER,
+            IID_IUnknown, (void **)pUnknown.replace()));
+        chk(pUnknown->QueryInterface(IID_ICOMAdminCatalog2,
+            (void **)pCatalog.replace()));
+        chk(pCatalog->ShutdownApplication(_bstr_t(QGA_PROVIDER_LNAME)));
+    }
+
+out:
+    return hr;
+}
diff --git a/qga/vss-win32/install.h b/qga/vss-win32/install.h
new file mode 100644
index 0000000..35364af
--- /dev/null
+++ b/qga/vss-win32/install.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU Guest Agent VSS requester declarations
+ *
+ * Copyright Hitachi Data Systems Corp. 2013
+ *
+ * Authors:
+ *  Tomoki Sekiyama   <tomoki.sekiyama@hds.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef INSTALL_H
+#define INSTALL_H
+
+#include <comadmin.h>
+
+STDAPI StopService(void);
+
+#endif
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 272e71b..27308ad 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "vss-common.h"
 #include "requester.h"
+#include "install.h"
 #include <inc/win2003/vswriter.h>
 #include <inc/win2003/vsbackup.h>
 
@@ -501,4 +502,5 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
     requester_cleanup();
 
     CoUninitialize();
+    StopService();
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH qemu-ga v2] qemu-ga: Make QGA VSS provider service run only when needed
  2017-03-23 16:26 ` [Qemu-devel] [PATCH qemu-ga v2] qemu-ga: " Sameeh Jubran
@ 2017-04-02  7:30   ` Sameeh Jubran
  2017-04-04 23:26   ` Michael Roth
  1 sibling, 0 replies; 4+ messages in thread
From: Sameeh Jubran @ 2017-04-02  7:30 UTC (permalink / raw)
  To: QEMU Developers, Michael Roth; +Cc: Yan Vugenfirer

Ping.

On Thu, Mar 23, 2017 at 7:26 PM, Sameeh Jubran <sameeh@daynix.com> wrote:

> Currently the service runs in background on boot even though it is not
> needed and once it is running it never stops. The service needs to be
> running only during freeze operation and it should be stopped after
> executing thaw.
>
> Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
> ---
>  qga/vss-win32/install.cpp   | 28 ++++++++++++++++++++++++++--
>  qga/vss-win32/install.h     | 20 ++++++++++++++++++++
>  qga/vss-win32/requester.cpp |  2 ++
>  3 files changed, 48 insertions(+), 2 deletions(-)
>  create mode 100644 qga/vss-win32/install.h
>
> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> index f4160a3..f41fcdf 100644
> --- a/qga/vss-win32/install.cpp
> +++ b/qga/vss-win32/install.cpp
> @@ -14,7 +14,7 @@
>
>  #include "vss-common.h"
>  #include <inc/win2003/vscoordint.h>
> -#include <comadmin.h>
> +#include "install.h"
>  #include <wbemidl.h>
>  #include <comdef.h>
>  #include <comutil.h>
> @@ -276,7 +276,7 @@ STDAPI COMRegister(void)
>
>      chk(pCatalog->CreateServiceForApplication(
>              _bstr_t(QGA_PROVIDER_LNAME), _bstr_t(QGA_PROVIDER_LNAME),
> -            _bstr_t(L"SERVICE_AUTO_START"), _bstr_t(L"SERVICE_ERROR_
> NORMAL"),
> +            _bstr_t(L"SERVICE_DEMAND_START"), _bstr_t(L"SERVICE_ERROR_
> NORMAL"),
>              _bstr_t(L""), _bstr_t(L".\\localsystem"), _bstr_t(L""),
> FALSE));
>      chk(pCatalog->InstallComponent(_bstr_t(QGA_PROVIDER_LNAME),
>                                     _bstr_t(dllPath), _bstr_t(tlbPath),
> @@ -461,3 +461,27 @@ namespace _com_util
>          return bstr;
>      }
>  }
> +
> +/* Stop QGA VSS provider service from COM+ Application Admin Catalog */
> +
> +STDAPI StopService(void)
> +{
> +    HRESULT hr;
> +    COMInitializer initializer;
> +    COMPointer<IUnknown> pUnknown;
> +    COMPointer<ICOMAdminCatalog2> pCatalog;
> +
> +    int count = 0;
> +
> +    chk(QGAProviderFind(QGAProviderCount, (void *)&count));
> +    if (count) {
> +        chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL,
> CLSCTX_INPROC_SERVER,
> +            IID_IUnknown, (void **)pUnknown.replace()));
> +        chk(pUnknown->QueryInterface(IID_ICOMAdminCatalog2,
> +            (void **)pCatalog.replace()));
> +        chk(pCatalog->ShutdownApplication(_bstr_t(QGA_PROVIDER_LNAME)));
> +    }
> +
> +out:
> +    return hr;
> +}
> diff --git a/qga/vss-win32/install.h b/qga/vss-win32/install.h
> new file mode 100644
> index 0000000..35364af
> --- /dev/null
> +++ b/qga/vss-win32/install.h
> @@ -0,0 +1,20 @@
> +/*
> + * QEMU Guest Agent VSS requester declarations
> + *
> + * Copyright Hitachi Data Systems Corp. 2013
> + *
> + * Authors:
> + *  Tomoki Sekiyama   <tomoki.sekiyama@hds.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef INSTALL_H
> +#define INSTALL_H
> +
> +#include <comadmin.h>
> +
> +STDAPI StopService(void);
> +
> +#endif
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> index 272e71b..27308ad 100644
> --- a/qga/vss-win32/requester.cpp
> +++ b/qga/vss-win32/requester.cpp
> @@ -13,6 +13,7 @@
>  #include "qemu/osdep.h"
>  #include "vss-common.h"
>  #include "requester.h"
> +#include "install.h"
>  #include <inc/win2003/vswriter.h>
>  #include <inc/win2003/vsbackup.h>
>
> @@ -501,4 +502,5 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
>      requester_cleanup();
>
>      CoUninitialize();
> +    StopService();
>  }
> --
> 2.9.3
>
>


-- 
Respectfully,
*Sameeh Jubran*
*Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>*
*Software Engineer @ Daynix <http://www.daynix.com>.*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH qemu-ga v2] qemu-ga: Make QGA VSS provider service run only when needed
  2017-03-23 16:26 ` [Qemu-devel] [PATCH qemu-ga v2] qemu-ga: " Sameeh Jubran
  2017-04-02  7:30   ` Sameeh Jubran
@ 2017-04-04 23:26   ` Michael Roth
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Roth @ 2017-04-04 23:26 UTC (permalink / raw)
  To: Sameeh Jubran, qemu-devel; +Cc: Yan Vugenfirer

Quoting Sameeh Jubran (2017-03-23 11:26:50)
> Currently the service runs in background on boot even though it is not
> needed and once it is running it never stops. The service needs to be
> running only during freeze operation and it should be stopped after
> executing thaw.
> 
> Signed-off-by: Sameeh Jubran <sameeh@daynix.com>


Thanks, applied to qga tree:

  https://github.com/mdroth/qemu/commits/qga

> ---
>  qga/vss-win32/install.cpp   | 28 ++++++++++++++++++++++++++--
>  qga/vss-win32/install.h     | 20 ++++++++++++++++++++
>  qga/vss-win32/requester.cpp |  2 ++
>  3 files changed, 48 insertions(+), 2 deletions(-)
>  create mode 100644 qga/vss-win32/install.h
> 
> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> index f4160a3..f41fcdf 100644
> --- a/qga/vss-win32/install.cpp
> +++ b/qga/vss-win32/install.cpp
> @@ -14,7 +14,7 @@
> 
>  #include "vss-common.h"
>  #include <inc/win2003/vscoordint.h>
> -#include <comadmin.h>
> +#include "install.h"
>  #include <wbemidl.h>
>  #include <comdef.h>
>  #include <comutil.h>
> @@ -276,7 +276,7 @@ STDAPI COMRegister(void)
> 
>      chk(pCatalog->CreateServiceForApplication(
>              _bstr_t(QGA_PROVIDER_LNAME), _bstr_t(QGA_PROVIDER_LNAME),
> -            _bstr_t(L"SERVICE_AUTO_START"), _bstr_t(L"SERVICE_ERROR_NORMAL"),
> +            _bstr_t(L"SERVICE_DEMAND_START"), _bstr_t(L"SERVICE_ERROR_NORMAL"),
>              _bstr_t(L""), _bstr_t(L".\\localsystem"), _bstr_t(L""), FALSE));
>      chk(pCatalog->InstallComponent(_bstr_t(QGA_PROVIDER_LNAME),
>                                     _bstr_t(dllPath), _bstr_t(tlbPath),
> @@ -461,3 +461,27 @@ namespace _com_util
>          return bstr;
>      }
>  }
> +
> +/* Stop QGA VSS provider service from COM+ Application Admin Catalog */
> +
> +STDAPI StopService(void)
> +{
> +    HRESULT hr;
> +    COMInitializer initializer;
> +    COMPointer<IUnknown> pUnknown;
> +    COMPointer<ICOMAdminCatalog2> pCatalog;
> +
> +    int count = 0;
> +
> +    chk(QGAProviderFind(QGAProviderCount, (void *)&count));
> +    if (count) {
> +        chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL, CLSCTX_INPROC_SERVER,
> +            IID_IUnknown, (void **)pUnknown.replace()));
> +        chk(pUnknown->QueryInterface(IID_ICOMAdminCatalog2,
> +            (void **)pCatalog.replace()));
> +        chk(pCatalog->ShutdownApplication(_bstr_t(QGA_PROVIDER_LNAME)));
> +    }
> +
> +out:
> +    return hr;
> +}
> diff --git a/qga/vss-win32/install.h b/qga/vss-win32/install.h
> new file mode 100644
> index 0000000..35364af
> --- /dev/null
> +++ b/qga/vss-win32/install.h
> @@ -0,0 +1,20 @@
> +/*
> + * QEMU Guest Agent VSS requester declarations
> + *
> + * Copyright Hitachi Data Systems Corp. 2013
> + *
> + * Authors:
> + *  Tomoki Sekiyama   <tomoki.sekiyama@hds.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef INSTALL_H
> +#define INSTALL_H
> +
> +#include <comadmin.h>
> +
> +STDAPI StopService(void);
> +
> +#endif
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> index 272e71b..27308ad 100644
> --- a/qga/vss-win32/requester.cpp
> +++ b/qga/vss-win32/requester.cpp
> @@ -13,6 +13,7 @@
>  #include "qemu/osdep.h"
>  #include "vss-common.h"
>  #include "requester.h"
> +#include "install.h"
>  #include <inc/win2003/vswriter.h>
>  #include <inc/win2003/vsbackup.h>
> 
> @@ -501,4 +502,5 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
>      requester_cleanup();
> 
>      CoUninitialize();
> +    StopService();
>  }
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-04 23:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 16:26 [Qemu-devel] [PATCH qemu-ga v2] Make QGA VSS provider service run only when needed Sameeh Jubran
2017-03-23 16:26 ` [Qemu-devel] [PATCH qemu-ga v2] qemu-ga: " Sameeh Jubran
2017-04-02  7:30   ` Sameeh Jubran
2017-04-04 23:26   ` Michael Roth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.