I will test this on my machine in lab. My goal is to use this hmc api to upgrade and update the hmcs and managed system. But first working on hmcs.
Original Message:
Sent: Wed February 14, 2024 03:11 AM
From: Andre Lutz
Subject: HMC API to shutdown
Must work like this. But unfortunately I can't test it.
curl -d "Operation=Restart" -k -c cookies.txt -b cookies.txt \
-H "Accept: application/atom+xml; charset=UTF-8" -X POST \
https://${HMC}:12443/rest/api/uom/ManagementConsole/${HMC-UUID}/do/ShutdownHM
------------------------------
Andre Lutz
Original Message:
Sent: Wed February 14, 2024 01:47 AM
From: Vijay Kumar Bana
Subject: HMC API to shutdown
We need to provide the input parameter "Operation" with value "Restart" for reboot. Without this HMC will go for shutdown.
------------------------------
Vijay Kumar Bana
Original Message:
Sent: Tue February 13, 2024 11:10 AM
From: Marvin Jones
Subject: HMC API to shutdown
@Andre... oh man thank you!!!!! i will try and convert this into go .. will let you know what i find.
------------------------------
Marvin Jones
Original Message:
Sent: Tue February 13, 2024 07:37 AM
From: Andre Lutz
Subject: HMC API to shutdown
Hello Marvin,
I think I have a solution for you.
But is in with Curl.
Shouldn't be a problem with Go or Python either. watsonx can do the job =) #advertising
# create login file
# Example #>cat login.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LogonRequest xmlns="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/" schemaVersion="V1_0">
<UserID>hscroot</UserID>
<Password>XXX</Password>
</LogonRequest>
# login with login.xml -> token(cookies.txt)
curl -k -c cookies.txt -i -X PUT -H "Content-Type: application/vnd.ibm.powervm.web+xml; type=LogonRequest" -H "Accept: application/vnd.ibm.powervm.web+xml; type=LogonResponse" -H "X-Audit-Memento: hmc_test" -d @login.xml https://${HMC}:12443/rest/api/web/Logon
#Example:
# $ cat cookies.txt
# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_hmc5.labda.sva.de FALSE / TRUE 0 CCFWSESSION 546BB7ACDD2A64817D86A718A403E48E
#HttpOnly_hmc5.labda.sva.de FALSE /rest TRUE 0 JSESSIONID 57FA02F0C10FBB552EB353EB1CB367D7
# curl to HMC to get HMC-UUID
HMC-UUID=$(curl -s -k -c cookies.txt -b cookies.txt -H "Accept: application/atom+xml; charset=UTF-8" https://${HMC}:12443/rest/api/uom/ManagementConsole | grep "<id>" | tail -1 | tr -d '</id>' | tr '<id>' ' ' | cut -f 1) #Not tested but must do.
#!!!!Attention!!!!
#!!!!!HMC Reboot !!!!!
##
curl -k -c cookies.txt -b cookies.txt -H "Accept: application/atom+xml; charset=UTF-8" https://${HMC}:12443/rest/api/uom/ManagementConsole/${HMC-UUID}/do/ShutdownHMC
------------------------------
Andre Lutz
Original Message:
Sent: Fri February 09, 2024 05:03 PM
From: Marvin Jones
Subject: HMC API to shutdown
Hello,
Can someone or is there some sort of example to use this API call to reboot a HMC?
python, Go or any language will work
ShutdownHMC_ManagementConsole Job
Ibm | remove preview |
| ShutdownHMC_ManagementConsole Job | The ShutdownHMC job performs shutdown and reboot operations on the HMC. | View this on Ibm > |
|
|
P
------------------------------
Marvin Jones
------------------------------