From bb867ce3948ddc23cf928ca3dda100a1a977896a Mon Sep 17 00:00:00 2001 From: Jason Kölker Date: Wed, 4 Jan 2012 11:10:10 -0600 Subject: 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 --- nova/utils.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'nova/utils.py') 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 -- cgit