diff --git a/openstack_dashboard/dashboards/admin/instances/forms.py b/openstack_dashboard/dashboards/admin/instances/forms.py index 4a39c5e917..01195a409b 100644 --- a/openstack_dashboard/dashboards/admin/instances/forms.py +++ b/openstack_dashboard/dashboards/admin/instances/forms.py @@ -30,8 +30,7 @@ class LiveMigrateForm(forms.SelfHandlingForm): attrs={'readonly': 'readonly'})) host = forms.ThemableChoiceField( label=_("New Host"), - help_text=_("Choose a Host to migrate to."), - required=False) + help_text=_("Choose a Host to migrate to.")) disk_over_commit = forms.BooleanField(label=_("Disk Over Commit"), initial=False, required=False) block_migration = forms.BooleanField(label=_("Block Migration"), @@ -55,7 +54,8 @@ class LiveMigrateForm(forms.SelfHandlingForm): if (host.service.startswith('compute') and host.host_name != current_host)] if host_list: - host_list.insert(0, ("", _("Automatically schedule new host."))) + host_list.insert(0, ("AUTO_SCHEDULE", + _("Automatically schedule new host."))) else: host_list.insert(0, ("", _("No other hosts available"))) return sorted(host_list) @@ -64,7 +64,7 @@ class LiveMigrateForm(forms.SelfHandlingForm): try: block_migration = data['block_migration'] disk_over_commit = data['disk_over_commit'] - host = None if not data['host'] else data['host'] + host = None if data['host'] == 'AUTO_SCHEDULE' else data['host'] api.nova.server_live_migrate(request, data['instance_id'], host, diff --git a/openstack_dashboard/dashboards/admin/instances/tests.py b/openstack_dashboard/dashboards/admin/instances/tests.py index 89e4388ef8..53dc2b3902 100644 --- a/openstack_dashboard/dashboards/admin/instances/tests.py +++ b/openstack_dashboard/dashboards/admin/instances/tests.py @@ -371,7 +371,7 @@ class InstanceViewTest(test.BaseAdminViewTests): 'server_live_migrate',)}) def test_instance_live_migrate_auto_sched(self): server = self.servers.first() - host = "" + host = "AUTO_SCHEDULE" api.nova.server_get(IsA(http.HttpRequest), server.id) \ .AndReturn(server) api.nova.host_list(IsA(http.HttpRequest)) \