Changed 'MigrateCommand' to use the global setting value of 'execute.in.sequence.hypervisor.commands'

Signed-off-by: Koushik Das <koushik@apache.org>
This commit is contained in:
Alex Ough 2013-12-05 09:25:41 -06:00 committed by Koushik Das
parent 425723e164
commit 88f64b2b93
4 changed files with 10 additions and 6 deletions

View File

@ -24,15 +24,17 @@ public class MigrateCommand extends Command {
String hostGuid;
boolean isWindows;
VirtualMachineTO vmTO;
boolean executeInSequence = false;
protected MigrateCommand() {
}
public MigrateCommand(String vmName, String destIp, boolean isWindows, VirtualMachineTO vmTO) {
public MigrateCommand(String vmName, String destIp, boolean isWindows, VirtualMachineTO vmTO, boolean executeInSequence) {
this.vmName = vmName;
this.destIp = destIp;
this.isWindows = isWindows;
this.vmTO = vmTO;
this.executeInSequence = executeInSequence;
}
public boolean isWindows() {
@ -61,6 +63,6 @@ public class MigrateCommand extends Command {
@Override
public boolean executeInSequence() {
return true;
return executeInSequence;
}
}

View File

@ -49,7 +49,7 @@ import com.cloud.utils.fsm.NoTransitionException;
*/
public interface VirtualMachineManager extends Manager {
static final ConfigKey<Boolean> ExecuteInSequence = new ConfigKey<Boolean>("Advanced", Boolean.class, "execute.in.sequence.hypervisor.commands", "false",
"If set to true, StartCommand, StopCommand, CopyCommand will be synchronized on the agent side."
"If set to true, StartCommand, StopCommand, CopyCommand, MigrateCommand will be synchronized on the agent side."
+ " If set to false, these commands become asynchronous. Default value is false.", true);
public interface Topics {

View File

@ -1723,7 +1723,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
boolean migrated = false;
try {
boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to);
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to, ExecuteInSequence.value());
mc.setHostGuid(dest.getHost().getGuid());
try {
@ -3536,7 +3536,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
boolean migrated = false;
try {
boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to);
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to, ExecuteInSequence.value());
mc.setHostGuid(dest.getHost().getGuid());
try {

View File

@ -211,4 +211,6 @@ CREATE VIEW `cloud`.`volume_view` AS
left join
`cloud`.`async_job` ON async_job.instance_id = volumes.id
and async_job.instance_type = 'Volume'
and async_job.job_status = 0;
and async_job.job_status = 0;
UPDATE `cloud`.`configuration` SET `description` = 'If set to true, StartCommand, StopCommand, CopyCommand, MigrateCommand will be synchronized on the agent side. If set to false, these commands become asynchronous. Default value is true.' WHERE `name` = 'execute.in.sequence.hypervisor.commands';