Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > Make the xenUnifiedDomainShutdownFlags and xenUnifiedDomainReboot > driver methods unconditionally call the XenD APIs for shutdown > and reboot. Delete the unreachable impls in the XenStore driver. > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > --- > src/xen/xen_driver.c | 22 +++--------------- > src/xen/xen_driver.h | 2 -- > src/xen/xend_internal.c | 7 +----- > src/xen/xend_internal.h | 2 +- > src/xen/xs_internal.c | 62 ------------------------------------------------- > src/xen/xs_internal.h | 3 --- > 6 files changed, 5 insertions(+), 93 deletions(-) > ACK. Regards, Jim > diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c > index b6d5124..db13438 100644 > --- a/src/xen/xen_driver.c > +++ b/src/xen/xen_driver.c > @@ -744,18 +744,9 @@ static int > xenUnifiedDomainShutdownFlags(virDomainPtr dom, > unsigned int flags) > { > - xenUnifiedPrivatePtr priv = dom->conn->privateData; > - int i; > - > virCheckFlags(0, -1); > > - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) > - if (priv->opened[i] && > - drivers[i]->xenDomainShutdown && > - drivers[i]->xenDomainShutdown(dom) == 0) > - return 0; > - > - return -1; > + return xenDaemonDomainShutdown(dom); > } > > static int > @@ -767,16 +758,9 @@ xenUnifiedDomainShutdown(virDomainPtr dom) > static int > xenUnifiedDomainReboot(virDomainPtr dom, unsigned int flags) > { > - xenUnifiedPrivatePtr priv = dom->conn->privateData; > - int i; > - > - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) > - if (priv->opened[i] && > - drivers[i]->xenDomainReboot && > - drivers[i]->xenDomainReboot(dom, flags) == 0) > - return 0; > + virCheckFlags(0, -1); > > - return -1; > + return xenDaemonDomainReboot(dom); > } > > static int > diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h > index ac38b19..b77067d 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; > - virDrvDomainShutdown xenDomainShutdown; > - virDrvDomainReboot xenDomainReboot; > virDrvDomainDestroyFlags xenDomainDestroyFlags; > virDrvDomainGetOSType xenDomainGetOSType; > virDrvDomainGetMaxMemory xenDomainGetMaxMemory; > diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c > index 0f658db..1cd810b 100644 > --- a/src/xen/xend_internal.c > +++ b/src/xen/xend_internal.c > @@ -1320,7 +1320,6 @@ xenDaemonDomainShutdown(virDomainPtr domain) > /** > * xenDaemonDomainReboot: > * @domain: pointer to the Domain block > - * @flags: extra flags for the reboot operation, not used yet > * > * Reboot the domain, the OS is requested to properly shutdown > * and restart but the domain may ignore it. It will return immediately > @@ -1329,10 +1328,8 @@ xenDaemonDomainShutdown(virDomainPtr domain) > * Returns 0 in case of success, -1 (with errno) in case of error. > */ > int > -xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags) > +xenDaemonDomainReboot(virDomainPtr domain) > { > - virCheckFlags(0, -1); > - > if (domain->id < 0) { > virReportError(VIR_ERR_OPERATION_INVALID, > _("Domain %s isn't running."), domain->name); > @@ -3450,8 +3447,6 @@ xenDaemonDomainBlockPeek(virDomainPtr domain, > } > > struct xenUnifiedDriver xenDaemonDriver = { > - .xenDomainShutdown = xenDaemonDomainShutdown, > - .xenDomainReboot = xenDaemonDomainReboot, > .xenDomainDestroyFlags = xenDaemonDomainDestroyFlags, > .xenDomainGetOSType = xenDaemonDomainGetOSType, > .xenDomainGetMaxMemory = xenDaemonDomainGetMaxMemory, > diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h > index e8713a7..27e8fbd 100644 > --- a/src/xen/xend_internal.h > +++ b/src/xen/xend_internal.h > @@ -90,7 +90,7 @@ int xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps); > int xenDaemonDomainSuspend(virDomainPtr domain); > int xenDaemonDomainResume(virDomainPtr domain); > int xenDaemonDomainShutdown(virDomainPtr domain); > -int xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags); > +int xenDaemonDomainReboot(virDomainPtr domain); > int xenDaemonDomainDestroyFlags(virDomainPtr domain, unsigned int flags); > int xenDaemonDomainSave(virDomainPtr domain, const char *filename); > int xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename, > diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c > index 7926535..a7a8d15 100644 > --- a/src/xen/xs_internal.c > +++ b/src/xen/xs_internal.c > @@ -58,8 +58,6 @@ static void xenStoreWatchEvent(int watch, int fd, int events, void *data); > static void xenStoreWatchListFree(xenStoreWatchListPtr list); > > struct xenUnifiedDriver xenStoreDriver = { > - .xenDomainShutdown = xenStoreDomainShutdown, > - .xenDomainReboot = xenStoreDomainReboot, > .xenDomainGetOSType = xenStoreDomainGetOSType, > .xenDomainGetMaxMemory = xenStoreDomainGetMaxMemory, > .xenDomainSetMemory = xenStoreDomainSetMemory, > @@ -581,66 +579,6 @@ xenStoreListDomains(virConnectPtr conn, int *ids, int maxids) > } > > > -/** > - * xenStoreDomainShutdown: > - * @domain: pointer to the Domain block > - * > - * Shutdown the domain, the OS is requested to properly shutdown > - * and the domain may ignore it. It will return immediately > - * after queuing the request. > - * > - * Returns 0 in case of success, -1 in case of error. > - */ > -int > -xenStoreDomainShutdown(virDomainPtr domain) > -{ > - int ret; > - xenUnifiedPrivatePtr priv = domain->conn->privateData; > - > - if (domain->id == -1 || domain->id == 0) > - return -1; > - /* > - * this is very hackish, the domU kernel probes for a special > - * node in the xenstore and launch the shutdown command if found. > - */ > - xenUnifiedLock(priv); > - ret = virDomainDoStoreWrite(domain, "control/shutdown", "poweroff"); > - xenUnifiedUnlock(priv); > - return ret; > -} > - > -/** > - * xenStoreDomainReboot: > - * @domain: pointer to the Domain block > - * @flags: extra flags for the reboot operation, not used yet > - * > - * Reboot the domain, the OS is requested to properly shutdown > - * and reboot but the domain may ignore it. It will return immediately > - * after queuing the request. > - * > - * Returns 0 in case of success, -1 in case of error. > - */ > -int > -xenStoreDomainReboot(virDomainPtr domain, unsigned int flags) > -{ > - int ret; > - xenUnifiedPrivatePtr priv = domain->conn->privateData; > - > - virCheckFlags(0, -1); > - > - if (domain->id == -1 || domain->id == 0) > - return -1; > - /* > - * this is very hackish, the domU kernel probes for a special > - * node in the xenstore and launch the shutdown command if found. > - */ > - > - xenUnifiedLock(priv); > - ret = virDomainDoStoreWrite(domain, "control/shutdown", "reboot"); > - xenUnifiedUnlock(priv); > - return ret; > -} > - > /* > * xenStoreDomainGetOSType: > * @domain: a domain object > diff --git a/src/xen/xs_internal.h b/src/xen/xs_internal.h > index fc7798d..da98eea 100644 > --- a/src/xen/xs_internal.h > +++ b/src/xen/xs_internal.h > @@ -47,9 +47,6 @@ unsigned long xenStoreGetMaxMemory (virDomainPtr domain); > int xenStoreDomainSetMemory (virDomainPtr domain, > unsigned long memory); > unsigned long long xenStoreDomainGetMaxMemory(virDomainPtr domain); > -int xenStoreDomainShutdown (virDomainPtr domain); > -int xenStoreDomainReboot (virDomainPtr domain, > - unsigned int flags); > > int xenStoreDomainGetVNCPort(virConnectPtr conn, > int domid); > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list