cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4518
Views
2
Helpful
8
Replies

Does UCS B-Series XML API support power up/down operations

knoppgary
Level 1
Level 1

I  am trying to develop a python script that uses the XML API for powering on/off blades on a UCS B-Series (40 blades).    I haven't been able to find clear documentation that explains what is supported on a B-series product.    However, I have found API info on later UCS series product on the xml schema that I'm hoping pertains to B-series too.  Does anyone know if the XML API supports powering up/down blades?    The xml schema defined the 'adminPower' values ('up','down','cycle-immediate',...).   However, when I send value 'up' or 'down' , I get ...


<error cookie="" response="yes" errorCode="ERR-xml-parse-error" invocationResult="594" errorDescr="XML PARSING ERROR: unknown property value down, name adminPower, class computeRackUnit [sys/chassis-5/blade-7]"/>

When I send 'cycle-immediate' it failed with error "rn is invalid".   I assume that its complaining about the relative name (DN).   However, I can successfully use that same DN (see below) and it works fine.

-bash-4.1$ ./b200M4.py

        ==Logging In==

        <aaaLogin cookie="" response="yes" outCookie="1502749539/7f431c81-64a1-4249-9a3f-cb487ea02855" outRefreshPeriod="600" outPriv="admin,read-only" outDomains="" outChannel="noencssl" outEvtChannel="noencssl" outSessionId="web_44919_B" outVersion="3.1(3a)" outName="admin"> </aaaLogin>

        Status: 200

        ==Power-cycle==

        * Request

        <configConfMo cookie='1502749539/7f431c81-64a1-4249-9a3f-cb487ea02855' dn='sys/chassis-5/blade-7'><inConfig><computeRackUnit dn='sys/chassis-5/blade-7' adminPower='cycle-immediate'></computeRackUnit></inConfig></configConfMo>

        * Response

        <configConfMo dn="sys/chassis-5/blade-7" cookie="1502749539/7f431c81-64a1-4249-9a3f-cb487ea02855" response="yes" errorCode="104" invocationResult="unidentified-fail" errorDescr="rn is invalid"> </configConfMo>

        Status: 200


       ==Blade-Info==

       * Request

       DATA=<configResolveDn cookie='1502752794/4d5bda6c-6be9-483c-9b8b-930b88c96575' inHierarchical='false' dn='sys/chassis-5/blade-7'/>

        <configResolveDn dn="sys/chassis-5/blade-7" cookie="1502752794/4d5bda6c-6be9-483c-9b8b-930b88c96575" response="yes">

       * Response

        <outConfig> <computeBlade adminPower="policy" adminState="in-service" assetTag="" assignedToDn="org-root/ls-sdot-b200-039" association="associated" availability="unavailable" availableMemory="131072" chassisId="5" checkPoint="discovered" connPath="A,B" connStatus="A,B" descr="" discovery="complete" discoveryStatus="" dn="sys/chassis-5/blade-7" fltAggr="34359738368" fsmDescr="" fsmFlags="" fsmPrev="TurnupSuccess" fsmProgr="100" fsmRmtInvErrCode="none" fsmRmtInvErrDescr="" fsmRmtInvRslt="" fsmStageDescr="" fsmStamp="2017-08-07T12:56:38.886" fsmStatus="nop" fsmTry="0" intId="221863" kmipFault="no" kmipFaultDescription="" lc="undiscovered" lcTs="1969-12-31T19:00:00.000" localId="" lowVoltageMemory="regular-voltage" managingInst="B" memorySpeed="2133" mfgTime="2017-03-25T01:00:00.000" model="UCSB-B200-M4" name="" numOf40GAdaptorsWithOldFw="0" numOf40GAdaptorsWithUnknownFw="0" numOfAdaptors="1" numOfCores="20" numOfCoresEnabled="20" numOfCpus="2" numOfEthHostIfs="4" numOfFcHostIfs="2" numOfThreads="40" operPower="on" operPwrTransSrc="software_mcserver" operQualifier="" operState="ok" operability="operable" originalUuid="5054d11c-303e-49a9-bc78-01fa343392d6" partNumber="73-15862-04" policyLevel="0" policyOwner="local" presence="equipped" revision="0" scaledMode="none" serial="FCH21117CKU" serverId="5/7" slotId="7" totalMemory="131072" usrLbl="" uuid="00000000-0000-0000-0000-0025b5270270" vendor="Cisco Systems Inc" vid="V02"/> </outConfig> </configResolveDn>

        Status: 200

        ==Logging Out==

        <aaaLogout cookie="1502749539/7f431c81-64a1-4249-9a3f-cb487ea02855" response="yes" outStatus="success"> </aaaLogout>

        Status: 200

1 Accepted Solution

Accepted Solutions

John,

     It is now working!   Thank-you for your help in figuring out the correct syntax.

<configConfMo cookie="1502884658/ca2c8e57-77eb-4e76-b3d1-3dca87fd0d1b" inHierarchical="false">

  <inConfig>

    <lsPower

    state="soft-shut-down"

    dn="org-root/org-ESX-PROD/ls-ESX-COMP-01/power"

    status="created,modified" >

    </lsPower>

  </inConfig>

</configConfMo>

View solution in original post

8 Replies 8

jomcdono
Cisco Employee
Cisco Employee

Hi Gary,

The class id in the request should be computeBlade, not computeRackUnit.  computeRackUnit is for a C-Series server

Also there is a UCS Python SDK that is developed by Cisco, Cisco UCS Python SDK - ucsmsdk and available on Github, with documentation and samples, GitHub - CiscoUcs/ucsmsdk: Python SDK for Cisco UCSM

Hope that helps.

Regards,

John

One more thing, if you need some help getting going with the UCS Python SDK, check out this Cisco DevNet learning lab module, https://learninglabs.cisco.com/modules/ucs-python-sdk-introduction

DevNet membership is free.

John,

                I changed the class id to ‘computeBlade’.   I’m now able to successfully power cycle the machines with adminPower=‘cycle-immediate’.   However, the values I found for shutting down (‘down’) and booting(‘up’) the blade from a later product XML schema don’t work.  How/where do I find the correct adminPower values?

gk

==adminPower=’down’==

DATA=<configConfMo cookie='1502801753/6b81ca9f-9a96-4d2e-81d0-08dc79cf1951' dn='sys/chassis-5/blade-7'><inConfig><computeBlade dn='sys/chassis-5/blade-7' adminPower='down'></computeBlade></inConfig></configConfMo>

<error cookie="" response="yes" errorCode="ERR-xml-parse-error" invocationResult="594" errorDescr="XML PARSING ERROR: unsupported number format for uint64_t: down,"/>

==adminPower=’cycle-immeidate’==

DATA=<configConfMo cookie='1502802375/e2b1b69d-7f18-44c3-bcaa-c0e25b02fa3d' dn='sys/chassis-5/blade-7'><inConfig><computeBlade dn='sys/chassis-5/blade-7' adminPower='cycle-immediate'></computeBlade></inConfig></configConfMo>

<configConfMo dn="sys/chassis-5/blade-7" cookie="1502802375/e2b1b69d-7f18-44c3-bcaa-c0e25b02fa3d" response="yes"> <outConfig> <computeBlade adminPower="policy" adminState="in-service" assetTag="" assignedToDn="org-root/ls-sdot-b200-039" association="associated" availability="unavailable" availableMemory="131072" chassisId="5" checkPoint="discovered" connPath="A,B" connStatus="A,B" descr="" discovery="complete" discoveryStatus="" dn="sys/chassis-5/blade-7" fltAggr="34359738368" fsmDescr="" fsmFlags="" fsmPrev="TurnupSuccess" fsmProgr="100" fsmRmtInvErrCode="none" fsmRmtInvErrDescr="" fsmRmtInvRslt="" fsmStageDescr="" fsmStamp="2017-08-07T12:56:38.886" fsmStatus="PowercycleBegin" fsmTry="0" intId="221863" kmipFault="no" kmipFaultDescription="" lc="undiscovered" lcTs="1969-12-31T19:00:00.000" localId="" lowVoltageMemory="regular-voltage" managingInst="B" memorySpeed="2133" mfgTime="2017-03-25T01:00:00.000" model="UCSB-B200-M4" name="" numOf40GAdaptorsWithOldFw="0" numOf40GAdaptorsWithUnknownFw="0" numOfAdaptors="1" numOfCores="20" numOfCoresEnabled="20" numOfCpus="2" numOfEthHostIfs="4" numOfFcHostIfs="2" numOfThreads="40" operPower="on" operPwrTransSrc="software_mcserver" operQualifier="" operState="ok" operability="operable" originalUuid="5054d11c-303e-49a9-bc78-01fa343392d6" partNumber="73-15862-04" policyLevel="0" policyOwner="local" presence="equipped" revision="0" scaledMode="none" serial="FCH21117CKU" serverId="5/7" slotId="7" status="modified" totalMemory="131072" usrLbl="" uuid="00000000-0000-0000-0000-0025b5270270" vendor="Cisco Systems Inc" vid="V02"/> </outConfig> </configConfMo>

Status: 200

Hi Gary,

The correct values are admin-up and admin-down

The UCS Platform Emulator comes with the UCS Object Model documentation which has details for all the UCS Objects and their attributes. Get the Emulator here, Cisco UCS Platform Emulator 3.1(2ePE1)

If you don't want to install the emulator just to get the Object Model docs, I have attached a zip of the object model documentation to that page as well, the attached file is ucsm_object_docs.zip

Also the UCS Python SDK and UCS PowerTool have the object meta data built into them, so you could always use those tools and be able to access the object meta data directly.

Hope that helps.

Regards,

John

John,

     Although the adminPower='admin-down' was accepted, it didn't actually power the blade down.    I had the blade's KVM console running while I executed the request.   The response does show that the DN provided is the blade of interest "sdot-b200-039" - so I'm not accidentally powering off another blade down. I also verified that its not a case that the KVM console needed to be refreshed.  Any idea what might block this command from being acted on?   The only adminPower value that seems to work is 'cycle-immediate'.

=Request=

DATA=<configConfMo cookie='1502808917/5b5baf89-3072-431b-a7ef-1a07684e2728' dn='sys/chassis-5/blade-7'><inConfig><computeBlade dn='sys/chassis-5/blade-7' adminPower='admin-down'></computeBlade></inConfig></configConfMo>

=Response=

<configConfMo dn="sys/chassis-5/blade-7" cookie="1502808917/5b5baf89-3072-431b-a7ef-1a07684e2728" response="yes"> <outConfig> <computeBlade adminPower="policy" adminState="in-service" assetTag="" assignedToDn="org-root/ls-sdot-b200-039" association="associated" availability="unavailable" availableMemory="131072" chassisId="5" checkPoint="discovered" connPath="A,B" connStatus="A,B" descr="" discovery="complete" discoveryStatus="" dn="sys/chassis-5/blade-7" fltAggr="34359738368" fsmDescr="" fsmFlags="" fsmPrev="TurnupSuccess" fsmProgr="100" fsmRmtInvErrCode="none" fsmRmtInvErrDescr="" fsmRmtInvRslt="" fsmStageDescr="" fsmStamp="2017-08-15T10:54:40.608" fsmStatus="nop" fsmTry="0" intId="221863" kmipFault="no" kmipFaultDescription="" lc="undiscovered" lcTs="1969-12-31T19:00:00.000" localId="" lowVoltageMemory="regular-voltage" managingInst="B" memorySpeed="2133" mfgTime="2017-03-25T01:00:00.000" model="UCSB-B200-M4" name="" numOf40GAdaptorsWithOldFw="0" numOf40GAdaptorsWithUnknownFw="0" numOfAdaptors="1" numOfCores="20" numOfCoresEnabled="20" numOfCpus="2" numOfEthHostIfs="4" numOfFcHostIfs="2" numOfThreads="40" operPower="on" operPwrTransSrc="software_mcserver" operQualifier="" operState="ok" operability="operable" originalUuid="5054d11c-303e-49a9-bc78-01fa343392d6" partNumber="73-15862-04" policyLevel="0" policyOwner="local" presence="equipped" revision="0" scaledMode="none" serial="FCH21117CKU" serverId="5/7" slotId="7" status="modified" totalMemory="131072" usrLbl="" uuid="00000000-0000-0000-0000-0025b5270270" vendor="Cisco Systems Inc" vid="V02"/> </outConfig> </configConfMo>

John,

      And idea why only the adminPower='cycle-immediate' works and values of 'admin-up' and 'admin-down' do not?   The latter 2 requests are accepted but the blades do not change power state.  

     I looked at the python ucsmsdk and the various examples as you suggested.  However,  I couldn't find any code examples that clearly showed how to power a blade up and down.   Do you have an example that you could share?    My guess is I'll see the same results where only cycle-immediate works.   However, its certainly worth a try.

jomcdono
Cisco Employee
Cisco Employee

Hi Gary,

Apologies I have given you incorrect information, sorry for any inconvenience it may has caused.

A Service Profile's power is managed by the lsPower object, which is a child of the Service Profile. To manage the power of a server you need to change the "state" attribute.  Here is an example of an lsPower object where the state has been set to "soft-shut-down".

<configConfMo cookie="1502884658/ca2c8e57-77eb-4e76-b3d1-3dca87fd0d1b" inHierarchical="false">

  <inConfig>

    <lsPower

    state="soft-shut-down"

    dn="org-root/org-ESX-PROD/ls-ESX-COMP-01/power"

    status="created,modified"

    </lsPower>

  </inConfig>

</configConfMo>

The valid values for state are

lsPower-state.jpg

Regards,

John

John,

     It is now working!   Thank-you for your help in figuring out the correct syntax.

<configConfMo cookie="1502884658/ca2c8e57-77eb-4e76-b3d1-3dca87fd0d1b" inHierarchical="false">

  <inConfig>

    <lsPower

    state="soft-shut-down"

    dn="org-root/org-ESX-PROD/ls-ESX-COMP-01/power"

    status="created,modified" >

    </lsPower>

  </inConfig>

</configConfMo>

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: