Return a list of the VMs that are on the provider
770263
def list_nodes_full(call=None, for_output=True):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_full function must be called with -f or --function.'
        )
    return _list_nodes(full=True, for_output=for_output)
25233
def get_provider(vm_=None):
    '''
    
    '''
    if vm_ is None:
        provider = __active_provider_name__ or 'ec2'
    else:
        provider = vm_.get('provider', 'ec2')

    if ':' in provider:
        prov_comps = provider.split(':')
        provider = prov_comps[0]
    return provider
939475
def list_domains():
    '''
    
    '''
    with _get_xapi_session() as xapi:
        hosts = xapi.VM.get_all()
        ret = []

        for _host in hosts:
            if xapi.VM.get_record(_host)['is_control_domain'] is False:
                ret.append(xapi.VM.get_name_label(_host))

        return ret
795360
def _list_machines(self):
        
        try:
            req = self.request(self.mist_client.uri+'/clouds/'+self.id+'/machines')
            machines = req.get().json()
        except:
            # Eg invalid cloud credentials
            machines = {}

        if machines:
            for machine in machines:
                self._machines[machine['machine_id']] = Machine(machine, self)
        else:
            self._machines = {}
1346360
def list_vhosts(runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'list_vhosts', '-q'],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)
    _check_response(res)
    return _output_to_list(res['stdout'])
902902
def list_vnets(access_token, subscription_id):
    '''
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/providers/Microsoft.Network/',
                        '/virtualNetworks?api-version=', NETWORK_API])
    return do_get(endpoint, access_token)
561135
def list_portgroups(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_portgroups function must be called with '
            '-f or --function.'
        )

    return {'Portgroups': salt.utils.vmware.list_portgroups(_get_si())}
898051
def list_domains():
    '''
    
    '''
    data = __salt__['vmadm.list'](keyed=True)
    vms = ["UUID                                  TYPE  RAM      STATE             ALIAS"]
    for vm in data:
        vms.append("{vmuuid}{vmtype}{vmram}{vmstate}{vmalias}".format(
            vmuuid=vm.ljust(38),
            vmtype=data[vm]['type'].ljust(6),
            vmram=data[vm]['ram'].ljust(9),
            vmstate=data[vm]['state'].ljust(18),
            vmalias=data[vm]['alias'],
        ))
    return vms
554878
def list_networks(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_networks function must be called with '
            '-f or --function.'
        )

    return {'Networks': salt.utils.vmware.list_networks(_get_si())}
1246364
def GetCpuStolenMs(self):
        ''''''
        counter = c_uint64()
        ret = vmGuestLib.VMGuestLib_GetCpuStolenMs(self.handle.value, byref(counter))
        if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret)
        return counter.value
346938
def list_available_providers(self):
        
        providers = []

        if self.alternative_config_dir:
            for f in os.listdir(os.path.join(self.alternative_config_dir, self.CLOUD_PROVIDERS_DIR)):
                if os.path.splitext(f)[1] in ['.conf', '.json']:
                    try:
                        n = os.path.join(self.alternative_config_dir, self.CLOUD_PROVIDERS_DIR, f)
                        providers.append(ServiceProviderConfiguration(n))
                    except ControllerConfigurationException:
                        pass


        for f in os.listdir(os.path.join(self.default_config_dir, self.CLOUD_PROVIDERS_DIR)):
            if os.path.splitext(f)[1] in ['.conf', '.json']:
                try:
                    n = os.path.join(self.default_config_dir, self.CLOUD_PROVIDERS_DIR, f)
                    providers.append(ServiceProviderConfiguration(n))
                except ControllerConfigurationException:
                    pass

        return providers
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
1176695
def list_virtual_networks(call=None, kwargs=None):
    '''
    
    '''
    if kwargs is None:
        kwargs = {}

    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_sizes function must be called with '
            '-f or --function'
        )

    netconn = get_conn(client_type='network')
    resource_groups = list_resource_groups()

    ret = {}
    for group in resource_groups:
        try:
            networks = netconn.virtual_networks.list(
                resource_group_name=group
            )
        except CloudError:
            networks = {}
        for network_obj in networks:
            network = network_obj.as_dict()
            ret[network['name']] = network
            ret[network['name']]['subnets'] = list_subnets(
                kwargs={'resource_group': group, 'network': network['name']}
            )

    return ret
425197
def vms(nictag):
    '''
    
    '''
    ret = {}
    cmd = 'nictagadm vms {0}'.format(nictag)
    res = __salt__['cmd.run_all'](cmd)
    retcode = res['retcode']
    if retcode != 0:
        ret['Error'] = res['stderr'] if 'stderr' in res else 'Failed to get list of vms.'
    else:
        ret = res['stdout'].splitlines()
    return ret
43326
def get_details(self):
        
        data = []
        if isinstance(self.model, vCenterCloneVMFromVMResourceModel):
            data.append(VmDetailsProperty(key='Cloned VM Name', value=self.model.vcenter_vm))

        if isinstance(self.model, VCenterDeployVMFromLinkedCloneResourceModel):
            template = self.model.vcenter_vm
            snapshot = self.model.vcenter_vm_snapshot
            data.append(VmDetailsProperty(key='Cloned VM Name',value= '{0} (snapshot: {1})'.format(template, snapshot)))

        if isinstance(self.model, vCenterVMFromImageResourceModel):
            data.append(VmDetailsProperty(key='Base Image Name', value=self.model.vcenter_image.split('/')[-1]))

        if isinstance(self.model, vCenterVMFromTemplateResourceModel):
            data.append(VmDetailsProperty(key='Template Name', value=self.model.vcenter_template))

        return data
828399
def _list_nodes_full(location=None):
    '''
    
    '''
    provider = __active_provider_name__ or 'ec2'
    if ':' in provider:
        comps = provider.split(':')
        provider = comps[0]

    params = {'Action': 'DescribeInstances'}
    instances = aws.query(params,
                          location=location,
                          provider=provider,
                          opts=__opts__,
                          sigver='4')
    if 'error' in instances:
        raise SaltCloudSystemExit(
            'An error occurred while listing nodes: {0}'.format(
                instances['error']['Errors']['Error']['Message']
            )
        )

    ret = _extract_instance_info(instances)

    __utils__['cloud.cache_node_list'](ret, provider, __opts__)
    return ret
416515
def list_nodes_min(kwargs=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_min function must be called '
            'with -f or --function.'
        )

    ret = {}
    vm_properties = ["name"]

    vm_list = salt.utils.vmware.get_mors_with_properties(_get_si(), vim.VirtualMachine, vm_properties)

    for vm in vm_list:
        ret[vm['name']] = {'state': 'Running', 'id': vm['name']}

    return ret