Add domainUndefineFlags support for these drivers (except qemu and libxl driver), and changes domainUndefine as a wrapper of domainUndefineFlags, but they actually perform same. --- 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 4643a32..b3bdf1d 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -3280,7 +3280,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; @@ -3289,6 +3290,8 @@ esxDomainUndefine(virDomainPtr domain) esxVI_String *propertyNameList = NULL; esxVI_VirtualMachinePowerState powerState; + virCheckFlags(0, -1); + if (priv->vCenter != NULL) { ctx = priv->vCenter; } else { @@ -3329,6 +3332,11 @@ esxDomainUndefine(virDomainPtr domain) } +static int +esxDomainUndefine(virDomainPtr domain) +{ + esxDomainUndefineFlags(domain, 0); +} static int esxDomainGetAutostart(virDomainPtr domain, int *autostart) @@ -4725,6 +4733,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 b6da757..3dddf2a 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) { @@ -2931,6 +2939,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 d50ecf1..c1147c3 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1083,13 +1083,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) { @@ -1121,6 +1124,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; @@ -1625,6 +1633,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 f3fb320..bcb409d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2533,12 +2533,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); @@ -2571,6 +2575,11 @@ cleanup: return ret; } +static int testDomainUndefine(virDomainPtr domain) +{ + return testDomainUndefineFlags(domain, 0); +} + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -5554,6 +5563,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 6eede55..2f7ff63 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1706,11 +1706,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) { @@ -1747,6 +1751,11 @@ cleanup: } +static int umlDomainUndefine(virDomainPtr dom) +{ + return umlDomainUndefineFlags(dom, 0); +} + static int umlDomainAttachUmlDisk(struct uml_driver *driver, virDomainObjPtr vm, virDomainDiskDefPtr disk) @@ -2238,6 +2247,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 c0430fe..14e49d3 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -609,11 +609,14 @@ 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) { @@ -967,6 +976,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 1d75da3..571922e 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -1517,11 +1517,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) @@ -1531,6 +1532,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); @@ -2211,6 +2217,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 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list