Search in sources :

Example 1 with PortConfig

use of com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig in project cloudstack by apache.

the class NfsSecondaryStorageResource method execute.

private Answer execute(SecStorageFirewallCfgCommand cmd) {
    if (!_inSystemVM) {
        return new Answer(cmd, true, null);
    }
    List<String> ipList = new ArrayList<String>();
    for (PortConfig pCfg : cmd.getPortConfigs()) {
        if (pCfg.isAdd()) {
            ipList.add(pCfg.getSourceIp());
        }
    }
    boolean success = true;
    String result;
    result = configureIpFirewall(ipList, cmd.getIsAppendAIp());
    if (result != null) {
        success = false;
    }
    return new Answer(cmd, success, result);
}
Also used : ListTemplateAnswer(com.cloud.agent.api.storage.ListTemplateAnswer) UploadStatusAnswer(org.apache.cloudstack.storage.command.UploadStatusAnswer) GetStorageStatsAnswer(com.cloud.agent.api.GetStorageStatsAnswer) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer) ListVolumeAnswer(com.cloud.agent.api.storage.ListVolumeAnswer) DownloadAnswer(com.cloud.agent.api.storage.DownloadAnswer) Answer(com.cloud.agent.api.Answer) CheckHealthAnswer(com.cloud.agent.api.CheckHealthAnswer) ReadyAnswer(com.cloud.agent.api.ReadyAnswer) SecStorageSetupAnswer(com.cloud.agent.api.SecStorageSetupAnswer) ArrayList(java.util.ArrayList) PortConfig(com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig)

Example 2 with PortConfig

use of com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig in project cloudstack by apache.

the class GsonHelper method setDefaultGsonConfig.

static Gson setDefaultGsonConfig(GsonBuilder builder) {
    builder.setVersion(1.5);
    InterfaceTypeAdaptor<DataStoreTO> dsAdaptor = new InterfaceTypeAdaptor<DataStoreTO>();
    builder.registerTypeAdapter(DataStoreTO.class, dsAdaptor);
    InterfaceTypeAdaptor<DataTO> dtAdaptor = new InterfaceTypeAdaptor<DataTO>();
    builder.registerTypeAdapter(DataTO.class, dtAdaptor);
    ArrayTypeAdaptor<Command> cmdAdaptor = new ArrayTypeAdaptor<Command>();
    builder.registerTypeAdapter(Command[].class, cmdAdaptor);
    ArrayTypeAdaptor<Answer> ansAdaptor = new ArrayTypeAdaptor<Answer>();
    builder.registerTypeAdapter(Answer[].class, ansAdaptor);
    builder.registerTypeAdapter(new TypeToken<List<PortConfig>>() {
    }.getType(), new PortConfigListTypeAdaptor());
    builder.registerTypeAdapter(new TypeToken<Pair<Long, Long>>() {
    }.getType(), new NwGroupsCommandTypeAdaptor());
    Gson gson = builder.create();
    dsAdaptor.initGson(gson);
    dtAdaptor.initGson(gson);
    cmdAdaptor.initGson(gson);
    ansAdaptor.initGson(gson);
    return gson;
}
Also used : DataStoreTO(com.cloud.agent.api.to.DataStoreTO) InterfaceTypeAdaptor(com.cloud.agent.transport.InterfaceTypeAdaptor) Gson(com.google.gson.Gson) NwGroupsCommandTypeAdaptor(com.cloud.agent.transport.Request.NwGroupsCommandTypeAdaptor) Answer(com.cloud.agent.api.Answer) DataTO(com.cloud.agent.api.to.DataTO) PortConfigListTypeAdaptor(com.cloud.agent.transport.Request.PortConfigListTypeAdaptor) Command(com.cloud.agent.api.Command) TypeToken(com.google.gson.reflect.TypeToken) ArrayTypeAdaptor(com.cloud.agent.transport.ArrayTypeAdaptor) PortConfig(com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig)

Aggregations

Answer (com.cloud.agent.api.Answer)2 PortConfig (com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig)2 CheckHealthAnswer (com.cloud.agent.api.CheckHealthAnswer)1 Command (com.cloud.agent.api.Command)1 GetStorageStatsAnswer (com.cloud.agent.api.GetStorageStatsAnswer)1 ReadyAnswer (com.cloud.agent.api.ReadyAnswer)1 SecStorageSetupAnswer (com.cloud.agent.api.SecStorageSetupAnswer)1 DownloadAnswer (com.cloud.agent.api.storage.DownloadAnswer)1 ListTemplateAnswer (com.cloud.agent.api.storage.ListTemplateAnswer)1 ListVolumeAnswer (com.cloud.agent.api.storage.ListVolumeAnswer)1 DataStoreTO (com.cloud.agent.api.to.DataStoreTO)1 DataTO (com.cloud.agent.api.to.DataTO)1 ArrayTypeAdaptor (com.cloud.agent.transport.ArrayTypeAdaptor)1 InterfaceTypeAdaptor (com.cloud.agent.transport.InterfaceTypeAdaptor)1 NwGroupsCommandTypeAdaptor (com.cloud.agent.transport.Request.NwGroupsCommandTypeAdaptor)1 PortConfigListTypeAdaptor (com.cloud.agent.transport.Request.PortConfigListTypeAdaptor)1 Gson (com.google.gson.Gson)1 TypeToken (com.google.gson.reflect.TypeToken)1 ArrayList (java.util.ArrayList)1 CopyCmdAnswer (org.apache.cloudstack.storage.command.CopyCmdAnswer)1