add host guid in migrate command

This commit is contained in:
Edison Su 2011-08-10 10:26:04 -07:00
parent 48342ff6e2
commit ed7214c710
2 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,7 @@ package com.cloud.agent.api;
public class MigrateCommand extends Command { public class MigrateCommand extends Command {
String vmName; String vmName;
String destIp; String destIp;
String hostGuid;
boolean isWindows; boolean isWindows;
@ -44,6 +45,14 @@ public class MigrateCommand extends Command {
return vmName; return vmName;
} }
public void setHostGuid(String guid) {
this.hostGuid = guid;
}
public String getHostGuid() {
return this.hostGuid;
}
@Override @Override
public boolean executeInSequence() { public boolean executeInSequence() {
return true; return true;

View File

@ -1174,6 +1174,8 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
try { try {
boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows); MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows);
mc.setHostGuid(dest.getHost().getGuid());
try { try {
MigrateAnswer ma = (MigrateAnswer) _agentMgr.send(vm.getLastHostId(), mc); MigrateAnswer ma = (MigrateAnswer) _agentMgr.send(vm.getLastHostId(), mc);
if (!ma.getResult()) { if (!ma.getResult()) {