本文整理汇总了Java中com.cloud.agent.api.Answer.createUnsupportedCommandAnswer方法的典型用法代码示例。如果您正苦于以下问题:Java Answer.createUnsupportedCommandAnswer方法的具体用法?Java Answer.createUnsupportedCommandAnswer怎么用?Java Answer.createUnsupportedCommandAnswer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cloud.agent.api.Answer
的用法示例。
在下文中一共展示了Answer.createUnsupportedCommandAnswer方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
if (cmd instanceof CheckConsoleProxyLoadCommand) {
return execute((CheckConsoleProxyLoadCommand) cmd);
} else if (cmd instanceof WatchConsoleProxyLoadCommand) {
return execute((WatchConsoleProxyLoadCommand) cmd);
} else if (cmd instanceof ReadyCommand) {
s_logger.info("Receive ReadyCommand, response with ReadyAnswer");
return new ReadyAnswer((ReadyCommand) cmd);
} else if (cmd instanceof CheckHealthCommand) {
return new CheckHealthAnswer((CheckHealthCommand) cmd, true);
} else if (cmd instanceof StartConsoleProxyAgentHttpHandlerCommand) {
return execute((StartConsoleProxyAgentHttpHandlerCommand) cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例2: testCreateUnsupportedCommandAnswer
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Test
public void testCreateUnsupportedCommandAnswer() {
UnsupportedAnswer usa = Answer.createUnsupportedCommandAnswer(acc);
boolean b = usa.executeInSequence();
assertFalse(b);
b = usa.getResult();
assertFalse(b);
String d = usa.getDetails();
assertTrue(d.contains("Unsupported command issued: " + acc.toString() + ". Are you sure you got the right type of server?"));
usa = Answer.createUnsupportedVersionAnswer(acc);
b = usa.executeInSequence();
assertFalse(b);
b = usa.getResult();
assertFalse(b);
d = usa.getDetails();
assertTrue(d.equals("Unsuppored Version."));
}
示例3: createTemplateFromSnapshot
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
protected Answer createTemplateFromSnapshot(final CopyCommand cmd) {
final DataTO srcData = cmd.getSrcTO();
final DataTO destData = cmd.getDestTO();
final DataStoreTO srcDataStore = srcData.getDataStore();
final DataStoreTO destDataStore = destData.getDataStore();
if (srcDataStore.getRole() == DataStoreRole.Image || srcDataStore.getRole() == DataStoreRole.ImageCache || srcDataStore.getRole() == DataStoreRole.Primary) {
if (!(srcDataStore instanceof NfsTO)) {
s_logger.debug("only support nfs storage as src, when create template from snapshot");
return Answer.createUnsupportedCommandAnswer(cmd);
}
if (destDataStore instanceof NfsTO) {
return copySnapshotToTemplateFromNfsToNfs(cmd, (SnapshotObjectTO) srcData, (NfsTO) srcDataStore, (TemplateObjectTO) destData, (NfsTO) destDataStore);
}
}
s_logger.debug("Failed to create templat from snapshot");
return new CopyCmdAnswer("Unsupported prototcol");
}
示例4: execute
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
protected Answer execute(final DeleteCommand cmd) {
final DataTO obj = cmd.getData();
final DataObjectType objType = obj.getObjectType();
if (obj.getPath() == null) {
// account for those fake entries for NFS migration to object store
return new Answer(cmd, true, "Object with null install path does not exist on image store , no need to delete");
}
switch (objType) {
case TEMPLATE:
return deleteTemplate(cmd);
case VOLUME:
return deleteVolume(cmd);
case SNAPSHOT:
return deleteSnapshot(cmd);
}
return Answer.createUnsupportedCommandAnswer(cmd);
}
示例5: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
if (cmd instanceof DownloadProgressCommand) {
return _dlMgr.handleDownloadCommand(this, (DownloadProgressCommand) cmd);
} else if (cmd instanceof DownloadCommand) {
return _dlMgr.handleDownloadCommand(this, (DownloadCommand) cmd);
} else if (cmd instanceof CheckHealthCommand) {
return new CheckHealthAnswer((CheckHealthCommand) cmd, true);
} else if (cmd instanceof SecStorageSetupCommand) {
return new Answer(cmd, true, "success");
} else if (cmd instanceof ReadyCommand) {
return new ReadyAnswer((ReadyCommand) cmd);
} else if (cmd instanceof ListTemplateCommand) {
return execute((ListTemplateCommand) cmd);
} else if (cmd instanceof ComputeChecksumCommand) {
return execute((ComputeChecksumCommand) cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例6: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
if (cmd instanceof DownloadProgressCommand) {
return new DownloadAnswer(null, 100, cmd, com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED, "dummyFS", "/dummy");
} else if (cmd instanceof DownloadCommand) {
return new DownloadAnswer(null, 100, cmd, com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED, "dummyFS", "/dummy");
} else if (cmd instanceof GetStorageStatsCommand) {
return execute((GetStorageStatsCommand) cmd);
} else if (cmd instanceof CheckHealthCommand) {
return new CheckHealthAnswer((CheckHealthCommand) cmd, true);
} else if (cmd instanceof ReadyCommand) {
return new ReadyAnswer((ReadyCommand) cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例7: retry
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
public Answer retry(final Command command, final Class<? extends Answer> answerClass, final Exception error) {
if (commandsToRetry.containsKey(command)) {
Integer numRetries = commandsToRetry.get(command);
if (numRetries > ZERO) {
commandsToRetry.put(command, --numRetries);
s_logger.warn("Retrying " + command.getClass().getSimpleName() + ". Number of retries remaining: " + numRetries);
return serverResource.executeRequest(command);
} else {
commandsToRetry.remove(command);
}
}
try {
final Constructor<? extends Answer> answerConstructor = answerClass.getConstructor(Command.class, Exception.class);
return answerConstructor.newInstance(command, error);
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
return Answer.createUnsupportedCommandAnswer(command);
}
}
示例8: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
if (cmd instanceof ReadyCommand) {
return execute((ReadyCommand) cmd);
} else if (cmd instanceof MaintainCommand) {
return execute((MaintainCommand) cmd);
} else if (cmd instanceof DirectNetworkUsageCommand) {
return execute((DirectNetworkUsageCommand) cmd);
} else if (cmd instanceof RecurringNetworkUsageCommand) {
return execute((RecurringNetworkUsageCommand) cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例9: executeQueryCommand
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
private Answer executeQueryCommand(final NetworkElementCommand cmd) {
if (cmd instanceof CheckRouterCommand) {
return execute((CheckRouterCommand) cmd);
} else if (cmd instanceof GetDomRVersionCmd) {
return execute((GetDomRVersionCmd) cmd);
} else if (cmd instanceof CheckS2SVpnConnectionsCommand) {
return execute((CheckS2SVpnConnectionsCommand) cmd);
} else {
s_logger.error("Unknown query command in VirtualRoutingResource!");
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例10: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
final NiciraNvpRequestWrapper wrapper = NiciraNvpRequestWrapper.getInstance();
try {
return wrapper.execute(cmd, this);
} catch (final Exception e) {
s_logger.debug("Received unsupported command " + cmd.toString());
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例11: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
try {
return wrapper.execute(cmd, this);
} catch (final Exception e) {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例12: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
logger.debug("Processing cmd " + cmd.toString());
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
try {
return wrapper.execute(cmd, this);
} catch (final Exception e) {
logger.debug("Exception was " + e.getMessage());
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
示例13: executeRequest
import com.cloud.agent.api.Answer; //导入方法依赖的package包/类
@Override
public Answer executeRequest(final Command cmd) {
if (cmd instanceof DownloadProgressCommand) {
return _dlMgr.handleDownloadCommand(this, (DownloadProgressCommand) cmd);
} else if (cmd instanceof DownloadCommand) {
return execute((DownloadCommand) cmd);
} else if (cmd instanceof UploadCommand) {
return _upldMgr.handleUploadCommand(this, (UploadCommand) cmd);
} else if (cmd instanceof CreateEntityDownloadURLCommand) {
return _upldMgr.handleCreateEntityURLCommand((CreateEntityDownloadURLCommand) cmd);
} else if (cmd instanceof DeleteEntityDownloadURLCommand) {
return _upldMgr.handleDeleteEntityDownloadURLCommand((DeleteEntityDownloadURLCommand) cmd);
} else if (cmd instanceof GetStorageStatsCommand) {
return execute((GetStorageStatsCommand) cmd);
} else if (cmd instanceof CheckHealthCommand) {
return new CheckHealthAnswer((CheckHealthCommand) cmd, true);
} else if (cmd instanceof ReadyCommand) {
return new ReadyAnswer((ReadyCommand) cmd);
} else if (cmd instanceof SecStorageFirewallCfgCommand) {
return execute((SecStorageFirewallCfgCommand) cmd);
} else if (cmd instanceof SecStorageVMSetupCommand) {
return execute((SecStorageVMSetupCommand) cmd);
} else if (cmd instanceof SecStorageSetupCommand) {
return execute((SecStorageSetupCommand) cmd);
} else if (cmd instanceof ComputeChecksumCommand) {
return execute((ComputeChecksumCommand) cmd);
} else if (cmd instanceof ListTemplateCommand) {
return execute((ListTemplateCommand) cmd);
} else if (cmd instanceof ListVolumeCommand) {
return execute((ListVolumeCommand) cmd);
} else if (cmd instanceof DeleteSnapshotsDirCommand) {
return execute((DeleteSnapshotsDirCommand) cmd);
} else if (cmd instanceof CopyCommand) {
return execute((CopyCommand) cmd);
} else if (cmd instanceof DeleteCommand) {
return execute((DeleteCommand) cmd);
} else if (cmd instanceof UploadStatusCommand) {
return execute((UploadStatusCommand) cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}