def get_vm_status(vmid=None, name=None):
 if (vmid is not None):
  log.debug('get_vm_status: VMID {0}'.format(vmid))
  vmobj = _get_vm_by_id(vmid)
 elif (name is not None):
  log.debug('get_vm_status: name {0}'.format(name))
  vmobj = _get_vm_by_name(name)
 else:
  log.debug('get_vm_status: No ID or NAME given')
  raise SaltCloudExecutionFailure
 log.debug('VM found: {0}'.format(vmobj))
 if ((vmobj is not None) and ('node' in vmobj)):
  log.debug('VM_STATUS: Has desired info. Retrieving.. ({0})'.format(vmobj['name']))
  data = query('get', 'nodes/{0}/{1}/{2}/status/current'.format(vmobj['node'], vmobj['type'], vmobj['vmid']))
  return data
 log.error('VM or requested status not found..')
 return False

def get_vm_status ( vmid = None , name = None ) : if ( vmid is not None ) : log . debug ( 'get_vm_status: VMID {0}' . format ( vmid ) ) vmobj = _get_vm_by_id ( vmid ) elif ( name is not None ) : log . debug ( 'get_vm_status: name {0}' . format ( name ) ) vmobj = _get_vm_by_name ( name ) else : log . debug ( 'get_vm_status: No ID or NAME given' ) raise SaltCloudExecutionFailure log . debug ( 'VM found: {0}' . format ( vmobj ) ) if ( ( vmobj is not None ) and ( 'node' in vmobj ) ) : log . debug ( 'VM_STATUS: Has desired info. Retrieving.. ({0})' . format ( vmobj [ 'name' ] ) ) data = query ( 'get' , 'nodes/{0}/{1}/{2}/status/current' . format ( vmobj [ 'node' ] , vmobj [ 'type' ] , vmobj [ 'vmid' ] ) ) return data log . error ( 'VM or requested status not found..' ) return False
get the status for a vm .