[ https://issues.apache.org/jira/browse/CLOUDSTACK-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mice Xia resolved CLOUDSTACK-2139. ---------------------------------- Resolution: Fixed there are two stateTransitTo(..) methods in VirtualMachineManagerImpl.java, for advanceStop, should use the one that will setLastHostId for stopping--> stopped transition. > When VM is live migrated to a different host , stopped and started , It > starts on the original host where it was before live migration. > --------------------------------------------------------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-2139 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-2139 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Management Server > Affects Versions: 4.2.0 > Environment: Build from master > Reporter: Sangeetha Hariharan > Assignee: Mice Xia > Fix For: 4.2.0 > > Attachments: management-server.rar > > > When VM is live migrated to a different host , stopped and started , It > starts on the original host where it was before live migration > Steps to reproduce the problem: > Deploy a Vm. > Say it gets deployed on host1 ( in my case host id 9) > Live migrate the Vm to a different host say host2 in the same cluster ( in my > case host id 7). > After live migration , stop this VM. > Start this VM. > We expect the Vm to be started on 7. > Actual Behavior: > Vm is started on 9 , since the "last_host_id" for the Vm still point to "9". > last_host_id did not change when the Vm was migrated and also when the Vm was > stopped. > After deployment succeeds: > mysql> select id, uuid,host_id,last_host_id,state,name from vm_instance > where id in (56) and state not in ("Expunging"); > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | id | uuid | host_id | last_host_id | state > | name | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | 56 | 0be22ab3-488a-4ab2-95f6-28bbb3f11bb6 | 9 | 9 | > Running | test-vm-migrate | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > After vm migration succeeds: > mysql> select id, uuid,host_id,last_host_id,state,name from vm_instance > where id in (56) and state not in ("Expunging"); > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | id | uuid | host_id | last_host_id | state > | name | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | 56 | 0be22ab3-488a-4ab2-95f6-28bbb3f11bb6 | 7 | 9 | > Running | test-vm-migrate | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > 1 row in set (0.00 sec) > After vm is stopped: > mysql> select id, uuid,host_id,last_host_id,state,name from vm_instance > where id in (56) and state not in ("Expunging"); > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | id | uuid | host_id | last_host_id | state > | name | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | 56 | 0be22ab3-488a-4ab2-95f6-28bbb3f11bb6 | NULL | 9 | > Stopped | test-vm-migrate | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > 1 row in set (0.00 sec) > After vm is started: > mysql> select id, uuid,host_id,last_host_id,state,name from vm_instance > where id in (56) and state not in ("Expunging"); > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | id | uuid | host_id | last_host_id | state > | name | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > | 56 | 0be22ab3-488a-4ab2-95f6-28bbb3f11bb6 | 9 | 9 | > Running | test-vm-migrate | > +----+--------------------------------------+---------+--------------+---------+-----------------+ > 1 row in set (0.00 sec) > mysql> -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira