CLOUDSTACK-2843: added CopyCommand to the list of the commands controlled by execute.in.sequence.hypervisor.commands global config. This command was introduced by the Storage refactoring, and used for volume creation on the primary storage

This commit is contained in:
Alena Prokharchyk 2013-07-11 17:17:51 -07:00
parent 96d29c7f3d
commit dd91974920
6 changed files with 20 additions and 14 deletions

View File

@ -371,4 +371,6 @@ public interface ManagementService {
List<String> listDeploymentPlanners();
VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableException, ManagementServerException, VirtualMachineMigrationException, ConcurrentOperationException;
boolean getExecuteInSequence();
}

View File

@ -23,12 +23,15 @@ public final class CopyCommand extends Command implements StorageSubSystemComman
private DataTO srcTO;
private DataTO destTO;
private DataTO cacheTO;
boolean executeInSequence = false;
public CopyCommand(DataTO srcData, DataTO destData, int timeout) {
public CopyCommand(DataTO srcData, DataTO destData, int timeout, boolean executeInSequence) {
super();
this.srcTO = srcData;
this.destTO = destData;
this.setWait(timeout);
this.executeInSequence = executeInSequence;
}
public DataTO getDestTO() {
@ -41,7 +44,7 @@ public final class CopyCommand extends Command implements StorageSubSystemComman
@Override
public boolean executeInSequence() {
return true;
return executeInSequence;
}
public DataTO getCacheTO() {

View File

@ -59,6 +59,7 @@ import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.host.Host;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.server.ManagementService;
import com.cloud.storage.DataStoreRole;
import com.cloud.storage.StorageManager;
import com.cloud.storage.StoragePool;
@ -113,6 +114,8 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
VolumeManager volumeMgr;
@Inject
StorageCacheManager cacheMgr;
@Inject
ManagementService _mgmtServer;
@Override
public boolean canHandle(DataObject srcData, DataObject destData) {
@ -184,7 +187,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
srcForCopy = cacheData = cacheMgr.createCacheObject(srcData, destScope);
}
CopyCommand cmd = new CopyCommand(srcForCopy.getTO(), destData.getTO(), _primaryStorageDownloadWait);
CopyCommand cmd = new CopyCommand(srcForCopy.getTO(), destData.getTO(), _primaryStorageDownloadWait, _mgmtServer.getExecuteInSequence());
EndPoint ep = selector.select(srcForCopy, destData);
answer = ep.sendMessage(cmd);
@ -242,7 +245,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
int _createVolumeFromSnapshotWait = NumbersUtil.parseInt(value,
Integer.parseInt(Config.CreateVolumeFromSnapshotWait.getDefaultValue()));
CopyCommand cmd = new CopyCommand(srcData.getTO(), volObj.getTO(), _createVolumeFromSnapshotWait);
CopyCommand cmd = new CopyCommand(srcData.getTO(), volObj.getTO(), _createVolumeFromSnapshotWait, _mgmtServer.getExecuteInSequence());
EndPoint ep = selector.select(snapObj, volObj);
Answer answer = ep.sendMessage(cmd);
@ -258,7 +261,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
}
protected Answer cloneVolume(DataObject template, DataObject volume) {
CopyCommand cmd = new CopyCommand(template.getTO(), volume.getTO(), 0);
CopyCommand cmd = new CopyCommand(template.getTO(), volume.getTO(), 0, _mgmtServer.getExecuteInSequence());
try {
EndPoint ep = selector.select(volume.getDataStore());
Answer answer = ep.sendMessage(cmd);
@ -301,7 +304,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
objOnImageStore.processEvent(Event.CopyingRequested);
CopyCommand cmd = new CopyCommand(objOnImageStore.getTO(), destData.getTO(), _copyvolumewait);
CopyCommand cmd = new CopyCommand(objOnImageStore.getTO(), destData.getTO(), _copyvolumewait, _mgmtServer.getExecuteInSequence());
EndPoint ep = selector.select(objOnImageStore, destData);
answer = ep.sendMessage(cmd);
@ -319,7 +322,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
return answer;
} else {
DataObject cacheData = cacheMgr.createCacheObject(srcData, destScope);
CopyCommand cmd = new CopyCommand(cacheData.getTO(), destData.getTO(), _copyvolumewait);
CopyCommand cmd = new CopyCommand(cacheData.getTO(), destData.getTO(), _copyvolumewait, _mgmtServer.getExecuteInSequence());
EndPoint ep = selector.select(cacheData, destData);
Answer answer = ep.sendMessage(cmd);
return answer;
@ -376,7 +379,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
srcData = cacheSnapshotChain(snapshot);
}
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait);
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait, _mgmtServer.getExecuteInSequence());
EndPoint ep = selector.select(srcData, destData);
Answer answer = ep.sendMessage(cmd);
return answer;
@ -393,12 +396,12 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
if (needCacheStorage(srcData, destData)) {
cacheData = cacheMgr.getCacheObject(srcData, destData.getDataStore().getScope());
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait);
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, _mgmtServer.getExecuteInSequence());
cmd.setCacheTO(cacheData.getTO());
EndPoint ep = selector.select(srcData, destData);
answer = ep.sendMessage(cmd);
} else {
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait);
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _backupsnapshotwait, _mgmtServer.getExecuteInSequence());
EndPoint ep = selector.select(srcData, destData);
answer = ep.sendMessage(cmd);
}

View File

@ -432,7 +432,7 @@ public enum Config {
"routes", ConfigurationParameterScope.zone.toString()),
InternalLbVmServiceOfferingId("Advanced", ManagementServer.class, String.class, "internallbvm.service.offering", null, "Uuid of the service offering used by internal lb vm; if NULL - default system internal lb offering will be used", null),
ExecuteInSequence("Advanced", ManagementServer.class, Boolean.class, "execute.in.sequence.hypervisor.commands", "false", "If set to true, StartCommand, StopCommand, CopyVolumeCommand, CreateCommand will be synchronized on the agent side." +
ExecuteInSequence("Advanced", ManagementServer.class, 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 false, these commands become asynchronous. Default value is false.", null),
ExecuteInSequenceNetworkElementCommands("Advanced", NetworkManager.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." +
" If set to false, these commands become asynchronous. Default value is false.", null);

View File

@ -72,6 +72,4 @@ public interface ManagementServer extends ManagementService, PluggableService {
String getEncryptionIV();
void resetEncryptionKeyIV();
boolean getExecuteInSequence();
}

View File

@ -2153,7 +2153,7 @@ UPDATE `cloud`.`networks` set name='Shared SG enabled network', display_text='Sh
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'use.system.public.ips', 'true', 'If true, when account has dedicated public ip range(s), once the ips dedicated to the account have been consumed ips will be acquired from the system pool');
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'use.system.guest.vlans', 'true', 'If true, when account has dedicated guest vlan range(s), once the vlans dedicated to the account have been consumed vlans will be allocated from the system pool');
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'execute.in.sequence.hypervisor.commands', 'false', 'If set to true, StartCommand, StopCommand, CopyVolumeCommand, CreateCommand will be synchronized on the agent side. If set to false, these commands become asynchronous. Default value is false.');
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'execute.in.sequence.hypervisor.commands', 'false', 'If set to true, StartCommand, StopCommand, CopyCommand will be synchronized on the agent side. If set to false, these commands become asynchronous. Default value is false.');
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'execute.in.sequence.network.element.commands', 'false', 'If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side. If set to false, these commands become asynchronous. Default value is false.');
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'direct.agent.scan.interval', 90, 'Time interval (in seconds) to run the direct agent scan task.');