[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/4] api: Add new public api for 'reset'



On 2011年09月28日 17:46, Daniel Veillard wrote:
On Wed, Sep 28, 2011 at 05:03:05PM +0800, Xu He Jie wrote:
Add new public api for 'reset'.
It can reset domain immediately without any guest shutdown.

Signed-off-by: Xu He Jie<xuhj linux vnet ibm com>
---
  include/libvirt/libvirt.h.in |    2 +
  src/driver.h                 |    3 ++
  src/libvirt.c                |   44 ++++++++++++++++++++++++++++++++++++++++++
  src/libvirt_public.syms      |    5 ++++
  4 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 39155a6..3d60023 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1031,6 +1031,8 @@ virDomainPtr            virDomainLookupByUUIDString     (virConnectPtr conn,
  int                     virDomainShutdown       (virDomainPtr domain);
  int                     virDomainReboot         (virDomainPtr domain,
                                                   unsigned int flags);
+int                     virDomainReset          (virDomainPtr domain);
+
   I would add flags even if unused yet
ok.
  int                     virDomainDestroy        (virDomainPtr domain);
  int                     virDomainDestroyFlags   (virDomainPtr domain,
                                                   unsigned int flags);
diff --git a/src/driver.h b/src/driver.h
index 3792003..fd0d3a1 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -124,6 +124,8 @@ typedef int
          (*virDrvDomainReboot)		(virDomainPtr domain,
                                           unsigned int flags);
  typedef int
+        (*virDrvDomainReset)        (virDomainPtr domain);
+typedef int
          (*virDrvDomainDestroy)		(virDomainPtr domain);
  typedef int
          (*virDrvDomainDestroyFlags) (virDomainPtr domain,
@@ -755,6 +757,7 @@ struct _virDriver {
      virDrvDomainResume		domainResume;
      virDrvDomainShutdown		domainShutdown;
      virDrvDomainReboot		domainReboot;
+    virDrvDomainReset       domainReset;
      virDrvDomainDestroy		domainDestroy;
      virDrvDomainDestroyFlags    domainDestroyFlags;
      virDrvDomainGetOSType		domainGetOSType;
diff --git a/src/libvirt.c b/src/libvirt.c
index 8f94b11..3c5cd5e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3017,6 +3017,50 @@ error:
  }

  /**
+ * virDomainReset:
+ * @domain: a domain object
+ *
+ * Reset a domain immediately without any guest shutdown
   Hum, so the goal of the reset operation is that it resets the
domain. That's a bit light in terms of semantic. What does that
mean actually ?
   Does that emulate the power reset of a button on a machine, i.e.
all hardware see the RST line set and reinitialize their internal state
?
If yes the obvious danger of this operation about loss of data should be
made very clear.
Yes, It is danger of this operation. I can add clearer comment
in here and virsh's help description.
+ * Returns 0 in case of success and -1 in case of failure.
+ */
+int
+virDomainReset(virDomainPtr domain)
   Daniel

Thanks!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]