mirror of https://github.com/apache/cloudstack.git
Creating new model for the MonitorService
This commit is contained in:
parent
6a016d5b54
commit
daf6c33507
|
|
@ -63,6 +63,7 @@ import com.cloud.agent.resource.virtualnetwork.model.IpAddress;
|
|||
import com.cloud.agent.resource.virtualnetwork.model.IpAddressAlias;
|
||||
import com.cloud.agent.resource.virtualnetwork.model.IpAliases;
|
||||
import com.cloud.agent.resource.virtualnetwork.model.IpAssociation;
|
||||
import com.cloud.agent.resource.virtualnetwork.model.MonitorService;
|
||||
import com.cloud.agent.resource.virtualnetwork.model.NetworkACL;
|
||||
import com.cloud.agent.resource.virtualnetwork.model.ProtocolAclRule;
|
||||
import com.cloud.agent.resource.virtualnetwork.model.RemoteAccessVpn;
|
||||
|
|
@ -124,13 +125,13 @@ public class ConfigHelper {
|
|||
} else if (cmd instanceof BumpUpPriorityCommand) {
|
||||
cfg = generateConfig((BumpUpPriorityCommand)cmd);
|
||||
} else if (cmd instanceof RemoteAccessVpnCfgCommand) {
|
||||
cfg = generateConfig((RemoteAccessVpnCfgCommand)cmd); //WIP (SB)
|
||||
cfg = generateConfig((RemoteAccessVpnCfgCommand)cmd); // Migrated (SB, TBT)
|
||||
} else if (cmd instanceof VpnUsersCfgCommand) {
|
||||
cfg = generateConfig((VpnUsersCfgCommand)cmd); // Migrated (SB)
|
||||
cfg = generateConfig((VpnUsersCfgCommand)cmd); // Migrated (SB, TBT)
|
||||
} else if (cmd instanceof Site2SiteVpnCfgCommand) {
|
||||
cfg = generateConfig((Site2SiteVpnCfgCommand)cmd); // Migrated (SB)
|
||||
} else if (cmd instanceof SetMonitorServiceCommand) {
|
||||
cfg = generateConfig((SetMonitorServiceCommand)cmd);
|
||||
cfg = generateConfig((SetMonitorServiceCommand)cmd); // Migrated (SB, TBT)
|
||||
} else if (cmd instanceof SetupGuestNetworkCommand) {
|
||||
cfg = generateConfig((SetupGuestNetworkCommand)cmd); // Migrated
|
||||
} else if (cmd instanceof SetNetworkACLCommand) {
|
||||
|
|
@ -157,15 +158,6 @@ public class ConfigHelper {
|
|||
return generateConfigItems(vpnUserList);
|
||||
}
|
||||
|
||||
/*
|
||||
private static List<ConfigItem> generateConfig(DhcpEntryCommand cmd) {
|
||||
VmDhcpConfig vmDhcpConfig = new VmDhcpConfig(cmd.getVmName(), cmd.getVmMac(), cmd.getVmIpAddress(), cmd.getVmIp6Address(), cmd.getDuid(), cmd.getDefaultDns(),
|
||||
cmd.getDefaultRouter(), cmd.getStaticRoutes(), cmd.isDefault());
|
||||
|
||||
return generateConfigItems(vmDhcpConfig);
|
||||
}
|
||||
*/
|
||||
|
||||
private static List<ConfigItem> generateConfig(RemoteAccessVpnCfgCommand cmd) {
|
||||
RemoteAccessVpn remoteAccessVpn = new RemoteAccessVpn(cmd.isCreate(), cmd.getIpRange(), cmd.getPresharedKey(), cmd.getVpnServerIp(), cmd.getLocalIp(), cmd.getLocalCidr(),
|
||||
cmd.getPublicInterface());
|
||||
|
|
@ -384,18 +376,8 @@ public class ConfigHelper {
|
|||
|
||||
|
||||
private static List<ConfigItem> generateConfig(SetMonitorServiceCommand cmd) {
|
||||
LinkedList<ConfigItem> cfg = new LinkedList<>();
|
||||
|
||||
String config = cmd.getConfiguration();
|
||||
String disableMonitoring = cmd.getAccessDetail(NetworkElementCommand.ROUTER_MONITORING_ENABLE);
|
||||
|
||||
String args = " -c " + config;
|
||||
if (disableMonitoring != null) {
|
||||
args = args + " -d";
|
||||
}
|
||||
|
||||
cfg.add(new ScriptConfigItem(VRScripts.MONITOR_SERVICE, args));
|
||||
return cfg;
|
||||
MonitorService monitorService = new MonitorService(cmd.getConfiguration(), cmd.getAccessDetail(NetworkElementCommand.ROUTER_MONITORING_ENABLE));
|
||||
return generateConfigItems(monitorService);
|
||||
}
|
||||
|
||||
private static List<ConfigItem> generateConfig(SetupGuestNetworkCommand cmd) {
|
||||
|
|
@ -551,6 +533,9 @@ public class ConfigHelper {
|
|||
case ConfigBase.REMOTEACCESSVPN:
|
||||
destinationFile = VRScripts.REMOTE_ACCESS_VPN_CONFIG;
|
||||
break;
|
||||
case ConfigBase.MONITORSERVICE:
|
||||
destinationFile = VRScripts.MONITOR_SERVICE_CONFIG;
|
||||
break;
|
||||
default:
|
||||
throw new CloudRuntimeException("Unable to process the configuration for " + configuration.getType());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class VRScripts {
|
|||
protected static final String SITE_2_SITE_VPN_CONFIG = "site_2_site_vpn.json";
|
||||
protected static final String STATIC_ROUTES_CONFIG = "static_routes.json";
|
||||
protected static final String REMOTE_ACCESS_VPN_CONFIG = "remote_access_vpn.json";
|
||||
protected static final String MONITOR_SERVICE_CONFIG = "monitor_service.json";
|
||||
|
||||
protected final static String CONFIG_CACHE_LOCATION = "/var/cache/cloud/";
|
||||
protected final static int DEFAULT_EXECUTEINVR_TIMEOUT = 120; //Seconds
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public abstract class ConfigBase {
|
|||
public static final String SITE2SITEVPN = "site2sitevpn";
|
||||
public static final String STATIC_ROUTES = "staticroutes";
|
||||
public static final String REMOTEACCESSVPN = "remoteaccessvpn";
|
||||
public static final String MONITORSERVICE = "monitorservice";
|
||||
|
||||
private String type = UNKNOWN;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
//
|
||||
|
||||
package com.cloud.agent.resource.virtualnetwork.model;
|
||||
|
||||
public class MonitorService extends ConfigBase {
|
||||
public String config, disableMonitoring;
|
||||
|
||||
public MonitorService() {
|
||||
super(ConfigBase.MONITORSERVICE);
|
||||
}
|
||||
|
||||
public MonitorService(String config, String disableMonitoring) {
|
||||
super(ConfigBase.MONITORSERVICE);
|
||||
this.config = config;
|
||||
this.disableMonitoring = disableMonitoring;
|
||||
}
|
||||
|
||||
public String getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfig(String config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public String getDisableMonitoring() {
|
||||
return disableMonitoring;
|
||||
}
|
||||
|
||||
public void setDisableMonitoring(String disableMonitoring) {
|
||||
this.disableMonitoring = disableMonitoring;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue