mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
build: fix bugs with destroyFlags patches
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.
This commit is contained in:
parent
a9135359b4
commit
934fdcb3c5
@ -901,30 +901,6 @@ xenUnifiedDomainReboot (virDomainPtr dom, unsigned int 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)
|
||||
@ -941,17 +917,24 @@ xenUnifiedDomainDestroyFlags(virDomainPtr dom,
|
||||
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)
|
||||
{
|
||||
|
@ -94,8 +94,7 @@ struct xenUnifiedDriver {
|
||||
virDrvDomainResume domainResume;
|
||||
virDrvDomainShutdown domainShutdown;
|
||||
virDrvDomainReboot domainReboot;
|
||||
virDrvDomainDestroy domainDestroy;
|
||||
virDrvDomainDestroyFlags domainDestroyFlags;
|
||||
virDrvDomainDestroyFlags domainDestroyFlags;
|
||||
virDrvDomainGetOSType domainGetOSType;
|
||||
virDrvDomainGetMaxMemory domainGetMaxMemory;
|
||||
virDrvDomainSetMaxMemory domainSetMaxMemory;
|
||||
|
@ -815,7 +815,6 @@ struct xenUnifiedDriver xenHypervisorDriver = {
|
||||
xenHypervisorResumeDomain, /* domainResume */
|
||||
NULL, /* domainShutdown */
|
||||
NULL, /* domainReboot */
|
||||
xenHypervisorDestroyDomain, /* domainDestroy */
|
||||
xenHypervisorDestroyDomainFlags, /* domainDestroyFlags */
|
||||
xenHypervisorDomainGetOSType, /* domainGetOSType */
|
||||
xenHypervisorGetMaxMemory, /* domainGetMaxMemory */
|
||||
@ -3467,18 +3466,6 @@ xenHypervisorDestroyDomainFlags(virDomainPtr domain,
|
||||
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
|
||||
|
@ -62,7 +62,6 @@ struct xenUnifiedDriver xenInotifyDriver = {
|
||||
NULL, /* domainResume */
|
||||
NULL, /* domainShutdown */
|
||||
NULL, /* domainReboot */
|
||||
NULL, /* domainDestroy */
|
||||
NULL, /* domainDestroyFlags */
|
||||
NULL, /* domainGetOSType */
|
||||
NULL, /* domainGetMaxMemory */
|
||||
|
@ -1545,18 +1545,6 @@ xenDaemonDomainDestroyFlags(virDomainPtr domain,
|
||||
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
|
||||
@ -2667,7 +2655,7 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
|
||||
error:
|
||||
/* Make sure we don't leave a still-born domain around */
|
||||
if (dom != NULL) {
|
||||
xenDaemonDomainDestroy(dom);
|
||||
xenDaemonDomainDestroyFlags(dom, 0);
|
||||
virUnrefDomain(dom);
|
||||
}
|
||||
virDomainDefFree(def);
|
||||
@ -3959,7 +3947,6 @@ struct xenUnifiedDriver xenDaemonDriver = {
|
||||
xenDaemonDomainResume, /* domainResume */
|
||||
xenDaemonDomainShutdown, /* domainShutdown */
|
||||
xenDaemonDomainReboot, /* domainReboot */
|
||||
xenDaemonDomainDestroy, /* domainDestroy */
|
||||
xenDaemonDomainDestroyFlags, /* domainDestroyFlags */
|
||||
xenDaemonDomainGetOSType, /* domainGetOSType */
|
||||
xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
|
||||
|
@ -105,7 +105,7 @@ int xenDaemonDomainSuspend(virDomainPtr domain);
|
||||
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);
|
||||
|
@ -94,7 +94,6 @@ struct xenUnifiedDriver xenXMDriver = {
|
||||
NULL, /* domainResume */
|
||||
NULL, /* domainShutdown */
|
||||
NULL, /* domainReboot */
|
||||
NULL, /* domainDestroy */
|
||||
NULL, /* domainDestroyFlags */
|
||||
NULL, /* domainGetOSType */
|
||||
xenXMDomainGetMaxMemory, /* domainGetMaxMemory */
|
||||
@ -1083,7 +1082,7 @@ int xenXMDomainCreate(virDomainPtr domain) {
|
||||
|
||||
error:
|
||||
if (domain->id != -1) {
|
||||
xenDaemonDomainDestroy(domain);
|
||||
xenDaemonDomainDestroyFlags(domain, 0);
|
||||
domain->id = -1;
|
||||
}
|
||||
xenUnifiedUnlock(priv);
|
||||
|
@ -55,7 +55,6 @@ struct xenUnifiedDriver xenStoreDriver = {
|
||||
NULL, /* domainResume */
|
||||
xenStoreDomainShutdown, /* domainShutdown */
|
||||
xenStoreDomainReboot, /* domainReboot */
|
||||
NULL, /* domainDestroy */
|
||||
NULL, /* domainDestroyFlags */
|
||||
xenStoreDomainGetOSType, /* domainGetOSType */
|
||||
xenStoreDomainGetMaxMemory, /* domainGetMaxMemory */
|
||||
|
@ -857,6 +857,9 @@ xenapiDomainDestroyFlags(virDomainPtr dom,
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user