def vm_running(name):
 name = name.lower()
 ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''}
 if (name in __salt__['vmadm.list'](order='hostname', search='state=running')):
  ret['result'] = True
  ret['comment'] = 'vm {0} already running'.format(name)
 else:
  ret['result'] = (True if __opts__['test'] else __salt__['vmadm.start'](name, key='hostname'))
  if ((not isinstance(ret['result'], bool)) and ret['result'].get('Error')):
   ret['result'] = False
   ret['comment'] = 'failed to start {0}'.format(name)
  else:
   ret['changes'][name] = 'running'
   ret['comment'] = 'vm {0} started'.format(name)
 return ret

def vm_running ( name ) : name = name . lower ( ) ret = { 'name' : name , 'changes' : { } , 'result' : None , 'comment' : '' } if ( name in __salt__ [ 'vmadm.list' ] ( order = 'hostname' , search = 'state=running' ) ) : ret [ 'result' ] = True ret [ 'comment' ] = 'vm {0} already running' . format ( name ) else : ret [ 'result' ] = ( True if __opts__ [ 'test' ] else __salt__ [ 'vmadm.start' ] ( name , key = 'hostname' ) ) if ( ( not isinstance ( ret [ 'result' ] , bool ) ) and ret [ 'result' ] . get ( 'Error' ) ) : ret [ 'result' ] = False ret [ 'comment' ] = 'failed to start {0}' . format ( name ) else : ret [ 'changes' ] [ name ] = 'running' ret [ 'comment' ] = 'vm {0} started' . format ( name ) return ret
ensure vm is in the running state on the computenode name : string hostname of vm .