private synchronized Answer execute(SetStaticNatRulesCommand cmd, int numRetries) { return Answer.createUnsupportedCommandAnswer(cmd); }
@Override public Answer executeRequest(Command cmd) { if (cmd instanceof ReadyCommand) { return execute((ReadyCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } }
@Override public Answer executeRequest(Command cmd) { if (cmd instanceof ReadyCommand) { return execute((ReadyCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } }
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); } } }
@Override public Answer executeRequest(final Command cmd) { final NuageVspRequestWrapper wrapper = NuageVspRequestWrapper.getInstance(); try { return wrapper.execute(cmd, this); } catch (final Exception e) { if (s_logger.isDebugEnabled()) { s_logger.debug("Received unsupported command " + cmd.toString(), e); } return Answer.createUnsupportedCommandAnswer(cmd); } }
@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); } }
@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); } }
/** * This finds a command wrapper to handle the command and executes it. * If no wrapper is found an {@see UnsupportedAnswer} is sent back. * Any other exceptions are to be caught and wrapped in an generic {@see Answer}, marked as failed. * * @param cmd the instance of a {@see Command} to execute. * @return the for the {@see Command} appropriate {@see Answer} or {@see UnsupportedAnswer} */ @Override public Answer executeRequest(final Command cmd) { final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance(); try { return wrapper.execute(cmd, this); } catch (final RequestWrapper.CommandNotSupported cmde) { return Answer.createUnsupportedCommandAnswer(cmd); } }
private Answer executeQueryCommand(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 if (cmd instanceof GetRouterAlertsCommand) { return execute((GetRouterAlertsCommand)cmd); } else if (cmd instanceof DiagnosticsCommand) { return execute((DiagnosticsCommand)cmd); } else { s_logger.error("Unknown query command in VirtualRoutingResource!"); return Answer.createUnsupportedCommandAnswer(cmd); } }
@Override public Answer executeRequest(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); } }
@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); } }
private synchronized Answer execute(final ExternalNetworkResourceUsageCommand cmd, final int numRetries) { try { if (!_isSdx) { return getPublicIpBytesSentAndReceived(cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } } catch (final ExecutionException e) { if (shouldRetry(numRetries)) { return retry(cmd, numRetries); } else { return new ExternalNetworkResourceUsageAnswer(cmd, e); } } }
@Override public Answer executeRequest(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); } }
public Answer executeRequest(Command cmd, int numRetries) { if (cmd instanceof ReadyCommand) { return executeRequest((ReadyCommand)cmd); } else if (cmd instanceof MaintainCommand) { return executeRequest((MaintainCommand)cmd); } else if (cmd instanceof CreateNetworkCommand) { return executeRequest((CreateNetworkCommand)cmd, numRetries); } else if (cmd instanceof AssociateMacToNetworkCommand) { return executeRequest((AssociateMacToNetworkCommand)cmd, numRetries); } else if (cmd instanceof DisassociateMacFromNetworkCommand) { return executeRequest((DisassociateMacFromNetworkCommand)cmd, numRetries); } else if (cmd instanceof DeleteNetworkCommand) { return executeRequest((DeleteNetworkCommand)cmd, numRetries); } s_logger.debug("Received unsupported command " + cmd.toString()); return Answer.createUnsupportedCommandAnswer(cmd); }
protected Answer execute(final DeleteCommand cmd) { DataTO obj = cmd.getData(); 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); }
@Override public Answer executeRequest(Command cmd) { if (cmd instanceof ReadyCommand) { return new ReadyAnswer((ReadyCommand)cmd); } else if (cmd instanceof MaintainCommand) { return new MaintainAnswer((MaintainCommand)cmd); } else if (cmd instanceof SignInCommand) { return execute((SignInCommand)cmd); } else if (cmd instanceof RemoveDomainCommand) { return execute((RemoveDomainCommand)cmd); } else if (cmd instanceof RemoveRecordCommand) { return execute((RemoveRecordCommand)cmd); } else if (cmd instanceof CreateOrUpdateDomainCommand) { return execute((CreateOrUpdateDomainCommand)cmd); } else if (cmd instanceof CreateOrUpdateRecordAndReverseCommand) { return execute((CreateOrUpdateRecordAndReverseCommand)cmd); } return Answer.createUnsupportedCommandAnswer(cmd); }
@Override public Answer executeRequest(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); } }
@Override public Answer executeRequest(Command cmd) { if (cmd instanceof ConfigureNetworkCommand) { return executeRequest((ConfigureNetworkCommand)cmd); } else if (cmd instanceof DestroyNetworkCommand) { return executeRequest((DestroyNetworkCommand)cmd); } else if (cmd instanceof ConfigurePortCommand) { return executeRequest((ConfigurePortCommand)cmd); } else if (cmd instanceof DestroyPortCommand) { return executeRequest((DestroyPortCommand)cmd); } else if (cmd instanceof AddHypervisorCommand) { return executeRequest((AddHypervisorCommand)cmd); } else if (cmd instanceof ReadyCommand) { return executeRequest((ReadyCommand)cmd); } else if (cmd instanceof MaintainCommand) { return executeRequest((MaintainCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } }
@Override public Answer executeRequest(Command cmd) { if (cmd instanceof ReadyCommand) { return execute((ReadyCommand)cmd); } else if (cmd instanceof MaintainCommand) { return execute((MaintainCommand)cmd); } else if (cmd instanceof IpAssocCommand) { return execute((IpAssocCommand)cmd); } else if (cmd instanceof SetStaticNatRulesCommand) { return execute((SetStaticNatRulesCommand)cmd); } else if (cmd instanceof SetPortForwardingRulesCommand) { return execute((SetPortForwardingRulesCommand)cmd); } else if (cmd instanceof SetFirewallRulesCommand) { return execute((SetFirewallRulesCommand)cmd); } else if (cmd instanceof ExternalNetworkResourceUsageCommand) { return execute((ExternalNetworkResourceUsageCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } }
protected Answer execute(CopyCommand cmd) { DataTO srcData = cmd.getSrcTO(); DataTO destData = cmd.getDestTO(); DataStoreTO srcDataStore = srcData.getDataStore(); DataStoreTO destDataStore = destData.getDataStore(); if (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) { return createTemplateFromSnapshot(cmd); } if (destDataStore instanceof NfsTO && destDataStore.getRole() == DataStoreRole.ImageCache) { NfsTO destImageStore = (NfsTO)destDataStore; if (srcDataStore instanceof S3TO) { S3TO s3 = (S3TO)srcDataStore; return copyFromS3ToNfs(cmd, srcData, s3, destData, destImageStore); } else if (srcDataStore instanceof SwiftTO) { return copyFromSwiftToNfs(cmd, srcData, (SwiftTO)srcDataStore, destData, destImageStore); } } if (srcDataStore.getRole() == DataStoreRole.ImageCache && destDataStore.getRole() == DataStoreRole.Image) { return copyFromNfsToImage(cmd); } return Answer.createUnsupportedCommandAnswer(cmd); }