vbox, xenapi: add virDomainUndefineFlags

We forgot to add virDomainUndefineFlags for a couple of hypervisors.
This wires up trivial versions (since neither hypervisor supports
managed save yet, they do not need to support any flags).

* src/vbox/vbox_tmpl.c (vboxDomainCreateXML): Update caller.
(vboxDomainUndefine): Move guts...
(vboxDomainUndefineFlags): ...to new function.
* src/xenapi/xenapi_driver.c (xenapiDomainUndefine)
(xenapiDomainUndefineFlags): Likewise.
This commit is contained in:
Eric Blake 2011-08-11 15:44:05 -06:00
parent 9a0ec36346
commit cfe35a88f0
2 changed files with 22 additions and 5 deletions

View File

@ -251,7 +251,7 @@ static vboxGlobalData *g_pVBoxGlobalData = NULL;
static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml);
static int vboxDomainCreate(virDomainPtr dom);
static int vboxDomainUndefine(virDomainPtr dom);
static int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags);
static void vboxDriverLock(vboxGlobalData *data) {
virMutexLock(&data->lock);
@ -1193,7 +1193,7 @@ static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
return NULL;
if (vboxDomainCreate(dom) < 0) {
vboxDomainUndefine(dom);
vboxDomainUndefineFlags(dom, 0);
virUnrefDomain(dom);
return NULL;
}
@ -4973,7 +4973,7 @@ cleanup:
}
static int
vboxDomainUndefine(virDomainPtr dom)
vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
{
VBOX_OBJECT_CHECK(dom->conn, int, -1);
IMachine *machine = NULL;
@ -4982,6 +4982,7 @@ vboxDomainUndefine(virDomainPtr dom)
#if VBOX_API_VERSION >= 4000
vboxArray media = VBOX_ARRAY_INITIALIZER;
#endif
virCheckFlags(0, -1);
vboxIIDFromUUID(&iid, dom->uuid);
@ -5131,6 +5132,12 @@ vboxDomainUndefine(virDomainPtr dom)
return ret;
}
static int
vboxDomainUndefine(virDomainPtr dom)
{
return vboxDomainUndefineFlags(dom, 0);
}
static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
const char *xml,
int mediaChangeOnly ATTRIBUTE_UNUSED) {
@ -8806,6 +8813,7 @@ virDriver NAME(Driver) = {
.domainCreateWithFlags = vboxDomainCreateWithFlags, /* 0.8.2 */
.domainDefineXML = vboxDomainDefineXML, /* 0.6.3 */
.domainUndefine = vboxDomainUndefine, /* 0.6.3 */
.domainUndefineFlags = vboxDomainUndefineFlags, /* 0.9.5 */
.domainAttachDevice = vboxDomainAttachDevice, /* 0.6.3 */
.domainAttachDeviceFlags = vboxDomainAttachDeviceFlags, /* 0.7.7 */
.domainDetachDevice = vboxDomainDetachDevice, /* 0.6.3 */

View File

@ -1696,17 +1696,19 @@ xenapiDomainDefineXML (virConnectPtr conn, const char *xml)
}
/*
* xenapiDomainUndefine
* xenapiDomainUndefineFlags
*
* destroys a domain
* Return 0 on success or -1 in case of error
*/
static int
xenapiDomainUndefine (virDomainPtr dom)
xenapiDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
{
struct xen_vm_set *vms;
xen_vm vm;
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
virCheckFlags(0, -1);
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
@ -1728,6 +1730,12 @@ xenapiDomainUndefine (virDomainPtr dom)
return -1;
}
static int
xenapiDomainUndefine(virDomainPtr dom)
{
return xenapiDomainUndefineFlags(dom, 0);
}
/*
* xenapiDomainGetAutostart
*
@ -1922,6 +1930,7 @@ static virDriver xenapiDriver = {
.domainCreateWithFlags = xenapiDomainCreateWithFlags, /* 0.8.2 */
.domainDefineXML = xenapiDomainDefineXML, /* 0.8.0 */
.domainUndefine = xenapiDomainUndefine, /* 0.8.0 */
.domainUndefineFlags = xenapiDomainUndefineFlags, /* 0.9.5 */
.domainGetAutostart = xenapiDomainGetAutostart, /* 0.8.0 */
.domainSetAutostart = xenapiDomainSetAutostart, /* 0.8.0 */
.domainGetSchedulerType = xenapiDomainGetSchedulerType, /* 0.8.0 */