From 02797aab3c78961c0cf100df4367df61654bedc1 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 9 Dec 2012 15:57:05 +0000 Subject: Use admin user to read Quantum port. This is part of blueprint vif-plugging-improvements. The port vif_type is only returned from Quantum when the user is an admin user. This patch ensures that when Nova reads the ports the user is an admin user. Change-Id: I4d1a2bfc6e3ae4ad63fe5c72eda32137713b31c6 --- nova/tests/network/test_quantumv2.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py index 8ceaa4c99..6cb0728a2 100644 --- a/nova/tests/network/test_quantumv2.py +++ b/nova/tests/network/test_quantumv2.py @@ -270,10 +270,16 @@ class TestQuantumv2(test.TestCase): def test_get_instance_nw_info_1(self): """Test to get one port in one network and subnet.""" + quantumv2.get_client(mox.IgnoreArg(), + admin=True).MultipleTimes().AndReturn( + self.moxed_client) self._get_instance_nw_info(1) def test_get_instance_nw_info_2(self): """Test to get one port in each of two networks and subnets.""" + quantumv2.get_client(mox.IgnoreArg(), + admin=True).MultipleTimes().AndReturn( + self.moxed_client) self._get_instance_nw_info(2) def test_get_instance_nw_info_with_nets(self): @@ -294,6 +300,9 @@ class TestQuantumv2(test.TestCase): network_id='my_netid1', device_owner='network:dhcp').AndReturn( {'ports': self.dhcp_port_data1}) + quantumv2.get_client(mox.IgnoreArg(), + admin=True).MultipleTimes().AndReturn( + self.moxed_client) self.mox.ReplayAll() nw_inf = api.get_instance_nw_info(self.context, self.instance, @@ -317,6 +326,9 @@ class TestQuantumv2(test.TestCase): {'networks': self.nets1}) self.moxed_client.list_networks( shared=True).AndReturn({'networks': []}) + quantumv2.get_client(mox.IgnoreArg(), + admin=True).MultipleTimes().AndReturn( + self.moxed_client) self.mox.ReplayAll() nw_inf = api.get_instance_nw_info(self.context, -- cgit