docs: def reset(rh):
      """
      Reset a virtual machine.
  
      Input:
         Request Handle with the following properties:
            function    - 'POWERVM'
            subfunction - 'RESET'
            userid      - userid of the virtual machine
            parms['maxQueries']     - Maximum number of queries to issue.
                                      Optional.
            parms['maxWait']        - Maximum time to wait in seconds. Optional,
                                      unless 'maxQueries' is specified.
            parms['poll']           - Polling interval in seconds. Optional,
                                      unless 'maxQueries' is specified.
  
      Output:
         Request Handle updated with the results.
         Return code - 0: ok, non-zero: error
      """
  
      rh.printSysLog("Enter powerVM.reset, userid: " + rh.userid)
  
      # Log off the user
      parms = ["-T", rh.userid]
      results = invokeSMCLI(rh, "Image_Deactivate", parms)
      if results['overallRC'] != 0:
          if results['rc'] == 200 and results['rs'] == 12:
              # Tolerated error.  Machine is already in the desired state.
              results['overallRC'] = 0
              results['rc'] = 0
              results['rs'] = 0
          else:
              # SMAPI API failed.
              rh.printLn("ES", results['response'])
              rh.updateResults(results)    # Use results from invokeSMCLI
  
      # Wait for the logoff to complete
      if results['overallRC'] == 0:
          results = waitForVMState(rh, rh.userid, "off",
              maxQueries=30, sleepSecs=10)
  
      # Log the user back on
      if results['overallRC'] == 0:
          parms = ["-T", rh.userid]
          results = invokeSMCLI(rh, "Image_Activate", parms)
          if results['overallRC'] != 0:
              # SMAPI API failed.
              rh.printLn("ES", results['response'])
              rh.updateResults(results)    # Use results from invokeSMCLI
  
      if results['overallRC'] == 0 and 'maxQueries' in rh.parms:
          if rh.parms['desiredState'] == 'up':
              results = waitForOSState(
                  rh,
                  rh.userid,
                  rh.parms['desiredState'],
                  maxQueries=rh.parms['maxQueries'],
                  sleepSecs=rh.parms['poll'])
          else:
              results = waitForVMState(
                  rh,
                  rh.userid,
                  rh.parms['desiredState'],
                  maxQueries=rh.parms['maxQueries'],
                  sleepSecs=rh.parms['poll'])
          if results['overallRC'] == 0:
              rh.printLn("N", rh.userid + ": " +
                         rh.parms['desiredState'])
          else:
              rh.updateResults(results)
  
      rh.printSysLog("Exit powerVM.reset, rc: " +
          str(rh.results['overallRC']))
      return rh.results['overallRC']