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;
|
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
|
static int
|
||||||
xenUnifiedDomainDestroyFlags(virDomainPtr dom,
|
xenUnifiedDomainDestroyFlags(virDomainPtr dom,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
@ -941,17 +917,24 @@ xenUnifiedDomainDestroyFlags(virDomainPtr dom,
|
|||||||
if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
|
if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
|
||||||
priv->opened[i] &&
|
priv->opened[i] &&
|
||||||
drivers[i]->domainDestroyFlags &&
|
drivers[i]->domainDestroyFlags &&
|
||||||
drivers[i]->domainDestroyFlags(dom) == 0)
|
drivers[i]->domainDestroyFlags(dom, flags) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
|
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
|
||||||
drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainDestroyFlags&&
|
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 0;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
xenUnifiedDomainDestroy(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
return xenUnifiedDomainDestroyFlags(dom, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
xenUnifiedDomainGetOSType (virDomainPtr dom)
|
xenUnifiedDomainGetOSType (virDomainPtr dom)
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,6 @@ struct xenUnifiedDriver {
|
|||||||
virDrvDomainResume domainResume;
|
virDrvDomainResume domainResume;
|
||||||
virDrvDomainShutdown domainShutdown;
|
virDrvDomainShutdown domainShutdown;
|
||||||
virDrvDomainReboot domainReboot;
|
virDrvDomainReboot domainReboot;
|
||||||
virDrvDomainDestroy domainDestroy;
|
|
||||||
virDrvDomainDestroyFlags domainDestroyFlags;
|
virDrvDomainDestroyFlags domainDestroyFlags;
|
||||||
virDrvDomainGetOSType domainGetOSType;
|
virDrvDomainGetOSType domainGetOSType;
|
||||||
virDrvDomainGetMaxMemory domainGetMaxMemory;
|
virDrvDomainGetMaxMemory domainGetMaxMemory;
|
||||||
|
@ -815,7 +815,6 @@ struct xenUnifiedDriver xenHypervisorDriver = {
|
|||||||
xenHypervisorResumeDomain, /* domainResume */
|
xenHypervisorResumeDomain, /* domainResume */
|
||||||
NULL, /* domainShutdown */
|
NULL, /* domainShutdown */
|
||||||
NULL, /* domainReboot */
|
NULL, /* domainReboot */
|
||||||
xenHypervisorDestroyDomain, /* domainDestroy */
|
|
||||||
xenHypervisorDestroyDomainFlags, /* domainDestroyFlags */
|
xenHypervisorDestroyDomainFlags, /* domainDestroyFlags */
|
||||||
xenHypervisorDomainGetOSType, /* domainGetOSType */
|
xenHypervisorDomainGetOSType, /* domainGetOSType */
|
||||||
xenHypervisorGetMaxMemory, /* domainGetMaxMemory */
|
xenHypervisorGetMaxMemory, /* domainGetMaxMemory */
|
||||||
@ -3467,18 +3466,6 @@ xenHypervisorDestroyDomainFlags(virDomainPtr domain,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xenHypervisorDestroyDomain:
|
|
||||||
* @domain: pointer to the domain block
|
|
||||||
*
|
|
||||||
* See xenHypervisorDestroyDomainFlags
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xenHypervisorDestroyDomain(virDomainPtr domain)
|
|
||||||
{
|
|
||||||
return xenHypervisorDestroyDomainFlags(domain, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenHypervisorSetMaxMemory:
|
* xenHypervisorSetMaxMemory:
|
||||||
* @domain: pointer to the domain block
|
* @domain: pointer to the domain block
|
||||||
|
@ -62,7 +62,6 @@ struct xenUnifiedDriver xenInotifyDriver = {
|
|||||||
NULL, /* domainResume */
|
NULL, /* domainResume */
|
||||||
NULL, /* domainShutdown */
|
NULL, /* domainShutdown */
|
||||||
NULL, /* domainReboot */
|
NULL, /* domainReboot */
|
||||||
NULL, /* domainDestroy */
|
|
||||||
NULL, /* domainDestroyFlags */
|
NULL, /* domainDestroyFlags */
|
||||||
NULL, /* domainGetOSType */
|
NULL, /* domainGetOSType */
|
||||||
NULL, /* domainGetMaxMemory */
|
NULL, /* domainGetMaxMemory */
|
||||||
|
@ -1545,18 +1545,6 @@ xenDaemonDomainDestroyFlags(virDomainPtr domain,
|
|||||||
return xend_op(domain->conn, domain->name, "op", "destroy", NULL);
|
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:
|
* xenDaemonDomainGetOSType:
|
||||||
* @domain: a domain object
|
* @domain: a domain object
|
||||||
@ -2667,7 +2655,7 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
|
|||||||
error:
|
error:
|
||||||
/* Make sure we don't leave a still-born domain around */
|
/* Make sure we don't leave a still-born domain around */
|
||||||
if (dom != NULL) {
|
if (dom != NULL) {
|
||||||
xenDaemonDomainDestroy(dom);
|
xenDaemonDomainDestroyFlags(dom, 0);
|
||||||
virUnrefDomain(dom);
|
virUnrefDomain(dom);
|
||||||
}
|
}
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
@ -3959,7 +3947,6 @@ struct xenUnifiedDriver xenDaemonDriver = {
|
|||||||
xenDaemonDomainResume, /* domainResume */
|
xenDaemonDomainResume, /* domainResume */
|
||||||
xenDaemonDomainShutdown, /* domainShutdown */
|
xenDaemonDomainShutdown, /* domainShutdown */
|
||||||
xenDaemonDomainReboot, /* domainReboot */
|
xenDaemonDomainReboot, /* domainReboot */
|
||||||
xenDaemonDomainDestroy, /* domainDestroy */
|
|
||||||
xenDaemonDomainDestroyFlags, /* domainDestroyFlags */
|
xenDaemonDomainDestroyFlags, /* domainDestroyFlags */
|
||||||
xenDaemonDomainGetOSType, /* domainGetOSType */
|
xenDaemonDomainGetOSType, /* domainGetOSType */
|
||||||
xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
|
xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
|
||||||
|
@ -105,7 +105,7 @@ int xenDaemonDomainSuspend(virDomainPtr domain);
|
|||||||
int xenDaemonDomainResume(virDomainPtr domain);
|
int xenDaemonDomainResume(virDomainPtr domain);
|
||||||
int xenDaemonDomainShutdown(virDomainPtr domain);
|
int xenDaemonDomainShutdown(virDomainPtr domain);
|
||||||
int xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags);
|
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 xenDaemonDomainSave(virDomainPtr domain, const char *filename);
|
||||||
int xenDaemonDomainRestore(virConnectPtr conn, const char *filename);
|
int xenDaemonDomainRestore(virConnectPtr conn, const char *filename);
|
||||||
int xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory);
|
int xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory);
|
||||||
|
@ -94,7 +94,6 @@ struct xenUnifiedDriver xenXMDriver = {
|
|||||||
NULL, /* domainResume */
|
NULL, /* domainResume */
|
||||||
NULL, /* domainShutdown */
|
NULL, /* domainShutdown */
|
||||||
NULL, /* domainReboot */
|
NULL, /* domainReboot */
|
||||||
NULL, /* domainDestroy */
|
|
||||||
NULL, /* domainDestroyFlags */
|
NULL, /* domainDestroyFlags */
|
||||||
NULL, /* domainGetOSType */
|
NULL, /* domainGetOSType */
|
||||||
xenXMDomainGetMaxMemory, /* domainGetMaxMemory */
|
xenXMDomainGetMaxMemory, /* domainGetMaxMemory */
|
||||||
@ -1083,7 +1082,7 @@ int xenXMDomainCreate(virDomainPtr domain) {
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
if (domain->id != -1) {
|
if (domain->id != -1) {
|
||||||
xenDaemonDomainDestroy(domain);
|
xenDaemonDomainDestroyFlags(domain, 0);
|
||||||
domain->id = -1;
|
domain->id = -1;
|
||||||
}
|
}
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
|
@ -55,7 +55,6 @@ struct xenUnifiedDriver xenStoreDriver = {
|
|||||||
NULL, /* domainResume */
|
NULL, /* domainResume */
|
||||||
xenStoreDomainShutdown, /* domainShutdown */
|
xenStoreDomainShutdown, /* domainShutdown */
|
||||||
xenStoreDomainReboot, /* domainReboot */
|
xenStoreDomainReboot, /* domainReboot */
|
||||||
NULL, /* domainDestroy */
|
|
||||||
NULL, /* domainDestroyFlags */
|
NULL, /* domainDestroyFlags */
|
||||||
xenStoreDomainGetOSType, /* domainGetOSType */
|
xenStoreDomainGetOSType, /* domainGetOSType */
|
||||||
xenStoreDomainGetMaxMemory, /* domainGetMaxMemory */
|
xenStoreDomainGetMaxMemory, /* domainGetMaxMemory */
|
||||||
|
@ -857,6 +857,9 @@ xenapiDomainDestroyFlags(virDomainPtr dom,
|
|||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
struct xen_vm_set *vms;
|
struct xen_vm_set *vms;
|
||||||
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
|
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 (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
|
||||||
if (vms->size != 1) {
|
if (vms->size != 1) {
|
||||||
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user