diff options
author | Eduardo Otubo <otubo@linux.vnet.ibm.com> | 2011-04-19 12:34:08 -0300 |
---|---|---|
committer | Matthias Bolte <matthias.bolte@googlemail.com> | 2011-04-21 08:25:33 +0200 |
commit | 41461ff7f7d6ee6679aae2a8004e305c5830c9e8 (patch) | |
tree | 388fa06504e638d7d962bd44f8378d17b73b0eff /src/phyp | |
parent | build: fix syntax-check failure (diff) | |
download | libvirt-41461ff7f7d6ee6679aae2a8004e305c5830c9e8.tar.gz libvirt-41461ff7f7d6ee6679aae2a8004e305c5830c9e8.tar.bz2 libvirt-41461ff7f7d6ee6679aae2a8004e305c5830c9e8.zip |
PHYP: Adding reboot domain function
Adding reboot <domain> function for pHyp driver.
Diffstat (limited to 'src/phyp')
-rw-r--r-- | src/phyp/phyp_driver.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index bb0e0ac6d..ebd4a8adb 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -3384,6 +3384,39 @@ cleanup: } static int +phypDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED) +{ + int result = -1; + ConnectionData *connection_data = dom->conn->networkPrivateData; + virConnectPtr conn = dom->conn; + LIBSSH2_SESSION *session = connection_data->session; + phyp_driverPtr phyp_driver = conn->privateData; + int system_type = phyp_driver->system_type; + char *managed_system = phyp_driver->managed_system; + int exit_status = 0; + char *ret = NULL; + virBuffer buf = VIR_BUFFER_INITIALIZER; + + virBufferAddLit(&buf, "chsysstate"); + if (system_type == HMC) + virBufferVSprintf(&buf, " -m %s", managed_system); + virBufferVSprintf(&buf, + " -r lpar -o shutdown --id %d --immed --restart", + dom->id); + ret = phypExecBuffer(session, &buf, &exit_status, dom->conn, false); + + if (exit_status < 0) + goto cleanup; + + result = 0; + + cleanup: + VIR_FREE(ret); + + return result; +} + +static int phypDomainShutdown(virDomainPtr dom) { int result = -1; @@ -3707,7 +3740,7 @@ static virDriver phypDriver = { NULL, /* domainSuspend */ phypDomainResume, /* domainResume */ phypDomainShutdown, /* domainShutdown */ - NULL, /* domainReboot */ + phypDomainReboot, /* domainReboot */ phypDomainDestroy, /* domainDestroy */ NULL, /* domainGetOSType */ NULL, /* domainGetMaxMemory */ |