bug 6119: some commands are supposed to take a longer time, set timeout for them to 120 min

status 6119: resolved fixed
This commit is contained in:
anthony 2010-09-04 13:54:57 -07:00
parent acabd549a6
commit 72f027f463
5 changed files with 16 additions and 7 deletions

View File

@ -210,4 +210,6 @@ public interface AgentManager extends Manager {
public boolean reconnect(final long hostId) throws AgentUnavailableException;
public List<HostVO> discoverHosts(long dcId, Long podId, Long clusterId, URI url, String username, String password) throws DiscoveryException;
Answer easySend(Long hostId, Command cmd, int timeout);
}

View File

@ -5744,7 +5744,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
checksum = "";
}
String result = callHostPluginWithTimeOut("post_create_private_template", 1800, "remoteTemplateMountPath", remoteTemplateMountPath, "templateDownloadFolder", templateDownloadFolder,
String result = callHostPluginWithTimeOut("post_create_private_template", 110*60, "remoteTemplateMountPath", remoteTemplateMountPath, "templateDownloadFolder", templateDownloadFolder,
"templateInstallFolder", templateInstallFolder, "templateFilename", templateFilename, "templateName", templateName, "templateDescription", templateDescription,
"checksum", checksum, "virtualSize", String.valueOf(virtualSize), "templateId", String.valueOf(templateId));
@ -5782,7 +5782,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
// Each argument is put in a separate line for readability.
// Using more lines does not harm the environment.
String results = callHostPluginWithTimeOut("backupSnapshot", 1800, "primaryStorageSRUuid", primaryStorageSRUuid, "dcId", dcId.toString(), "accountId", accountId.toString(), "volumeId",
String results = callHostPluginWithTimeOut("backupSnapshot", 110*60, "primaryStorageSRUuid", primaryStorageSRUuid, "dcId", dcId.toString(), "accountId", accountId.toString(), "volumeId",
volumeId.toString(), "secondaryStorageMountPath", secondaryStorageMountPath, "snapshotUuid", snapshotUuid, "prevSnapshotUuid", prevSnapshotUuid, "prevBackupUuid",
prevBackupUuid, "isFirstSnapshotOfRootVolume", isFirstSnapshotOfRootVolume.toString(), "isISCSI", isISCSI.toString());
@ -5885,7 +5885,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
String failureString = "Could not create volume from " + backedUpSnapshotUuid;
templatePath = (templatePath == null) ? "" : templatePath;
String results = callHostPluginWithTimeOut("createVolumeFromSnapshot", 1800, "dcId", dcId.toString(), "accountId", accountId.toString(), "volumeId", volumeId.toString(),
String results = callHostPluginWithTimeOut("createVolumeFromSnapshot", 110*60, "dcId", dcId.toString(), "accountId", accountId.toString(), "volumeId", volumeId.toString(),
"secondaryStorageMountPath", secondaryStorageMountPath, "backedUpSnapshotUuid", backedUpSnapshotUuid, "templatePath", templatePath, "templateDownloadFolder",
templateDownloadFolder, "isISCSI", isISCSI.toString());

View File

@ -1117,8 +1117,13 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
@Override
public Answer easySend(final Long hostId, final Command cmd) {
return easySend(hostId, cmd, _wait);
}
@Override
public Answer easySend(final Long hostId, final Command cmd, int timeout) {
try {
final Answer answer = send(hostId, cmd, _wait);
final Answer answer = send(hostId, cmd, timeout);
if (answer == null) {
s_logger.warn("send returns null answer");
return null;

View File

@ -1654,7 +1654,8 @@ public class StorageManagerImpl implements StorageManager {
}
}
s_logger.debug("Trying to execute Command: " + cmd + " on host: " + hostId + " try: " + tryCount);
answer = _agentMgr.send(hostId, cmd);
// set 120 min timeout for storage related command
answer = _agentMgr.send(hostId, cmd, 120*60*1000);
if (answer != null && answer.getResult()) {
return answer;

View File

@ -231,7 +231,8 @@ public class TemplateManagerImpl implements TemplateManager {
s_logger.debug("Downloading " + templateId + " via " + vo.getHostId());
}
dcmd.setLocalPath(vo.getLocalPath());
DownloadAnswer answer = (DownloadAnswer)_agentMgr.easySend(vo.getHostId(), dcmd);
// set 120 min timeout for this command
DownloadAnswer answer = (DownloadAnswer)_agentMgr.easySend(vo.getHostId(), dcmd, 120*60*1000);
if (answer != null) {
templateStoragePoolRef.setDownloadPercent(templateStoragePoolRef.getDownloadPercent());
templateStoragePoolRef.setDownloadState(answer.getDownloadStatus());