yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #93828
[Bug 2060808] Re: already associated floating ip can be associated to another server without check or warning
Well, for the PUT operation it's the same thing for neutron (and the
same call here [0]), whether the port is null or another valid port id,
neutron is going to update it.
As I mentioned in the other bug, it will be up to the Nova team to
determine if it's API is working correctly.
[0] PUT
/networking/v2.0/floatingips/1875754d-7b9f-47c2-9c0d-83eafd1a0a76
** Changed in: neutron
Status: New => Opinion
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/2060808
Title:
already associated floating ip can be associated to another server
without check or warning
Status in neutron:
Opinion
Status in OpenStack Compute (nova):
New
Bug description:
When adding a floating ip to a server the following CLI command is used:
openstack server add floating ip <server> <floating ip>
When nova was still handling the floating IPs in the backend, it seems there was a check, whether the floating IP was already associated to an instance:
https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/floating_ips.py#L243
And as a user I don't want to accidentally associate a floating IP to
a server, that is already associated to another.
But that is right now the case:
Steps to reproduce:
1. Have two servers, one with an associated floating ip (server A) and one without (server B)
2. execute the command: openstack server add floating ip <server B> <floating IP from server A>
3. now server B has a floating IP associated but server A has not.
Example:
stack@devstack:~/devstack$ openstack server list
+--------------------------------------+---------------+--------+-----------------------------------------------------------------------+--------------------------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+---------------+--------+-----------------------------------------------------------------------+--------------------------+----------+
| 66f8f821-ec26-4264-807e-36ec016d51f9 | my-new-server | ACTIVE | private=10.0.0.41, fd13:d046:e727:0:f816:3eff:fe98:3e70 | N/A (booted from volume) | m1.small |
| e7c7d615-8abc-4657-a334-953d5c6a95e1 | test-server | ACTIVE | private=10.0.0.45, 172.24.4.210, fd13:d046:e727:0:f816:3eff:febf:840b | N/A (booted from volume) | m1.small |
+--------------------------------------+---------------+--------+-----------------------------------------------------------------------+--------------------------+----------+
stack@devstack:~/devstack$ openstack floating ip list
+------------------------------------+---------------------+------------------+------------------------------------+------------------------------------+----------------------------------+
| ID | Floating IP Address | Fixed IP Address | Port | Floating Network | Project |
+------------------------------------+---------------------+------------------+------------------------------------+------------------------------------+----------------------------------+
| 0f340eb1-74c7-4cc0-8495- | 172.24.4.155 | None | None | 73edb86b-d7ab-4db3-82b7- | f58edaee60ad484facd2436d31d9caff |
| 8f648ff7bc61 | | | | 25fa8b012e40 | |
| 1875754d-7b9f-47c2-9c0d- | 172.24.4.210 | 10.0.0.45 | d8387e3b-3b19-444a-9983- | 73edb86b-d7ab-4db3-82b7- | 15f2ab0eaa5b4372b759bde609e86224 |
| 83eafd1a0a76 | | | 42b61b3d19c1 | 25fa8b012e40 | |
| 3978a1f6-3af8-432f-978a- | 172.24.4.222 | None | None | 73edb86b-d7ab-4db3-82b7- | 15f2ab0eaa5b4372b759bde609e86224 |
| c7feafd88057 | | | | 25fa8b012e40 | |
| 9e193d33-17f9-400b-b639- | 172.24.4.107 | None | None | 73edb86b-d7ab-4db3-82b7- | 15f2ab0eaa5b4372b759bde609e86224 |
| b51750d41bc0 | | | | 25fa8b012e40 | |
+------------------------------------+---------------------+------------------+------------------------------------+------------------------------------+----------------------------------+
stack@devstack:~/devstack$ openstack server add floating ip my-new-server 172.24.4.210 --debug
START with options: server add floating ip my-new-server 172.24.4.210 --debug
options: Namespace(verbose_level=3, log_file=None, deferred_help=False, debug=True, cloud='', region_name='RegionOne', cacert=None, cert='', key='', verify=None, insecure=None, default_domain='default', interface='', service_provider='', remote_project_name='', remote_project_id='', remote_project_domain_name='', remote_project_domain_id='', timing=False, os_beta_command=False, profile='', os_compute_api_version='', os_identity_api_version='3', os_image_api_version='', os_network_api_version='', os_object_api_version='', os_volume_api_version='3', os_dns_api_version='2', os_placement_api_version='1', os_key_manager_api_version='1', auth_type='password', user_id='', project_id='', endpoint='', auth_url='http://192.168.23.238/identity', system_scope='', domain_id='', domain_name='', project_name='admin', project_domain_id='default', project_domain_name='', trust_id='', username='admin', user_domain_id='default', user_domain_name='', password='***', identity_provider='', protocol='', client_id='', client_secret='***', openid_scope='', access_token_endpoint='', discovery_endpoint='', device_authorization_endpoint='', code_challenge_method='', identity_provider_url='', service_provider_endpoint='', service_provider_entity_id='', token='***', application_credential_secret='***', application_credential_id='', application_credential_name='', auth_methods='', access_token='***', oauth2_endpoint='', oauth2_client_id='', oauth2_client_secret='***', default_domain_id='', default_domain_name='', access_token_type='', passcode='', consumer_key='', consumer_secret='***', access_key='', access_secret='***', redirect_uri='', code='', os_project_name=None, os_project_id=None)
Auth plugin password selected
auth_config_hook(): {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'admin'}, 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.23.238/identity', 'username': 'admin', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'placement_api_version': '1', 'key_manager_api_version': '1', 'auth_type': 'password', ': []}
defaults: {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'auth_type': 'password', 'baremetal_status_code_retries': 5, 'baremetal_introspection_status_code_retries': 5, 'image_status_code_retries': 5, 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active'}
cloud cfg: {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'admin'}, 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.23.238/identity', 'username': 'admin', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'placement_api_version': '1', 'key_manager_api_version': '1', 'auth_type': 'password', ': []}
compute API version 2.1, cmd group openstack.compute.v2
identity API version 3, cmd group openstack.identity.v3
image API version 2, cmd group openstack.image.v2
network API version 2, cmd group openstack.network.v2
object_store API version 1, cmd group openstack.object_store.v1
volume API version 3, cmd group openstack.volume.v3
neutronclient API version 2, cmd group openstack.neutronclient.v2
dns API version 2, cmd group openstack.dns.v2
placement API version 1, cmd group openstack.placement.v1
key_manager API version 1, cmd group openstack.key_manager.v1
command: server add floating ip -> openstackclient.compute.v2.server.AddFloatingIP (auth=True)
Auth plugin password selected
auth_config_hook(): {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'admin'}, 'additional_user_agent': [('osc-lib', '3.0.0')], 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.23.238/identity', 'username': 'admin', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'placement_api_version': '1', 'key_manager_api_version': '1', 'auth_type': 'password', ': []}
Using auth plugin: password
Using parameters {'auth_url': 'http://192.168.23.238/identity', 'project_name': 'admin', 'project_domain_id': 'default', 'username': 'admin', 'user_domain_id': 'default', 'password': '***'}
Get auth_ref
REQ: curl -g -i -X GET http://192.168.23.238/identity -H "Accept: application/json" -H "User-Agent: openstacksdk/2.1.0 keystoneauth1/5.5.0 python-requests/2.31.0 CPython/3.10.12"
Starting new HTTP connection (1): 192.168.23.238:80
http://192.168.23.238:80 "GET /identity HTTP/1.1" 300 273
RESP: [300] Connection: close Content-Length: 273 Content-Type: application/json Date: Wed, 10 Apr 2024 09:10:50 GMT Location: http://192.168.23.238/identity/v3/ Server: Apache/2.4.52 (Ubuntu) Vary: X-Auth-Token x-openstack-request-id: req-a4641f7d-f848-47fc-9ab1-7c101b022647
RESP BODY: {"versions": {"values": [{"id": "v3.14", "status": "stable", "updated": "2020-04-07T00:00:00Z", "links": [{"rel": "self", "href": "http://192.168.23.238/identity/v3/"}], "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}]}]}}
GET call to http://192.168.23.238/identity used request id req-a4641f7d-f848-47fc-9ab1-7c101b022647
Making authentication request to http://192.168.23.238/identity/v3/auth/tokens
Resetting dropped connection: 192.168.23.238
http://192.168.23.238:80 "POST /identity/v3/auth/tokens HTTP/1.1" 201 3469
{"token": {"methods": ["password"], "user": {"domain": {"id": "default", "name": "Default"}, "id": "6cf194afebb6469e8423f50500b5c3fc", "name": "admin", "password_expires_at": null}, "audit_ids": ["if9cGE9LTdWHW9-9PScpdA"], "expires_at": "2024-04-10T10:10:50.000000Z", "issued_at": "2024-04-10T09:10:50.000000Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "15f2ab0eaa5b4372b759bde609e86224", "name": "admin"}, "is_domain": false, "roles": [{"id": "516ea3653eb7463e816fc5a3ee5042e8", "name": "manager"}, {"id": "8d64c40ff3ad45d3977e8b2fb2edee5f", "name": "member"}, {"id": "361b94f7a2884974bd4abd935a18dcde", "name": "admin"}, {"id": "d8c7c4eb2f42426a946d6988207af29a", "name": "reader"}], "catalog": [{"endpoints": [{"id": "4b01cdbd8cfa4a97b6204321495f8ddb", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238:9696/networking", "region": "RegionOne"}], "id": "08c8d312e77b44b8a7194351a2c32207", "type": "network", "name": "neutron"}, {"endpoints": [{"id": "b5269d2bbce445e7b8dbf3f1c5f08598", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/volume/v3/15f2ab0eaa5b4372b759bde609e86224", "region": "RegionOne"}], "id": "1116eaaf6d1d43868c7bddefbef96dcb", "type": "block-storage", "name": "cinder"}, {"endpoints": [{"id": "9c302e038ce1420fad7273c4cc7f6366", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/identity", "region": "RegionOne"}], "id": "1dbd7ef92355476fa1a992c718ace24c", "type": "identity", "name": "keystone"}, {"endpoints": [{"id": "92072f1115a24c41b5f9a0892ecf40aa", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/placement", "region": "RegionOne"}], "id": "28c0a8eb33314a96aa5fd7945cd42e24", "type": "placement", "name": "placement"}, {"endpoints": [{"id": "3a553972ba8d4f61bb947c93a30ff3e6", "interface": "admin", "region_id": "RegionOne", "url": "http://192.168.23.238/key-manager", "region": "RegionOne"}, {"id": "b8aa5e3fdb02414b9bdcf4e39634a180", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/key-manager", "region": "RegionOne"}, {"id": "e9298bef1ac84385a52cb70fdf40ce53", "interface": "internal", "region_id": "RegionOne", "url": "http://192.168.23.238/key-manager", "region": "RegionOne"}], "id": "36aa21dd25e244c49f4885989e3bac6a", "type": "key-manager", "name": "barbican"}, {"endpoints": [{"id": "869649bc451e407ead58e930671ec7b8", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/compute/v2/15f2ab0eaa5b4372b759bde609e86224", "region": "RegionOne"}], "id": "5434067a7ee74c648087eda6e3c74ab8", "type": "compute_legacy", "name": "nova_legacy"}, {"endpoints": [{"id": "4267b32aae4e4ccca1caecadd495b9b6", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/compute/v2.1", "region": "RegionOne"}], "id": "94d6e172207642cebadaa383112ee69d", "type": "compute", "name": "nova"}, {"endpoints": [{"id": "6038adcb92494e1c9a1c23eb8647478c", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/volume/v3/15f2ab0eaa5b4372b759bde609e86224", "region": "RegionOne"}], "id": "cdd03520aa414d07a082c22942bbe4d5", "type": "volumev3", "name": "cinderv3"}, {"endpoints": [{"id": "3376975f7aab4e9081fdd60100a6ae3f", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.23.238/image", "region": "RegionOne"}], "id": "cf8f2e4ac7af482fabd484a700b9c599", "type": "image", "name": "glance"}]}}
get_parser(openstack server add floating ip)
common parser: ArgumentParser(prog='openstack server add floating ip', usage=None, description='Add floating IP address to server', formatter_class=<class 'cliff._argparse.SmartHelpFormatter'>, conflict_handler='ignore', add_help=True)
network endpoint in service catalog
run(Namespace(server='my-new-server', ip_address='172.24.4.210', fixed_ip_address=None))
Network client initialized using OpenStack SDK: <openstack.network.v2._proxy.Proxy object at 0x7f8a135b0640>
Instantiating compute client for API Version Major: 2, Minor: 1
Instantiating compute api: <class 'openstackclient.api.compute_v2.APIv2'>
REQ: curl -g -i -X GET http://192.168.23.238:9696/networking/v2.0/floatingips/172.24.4.210 -H "User-Agent: openstacksdk/2.1.0 keystoneauth1/5.5.0 python-requests/2.31.0 CPython/3.10.12" -H "X-Auth-Token: {SHA256}c6a75e57e3cb0d9e74e4f81621dd357f32ff3ce9888537b999f8404c699c02f4"
Starting new HTTP connection (1): 192.168.23.238:9696
http://192.168.23.238:9696 "GET /networking/v2.0/floatingips/172.24.4.210 HTTP/1.1" 404 120
RESP: [404] Connection: keep-alive Content-Length: 120 Content-Type: application/json Date: Wed, 10 Apr 2024 09:10:51 GMT X-Openstack-Request-Id: req-aac5c650-62bc-4f9f-bd4f-c7921df892b9
RESP BODY: {"NeutronError": {"type": "FloatingIPNotFound", "message": "Floating IP 172.24.4.210 could not be found", "detail": ""}}
GET call to network for http://192.168.23.238:9696/networking/v2.0/floatingips/172.24.4.210 used request id req-aac5c650-62bc-4f9f-bd4f-c7921df892b9
REQ: curl -g -i -X GET http://192.168.23.238:9696/networking/v2.0/floatingips -H "Accept: application/json" -H "User-Agent: openstacksdk/2.1.0 keystoneauth1/5.5.0 python-requests/2.31.0 CPython/3.10.12" -H "X-Auth-Token: {SHA256}c6a75e57e3cb0d9e74e4f81621dd357f32ff3ce9888537b999f8404c699c02f4"
http://192.168.23.238:9696 "GET /networking/v2.0/floatingips HTTP/1.1" 200 2377
RESP: [200] Connection: keep-alive Content-Length: 2377 Content-Type: application/json Date: Wed, 10 Apr 2024 09:10:51 GMT X-Openstack-Request-Id: req-c42b0eec-e313-4e89-a3cf-0198c2a9475f
RESP BODY: {"floatingips": [{"id": "0f340eb1-74c7-4cc0-8495-8f648ff7bc61", "tenant_id": "f58edaee60ad484facd2436d31d9caff", "floating_ip_address": "172.24.4.155", "floating_network_id": "73edb86b-d7ab-4db3-82b7-25fa8b012e40", "router_id": null, "port_id": null, "fixed_ip_address": null, "status": "DOWN", "description": "", "port_details": null, "dns_domain": "", "dns_name": "", "tags": [], "created_at": "2024-03-13T08:49:51Z", "updated_at": "2024-03-13T08:49:51Z", "revision_number": 0, "project_id": "f58edaee60ad484facd2436d31d9caff"}, {"id": "1875754d-7b9f-47c2-9c0d-83eafd1a0a76", "tenant_id": "15f2ab0eaa5b4372b759bde609e86224", "floating_ip_address": "172.24.4.210", "floating_network_id": "73edb86b-d7ab-4db3-82b7-25fa8b012e40", "router_id": "5c5c792e-c4d9-4077-97d1-6d8a9108f39f", "port_id": "d8387e3b-3b19-444a-9983-42b61b3d19c1", "fixed_ip_address": "10.0.0.45", "status": "ACTIVE", "description": "", "port_details": {"name": "", "network_id": "9f8b7b77-3a81-4484-bf8a-563027c663e1", "mac_address": "fa:16:3e:bf:84:0b", "admin_state_up": true, "status": "ACTIVE", "device_id": "e7c7d615-8abc-4657-a334-953d5c6a95e1", "device_owner": "compute:nova"}, "dns_domain": "", "dns_name": "", "tags": [], "created_at": "2024-02-19T07:14:18Z", "updated_at": "2024-03-08T08:46:54Z", "revision_number": 2, "project_id": "15f2ab0eaa5b4372b759bde609e86224"}, {"id": "3978a1f6-3af8-432f-978a-c7feafd88057", "tenant_id": "15f2ab0eaa5b4372b759bde609e86224", "floating_ip_address": "172.24.4.222", "floating_network_id": "73edb86b-d7ab-4db3-82b7-25fa8b012e40", "router_id": null, "port_id": null, "fixed_ip_address": null, "status": "DOWN", "description": "", "port_details": null, "dns_domain": "", "dns_name": "", "tags": [], "created_at": "2024-03-13T08:48:54Z", "updated_at": "2024-03-13T08:48:54Z", "revision_number": 0, "project_id": "15f2ab0eaa5b4372b759bde609e86224"}, {"id": "9e193d33-17f9-400b-b639-b51750d41bc0", "tenant_id": "15f2ab0eaa5b4372b759bde609e86224", "floating_ip_address": "172.24.4.107", "floating_network_id": "73edb86b-d7ab-4db3-82b7-25fa8b012e40", "router_id": null, "port_id": null, "fixed_ip_address": null, "status": "DOWN", "description": "", "port_details": null, "dns_domain": "", "dns_name": "", "tags": [], "created_at": "2024-03-27T13:35:59Z", "updated_at": "2024-03-27T13:35:59Z", "revision_number": 0, "project_id": "15f2ab0eaa5b4372b759bde609e86224"}]}
GET call to network for http://192.168.23.238:9696/networking/v2.0/floatingips used request id req-c42b0eec-e313-4e89-a3cf-0198c2a9475f
REQ: curl -g -i -X GET http://192.168.23.238/compute/v2.1/servers/my-new-server -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Token: {SHA256}c6a75e57e3cb0d9e74e4f81621dd357f32ff3ce9888537b999f8404c699c02f4" -H "X-OpenStack-Nova-API-Version: 2.1"
Resetting dropped connection: 192.168.23.238
http://192.168.23.238:80 "GET /compute/v2.1/servers/my-new-server HTTP/1.1" 404 88
RESP: [404] Connection: close Content-Length: 88 Content-Type: application/json; charset=UTF-8 Date: Wed, 10 Apr 2024 09:10:51 GMT OpenStack-API-Version: compute 2.1 Server: Apache/2.4.52 (Ubuntu) Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version X-OpenStack-Nova-API-Version: 2.1 x-compute-request-id: req-6122e4f8-ed4b-48d6-b48b-bbdba28da8bd x-openstack-request-id: req-6122e4f8-ed4b-48d6-b48b-bbdba28da8bd
RESP BODY: {"itemNotFound": {"code": 404, "message": "Instance my-new-server could not be found."}}
GET call to compute for http://192.168.23.238/compute/v2.1/servers/my-new-server used request id req-6122e4f8-ed4b-48d6-b48b-bbdba28da8bd
REQ: curl -g -i -X GET http://192.168.23.238/compute/v2.1/servers?name=my-new-server -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Token: {SHA256}c6a75e57e3cb0d9e74e4f81621dd357f32ff3ce9888537b999f8404c699c02f4" -H "X-OpenStack-Nova-API-Version: 2.1"
Resetting dropped connection: 192.168.23.238
http://192.168.23.238:80 "GET /compute/v2.1/servers?name=my-new-server HTTP/1.1" 200 312
RESP: [200] Connection: close Content-Length: 312 Content-Type: application/json Date: Wed, 10 Apr 2024 09:10:51 GMT OpenStack-API-Version: compute 2.1 Server: Apache/2.4.52 (Ubuntu) Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version X-OpenStack-Nova-API-Version: 2.1 x-compute-request-id: req-2e80374d-447d-44e5-9d15-0e7a3d043d60 x-openstack-request-id: req-2e80374d-447d-44e5-9d15-0e7a3d043d60
RESP BODY: {"servers": [{"id": "66f8f821-ec26-4264-807e-36ec016d51f9", "name": "my-new-server", "links": [{"rel": "self", "href": "http://192.168.23.238/compute/v2.1/servers/66f8f821-ec26-4264-807e-36ec016d51f9"}, {"rel": "bookmark", "href": "http://192.168.23.238/compute/servers/66f8f821-ec26-4264-807e-36ec016d51f9"}]}]}
GET call to compute for http://192.168.23.238/compute/v2.1/servers?name=my-new-server used request id req-2e80374d-447d-44e5-9d15-0e7a3d043d60
REQ: curl -g -i -X GET http://192.168.23.238/compute/v2.1/servers/66f8f821-ec26-4264-807e-36ec016d51f9 -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Token: {SHA256}c6a75e57e3cb0d9e74e4f81621dd357f32ff3ce9888537b999f8404c699c02f4" -H "X-OpenStack-Nova-API-Version: 2.1"
Resetting dropped connection: 192.168.23.238
http://192.168.23.238:80 "GET /compute/v2.1/servers/66f8f821-ec26-4264-807e-36ec016d51f9 HTTP/1.1" 200 1596
RESP: [200] Connection: close Content-Length: 1596 Content-Type: application/json Date: Wed, 10 Apr 2024 09:10:51 GMT OpenStack-API-Version: compute 2.1 Server: Apache/2.4.52 (Ubuntu) Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version X-OpenStack-Nova-API-Version: 2.1 x-compute-request-id: req-500bf337-8924-4b4f-b8a2-a343740b504e x-openstack-request-id: req-500bf337-8924-4b4f-b8a2-a343740b504e
RESP BODY: {"server": {"id": "66f8f821-ec26-4264-807e-36ec016d51f9", "name": "my-new-server", "status": "ACTIVE", "tenant_id": "15f2ab0eaa5b4372b759bde609e86224", "user_id": "6cf194afebb6469e8423f50500b5c3fc", "metadata": {}, "hostId": "695ed57b329c2b267ab3b3443ad962f3ae9e1c8bc19ad035f039557b", "image": "", "flavor": {"id": "2", "links": [{"rel": "bookmark", "href": "http://192.168.23.238/compute/flavors/2"}]}, "created": "2024-04-10T07:30:50Z", "updated": "2024-04-10T07:31:03Z", "addresses": {"private": [{"version": 4, "addr": "10.0.0.41", "OS-EXT-IPS:type": "fixed", "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:98:3e:70"}, {"version": 6, "addr": "fd13:d046:e727:0:f816:3eff:fe98:3e70", "OS-EXT-IPS:type": "fixed", "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:98:3e:70"}]}, "accessIPv4": "", "accessIPv6": "", "links": [{"rel": "self", "href": "http://192.168.23.238/compute/v2.1/servers/66f8f821-ec26-4264-807e-36ec016d51f9"}, {"rel": "bookmark", "href": "http://192.168.23.238/compute/servers/66f8f821-ec26-4264-807e-36ec016d51f9"}], "OS-DCF:diskConfig": "MANUAL", "progress": 0, "OS-EXT-AZ:availability_zone": "nova", "config_drive": "", "key_name": null, "OS-SRV-USG:launched_at": "2024-04-10T07:31:03.000000", "OS-SRV-USG:terminated_at": null, "security_groups": [{"name": "default"}], "OS-EXT-SRV-ATTR:host": "devstack", "OS-EXT-SRV-ATTR:instance_name": "instance-00000004", "OS-EXT-SRV-ATTR:hypervisor_hostname": "devstack", "OS-EXT-STS:task_state": null, "OS-EXT-STS:vm_state": "active", "OS-EXT-STS:power_state": 1, "os-extended-volumes:volumes_attached": [{"id": "6c5a7389-ba9f-413c-be5c-64efca90e0bb"}]}}
GET call to compute for http://192.168.23.238/compute/v2.1/servers/66f8f821-ec26-4264-807e-36ec016d51f9 used request id req-500bf337-8924-4b4f-b8a2-a343740b504e
REQ: curl -g -i -X GET "http://192.168.23.238:9696/networking/v2.0/ports?device_id=66f8f821-ec26-4264-807e-36ec016d51f9" -H "Accept: application/json" -H "User-Agent: openstacksdk/2.1.0 keystoneauth1/5.5.0 python-requests/2.31.0 CPython/3.10.12" -H "X-Auth-Token: {SHA256}c6a75e57e3cb0d9e74e4f81621dd357f32ff3ce9888537b999f8404c699c02f4"
http://192.168.23.238:9696 "GET /networking/v2.0/ports?device_id=66f8f821-ec26-4264-807e-36ec016d51f9 HTTP/1.1" 200 1016
RESP: [200] Connection: keep-alive Content-Length: 1016 Content-Type: application/json Date: Wed, 10 Apr 2024 09:10:51 GMT X-Openstack-Request-Id: req-9dbce093-8c0d-459f-8842-143fbd1d4f06
RESP BODY: {"ports":[{"id":"2a7a9f37-99ce-48e5-aaad-416368438c52","name":"","network_id":"9f8b7b77-3a81-4484-bf8a-563027c663e1","tenant_id":"15f2ab0eaa5b4372b759bde609e86224","mac_address":"fa:16:3e:98:3e:70","admin_state_up":true,"status":"ACTIVE","device_id":"66f8f821-ec26-4264-807e-36ec016d51f9","device_owner":"compute:nova","fixed_ips":[{"subnet_id":"bbf35107-2f63-40e8-88b5-82f30f0a6630","ip_address":"10.0.0.41"},{"subnet_id":"e875ab60-0a0f-4b16-b0dc-e9fe74c37e7f","ip_address":"fd13:d046:e727:0:f816:3eff:fe98:3e70"}],"allowed_address_pairs":[],"extra_dhcp_opts":[],"security_groups":["0a2427bd-db7b-4974-a372-3c5151b79b7f"],"description":"","binding:vnic_type":"normal","binding:profile":{},"binding:host_id":"devstack","binding:vif_type":"ovs","binding:vif_details":{"port_filter":true,"connectivity":"l2","bound_drivers":{"0":"ovn"}},"port_security_enabled":true,"tags":[],"created_at":"2024-04-10T07:30:53Z","updated_at":"2024-04-10T07:31:00Z","revision_number":4,"project_id":"15f2ab0eaa5b4372b759bde609e86224"}]}
GET call to network for http://192.168.23.238:9696/networking/v2.0/ports?device_id=66f8f821-ec26-4264-807e-36ec016d51f9 used request id req-9dbce093-8c0d-459f-8842-143fbd1d4f06
REQ: curl -g -i -X PUT http://192.168.23.238:9696/networking/v2.0/floatingips/1875754d-7b9f-47c2-9c0d-83eafd1a0a76 -H "Content-Type: application/json" -H "User-Agent: openstacksdk/2.1.0 keystoneauth1/5.5.0 python-requests/2.31.0 CPython/3.10.12" -H "X-Auth-Token: {SHA256}c6a75e57e3cb0d9e74e4f81621dd357f32ff3ce9888537b999f8404c699c02f4" -d '{"floatingip": {"port_id": "2a7a9f37-99ce-48e5-aaad-416368438c52"}}'
http://192.168.23.238:9696 "PUT /networking/v2.0/floatingips/1875754d-7b9f-47c2-9c0d-83eafd1a0a76 HTTP/1.1" 200 832
RESP: [200] Connection: keep-alive Content-Length: 832 Content-Type: application/json Date: Wed, 10 Apr 2024 09:10:53 GMT X-Openstack-Request-Id: req-4d44c1ed-3077-4e83-b996-8398085cb4d5
RESP BODY: {"floatingip": {"id": "1875754d-7b9f-47c2-9c0d-83eafd1a0a76", "tenant_id": "15f2ab0eaa5b4372b759bde609e86224", "floating_ip_address": "172.24.4.210", "floating_network_id": "73edb86b-d7ab-4db3-82b7-25fa8b012e40", "router_id": "5c5c792e-c4d9-4077-97d1-6d8a9108f39f", "port_id": "2a7a9f37-99ce-48e5-aaad-416368438c52", "fixed_ip_address": "10.0.0.41", "status": "ACTIVE", "description": "", "port_details": {"name": "", "network_id": "9f8b7b77-3a81-4484-bf8a-563027c663e1", "mac_address": "fa:16:3e:98:3e:70", "admin_state_up": true, "status": "ACTIVE", "device_id": "66f8f821-ec26-4264-807e-36ec016d51f9", "device_owner": "compute:nova"}, "dns_domain": "", "dns_name": "", "tags": [], "created_at": "2024-02-19T07:14:18Z", "updated_at": "2024-04-10T09:10:52Z", "revision_number": 3, "project_id": "15f2ab0eaa5b4372b759bde609e86224"}}
PUT call to network for http://192.168.23.238:9696/networking/v2.0/floatingips/1875754d-7b9f-47c2-9c0d-83eafd1a0a76 used request id req-4d44c1ed-3077-4e83-b996-8398085cb4d5
clean_up AddFloatingIP:
END return value: 0
stack@devstack:~/devstack$ openstack server list
+--------------------------------------+---------------+--------+-----------------------------------------------------------------------+--------------------------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+---------------+--------+-----------------------------------------------------------------------+--------------------------+----------+
| 66f8f821-ec26-4264-807e-36ec016d51f9 | my-new-server | ACTIVE | private=10.0.0.41, 172.24.4.210, fd13:d046:e727:0:f816:3eff:fe98:3e70 | N/A (booted from volume) | m1.small |
| e7c7d615-8abc-4657-a334-953d5c6a95e1 | test-server | ACTIVE | private=10.0.0.45, fd13:d046:e727:0:f816:3eff:febf:840b | N/A (booted from volume) | m1.small |
+--------------------------------------+---------------+--------+-----------------------------------------------------------------------+--------------------------+----------+
As can be seen in the debug output, after checking whether floating ip
and server exist and getting the correct port, the floating ip is just
set on that port. There is no check, if the floating ip was already
associated to another port or server.
This has positive and negative implications:
Positive:
Transferring a floating ip from one server to another is just one step instead of two
Negative:
If a user of the CLI just checks its floating IPs to use an unassociated one for a new server, the mistake of reading the wrong line can occur. In that moment, an already associated floating IP is mistakenly transferred from one server to another.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2060808/+subscriptions
References