Merge "Use instance data instead of flavor in simple_tenant_usage extension"
This commit is contained in:
commit
7fa9b7e0cc
@ -145,19 +145,19 @@ class SimpleTenantUsageController(object):
|
||||
period_stop)
|
||||
flavor = self._get_flavor(context, instance, flavors)
|
||||
if not flavor:
|
||||
continue
|
||||
info['flavor'] = ''
|
||||
else:
|
||||
info['flavor'] = flavor.name
|
||||
|
||||
info['instance_id'] = instance.uuid
|
||||
info['name'] = instance.display_name
|
||||
|
||||
info['memory_mb'] = flavor.memory_mb
|
||||
info['local_gb'] = flavor.root_gb + flavor.ephemeral_gb
|
||||
info['vcpus'] = flavor.vcpus
|
||||
info['memory_mb'] = instance.memory_mb
|
||||
info['local_gb'] = instance.root_gb + instance.ephemeral_gb
|
||||
info['vcpus'] = instance.vcpus
|
||||
|
||||
info['tenant_id'] = instance.project_id
|
||||
|
||||
info['flavor'] = flavor.name
|
||||
|
||||
# NOTE(mriedem): We need to normalize the start/end times back
|
||||
# to timezone-naive so the response doesn't change after the
|
||||
# conversion to objects.
|
||||
|
@ -82,7 +82,11 @@ def get_fake_db_instance(start, end, instance_id, tenant_id,
|
||||
flavor_id=FAKE_INST_TYPE['id'],
|
||||
launched_at=start,
|
||||
terminated_at=end,
|
||||
vm_state=vm_state)
|
||||
vm_state=vm_state,
|
||||
memory_mb=MEMORY_MB,
|
||||
vcpus=VCPUS,
|
||||
root_gb=ROOT_GB,
|
||||
ephemeral_gb=EPHEMERAL_GB,)
|
||||
inst['system_metadata'] = sys_meta
|
||||
return inst
|
||||
|
||||
|
@ -494,8 +494,8 @@ def stub_instance(id, user_id=None, project_id=None, host=None,
|
||||
limit=None, marker=None,
|
||||
launched_at=timeutils.utcnow(),
|
||||
terminated_at=timeutils.utcnow(),
|
||||
availability_zone='', locked_by=None, cleaned=False):
|
||||
|
||||
availability_zone='', locked_by=None, cleaned=False,
|
||||
memory_mb=0, vcpus=0, root_gb=0, ephemeral_gb=0):
|
||||
if user_id is None:
|
||||
user_id = 'fake_user'
|
||||
if project_id is None:
|
||||
@ -550,10 +550,10 @@ def stub_instance(id, user_id=None, project_id=None, host=None,
|
||||
"vm_state": vm_state or vm_states.BUILDING,
|
||||
"task_state": task_state,
|
||||
"power_state": power_state,
|
||||
"memory_mb": 0,
|
||||
"vcpus": 0,
|
||||
"root_gb": 0,
|
||||
"ephemeral_gb": 0,
|
||||
"memory_mb": memory_mb,
|
||||
"vcpus": vcpus,
|
||||
"root_gb": root_gb,
|
||||
"ephemeral_gb": ephemeral_gb,
|
||||
"ephemeral_key_uuid": None,
|
||||
"hostname": display_name or server_name,
|
||||
"host": host,
|
||||
|
Loading…
Reference in New Issue
Block a user