Warm Reboot should call the host reboot object
From https://github.com/openbmc/docs/blob/master/host-management.md:
To reboot the host:
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT
-d '{"data": "xyz.openbmc_project.State.Host.Transition.Reboot"}'
https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition
Resolves openbmc/openbmc#2797
Tested: Pointed the local GUI to a Witherspoon system and
verfied the correct rest call was made and the system warm rebooted.
Change-Id: If073ef4447b323777603e886668212bd04791eea
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 730b2d8..3f28751 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -357,19 +357,19 @@
},
hostReboot: function(callback){
$http({
- method: 'POST',
- url: DataService.getHost() + "/xyz/openbmc_project/state/host0",
+ method: 'PUT',
+ url: DataService.getHost() + "/xyz/openbmc_project/state/host0/attr/RequestedHostTransition",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
withCredentials: true,
- data: JSON.stringify({"data": []}),
+ data: JSON.stringify({"data": "xyz.openbmc_project.State.Host.Transition.Reboot"})
}).then(function(response){
var json = JSON.stringify(response.data);
var content = JSON.parse(json);
if(callback){
- return callback(content);
+ return callback(content.status);
}
}, function(error){
if(callback){
diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js
index d38076f..273bb19 100644
--- a/app/server-control/controllers/power-operations-controller.js
+++ b/app/server-control/controllers/power-operations-controller.js
@@ -59,15 +59,11 @@
$scope.warmReboot = function(){
//@TODO:show progress
dataService.setBootingState();
- APIUtils.hostPowerOff(function(response){
+ APIUtils.hostReboot(function(response){
if(response){
- APIUtils.hostPowerOn(function(response){
- if(response){
- dataService.setPowerOnState();
- }else{
- //@TODO:show error message
- }
- });
+ dataService.setPowerOnState();
+ }else{
+ //@TODO:hide progress & show error message
}
});
};