Get the list of access instance sizes (flavors).
492359
def flavor_access_list(request, flavor=None):
    """"""
    return _nova.novaclient(request).flavor_access.list(flavor=flavor)
613889
def flavor_get_extras(request, flavor_id, raw=False, flavor=None):
    """"""
    if flavor is None:
        flavor = _nova.novaclient(request).flavors.get(flavor_id)
    extras = flavor.get_keys()
    if raw:
        return extras
    return [FlavorExtraSpec(flavor_id, key, value) for
            key, value in extras.items()]
726927
def avail_sizes(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_sizes function must be called with '
            '-f or --function, or with the --list-sizes option'
        )

    items = query(method='sizes', command='?per_page=100')
    ret = {}
    for size in items['sizes']:
        ret[size['slug']] = {}
        for item in six.iterkeys(size):
            ret[size['slug']][item] = six.text_type(size[item])

    return ret
1088725
def DbGetInstanceNameList(self, argin):
        
        self._log.debug("In DbGetInstanceNameList()")
        return self.db.get_instance_name_list(argin)
1151853
def get(self, instance_ids=None, filters=None):
        """"""
        params = {}
        if filters:
            params["filters"] = make_filters(filters)
        if instance_ids:
            params['InstanceIds'] = instance_ids
        reservations = self.call("DescribeInstances",
                                 response_data_key="Reservations",
                                 **params)
        if reservations:
            return list(chain(*(r["Instances"] for r in reservations)))
        return []
152491
def get_instances(self):
        # type: () -> List[Tuple[str, str, int]]
        
        with self.__instances_lock:
            return sorted(
                (name, stored_instance.factory_name, stored_instance.state)
                for name, stored_instance in self.__instances.items()
            )
628156
private Volume[] getVolumes(TestContext context) {
        String[] volumes = StringUtils.commaDelimitedListToStringArray(getParameter("volumes", context));
        Volume[] volumeSpecs = new Volume[volumes.length];

        for (int i = 0; i < volumes.length; i++) {
            volumeSpecs[i] = new Volume(volumes[i]);
        }

        return volumeSpecs;
    }
552758
def get_vm_instances(instance_id=None):
    """"""
    return get_instances(device_owners=[n_const.DEVICE_OWNER_COMPUTE_PREFIX],
                         vnic_type=portbindings.VNIC_NORMAL,
                         instance_id=instance_id)
850580
def avail_sizes(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_sizes function must be called with '
            '-f or --function, or with the --list-sizes option'
        )

    params = {'Action': 'DescribeInstanceTypes'}
    items = query(params=params)

    ret = {}
    for image in items['InstanceTypes']['InstanceType']:
        ret[image['InstanceTypeId']] = {}
        for item in image:
            ret[image['InstanceTypeId']][item] = six.text_type(image[item])

    return ret
1299823
def flavor_list_paged(request, is_public=True, get_extras=False, marker=None,
                      paginate=False, sort_key="name", sort_dir="desc",
                      reversed_order=False):
    """"""
    has_more_data = False
    has_prev_data = False

    if paginate:
        if reversed_order:
            sort_dir = 'desc' if sort_dir == 'asc' else 'asc'
        page_size = utils.get_page_size(request)
        flavors = _nova.novaclient(request).flavors.list(is_public=is_public,
                                                         marker=marker,
                                                         limit=page_size + 1,
                                                         sort_key=sort_key,
                                                         sort_dir=sort_dir)
        flavors, has_more_data, has_prev_data = update_pagination(
            flavors, page_size, marker, reversed_order)
    else:
        flavors = _nova.novaclient(request).flavors.list(is_public=is_public)

    if get_extras:
        for flavor in flavors:
            flavor.extras = flavor_get_extras(request, flavor.id, True, flavor)

    return (flavors, has_more_data, has_prev_data)
569045
def sort_flavor_list(request, flavors, with_menu_label=True):
    
    def get_key(flavor, sort_key):
        try:
            return getattr(flavor, sort_key)
        except AttributeError:
            LOG.warning('Could not find sort key "%s". Using the default '
                        '"ram" instead.', sort_key)
            return getattr(flavor, 'ram')
    try:
        flavor_sort = getattr(settings, 'CREATE_INSTANCE_FLAVOR_SORT', {})
        sort_key = flavor_sort.get('key', 'ram')
        rev = flavor_sort.get('reverse', False)
        if not callable(sort_key):
            def key(flavor):
                return get_key(flavor, sort_key)
        else:
            key = sort_key

        if with_menu_label:
            flavor_list = [(flavor.id, '%s' % flavor.name)
                           for flavor in sorted(flavors, key=key, reverse=rev)]
        else:
            flavor_list = sorted(flavors, key=key, reverse=rev)
        return flavor_list
    except Exception:
        exceptions.handle(request,
                          _('Unable to sort instance flavors.'))
        return []
487556
public function getCroppableSizes() {
		return array(
			self::SIZE_LARGE,
			self::SIZE_MEDIUM,
			self::SIZE_SMALL,
			self::SIZE_TINY,
			self::SIZE_TOPBAR,
		);
	}
449118
public static DatabaseSizes getCatalogSizes(Database dbCatalog, boolean isXDCR) {
        DatabaseSizes dbSizes = new DatabaseSizes();
        for (Table table: dbCatalog.getTables()) {
            dbSizes.addTable(getTableSize(table, isXDCR));
        }
        return dbSizes;
    }
700005
def _check_flavors_exist(self, parsed_args):
        """"""
        compute_client = self.app.client_manager.compute

        flavors = {f.name: f for f in compute_client.flavors.list()}

        message = "Provided --{}-flavor, '{}', does not exist"

        for target, flavor, scale in (
            ('control', parsed_args.control_flavor,
                parsed_args.control_scale),
            ('compute', parsed_args.compute_flavor,
                parsed_args.compute_scale),
            ('ceph-storage', parsed_args.ceph_storage_flavor,
                parsed_args.ceph_storage_scale),
            ('block-storage', parsed_args.block_storage_flavor,
                parsed_args.block_storage_scale),
            ('swift-storage', parsed_args.swift_storage_flavor,
                parsed_args.swift_storage_scale),
        ):
            if flavor is None or scale == 0:
                self.log.debug("--{}-flavor not used".format(target))
            elif flavor not in flavors:
                self.predeploy_errors += 1
                self.log.error(message.format(target, flavor))
156875
def _get_max_name_len(instances):
    """"""
    # FIXME: ec2.instanceCollection doesn't have __len__
    for i in instances:
        return max([len(get_tag_value(i.tags, 'Name')) for i in instances])
    return 0
285009
def get_occupied_slots(instance):
    
    return [slot for slot in get_all_slots(type(instance))
            if hasattr(instance,slot)]
1203034
def avail_sizes(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_sizes function must be called with '
            '-f or --function, or with the --list-sizes option'
        )

    compconn = get_conn(client_type='compute')

    ret = {}
    location = get_location()

    try:
        sizes = compconn.virtual_machine_sizes.list(
            location=location
        )
        for size_obj in sizes:
            size = size_obj.as_dict()
            ret[size['name']] = size
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('compute', exc.message)
        ret = {'Error': exc.message}

    return ret