From 88f64b2b93a3898e7868e9e55c1feca57b2ed48e Mon Sep 17 00:00:00 2001 From: Alex Ough Date: Thu, 5 Dec 2013 09:25:41 -0600 Subject: [PATCH] Changed 'MigrateCommand' to use the global setting value of 'execute.in.sequence.hypervisor.commands' Signed-off-by: Koushik Das --- core/src/com/cloud/agent/api/MigrateCommand.java | 6 ++++-- engine/api/src/com/cloud/vm/VirtualMachineManager.java | 2 +- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 4 ++-- setup/db/db/schema-430to440.sql | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/src/com/cloud/agent/api/MigrateCommand.java b/core/src/com/cloud/agent/api/MigrateCommand.java index 0d8f70cf047..e79c8a51bcf 100644 --- a/core/src/com/cloud/agent/api/MigrateCommand.java +++ b/core/src/com/cloud/agent/api/MigrateCommand.java @@ -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; } } diff --git a/engine/api/src/com/cloud/vm/VirtualMachineManager.java b/engine/api/src/com/cloud/vm/VirtualMachineManager.java index fbbed213bfd..7292d659f7e 100644 --- a/engine/api/src/com/cloud/vm/VirtualMachineManager.java +++ b/engine/api/src/com/cloud/vm/VirtualMachineManager.java @@ -49,7 +49,7 @@ import com.cloud.utils.fsm.NoTransitionException; */ public interface VirtualMachineManager extends Manager { static final ConfigKey ExecuteInSequence = new ConfigKey("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 { diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 5136130eaef..d4bbbe67eeb 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -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 { diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql index 8098ad803b2..f4dc2e6721d 100644 --- a/setup/db/db/schema-430to440.sql +++ b/setup/db/db/schema-430to440.sql @@ -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; \ No newline at end of file + 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';