def _instance_type_for_nova(data): return { u'name': data['name'], u'ram': to_mb(data['ram']), u'vcpus': data['cpus'], u'disk': to_gb(data['root-size']), u'ephemeral': to_gb(data['ephemeral-size']) }
def _set_quota(tenant_id, data): """Set project limits from project dict""" kwargs = {} if 'cpus-limit' in data: kwargs['cores'] = data.get('cpus-limit') if 'ram-limit' in data: kwargs['ram'] = to_mb(data.get('ram-limit')) if 'instances-limit' in data: kwargs['instances'] = data.get('instances-limit') if kwargs: g.client_set.compute.quotas.update(tenant_id, **kwargs)