diff options
author | Rikimaru Honjo <honjo.rikimaru@ntt-tx.co.jp> | 2020-01-15 10:48:14 +0000 |
---|---|---|
committer | Rikimaru Honjo <honjo.rikimaru@ntt-tx.co.jp> | 2020-01-29 05:06:34 +0000 |
commit | 42d9a8d2e8736c5a8e94eaf7074755a1add3922b (patch) | |
tree | 0e6a5231081eec03fda9ada6590d956c4dffcdb6 | |
parent | fe61f2358a6e16ea462630747180b83337eb5b55 (diff) | |
download | horizon-42d9a8d2e8736c5a8e94eaf7074755a1add3922b.tar.gz |
Allow to evacuate without specifying a target host
When the evacuate is run without specifying a target host, horizon
sets an empty string for target host. But the evacuate api doesn't
allow an empty string. As a result, nova returns "HTTP 400 Bad
request".
So this patch sets None as the target host when it isn't specified.
Change-Id: Ia865a6c02e206fa49efc3095e8d3488f5638d0e3
Closes-Bug: 1793694
(cherry picked from commit f9e0f8a976b82088ef095a69cd1fa892cddde3ba)
-rw-r--r-- | openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py b/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py index 2e9a6434b..8082e8268 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py @@ -57,6 +57,11 @@ class EvacuateHostForm(forms.SelfHandlingForm): current_host = data['current_host'] target_host = data['target_host'] on_shared_storage = data['on_shared_storage'] + # The target_host value will be an empty string when the target + # host wasn't specified. But the evacuate api doesn't allow + # an empty string. So set None as the target_host value. + if not target_host: + target_host = None api.nova.evacuate_host(request, current_host, target_host, on_shared_storage) |