CLOUDSTACK-7504,CLOUDSTACK-7507: For LXC host maintenance, migrate system Vms and schedule restart of users Vms

This commit is contained in:
Kishan Kavala 2014-09-08 18:04:32 +05:30
parent 40a537fedc
commit c773754fda

View File

@ -30,6 +30,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.vm.VirtualMachine;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
@ -1195,9 +1196,9 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
if (hosts == null || hosts.isEmpty() || !answer.getMigrate()) {
// for the last host in this cluster, stop all the VMs
_haMgr.scheduleStop(vm, hostId, WorkType.ForceStop);
} else if (HypervisorType.LXC.equals(host.getHypervisorType())){
//Stop LXC Vms. LXC doesn't support migration
_haMgr.scheduleStop(vm, hostId, WorkType.Stop);
} else if (HypervisorType.LXC.equals(host.getHypervisorType()) && VirtualMachine.Type.User.equals(vm.getType())){
//Migration is not supported for LXC Vms. Schedule restart instead.
_haMgr.scheduleRestart(vm, false);
} else {
_haMgr.scheduleMigration(vm);
}