def sysrq(vm, action='nmi', key='uuid'):
 ret = {}
 vmadm = _check_vmadm()
 if (key not in ['uuid', 'alias', 'hostname']):
  ret['Error'] = 'Key must be either uuid, alias or hostname'
  return ret
 if (action not in ['nmi', 'screenshot']):
  ret['Error'] = 'Action must be either nmi or screenshot'
  return ret
 vm = lookup('{0}={1}'.format(key, vm), one=True)
 if ('Error' in vm):
  return vm
 cmd = '{vmadm} sysrq {uuid} {action}'.format(vmadm=vmadm, uuid=vm, action=action)
 res = __salt__['cmd.run_all'](cmd)
 retcode = res['retcode']
 if (retcode != 0):
  ret['Error'] = (res['stderr'] if ('stderr' in res) else _exit_status(retcode))
  return ret
 return True

def sysrq ( vm , action = 'nmi' , key = 'uuid' ) : ret = { } vmadm = _check_vmadm ( ) if ( key not in [ 'uuid' , 'alias' , 'hostname' ] ) : ret [ 'Error' ] = 'Key must be either uuid, alias or hostname' return ret if ( action not in [ 'nmi' , 'screenshot' ] ) : ret [ 'Error' ] = 'Action must be either nmi or screenshot' return ret vm = lookup ( '{0}={1}' . format ( key , vm ) , one = True ) if ( 'Error' in vm ) : return vm cmd = '{vmadm} sysrq {uuid} {action}' . format ( vmadm = vmadm , uuid = vm , action = action ) res = __salt__ [ 'cmd.run_all' ] ( cmd ) retcode = res [ 'retcode' ] if ( retcode != 0 ) : ret [ 'Error' ] = ( res [ 'stderr' ] if ( 'stderr' in res ) else _exit_status ( retcode ) ) return ret return True
send non-maskable interrupt to vm or capture a screenshot vm : string vm to be targeted action : string nmi or screenshot -- default: nmi key : string [uuid|alias|hostname] value type of vm parameter cli example: .