Return a list of the VMs that are on the provider
348307
def list_nodes(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called with -f or --function.'
        )

    nodes = list_nodes_full()
    ret = {}
    for instanceId in nodes:
        node = nodes[instanceId]
        ret[node['name']] = {
            'id': node['id'],
            'name': node['name'],
            'public_ips': node['public_ips'],
            'private_ips': node['private_ips'],
            'size': node['size'],
            'state': six.text_type(node['state']),
        }
    return ret
951158
def virtual_networks_list_all(**kwargs):
    '''
    

    '''
    result = {}
    netconn = __utils__['azurearm.get_client']('network', **kwargs)
    try:
        vnets = __utils__['azurearm.paged_object_to_list'](netconn.virtual_networks.list_all())

        for vnet in vnets:
            result[vnet['name']] = vnet
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs)
        result = {'error': str(exc)}

    return result
875710
def list(gandi, only_paas, only_vm):
    
    target = None
    if only_paas and not only_vm:
        target = 'paas'
    if only_vm and not only_paas:
        target = 'vm'

    output_keys = ['id', 'name', 'kept_total', 'target']
    result = gandi.snapshotprofile.list({}, target=target)

    for num, profile in enumerate(result):
        if num:
            gandi.separator_line()
        output_snapshot_profile(gandi, profile, output_keys)

    return result
1356896
def sqlvm_list(
        client,
        resource_group_name=None):
    '''
    
    '''
    if resource_group_name:
        # List all sql vms  in the resource group
        return client.list_by_resource_group(resource_group_name=resource_group_name)

    # List all sql vms in the subscription
    return client.list()
640892
def list_vapps(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_vapps function must be called with '
            '-f or --function.'
        )

    return {'vApps': salt.utils.vmware.list_vapps(_get_si())}
183363
def vms
      logger.debug "get all VMs in all datacenters: begin"
      result = dcs.inject([]) do |r, dc|
        r + serviceContent.viewManager.CreateContainerView(
          container: dc.vmFolder,
          type: ['VirtualMachine'],
          recursive: true
        ).view
      end
      logger.debug "get all VMs in all datacenters: end"
      result
    end
968506
async def get(self):
        
        shepherd = self.request.app.vmshepherd
        data = {'presets': {}, 'config': shepherd.config}
        presets = await shepherd.preset_manager.list_presets()
        runtime = shepherd.runtime_manager
        for name in presets:
            preset = shepherd.preset_manager.get_preset(name)
            data['presets'][name] = {
                'preset': preset,
                'vms': preset.vms,
                'runtime': await runtime.get_preset_data(name),
                'vmshepherd_id': shepherd.instance_id,
                'now': time.time()
            }
        return data
1125265
def list(host=None, quiet=False, hyper=None):  # pylint: disable=redefined-builtin
    '''
    
    '''
    if quiet:
        log.warning("'quiet' is deprecated. Please migrate to --quiet")
    ret = {}
    client = salt.client.get_local_client(__opts__['conf_file'])
    for info in client.cmd_iter('virtual:physical',
                                'virt.vm_info', tgt_type='grain'):
        if not info:
            continue
        if not isinstance(info, dict):
            continue
        chunk = {}
        id_ = next(six.iterkeys(info))
        if host:
            if host != id_:
                continue
        if not isinstance(info[id_], dict):
            continue
        if 'ret' not in info[id_]:
            continue
        if not isinstance(info[id_]['ret'], dict):
            continue
        data = {}
        for key, val in six.iteritems(info[id_]['ret']):
            if val['state'] in data:
                data[val['state']].append(key)
            else:
                data[val['state']] = [key]
        chunk[id_] = data
        ret.update(chunk)
        if not quiet:
            __jid_event__.fire_event({'data': chunk, 'outputter': 'nested'}, 'progress')

    return ret
367341
def get_resources_vms(call=None, resFilter=None, includeConfig=True):
    '''
    
    '''

    timeoutTime = time.time() + 60
    while True:
        log.debug('Getting resource: vms.. (filter: %s)', resFilter)
        resources = query('get', 'cluster/resources')
        ret = {}
        badResource = False
        for resource in resources:
            if 'type' in resource and resource['type'] in ['openvz', 'qemu',
                                                           'lxc']:
                try:
                    name = resource['name']
                except KeyError:
                    badResource = True
                    log.debug('No name in VM resource %s', repr(resource))
                    break

                ret[name] = resource

                if includeConfig:
                    # Requested to include the detailed configuration of a VM
                    ret[name]['config'] = get_vmconfig(
                        ret[name]['vmid'],
                        ret[name]['node'],
                        ret[name]['type']
                    )

        if time.time() > timeoutTime:
            raise SaltCloudExecutionTimeout('FAILED to get the proxmox '
                                            'resources vms')

        # Carry on if there wasn't a bad resource return from Proxmox
        if not badResource:
            break

        time.sleep(0.5)

    if resFilter is not None:
        log.debug('Filter given: %s, returning requested '
                  'resource: nodes', resFilter)
        return ret[resFilter]

    log.debug('Filter not given: %s, returning all resource: nodes', ret)
    return ret
968407
def list_nodes_full(conn=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_full function must be called with -f or '
            '--function.'
        )

    if not conn:
        conn = get_conn()   # pylint: disable=E0602

    ret = {}
    datacenter_id = get_datacenter_id()
    nodes = conn.list_servers(datacenter_id=datacenter_id, depth=3)

    for item in nodes['items']:
        node = {'id': item['id']}
        node.update(item['properties'])
        node['state'] = node.pop('vmState')
        node['public_ips'] = []
        node['private_ips'] = []
        if item['entities']['nics']['items'] > 0:
            for nic in item['entities']['nics']['items']:
                if nic['properties']['ips']:
                    pass
                ip_address = nic['properties']['ips'][0]
                if salt.utils.cloud.is_public_ip(ip_address):
                    node['public_ips'].append(ip_address)
                else:
                    node['private_ips'].append(ip_address)

        ret[node['name']] = node

    __utils__['cloud.cache_node_list'](
        ret,
        __active_provider_name__.split(':')[0],
        __opts__
    )

    return ret
839941
def list_dvs(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_dvs function must be called with '
            '-f or --function.'
        )

    return {'Distributed Virtual Switches': salt.utils.vmware.list_dvs(_get_si())}
1264130
def list_nodes_full(session=None):
    '''
    

    '''
    if session is None:
        session = _get_session()

    ret = {}
    vms = session.xenapi.VM.get_all()
    for vm in vms:
        record = session.xenapi.VM.get_record(vm)
        if not record['is_a_template'] and not record['is_control_domain']:
            # deal with cases where the VM doesn't have 'base_template_name' attribute
            try:
                base_template_name = record['other_config']['base_template_name']
            except Exception:
                base_template_name = None
                log.debug(
                    'VM %s, doesnt have base_template_name attribute',
                    record['name_label']
                )
            vm_cfg = session.xenapi.VM.get_record(vm)
            vm_cfg['id'] = record['uuid']
            vm_cfg['name'] = record['name_label']
            vm_cfg['image'] = base_template_name
            vm_cfg['size'] = None
            vm_cfg['state'] = record['power_state']
            vm_cfg['private_ips'] = get_vm_ip(record['name_label'], session)
            vm_cfg['public_ips'] = None
            if 'snapshot_time' in vm_cfg.keys():
                del vm_cfg['snapshot_time']
            ret[record['name_label']] = vm_cfg

    provider = __active_provider_name__ or 'xen'
    if ':' in provider:
        comps = provider.split(':')
        provider = comps[0]
    log.debug('ret: %s', ret)
    log.debug('provider: %s', provider)
    log.debug('__opts__: %s', __opts__)
    __utils__['cloud.cache_node_list'](ret, provider, __opts__)
    return ret
1291928
def get_servers():
    '''
    
    '''
    cmd = ['w32tm', '/query', '/configuration']
    lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines()
    for line in lines:
        try:
            if line.startswith('NtpServer:'):
                _, ntpsvrs = line.rsplit(' (', 1)[0].split(':', 1)
                return sorted(ntpsvrs.split())
        except ValueError as e:
            return False
    return False
880280
def list_nodes(conn=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called with -f or --function.'
        )

    if not conn:
        conn = get_conn()

    ret = {}
    datacenter_id = get_datacenter_id()

    try:
        nodes = conn.list_servers(datacenter_id=datacenter_id)
    except PBNotFoundError:
        log.error('Failed to get nodes list '
                  'from datacenter: %s', datacenter_id)
        raise

    for item in nodes['items']:
        node = {'id': item['id']}
        node.update(item['properties'])
        node['state'] = node.pop('vmState')
        ret[node['name']] = node

    return ret
649553
def get_vm_ports(port_id=None):
    """"""
    return get_ports(device_owners=[n_const.DEVICE_OWNER_COMPUTE_PREFIX,
                                    t_const.TRUNK_SUBPORT_OWNER],
                     vnic_type=portbindings.VNIC_NORMAL, port_id=port_id)
63652
def virtual_interface_list(self, name):
        '''
        
        '''
        nt_ks = self.compute_conn
        nets = nt_ks.virtual_interfaces.list(self._server_uuid_from_name(name))
        return [network.__dict__ for network in nets]
51966
def list_vms_sub(access_token, subscription_id):
    '''
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/providers/Microsoft.Compute/virtualMachines',
                        '?api-version=', COMP_API])
    return do_get_next(endpoint, access_token)