Skip to content

Commit

Permalink
Merge pull request #14155 from jelkosz/fail-migration-with-better-error
Browse files Browse the repository at this point in the history
Provide better error message when migrating to the same host
(cherry picked from commit 9764860)

https://bugzilla.redhat.com/show_bug.cgi?id=1436222
  • Loading branch information
isimluk authored and simaishi committed Apr 13, 2017
1 parent 9608b90 commit 22bf18a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/vm_or_template/operations/relocation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def raw_migrate(host, pool = nil, priority = "defaultPriority", state = nil)
end
end

if host_id == host.id
raise _("The VM '#{name}' can not be migrated to the same host it is already running on.")
end

host_mor = host.ems_ref_obj
pool_mor = pool.ems_ref_obj
run_command_via_parent(:vm_migrate, :host => host_mor, :pool => pool_mor, :priority => priority, :state => state)
Expand Down

0 comments on commit 22bf18a

Please sign in to comment.