def getStatus(rh):
    """
    Get the power (logon/off) status of a virtual machine.

    Input:
       Request Handle with the following properties:
          function    - 'POWERVM'
          subfunction - 'STATUS'
          userid      - userid of the virtual machine

    Output:
       Request Handle updated with the results.
       results['overallRC'] - 0: ok, non-zero: error
       if ok:
          results['rc'] - 0: for both on and off cases
          results['rs'] - 0: powered on
          results['rs'] - 1: powered off
    """

    rh.printSysLog("Enter powerVM.getStatus, userid: " +
        rh.userid)

    results = isLoggedOn(rh, rh.userid)
    if results['overallRC'] != 0:
        # Unexpected error
        pass
    elif results['rs'] == 0:
        rh.printLn("N", rh.userid + ": on")
    else:
        rh.printLn("N", rh.userid + ": off")

    rh.updateResults(results)

    rh.printSysLog("Exit powerVM.getStatus, rc: " +
        str(rh.results['overallRC']))
    return rh.results['overallRC']
def getStatus ( rh ) : rh . printSysLog ( "Enter powerVM.getStatus, userid: " + rh . userid ) results = isLoggedOn ( rh , rh . userid ) if results [ 'overallRC' ] != 0 : pass elif results [ 'rs' ] == 0 : rh . printLn ( "N" , rh . userid + ": on" ) else : rh . printLn ( "N" , rh . userid + ": off" ) rh . updateResults ( results ) rh . printSysLog ( "Exit powerVM.getStatus, rc: " + str ( rh . results [ 'overallRC' ] ) ) return rh . results [ 'overallRC' ]
Get the power (logon/off) status of a virtual machine.

    Input:
       Request Handle with the following properties:
          function    - 'POWERVM'
          subfunction - 'STATUS'
          userid      - userid of the virtual machine

    Output:
       Request Handle updated with the results.
       results['overallRC'] - 0: ok, non-zero: error
       if ok:
          results['rc'] - 0: for both on and off cases
          results['rs'] - 0: powered on
          results['rs'] - 1: powered off