diff options
| author | Jason Kölker <jason@koelker.net> | 2011-05-24 15:56:03 -0500 |
|---|---|---|
| committer | Jason Kölker <jason@koelker.net> | 2011-05-24 15:56:03 -0500 |
| commit | 67dd7e73dfeea462a515357d665bc19a4217dec5 (patch) | |
| tree | 2e037c255365a48babc247d789d99e328934f93c | |
| parent | 2cdad3733a6c00a8ba9246f16509f612e22e148c (diff) | |
create a mac address entry and blindly use the first network
| -rw-r--r-- | nova/tests/test_virt.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/nova/tests/test_virt.py b/nova/tests/test_virt.py index 0a0c7a958..dbfc4b5d9 100644 --- a/nova/tests/test_virt.py +++ b/nova/tests/test_virt.py @@ -618,18 +618,27 @@ class IptablesFirewallTestCase(test.TestCase): instance_ref = db.instance_create(self.context, {'user_id': 'fake', 'project_id': 'fake', - 'mac_address': '56:12:12:12:12:12', 'instance_type_id': 1}) ip = '10.11.12.13' - network_ref = db.project_get_network(self.context, - 'fake') + # NOTE(jkoelker): This just takes the first network and runs with it + # Should probably do something more inteligent + networks_ref = db.project_get_network(self.context, + 'fake', + associate=False)[0] + + mac_address = {'address': '56:12:12:12:12:12', + 'network_id': network_ref['id'], + 'instance_id': instance_ref['id']} + mac_ref = db.mac_address_create(self.context, mac_address) fixed_ip = {'address': ip, - 'network_id': network_ref['id']} + 'network_id': network_ref['id'], + 'mac_address_id': mac_ref['id']} admin_ctxt = context.get_admin_context() db.fixed_ip_create(admin_ctxt, fixed_ip) + db.mac_address_create( db.fixed_ip_update(admin_ctxt, ip, {'allocated': True, 'instance_id': instance_ref['id']}) |
