return -1;
}
+static int
+xenUnifiedDomainDestroyFlags(virDomainPtr dom,
+ unsigned int flags)
+{
+ GET_PRIVATE(dom->conn);
+ int i;
+
+ virCheckFlags(0, -1);
+
+ /* 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]->domainDestroyFlags &&
+ drivers[i]->domainDestroyFlags(dom) == 0)
+ return 0;
+
+ if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
+ drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags&&
+ drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags(dom) == 0)
+ return 0;
+
+ return -1;
+}
+
static char *
xenUnifiedDomainGetOSType (virDomainPtr dom)
{
.domainShutdown = xenUnifiedDomainShutdown, /* 0.0.3 */
.domainReboot = xenUnifiedDomainReboot, /* 0.1.0 */
.domainDestroy = xenUnifiedDomainDestroy, /* 0.0.3 */
+ .domainDestroyFlags = xenUnifiedDomainDestroyFlags, /* 0.9.4 */
.domainGetOSType = xenUnifiedDomainGetOSType, /* 0.0.3 */
.domainGetMaxMemory = xenUnifiedDomainGetMaxMemory, /* 0.0.3 */
.domainSetMaxMemory = xenUnifiedDomainSetMaxMemory, /* 0.0.3 */
virDrvDomainShutdown domainShutdown;
virDrvDomainReboot domainReboot;
virDrvDomainDestroy domainDestroy;
+ virDrvDomainDestroyFlags domainDestroyFlags;
virDrvDomainGetOSType domainGetOSType;
virDrvDomainGetMaxMemory domainGetMaxMemory;
virDrvDomainSetMaxMemory domainSetMaxMemory;
NULL, /* domainShutdown */
NULL, /* domainReboot */
xenHypervisorDestroyDomain, /* domainDestroy */
+ xenHypervisorDestroyDomainFlags, /* domainDestroyFlags */
xenHypervisorDomainGetOSType, /* domainGetOSType */
xenHypervisorGetMaxMemory, /* domainGetMaxMemory */
xenHypervisorSetMaxMemory, /* domainSetMaxMemory */
}
/**
- * xenHypervisorDestroyDomain:
+ * xenHypervisorDestroyDomainFlags:
* @domain: pointer to the domain block
+ * @flags: an OR'ed set of virDomainDestroyFlagsValues
*
* Do an hypervisor call to destroy the given domain
*
+ * Calling this function with no @flags set (equal to zero)
+ * is equivalent to calling xenHypervisorDestroyDomain.
+ *
* Returns 0 in case of success, -1 in case of error.
*/
int
-xenHypervisorDestroyDomain(virDomainPtr domain)
+xenHypervisorDestroyDomainFlags(virDomainPtr domain,
+ unsigned int flags)
{
int ret;
xenUnifiedPrivatePtr priv;
+ virCheckFlags(0, -1);
+
if (domain->conn == NULL)
return -1;
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
const char *type);
int xenHypervisorDestroyDomain (virDomainPtr domain)
ATTRIBUTE_NONNULL (1);
+int xenHypervisorDestroyDomainFlags (virDomainPtr domain,
+ unsigned int flags)
+ ATTRIBUTE_NONNULL (1);
int xenHypervisorResumeDomain (virDomainPtr domain)
ATTRIBUTE_NONNULL (1);
int xenHypervisorPauseDomain (virDomainPtr domain)
NULL, /* domainShutdown */
NULL, /* domainReboot */
NULL, /* domainDestroy */
+ NULL, /* domainDestroyFlags */
NULL, /* domainGetOSType */
NULL, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */
}
/**
- * xenDaemonDomainDestroy:
+ * xenDaemonDomainDestroyFlags:
* @domain: pointer to the Domain block
+ * @flags: an OR'ed set of virDomainDestroyFlagsValues
*
* Abruptly halt the domain, the OS is not properly shutdown and the
* resources allocated for the domain are immediately freed, mounted
* dying and will go away completely once all of the resources have been
* unmapped (usually from the backend devices).
*
+ * Calling this function with no @flags set (equal to zero)
+ * is equivalent to calling xenDaemonDomainDestroy.
+ *
* Returns 0 in case of success, -1 (with errno) in case of error.
*/
int
-xenDaemonDomainDestroy(virDomainPtr domain)
+xenDaemonDomainDestroyFlags(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);
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
xenDaemonDomainShutdown, /* domainShutdown */
xenDaemonDomainReboot, /* domainReboot */
xenDaemonDomainDestroy, /* domainDestroy */
+ xenDaemonDomainDestroyFlags, /* domainDestroyFlags */
xenDaemonDomainGetOSType, /* domainGetOSType */
xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
xenDaemonDomainSetMaxMemory, /* domainSetMaxMemory */
NULL, /* domainShutdown */
NULL, /* domainReboot */
NULL, /* domainDestroy */
+ NULL, /* domainDestroyFlags */
NULL, /* domainGetOSType */
xenXMDomainGetMaxMemory, /* domainGetMaxMemory */
xenXMDomainSetMaxMemory, /* domainSetMaxMemory */
xenStoreDomainShutdown, /* domainShutdown */
xenStoreDomainReboot, /* domainReboot */
NULL, /* domainDestroy */
+ NULL, /* domainDestroyFlags */
xenStoreDomainGetOSType, /* domainGetOSType */
xenStoreDomainGetMaxMemory, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */