Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > Update xenUnifiedDomainSuspend and xenUnifiedDomainResume to > unconditionally invoke the XenD APIs for suspend/resume. Delete > the impls in the hypervisor driver which was unreachable. > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > --- > src/xen/xen_driver.c | 38 +------------- > src/xen/xen_driver.h | 2 - > src/xen/xen_hypervisor.c | 125 ----------------------------------------------- > src/xen/xen_hypervisor.h | 4 -- > src/xen/xend_internal.c | 2 - > 5 files changed, 2 insertions(+), 169 deletions(-) > I wonder if the hypervisor driver code was ever used... ACK. Regards, Jim > diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c > index 5f296ad..b6d5124 100644 > --- a/src/xen/xen_driver.c > +++ b/src/xen/xen_driver.c > @@ -731,47 +731,13 @@ xenUnifiedDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED) > static int > xenUnifiedDomainSuspend(virDomainPtr dom) > { > - xenUnifiedPrivatePtr priv = dom->conn->privateData; > - 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]->xenDomainSuspend && > - drivers[i]->xenDomainSuspend(dom) == 0) > - return 0; > - > - if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] && > - xenHypervisorPauseDomain(dom) == 0) > - return 0; > - > - return -1; > + return xenDaemonDomainSuspend(dom); > } > > static int > xenUnifiedDomainResume(virDomainPtr dom) > { > - xenUnifiedPrivatePtr priv = dom->conn->privateData; > - 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]->xenDomainResume && > - drivers[i]->xenDomainResume(dom) == 0) > - return 0; > - > - if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] && > - xenHypervisorResumeDomain(dom) == 0) > - return 0; > - > - return -1; > + return xenDaemonDomainResume(dom); > } > > static int > diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h > index 803fee7..ac38b19 100644 > --- a/src/xen/xen_driver.h > +++ b/src/xen/xen_driver.h > @@ -94,8 +94,6 @@ extern int xenRegister (void); > */ > struct xenUnifiedDriver { > virDrvConnectGetHostname xenGetHostname; > - virDrvDomainSuspend xenDomainSuspend; > - virDrvDomainResume xenDomainResume; > virDrvDomainShutdown xenDomainShutdown; > virDrvDomainReboot xenDomainReboot; > virDrvDomainDestroyFlags xenDomainDestroyFlags; > diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c > index 2068a8a..71212eb 100644 > --- a/src/xen/xen_hypervisor.c > +++ b/src/xen/xen_hypervisor.c > @@ -880,8 +880,6 @@ typedef struct xen_op_v2_dom xen_op_v2_dom; > static unsigned long long xenHypervisorGetMaxMemory(virDomainPtr domain); > > struct xenUnifiedDriver xenHypervisorDriver = { > - .xenDomainSuspend = xenHypervisorPauseDomain, > - .xenDomainResume = xenHypervisorResumeDomain, > .xenDomainDestroyFlags = xenHypervisorDestroyDomainFlags, > .xenDomainGetOSType = xenHypervisorDomainGetOSType, > .xenDomainGetMaxMemory = xenHypervisorGetMaxMemory, > @@ -1486,83 +1484,6 @@ xenHypervisorDomainInterfaceStats(virDomainPtr dom, > #endif > } > > -/** > - * virXen_pausedomain: > - * @handle: the hypervisor handle > - * @id: the domain id > - * > - * Do a low level hypercall to pause the domain > - * > - * Returns 0 or -1 in case of failure > - */ > -static int > -virXen_pausedomain(int handle, int id) > -{ > - int ret = -1; > - > - if (hv_versions.hypervisor > 1) { > - xen_op_v2_dom op; > - > - memset(&op, 0, sizeof(op)); > - op.cmd = XEN_V2_OP_PAUSEDOMAIN; > - op.domain = (domid_t) id; > - ret = xenHypervisorDoV2Dom(handle, &op); > - } else if (hv_versions.hypervisor == 1) { > - xen_op_v1 op; > - > - memset(&op, 0, sizeof(op)); > - op.cmd = XEN_V1_OP_PAUSEDOMAIN; > - op.u.domain.domain = (domid_t) id; > - ret = xenHypervisorDoV1Op(handle, &op); > - } else if (hv_versions.hypervisor == 0) { > - xen_op_v0 op; > - > - memset(&op, 0, sizeof(op)); > - op.cmd = XEN_V0_OP_PAUSEDOMAIN; > - op.u.domain.domain = (domid_t) id; > - ret = xenHypervisorDoV0Op(handle, &op); > - } > - return ret; > -} > - > -/** > - * virXen_unpausedomain: > - * @handle: the hypervisor handle > - * @id: the domain id > - * > - * Do a low level hypercall to unpause the domain > - * > - * Returns 0 or -1 in case of failure > - */ > -static int > -virXen_unpausedomain(int handle, int id) > -{ > - int ret = -1; > - > - if (hv_versions.hypervisor > 1) { > - xen_op_v2_dom op; > - > - memset(&op, 0, sizeof(op)); > - op.cmd = XEN_V2_OP_UNPAUSEDOMAIN; > - op.domain = (domid_t) id; > - ret = xenHypervisorDoV2Dom(handle, &op); > - } else if (hv_versions.hypervisor == 1) { > - xen_op_v1 op; > - > - memset(&op, 0, sizeof(op)); > - op.cmd = XEN_V1_OP_UNPAUSEDOMAIN; > - op.u.domain.domain = (domid_t) id; > - ret = xenHypervisorDoV1Op(handle, &op); > - } else if (hv_versions.hypervisor == 0) { > - xen_op_v0 op; > - > - memset(&op, 0, sizeof(op)); > - op.cmd = XEN_V0_OP_UNPAUSEDOMAIN; > - op.u.domain.domain = (domid_t) id; > - ret = xenHypervisorDoV0Op(handle, &op); > - } > - return ret; > -} > > /** > * virXen_destroydomain: > @@ -3143,52 +3064,6 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, > > > /** > - * xenHypervisorPauseDomain: > - * @domain: pointer to the domain block > - * > - * Do a hypervisor call to pause the given domain > - * > - * Returns 0 in case of success, -1 in case of error. > - */ > -int > -xenHypervisorPauseDomain(virDomainPtr domain) > -{ > - int ret; > - xenUnifiedPrivatePtr priv = domain->conn->privateData; > - > - if (domain->id < 0) > - return -1; > - > - ret = virXen_pausedomain(priv->handle, domain->id); > - if (ret < 0) > - return -1; > - return 0; > -} > - > -/** > - * xenHypervisorResumeDomain: > - * @domain: pointer to the domain block > - * > - * Do a hypervisor call to resume the given domain > - * > - * Returns 0 in case of success, -1 in case of error. > - */ > -int > -xenHypervisorResumeDomain(virDomainPtr domain) > -{ > - int ret; > - xenUnifiedPrivatePtr priv = domain->conn->privateData; > - > - if (domain->id < 0) > - return -1; > - > - ret = virXen_unpausedomain(priv->handle, domain->id); > - if (ret < 0) > - return -1; > - return 0; > -} > - > -/** > * xenHypervisorDestroyDomainFlags: > * @domain: pointer to the domain block > * @flags: an OR'ed set of virDomainDestroyFlagsValues > diff --git a/src/xen/xen_hypervisor.h b/src/xen/xen_hypervisor.h > index 949311d..812816d 100644 > --- a/src/xen/xen_hypervisor.h > +++ b/src/xen/xen_hypervisor.h > @@ -77,10 +77,6 @@ int xenHypervisorDestroyDomain (virDomainPtr domain) > int xenHypervisorDestroyDomainFlags (virDomainPtr domain, > unsigned int flags) > ATTRIBUTE_NONNULL (1); > -int xenHypervisorResumeDomain (virDomainPtr domain) > - ATTRIBUTE_NONNULL (1); > -int xenHypervisorPauseDomain (virDomainPtr domain) > - ATTRIBUTE_NONNULL (1); > int xenHypervisorGetDomainInfo (virDomainPtr domain, > virDomainInfoPtr info) > ATTRIBUTE_NONNULL (1); > diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c > index 4ad30fa..0f658db 100644 > --- a/src/xen/xend_internal.c > +++ b/src/xen/xend_internal.c > @@ -3450,8 +3450,6 @@ xenDaemonDomainBlockPeek(virDomainPtr domain, > } > > struct xenUnifiedDriver xenDaemonDriver = { > - .xenDomainSuspend = xenDaemonDomainSuspend, > - .xenDomainResume = xenDaemonDomainResume, > .xenDomainShutdown = xenDaemonDomainShutdown, > .xenDomainReboot = xenDaemonDomainReboot, > .xenDomainDestroyFlags = xenDaemonDomainDestroyFlags, > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list