[PATCH 11/12] shutdown: Implement internal API for xen driver

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

 



---
 src/xen/xen_driver.c     |   14 +++++++++++---
 src/xen/xen_driver.h     |    2 +-
 src/xen/xen_hypervisor.c |    2 +-
 src/xen/xen_inotify.c    |    2 +-
 src/xen/xend_internal.c  |   10 +++++++---
 src/xen/xend_internal.h  |    2 +-
 src/xen/xm_internal.c    |    2 +-
 src/xen/xs_internal.c    |   10 +++++++---
 src/xen/xs_internal.h    |    3 ++-
 9 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index e256c33..758d00a 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -872,21 +872,28 @@ xenUnifiedDomainResume (virDomainPtr dom)
 }
 
 static int
-xenUnifiedDomainShutdown (virDomainPtr dom)
+xenUnifiedDomainShutdownFlags (virDomainPtr dom,
+                               unsigned int flags)
 {
     GET_PRIVATE(dom->conn);
     int i;
 
     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] &&
-            drivers[i]->domainShutdown &&
-            drivers[i]->domainShutdown (dom) == 0)
+            drivers[i]->domainShutdownFlags &&
+            drivers[i]->domainShutdownFlags (dom, flags) == 0)
             return 0;
 
     return -1;
 }
 
 static int
+xenUnifiedDomainShutdown (virDomainPtr dom)
+{
+    return xenUnifiedDomainShutdownFlags(dom, 0);
+}
+
+static int
 xenUnifiedDomainReboot (virDomainPtr dom, unsigned int flags)
 {
     GET_PRIVATE(dom->conn);
@@ -2213,6 +2220,7 @@ static virDriver xenUnifiedDriver = {
     .domainSuspend = xenUnifiedDomainSuspend, /* 0.0.3 */
     .domainResume = xenUnifiedDomainResume, /* 0.0.3 */
     .domainShutdown = xenUnifiedDomainShutdown, /* 0.0.3 */
+    .domainShutdownFlags = xenUnifiedDomainShutdownFlags, /* 0.9.4 */
     .domainReboot = xenUnifiedDomainReboot, /* 0.1.0 */
     .domainDestroy = xenUnifiedDomainDestroy, /* 0.0.3 */
     .domainDestroyFlags = xenUnifiedDomainDestroyFlags, /* 0.9.4 */
diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
index 039aea3..eed21c7 100644
--- a/src/xen/xen_driver.h
+++ b/src/xen/xen_driver.h
@@ -92,7 +92,7 @@ struct xenUnifiedDriver {
         virDrvDomainCreateXML		domainCreateXML;
         virDrvDomainSuspend		domainSuspend;
         virDrvDomainResume		domainResume;
-        virDrvDomainShutdown		domainShutdown;
+        virDrvDomainShutdownFlags   domainShutdownFlags;
         virDrvDomainReboot		domainReboot;
         virDrvDomainDestroyFlags        domainDestroyFlags;
         virDrvDomainGetOSType		domainGetOSType;
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 0309d8a..4cf8ada 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -813,7 +813,7 @@ struct xenUnifiedDriver xenHypervisorDriver = {
     NULL, /* domainCreateXML */
     xenHypervisorPauseDomain, /* domainSuspend */
     xenHypervisorResumeDomain, /* domainResume */
-    NULL, /* domainShutdown */
+    NULL, /* domainShutdownFlags */
     NULL, /* domainReboot */
     xenHypervisorDestroyDomainFlags, /* domainDestroyFlags */
     xenHypervisorDomainGetOSType, /* domainGetOSType */
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 1496330..1ae8a9b 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -60,7 +60,7 @@ struct xenUnifiedDriver xenInotifyDriver = {
     NULL, /* domainCreateLinux */
     NULL, /* domainSuspend */
     NULL, /* domainResume */
-    NULL, /* domainShutdown */
+    NULL, /* domainShutdownFlags */
     NULL, /* domainReboot */
     NULL, /* domainDestroyFlags */
     NULL, /* domainGetOSType */
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index cec2e01..71f5cd5 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1452,8 +1452,9 @@ xenDaemonDomainResume(virDomainPtr domain)
 }
 
 /**
- * xenDaemonDomainShutdown:
+ * xenDaemonDomainShutdownFlags:
  * @domain: pointer to the Domain block
+ * @flags: an OR'ed set of virDomainShutdownFlagsValues
  *
  * Shutdown the domain, the OS is requested to properly shutdown
  * and the domain may ignore it.  It will return immediately
@@ -1462,8 +1463,11 @@ xenDaemonDomainResume(virDomainPtr domain)
  * Returns 0 in case of success, -1 (with errno) in case of error.
  */
 int
-xenDaemonDomainShutdown(virDomainPtr domain)
+xenDaemonDomainShutdownFlags(virDomainPtr domain,
+                             unsigned int flags)
 {
+    virCheckFlags(0, -1);
+
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
         virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
@@ -3945,7 +3949,7 @@ struct xenUnifiedDriver xenDaemonDriver = {
     xenDaemonCreateXML,          /* domainCreateXML */
     xenDaemonDomainSuspend,      /* domainSuspend */
     xenDaemonDomainResume,       /* domainResume */
-    xenDaemonDomainShutdown,     /* domainShutdown */
+    xenDaemonDomainShutdownFlags,   /* domainShutdownFlags */
     xenDaemonDomainReboot,       /* domainReboot */
     xenDaemonDomainDestroyFlags, /* domainDestroyFlags */
     xenDaemonDomainGetOSType,    /* domainGetOSType */
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index a5dd359..af623a3 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -103,7 +103,7 @@ int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
 int xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps);
 int xenDaemonDomainSuspend(virDomainPtr domain);
 int xenDaemonDomainResume(virDomainPtr domain);
-int xenDaemonDomainShutdown(virDomainPtr domain);
+int xenDaemonDomainShutdownFlags(virDomainPtr domain, unsigned int flags);
 int xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags);
 int xenDaemonDomainDestroyFlags(virDomainPtr domain, unsigned int flags);
 int xenDaemonDomainSave(virDomainPtr domain, const char *filename);
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 185303b..f6e2478 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -92,7 +92,7 @@ struct xenUnifiedDriver xenXMDriver = {
     NULL, /* domainCreateXML */
     NULL, /* domainSuspend */
     NULL, /* domainResume */
-    NULL, /* domainShutdown */
+    NULL, /* domainShutdownFlags */
     NULL, /* domainReboot */
     NULL, /* domainDestroyFlags */
     NULL, /* domainGetOSType */
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index c1b00e5..8816af1 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -53,7 +53,7 @@ struct xenUnifiedDriver xenStoreDriver = {
     NULL, /* domainCreateXML */
     NULL, /* domainSuspend */
     NULL, /* domainResume */
-    xenStoreDomainShutdown, /* domainShutdown */
+    xenStoreDomainShutdownFlags, /* domainShutdownFlags */
     xenStoreDomainReboot, /* domainReboot */
     NULL, /* domainDestroyFlags */
     xenStoreDomainGetOSType, /* domainGetOSType */
@@ -738,8 +738,9 @@ done:
 }
 
 /**
- * xenStoreDomainShutdown:
+ * xenStoreDomainShutdownFlags:
  * @domain: pointer to the Domain block
+ * @flags: an OR'ed set of virDomainShutdownFlagsValues
  *
  * Shutdown the domain, the OS is requested to properly shutdown
  * and the domain may ignore it.  It will return immediately
@@ -748,11 +749,14 @@ done:
  * Returns 0 in case of success, -1 in case of error.
  */
 int
-xenStoreDomainShutdown(virDomainPtr domain)
+xenStoreDomainShutdownFlags(virDomainPtr domain,
+                            unsigned int flags)
 {
     int ret;
     xenUnifiedPrivatePtr priv;
 
+    virCheckFlags(0, -1);
+
     if ((domain == NULL) || (domain->conn == NULL)) {
         virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
diff --git a/src/xen/xs_internal.h b/src/xen/xs_internal.h
index 0278799..5d823d8 100644
--- a/src/xen/xs_internal.h
+++ b/src/xen/xs_internal.h
@@ -37,7 +37,8 @@ unsigned long	xenStoreGetMaxMemory	(virDomainPtr domain);
 int		xenStoreDomainSetMemory	(virDomainPtr domain,
                                          unsigned long memory);
 unsigned long	xenStoreDomainGetMaxMemory(virDomainPtr domain);
-int		xenStoreDomainShutdown	(virDomainPtr domain);
+int		xenStoreDomainShutdownFlags     (virDomainPtr domain,
+                                         unsigned int flags);
 int		xenStoreDomainReboot	(virDomainPtr domain,
                                          unsigned int flags);
 
-- 
1.7.5.rc3

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]