diff options
| author | yanpuqing <yanpq@awcloud.com> | 2019-06-20 11:14:22 +0800 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2020-10-12 17:09:19 +0100 |
| commit | 415545ab9fd842bdc19b7fbfa63e3332dd63fe6c (patch) | |
| tree | 14c1f8536d627719098b42cd1e62efe94320e0b5 /openstackclient/compute/v2 | |
| parent | a48c05b90a376ce33e2f0a2d321b8c851a6ef0b0 (diff) | |
| download | python-openstackclient-415545ab9fd842bdc19b7fbfa63e3332dd63fe6c.tar.gz | |
Add an error message when server bind floating IP
If we add a floating IP for the server with no fixed IP, CLI doesn't
report an error and nothing happens. The patch adds an error message
when the server which don't have fixed IP bind floating IP.
Change-Id: I400f2bab08521bb7fa443d87c7f45cc79eb80694
Task: 27941
Story: 2004346
Diffstat (limited to 'openstackclient/compute/v2')
| -rw-r--r-- | openstackclient/compute/v2/server.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index e5a7a328..30057111 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -292,6 +292,10 @@ class AddFloatingIP(network_common.NetworkAndComputeCommand): parsed_args.server, ) ports = list(client.ports(device_id=server.id)) + if not ports: + msg = _('No attached ports found to associate floating IP with') + raise exceptions.CommandError(msg) + # If the fixed IP address was specified, we need to find the # corresponding port. if parsed_args.fixed_ip_address: |
