Merge "minor fix to https://review.openstack.org/#/c/466115/"
This commit is contained in:
commit
b560a6b88a
|
@ -195,15 +195,14 @@ def _disassociate_address_item(context, address):
|
||||||
db_api.update_item(context, address)
|
db_api.update_item(context, address)
|
||||||
|
|
||||||
|
|
||||||
def _get_os_instance_id(context, os_floating_ip,
|
def _get_os_instance_id(context, os_floating_ip, os_ports=[]):
|
||||||
os_ports=[]):
|
|
||||||
port_id = os_floating_ip.get('port_id')
|
port_id = os_floating_ip.get('port_id')
|
||||||
os_instance_id = None
|
os_instance_id = None
|
||||||
if port_id:
|
if port_id:
|
||||||
port = next((port for port in os_ports
|
port = next((port for port in os_ports
|
||||||
if port['id'] == port_id), None)
|
if port['id'] == port_id), None)
|
||||||
if port and port.get('device_id'):
|
if port:
|
||||||
os_instance_id = port['device_id']
|
os_instance_id = port.get('device_id')
|
||||||
return os_instance_id
|
return os_instance_id
|
||||||
|
|
||||||
|
|
||||||
|
@ -402,11 +401,10 @@ class AddressEngineNeutron(object):
|
||||||
# NOTE(tikitavi): check the public IP exists to raise AWS
|
# NOTE(tikitavi): check the public IP exists to raise AWS
|
||||||
# exception otherwise
|
# exception otherwise
|
||||||
os_floating_ip = self.get_os_floating_ip_by_public_ip(
|
os_floating_ip = self.get_os_floating_ip_by_public_ip(
|
||||||
context,
|
context, public_ip)
|
||||||
public_ip)
|
|
||||||
os_ports = self.get_os_ports(context)
|
os_ports = self.get_os_ports(context)
|
||||||
os_instance_id = _get_os_instance_id(context, os_floating_ip,
|
os_instance_id = _get_os_instance_id(context, os_floating_ip,
|
||||||
os_ports)
|
os_ports)
|
||||||
if os_instance_id:
|
if os_instance_id:
|
||||||
nova = clients.nova(context)
|
nova = clients.nova(context)
|
||||||
nova.servers.remove_floating_ip(os_instance_id, public_ip)
|
nova.servers.remove_floating_ip(os_instance_id, public_ip)
|
||||||
|
|
|
@ -54,7 +54,6 @@ class AvailabilityZoneCase(base.ApiTestCase):
|
||||||
self.assertTrue(resp['regionInfo'][0].get('regionEndpoint')
|
self.assertTrue(resp['regionInfo'][0].get('regionEndpoint')
|
||||||
is not None)
|
is not None)
|
||||||
|
|
||||||
# TODO(tikitavi): Rework test to exclude nova-network
|
|
||||||
@mock.patch('ec2api.api.ec2utils.check_and_create_default_vpc')
|
@mock.patch('ec2api.api.ec2utils.check_and_create_default_vpc')
|
||||||
def test_describe_account_attributes(self, check_and_create):
|
def test_describe_account_attributes(self, check_and_create):
|
||||||
self.nova.quotas.get.return_value = mock.Mock(instances=77)
|
self.nova.quotas.get.return_value = mock.Mock(instances=77)
|
||||||
|
|
|
@ -848,10 +848,7 @@ class InstanceTestCase(base.ApiTestCase):
|
||||||
'DescribeInstances', ['reservationSet', 'instancesSet'],
|
'DescribeInstances', ['reservationSet', 'instancesSet'],
|
||||||
fakes.ID_EC2_INSTANCE_1, 'instanceId')
|
fakes.ID_EC2_INSTANCE_1, 'instanceId')
|
||||||
|
|
||||||
# TODO(tikitavi): Rework test to exclude nova-network
|
def test_describe_instances_ec2_classic(self):
|
||||||
def _test_describe_instances_ec2_classic(self):
|
|
||||||
instance_api.instance_engine = (
|
|
||||||
instance_api.InstanceEngineNova())
|
|
||||||
self.set_mock_db_items(
|
self.set_mock_db_items(
|
||||||
fakes.DB_INSTANCE_2, fakes.DB_IMAGE_1, fakes.DB_IMAGE_2,
|
fakes.DB_INSTANCE_2, fakes.DB_IMAGE_1, fakes.DB_IMAGE_2,
|
||||||
fakes.DB_VOLUME_1, fakes.DB_VOLUME_2, fakes.DB_VOLUME_3)
|
fakes.DB_VOLUME_1, fakes.DB_VOLUME_2, fakes.DB_VOLUME_3)
|
||||||
|
|
|
@ -92,7 +92,7 @@ class ProxyTestCase(test_base.BaseTestCase):
|
||||||
self.assertEqual(500, response.status_int)
|
self.assertEqual(500, response.status_int)
|
||||||
self.assertEqual(len(log.mock_calls), 2)
|
self.assertEqual(len(log.mock_calls), 2)
|
||||||
|
|
||||||
def _test_get_requester(self):
|
def test_get_requester(self):
|
||||||
expected = {'os_instance_id': mock.sentinel.os_instance_id,
|
expected = {'os_instance_id': mock.sentinel.os_instance_id,
|
||||||
'project_id': mock.sentinel.project_id,
|
'project_id': mock.sentinel.project_id,
|
||||||
'private_ip': mock.sentinel.private_ip}
|
'private_ip': mock.sentinel.private_ip}
|
||||||
|
|
|
@ -163,7 +163,6 @@ class SecurityGroupTestCase(base.ApiTestCase):
|
||||||
self.neutron.create_security_group.assert_called_once_with(
|
self.neutron.create_security_group.assert_called_once_with(
|
||||||
secgroup_body)
|
secgroup_body)
|
||||||
|
|
||||||
# TODO(tikitavi): Rework test to exclude nova-network
|
|
||||||
@tools.screen_unexpected_exception_logs
|
@tools.screen_unexpected_exception_logs
|
||||||
def test_create_security_group_rollback(self):
|
def test_create_security_group_rollback(self):
|
||||||
self.set_mock_db_items(fakes.DB_VPC_1)
|
self.set_mock_db_items(fakes.DB_VPC_1)
|
||||||
|
|
Loading…
Reference in New Issue