Build failure on xenapi_driver from compiler warnings (flags was unused).
Build failure on xen (incorrect number of arguments). And in fixing
that, I obeyed the comments of struct xenUnifiedDriver that state
that we want to minimize the number of callback functions in that
struct, not add to it.
* src/xen/xen_driver.c (xenUnifiedDomainDestroyFlags): Use correct
arguments.
(xenUnifiedDomainDestroy): Simplify.
* src/xen/xen_driver.h (xenUnifiedDriver): Remove unused callback.
* src/xen/xen_hypervisor.c (xenHypervisorDestroyDomain): Likewise.
* src/xen/xend_internal.c (xenDaemonDomainDestroy): Likewise.
* src/xen/xend_internal.h (xenDaemonDomainDestroyFlags): Likewise.
* src/xen/xm_internal.c (xenXMDriver): Likewise.
* src/xen/xs_internal.c (xenStoreDriver): Likewise.
* src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainDestroyFlags): Reject
unknown flags.
return -1;
}
-static int
-xenUnifiedDomainDestroy (virDomainPtr dom)
-{
- GET_PRIVATE(dom->conn);
- int i;
-
- /* Try non-hypervisor methods first, then hypervisor direct method
- * as a last resort.
- */
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
- if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
- priv->opened[i] &&
- drivers[i]->domainDestroy &&
- drivers[i]->domainDestroy (dom) == 0)
- return 0;
-
- if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
- drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroy &&
- drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroy (dom) == 0)
- return 0;
-
- return -1;
-}
-
static int
xenUnifiedDomainDestroyFlags(virDomainPtr dom,
unsigned int flags)
if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
priv->opened[i] &&
drivers[i]->domainDestroyFlags &&
- drivers[i]->domainDestroyFlags(dom) == 0)
+ drivers[i]->domainDestroyFlags(dom, flags) == 0)
return 0;
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags&&
- drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags(dom) == 0)
+ drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags(dom,
+ flags) == 0)
return 0;
return -1;
}
+static int
+xenUnifiedDomainDestroy(virDomainPtr dom)
+{
+ return xenUnifiedDomainDestroyFlags(dom, 0);
+}
+
static char *
xenUnifiedDomainGetOSType (virDomainPtr dom)
{
virDrvDomainResume domainResume;
virDrvDomainShutdown domainShutdown;
virDrvDomainReboot domainReboot;
- virDrvDomainDestroy domainDestroy;
- virDrvDomainDestroyFlags domainDestroyFlags;
+ virDrvDomainDestroyFlags domainDestroyFlags;
virDrvDomainGetOSType domainGetOSType;
virDrvDomainGetMaxMemory domainGetMaxMemory;
virDrvDomainSetMaxMemory domainSetMaxMemory;
xenHypervisorResumeDomain, /* domainResume */
NULL, /* domainShutdown */
NULL, /* domainReboot */
- xenHypervisorDestroyDomain, /* domainDestroy */
xenHypervisorDestroyDomainFlags, /* domainDestroyFlags */
xenHypervisorDomainGetOSType, /* domainGetOSType */
xenHypervisorGetMaxMemory, /* domainGetMaxMemory */
return (0);
}
-/**
- * xenHypervisorDestroyDomain:
- * @domain: pointer to the domain block
- *
- * See xenHypervisorDestroyDomainFlags
- */
-int
-xenHypervisorDestroyDomain(virDomainPtr domain)
-{
- return xenHypervisorDestroyDomainFlags(domain, 0);
-}
-
/**
* xenHypervisorSetMaxMemory:
* @domain: pointer to the domain block
NULL, /* domainResume */
NULL, /* domainShutdown */
NULL, /* domainReboot */
- NULL, /* domainDestroy */
NULL, /* domainDestroyFlags */
NULL, /* domainGetOSType */
NULL, /* domainGetMaxMemory */
return xend_op(domain->conn, domain->name, "op", "destroy", NULL);
}
-/**
- * xenDaemonDomainDestroy:
- * @domain: pointer to the Domain block
- *
- * See xenDaemonDomainDestroyFlags
- */
-int
-xenDaemonDomainDestroy(virDomainPtr dom)
-{
- return xenDaemonDomainDestroyFlags(dom, 0);
-}
-
/**
* xenDaemonDomainGetOSType:
* @domain: a domain object
error:
/* Make sure we don't leave a still-born domain around */
if (dom != NULL) {
- xenDaemonDomainDestroy(dom);
+ xenDaemonDomainDestroyFlags(dom, 0);
virUnrefDomain(dom);
}
virDomainDefFree(def);
xenDaemonDomainResume, /* domainResume */
xenDaemonDomainShutdown, /* domainShutdown */
xenDaemonDomainReboot, /* domainReboot */
- xenDaemonDomainDestroy, /* domainDestroy */
xenDaemonDomainDestroyFlags, /* domainDestroyFlags */
xenDaemonDomainGetOSType, /* domainGetOSType */
xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
int xenDaemonDomainResume(virDomainPtr domain);
int xenDaemonDomainShutdown(virDomainPtr domain);
int xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags);
-int xenDaemonDomainDestroy(virDomainPtr domain);
+int xenDaemonDomainDestroyFlags(virDomainPtr domain, unsigned int flags);
int xenDaemonDomainSave(virDomainPtr domain, const char *filename);
int xenDaemonDomainRestore(virConnectPtr conn, const char *filename);
int xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory);
NULL, /* domainResume */
NULL, /* domainShutdown */
NULL, /* domainReboot */
- NULL, /* domainDestroy */
NULL, /* domainDestroyFlags */
NULL, /* domainGetOSType */
xenXMDomainGetMaxMemory, /* domainGetMaxMemory */
error:
if (domain->id != -1) {
- xenDaemonDomainDestroy(domain);
+ xenDaemonDomainDestroyFlags(domain, 0);
domain->id = -1;
}
xenUnifiedUnlock(priv);
NULL, /* domainResume */
xenStoreDomainShutdown, /* domainShutdown */
xenStoreDomainReboot, /* domainReboot */
- NULL, /* domainDestroy */
NULL, /* domainDestroyFlags */
xenStoreDomainGetOSType, /* domainGetOSType */
xenStoreDomainGetMaxMemory, /* domainGetMaxMemory */
xen_vm vm;
struct xen_vm_set *vms;
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,