Bug 1612369
Summary: | Unable to attach floating ip to an instance | ||
---|---|---|---|
Product: | Red Hat OpenStack | Reporter: | awaugama |
Component: | openstack-ec2-api | Assignee: | RHOS Maint <rhos-maint> |
Status: | CLOSED WONTFIX | QA Contact: | Shai Revivo <srevivo> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 14.0 (Rocky) | CC: | amodi, apevec, awaugama, egallen, jpichon, lhh, lyarwood, mwitt, owalsh, srevivo |
Target Milestone: | rc | Keywords: | Triaged |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | 1612360 | Environment: | |
Last Closed: | 2018-11-06 20:38:12 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 1612360 | ||
Bug Blocks: |
Description
awaugama
2018-08-03 19:34:14 UTC
The error message occurring this time is not the same as what's shown in the cloned bug. The error message this time is: "botocore.exceptions.ClientError: An error occurred (AttributeError) when calling the AssociateAddress operation (reached max retries: 4): Unknown error occurred." which is not coming from openstackclient. We discussed this in #rhos-compute today and I think I found the problem on the ec2-api server side: https://github.com/openstack/ec2-api/blob/0243b82bf03d7f54206a96a3ff650faa6a29211d/ec2api/api/address.py#L287-L321 On L321 there, it calls nova.servers.add_floating_ip but that method was removed back in January and released in novaclient version 10.0.0 [1]. I also saw a related commit [2] that added skips to unit tests that were calling removed novaclient floating ip APIs. So, this is broken upstream in the ec2-api itself and would need to be fixed there first. [1] https://github.com/openstack/python-novaclient/commit/01fb16533bf562f39fe822bc12b9cc34b8580359 [2] https://github.com/openstack/ec2-api/commit/66a5333f1b97b80f58b22e47276b9b0526554dfd The nova-ec2 project upstream is not active anymore. We will check if some existing users are still using this EC2 feature. If not, we will start a deprecation process. I'm going to need more information on how to reproduce this, because so far I'm unable. Unless this has somehow been fixed in master, which is where I tried this. ### List devstack's image $ aws --endpoint-url http://192.168.100.200:8788/ ec2 describe-images { "Images": [ { "Name": "cirros-0.3.5-x86_64-disk", "ImageId": "ami-960ef701", "State": "available", "Architecture": "", "ImageLocation": "None (cirros-0.3.5-x86_64-disk)", "RootDeviceType": "instance-store", "OwnerId": "e03ae3a775634c6f958847d00d0ebfb8", "CreationDate": "2018-11-02T16:03:34Z", "Public": true, "ImageType": "machine" } ] } ### Build instance $ aws --endpoint-url http://192.168.100.200:8788/ ec2 run-instances --image-id ami-960ef701 { "Instances": [ { "SourceDestCheck": true, "VpcId": "vpc-ae7809df", "Placement": { "AvailabilityZone": "" }, "InstanceId": "i-a9bcb481", "PublicDnsName": "", "ImageId": "ami-960ef701", "PrivateDnsName": "r-7fgosgej-0", "State": { "Code": 0, "Name": "error" }, "KeyName": "", "LaunchTime": "2018-11-02T17:46:54Z", "SubnetId": "subnet-2b41091f", "SecurityGroups": [ { "GroupName": "default", "GroupId": "sg-ae7809df" } ], "AmiLaunchIndex": 0, "InstanceType": "m1.small", "PrivateIpAddress": "172.31.0.3", "NetworkInterfaces": [ { "Status": "in-use", "MacAddress": "fa:16:3e:d6:61:fd", "SourceDestCheck": true, "VpcId": "vpc-ae7809df", "Description": "", "NetworkInterfaceId": "eni-a9e03c25", "PrivateIpAddresses": [ { "Primary": true, "PrivateIpAddress": "172.31.0.3" } ], "Attachment": { "Status": "attached", "DeviceIndex": 0, "DeleteOnTermination": true, "AttachmentId": "eni-attach-a9e03c25", "AttachTime": "2018-11-02T17:46:54.506151Z" }, "Groups": [ { "GroupName": "default", "GroupId": "sg-ae7809df" } ], "SubnetId": "subnet-2b41091f", "OwnerId": "ce1ef907e2bd477a8db4021c5bf19284", "PrivateIpAddress": "172.31.0.3" } ] } ], "ReservationId": "r-7fgosgej", "Groups": [], "OwnerId": "ce1ef907e2bd477a8db4021c5bf19284" } ### Allocate a "floating ip" $ aws --endpoint-url http://192.168.100.200:8788/ ec2 allocate-address { "PublicIp": "172.24.4.3", "Domain": "vpc", "AllocationId": "eipalloc-4e59f691" } ### Associate it with our instance $ aws --endpoint-url http://192.168.100.200:8788/ ec2 associate-address --instance-id i-a9bcb481 --public-ip 172.24.4.3 { "AssociationId": "eipassoc-4e59f691" } Doh, as Ollie pointed out in comment #3, setting disable_ec2_classic=True works around this, and that's how devstack deploys the ec2api plugin. With disable_ec2_classic=False, I can reproduce with the steps in comment #5. And as Melanie correctly pointed out in comment #1, it's because add_floating_ip no longer exists: Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api [req-e1509cd8-38e4-4b4e-9536-ee2cd0c4fe2d c4569976f00e4aa1a470925dec004abc ce1ef907e2bd477a8db4021c5bf19284 - - -] Unexpected Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api Traceback (most recent call last): Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api File "/opt/stack/ec2-api/ec2api/api/__init__.py", line 377, in __call__ Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api result = api_request.invoke(context) Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api File "/opt/stack/ec2-api/ec2api/api/apirequest.py", line 81, in invoke Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api result = method(context, **args) Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api File "/opt/stack/ec2-api/ec2api/api/cloud.py", line 78, in func_wrapped Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api return impl_func(context, **kwargs) Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api File "/opt/stack/ec2-api/ec2api/api/address.py", line 69, in associate_address Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api private_ip_address, allow_reassociation) Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api File "/opt/stack/ec2-api/ec2api/api/address.py", line 321, in associate_address Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api nova.servers.add_floating_ip(os_instance_id, public_ip) Nov 02 17:56:08 ubuntu ec2-api[13758]: 2018-11-02 17:56:08.617 13770 ERROR ec2api.api AttributeError: 'ServerManager' object has no attribute 'add_floating_ip' While nova-network supported adding a floating IP to an instance, Neutron requires a port. So the `associate-address --instance-id <id> --public-ip <fip>` form of the command can only work if the insance has a single port with a single IP address. If that's not the case, the ec2api needs to throw some kind of exception, and require that the command be used with the `--private-ip-address` or `--network-interface-id` option. We would then loop up the Neutron port based on one of those parameters. Also, in addition to fixing this for the associate-address case (nova.servers.add_floating_ip), we'll also need to fix this for the disassociate-address case (nova.servers.remove_floating_ip). It's not hard work, but it's definitely not trivial. Before we embark on this, I want to make sure there are still customers using this in OSP14 and beyond. |