On Tuesday, 13 October 2020 07:14:00 CEST Matt Coleman wrote: > Co-authored-by: Sri Ramanujam <sramanujam@xxxxxxxxx> > Signed-off-by: Matt Coleman <matt@xxxxxxxxx> > --- > src/hyperv/hyperv_driver.c | 48 +++++++++++++++++++++++++++++++++ > src/hyperv/hyperv_wmi_classes.h | 1 + > 2 files changed, 49 insertions(+) > > diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c > index c4fca4685e..7182340f74 100644 > --- a/src/hyperv/hyperv_driver.c > +++ b/src/hyperv/hyperv_driver.c > @@ -917,6 +917,52 @@ hypervDomainResume(virDomainPtr domain) > > > > +static int > +hypervDomainReboot(virDomainPtr domain, unsigned int flags) > +{ > + int result = -1; > + hypervPrivate *priv = domain->conn->privateData; > + Msvm_ComputerSystem *computerSystem = NULL; > + > + virCheckFlags(0, -1); > + > + if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) > + goto cleanup; > + > + result = hypervInvokeMsvmComputerSystemRequestStateChange(domain, > + MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_REBOOT); > + > + cleanup: > + hypervFreeObject(priv, (hypervObject *)computerSystem); > + > + return result; > +} > + > + > + > +static int > +hypervDomainReset(virDomainPtr domain, unsigned int flags) > +{ > + int result = -1; > + hypervPrivate *priv = domain->conn->privateData; > + Msvm_ComputerSystem *computerSystem = NULL; > + > + virCheckFlags(0, -1); > + > + if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) > + goto cleanup; > + > + result = hypervInvokeMsvmComputerSystemRequestStateChange(domain, > + MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_RESET); > + > + cleanup: > + hypervFreeObject(priv, (hypervObject *)computerSystem); > + > + return result; > +} What about making a common helper function that calls hypervMsvmComputerSystemFromDomain + hypervInvokeMsvmComputerSystemRequestStateChange? Note that virDomainReboot() can take various flags, however none is used ATM. -- Pino Toscano
Attachment:
signature.asc
Description: This is a digitally signed message part.