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

[libvirt] [PATCH v4 5/6] undefine: Implement undefineFlags for all other drivers



---
 src/esx/esx_driver.c       |   11 ++++++++++-
 src/lxc/lxc_driver.c       |   11 ++++++++++-
 src/openvz/openvz_driver.c |   11 ++++++++++-
 src/test/test_driver.c     |   12 +++++++++++-
 src/uml/uml_driver.c       |   12 +++++++++++-
 src/vmware/vmware_driver.c |   12 +++++++++++-
 src/xen/xen_driver.c       |    9 ++++++++-
 7 files changed, 71 insertions(+), 7 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 9b0a541..5ed6a38 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3290,7 +3290,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
 
 
 static int
-esxDomainUndefine(virDomainPtr domain)
+esxDomainUndefineFlags(virDomainPtr domain,
+                       unsigned int flags)
 {
     int result = -1;
     esxPrivate *priv = domain->conn->privateData;
@@ -3299,6 +3300,8 @@ esxDomainUndefine(virDomainPtr domain)
     esxVI_String *propertyNameList = NULL;
     esxVI_VirtualMachinePowerState powerState;
 
+    virCheckFlags(0, -1);
+
     if (priv->vCenter != NULL) {
         ctx = priv->vCenter;
     } else {
@@ -3339,6 +3342,11 @@ esxDomainUndefine(virDomainPtr domain)
 }
 
 
+static int
+esxDomainUndefine(virDomainPtr domain)
+{
+    return esxDomainUndefineFlags(domain, 0);
+}
 
 static int
 esxDomainGetAutostart(virDomainPtr domain, int *autostart)
@@ -4747,6 +4755,7 @@ static virDriver esxDriver = {
     .domainCreateWithFlags = esxDomainCreateWithFlags, /* 0.8.2 */
     .domainDefineXML = esxDomainDefineXML, /* 0.7.2 */
     .domainUndefine = esxDomainUndefine, /* 0.7.1 */
+    .domainUndefineFlags = esxDomainUndefineFlags, /* 0.9.4 */
     .domainGetAutostart = esxDomainGetAutostart, /* 0.9.0 */
     .domainSetAutostart = esxDomainSetAutostart, /* 0.9.0 */
     .domainGetSchedulerType = esxDomainGetSchedulerType, /* 0.7.0 */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index fd1aea0..afac879 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -458,13 +458,16 @@ cleanup:
     return dom;
 }
 
-static int lxcDomainUndefine(virDomainPtr dom)
+static int lxcDomainUndefineFlags(virDomainPtr dom,
+                                  unsigned int flags)
 {
     lxc_driver_t *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     virDomainEventPtr event = NULL;
     int ret = -1;
 
+    virCheckFlags(0, -1);
+
     lxcDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     if (!vm) {
@@ -509,6 +512,11 @@ cleanup:
     return ret;
 }
 
+static int lxcDomainUndefine(virDomainPtr dom)
+{
+    return lxcDomainUndefineFlags(dom, 0);
+}
+
 static int lxcDomainGetInfo(virDomainPtr dom,
                             virDomainInfoPtr info)
 {
@@ -2935,6 +2943,7 @@ static virDriver lxcDriver = {
     .domainCreateWithFlags = lxcDomainStartWithFlags, /* 0.8.2 */
     .domainDefineXML = lxcDomainDefine, /* 0.4.2 */
     .domainUndefine = lxcDomainUndefine, /* 0.4.2 */
+    .domainUndefineFlags = lxcDomainUndefineFlags, /* 0.9.4 */
     .domainGetAutostart = lxcDomainGetAutostart, /* 0.7.0 */
     .domainSetAutostart = lxcDomainSetAutostart, /* 0.7.0 */
     .domainGetSchedulerType = lxcGetSchedulerType, /* 0.5.0 */
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index cc0c590..d24a5e3 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1085,13 +1085,16 @@ openvzDomainCreate(virDomainPtr dom)
 }
 
 static int
-openvzDomainUndefine(virDomainPtr dom)
+openvzDomainUndefineFlags(virDomainPtr dom,
+                          unsigned int flags)
 {
     struct openvz_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     const char *prog[] = { VZCTL, "--quiet", "destroy", PROGRAM_SENTINAL, NULL };
     int ret = -1;
 
+    virCheckFlags(0, -1);
+
     openvzDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     if (!vm) {
@@ -1123,6 +1126,11 @@ cleanup:
 }
 
 static int
+openvzDomainUndefine(virDomainPtr dom)
+{
+    return openvzDomainUndefineFlags(dom, 0);
+}
+static int
 openvzDomainSetAutostart(virDomainPtr dom, int autostart)
 {
     struct openvz_driver *driver = dom->conn->privateData;
@@ -1627,6 +1635,7 @@ static virDriver openvzDriver = {
     .domainCreateWithFlags = openvzDomainCreateWithFlags, /* 0.8.2 */
     .domainDefineXML = openvzDomainDefineXML, /* 0.3.3 */
     .domainUndefine = openvzDomainUndefine, /* 0.3.3 */
+    .domainUndefineFlags = openvzDomainUndefineFlags, /* 0.9.4 */
     .domainGetAutostart = openvzDomainGetAutostart, /* 0.4.6 */
     .domainSetAutostart = openvzDomainSetAutostart, /* 0.4.6 */
     .isEncrypted = openvzIsEncrypted, /* 0.7.3 */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 064a1cd..a68cc0d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2535,12 +2535,16 @@ static int testDomainCreate(virDomainPtr domain) {
     return testDomainCreateWithFlags(domain, 0);
 }
 
-static int testDomainUndefine(virDomainPtr domain) {
+static int testDomainUndefineFlags(virDomainPtr domain,
+                                   unsigned int flags)
+{
     testConnPtr privconn = domain->conn->privateData;
     virDomainObjPtr privdom;
     virDomainEventPtr event = NULL;
     int ret = -1;
 
+    virCheckFlags(0, -1);
+
     testDriverLock(privconn);
     privdom = virDomainFindByName(&privconn->domains,
                                   domain->name);
@@ -2573,6 +2577,11 @@ cleanup:
     return ret;
 }
 
+static int testDomainUndefine(virDomainPtr domain)
+{
+    return testDomainUndefineFlags(domain, 0);
+}
+
 static int testDomainGetAutostart(virDomainPtr domain,
                                   int *autostart)
 {
@@ -5556,6 +5565,7 @@ static virDriver testDriver = {
     .domainCreateWithFlags = testDomainCreateWithFlags, /* 0.8.2 */
     .domainDefineXML = testDomainDefineXML, /* 0.1.11 */
     .domainUndefine = testDomainUndefine, /* 0.1.11 */
+    .domainUndefineFlags = testDomainUndefineFlags, /* 0.9.4 */
     .domainGetAutostart = testDomainGetAutostart, /* 0.3.2 */
     .domainSetAutostart = testDomainSetAutostart, /* 0.3.2 */
     .domainGetSchedulerType = testDomainGetSchedulerType, /* 0.3.2 */
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 557c948..0d6f71a 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1778,11 +1778,15 @@ cleanup:
     return dom;
 }
 
-static int umlDomainUndefine(virDomainPtr dom) {
+static int umlDomainUndefineFlags(virDomainPtr dom,
+                                  unsigned int flags)
+{
     struct uml_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int ret = -1;
 
+    virCheckFlags(0, -1);
+
     umlDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     if (!vm) {
@@ -1819,6 +1823,11 @@ cleanup:
 }
 
 
+static int umlDomainUndefine(virDomainPtr dom)
+{
+    return umlDomainUndefineFlags(dom, 0);
+}
+
 static int umlDomainAttachUmlDisk(struct uml_driver *driver,
                                   virDomainObjPtr vm,
                                   virDomainDiskDefPtr disk)
@@ -2427,6 +2436,7 @@ static virDriver umlDriver = {
     .domainCreateWithFlags = umlDomainStartWithFlags, /* 0.8.2 */
     .domainDefineXML = umlDomainDefine, /* 0.5.0 */
     .domainUndefine = umlDomainUndefine, /* 0.5.0 */
+    .domainUndefineFlags = umlDomainUndefineFlags, /* 0.9.4 */
     .domainAttachDevice = umlDomainAttachDevice, /* 0.8.4 */
     .domainAttachDeviceFlags = umlDomainAttachDeviceFlags, /* 0.8.4 */
     .domainDetachDevice = umlDomainDetachDevice, /* 0.8.4 */
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 36b48e0..7cec310 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -609,12 +609,15 @@ vmwareDomainCreate(virDomainPtr dom)
 }
 
 static int
-vmwareDomainUndefine(virDomainPtr dom)
+vmwareDomainUndefineFlags(virDomainPtr dom,
+                          unsigned int flags)
 {
     struct vmware_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int ret = -1;
 
+    virCheckFlags(0, -1);
+
     vmwareDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
 
@@ -650,6 +653,12 @@ vmwareDomainUndefine(virDomainPtr dom)
     return ret;
 }
 
+static int
+vmwareDomainUndefine(virDomainPtr dom)
+{
+    return vmwareDomainUndefineFlags(dom, 0);
+}
+
 static virDomainPtr
 vmwareDomainLookupByID(virConnectPtr conn, int id)
 {
@@ -969,6 +978,7 @@ static virDriver vmwareDriver = {
     .domainCreateWithFlags = vmwareDomainCreateWithFlags, /* 0.8.7 */
     .domainDefineXML = vmwareDomainDefineXML, /* 0.8.7 */
     .domainUndefine = vmwareDomainUndefine, /* 0.8.7 */
+    .domainUndefineFlags = vmwareDomainUndefineFlags, /* 0.9.4 */
     .domainIsActive = vmwareDomainIsActive, /* 0.8.7 */
     .domainIsPersistent = vmwareDomainIsPersistent, /* 0.8.7 */
 };
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index dd1ba6c..3b5df46 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1527,11 +1527,12 @@ xenUnifiedDomainDefineXML (virConnectPtr conn, const char *xml)
 }
 
 static int
-xenUnifiedDomainUndefine (virDomainPtr dom)
+xenUnifiedDomainUndefineFlags (virDomainPtr dom, unsigned int flags)
 {
     GET_PRIVATE(dom->conn);
     int i;
 
+    virCheckFlags(0, -1);
     for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
         if (priv->opened[i] && drivers[i]->domainUndefine &&
             drivers[i]->domainUndefine (dom) == 0)
@@ -1541,6 +1542,11 @@ xenUnifiedDomainUndefine (virDomainPtr dom)
 }
 
 static int
+xenUnifiedDomainUndefine (virDomainPtr dom) {
+    return xenUnifiedDomainUndefineFlags(dom, 0);
+}
+
+static int
 xenUnifiedDomainAttachDevice (virDomainPtr dom, const char *xml)
 {
     GET_PRIVATE(dom->conn);
@@ -2223,6 +2229,7 @@ static virDriver xenUnifiedDriver = {
     .domainCreateWithFlags = xenUnifiedDomainCreateWithFlags, /* 0.8.2 */
     .domainDefineXML = xenUnifiedDomainDefineXML, /* 0.1.1 */
     .domainUndefine = xenUnifiedDomainUndefine, /* 0.1.1 */
+    .domainUndefineFlags = xenUnifiedDomainUndefineFlags, /* 0.9.4 */
     .domainAttachDevice = xenUnifiedDomainAttachDevice, /* 0.1.9 */
     .domainAttachDeviceFlags = xenUnifiedDomainAttachDeviceFlags, /* 0.7.7 */
     .domainDetachDevice = xenUnifiedDomainDetachDevice, /* 0.1.9 */
-- 
1.7.6


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