Merge "Check the target host before live migrating a instance"
This commit is contained in:
commit
b80668e7d4
@ -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,
|
||||
|
@ -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)) \
|
||||
|
Loading…
Reference in New Issue
Block a user