diff options
| author | Jason Kölker <jason@koelker.net> | 2012-01-04 11:10:10 -0600 |
|---|---|---|
| committer | Jason Kölker <jason@koelker.net> | 2012-01-16 10:52:56 -0600 |
| commit | bb867ce3948ddc23cf928ca3dda100a1a977896a (patch) | |
| tree | 2931f3ea721e452bed8304fd192024394972b602 /nova/utils.py | |
| parent | 46f90f7cb79a01104376919c56e70a6324fe89af (diff) | |
| download | nova-bb867ce3948ddc23cf928ca3dda100a1a977896a.tar.gz nova-bb867ce3948ddc23cf928ca3dda100a1a977896a.tar.xz nova-bb867ce3948ddc23cf928ca3dda100a1a977896a.zip | |
Implement BP untie-nova-network-models
Fixes LP853979
Remove the FK references for network data.
Remove unused db functions that used the FK's
Update db functions to not joinload
Update notification to optionally take network_info if compute has it
Update EC2 Api to use the network cache, falling back to rpc.call
Remove test_instance_get_project_vpn_joins which tests calls not used
Change-Id: I1a01ccc5ebcf7efeafe014af62be893325bb0825
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/nova/utils.py b/nova/utils.py index 355f577ab..53832153e 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -398,7 +398,7 @@ def current_audit_period(unit=None): return (begin, end) -def usage_from_instance(instance_ref, **kw): +def usage_from_instance(instance_ref, network_info=None, **kw): image_ref_url = "%s/images/%s" % (generate_glance_url(), instance_ref['image_ref']) @@ -415,8 +415,16 @@ def usage_from_instance(instance_ref, **kw): image_ref_url=image_ref_url, state=instance_ref['vm_state'], state_description=instance_ref['task_state'] \ - if instance_ref['task_state'] else '', - fixed_ips=[a.address for a in instance_ref['fixed_ips']]) + if instance_ref['task_state'] else '') + + # NOTE(jkoelker) This nastyness can go away once compute uses the + # network model + if network_info is not None: + fixed_ips = [] + for network, info in network_info: + fixed_ips.extend([ip['ip'] for ip in info['ips']]) + usage_info['fixed_ips'] = fixed_ips + usage_info.update(kw) return usage_info |
