mirror of https://github.com/apache/cloudstack.git
Merge branch '3.0.x' of ssh://git.cloud.com/var/lib/git/cloudstack-oss into 3.0.x
This commit is contained in:
commit
d55021e82f
|
|
@ -1,3 +1,19 @@
|
|||
// 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.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
// 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.api;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.agent.api;
|
||||
package com.cloud.agent.api.routing;
|
||||
|
||||
import com.cloud.agent.api.routing.SetSourceNatCommand;
|
||||
import com.cloud.agent.api.Answer;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
|
|
@ -1,3 +1,19 @@
|
|||
// 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.api.routing;
|
||||
|
||||
public class Site2SiteVpnCfgCommand extends NetworkElementCommand {
|
||||
|
|
|
|||
|
|
@ -287,9 +287,10 @@ public class LoadBalancerTO implements Serializable {
|
|||
private final String cloudStackApiUrl;
|
||||
private final String autoScaleUserApiKey;
|
||||
private final String autoScaleUserSecretKey;
|
||||
private final String networkId;
|
||||
|
||||
public AutoScaleVmProfileTO(String zoneId, String domainId, String cloudStackApiUrl, String autoScaleUserApiKey, String autoScaleUserSecretKey, String serviceOfferingId, String templateId,
|
||||
String otherDeployParams, String snmpCommunity, Integer snmpPort, Integer destroyVmGraceperiod) {
|
||||
public AutoScaleVmProfileTO(String zoneId, String domainId, String cloudStackApiUrl, String autoScaleUserApiKey, String autoScaleUserSecretKey, String serviceOfferingId,
|
||||
String templateId, String networkId, String otherDeployParams, String snmpCommunity, Integer snmpPort, Integer destroyVmGraceperiod) {
|
||||
this.zoneId = zoneId;
|
||||
this.domainId = domainId;
|
||||
this.serviceOfferingId = serviceOfferingId;
|
||||
|
|
@ -301,6 +302,7 @@ public class LoadBalancerTO implements Serializable {
|
|||
this.cloudStackApiUrl = cloudStackApiUrl;
|
||||
this.autoScaleUserApiKey = autoScaleUserApiKey;
|
||||
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public String getZoneId() {
|
||||
|
|
@ -346,6 +348,10 @@ public class LoadBalancerTO implements Serializable {
|
|||
public String getAutoScaleUserSecretKey() {
|
||||
return autoScaleUserSecretKey;
|
||||
}
|
||||
|
||||
public String getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
}
|
||||
|
||||
public static class AutoScaleVmGroupTO implements Serializable {
|
||||
|
|
@ -427,8 +433,9 @@ public class LoadBalancerTO implements Serializable {
|
|||
|
||||
AutoScaleVmProfileTO autoScaleVmProfileTO = new AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(),
|
||||
lbAutoScaleVmProfile.getCsUrl(), lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(),
|
||||
lbAutoScaleVmProfile.getServiceOfferingId(), lbAutoScaleVmProfile.getTemplateId(), autoScaleVmProfile.getOtherDeployParams(),
|
||||
autoScaleVmProfile.getSnmpCommunity(), autoScaleVmProfile.getSnmpPort(), autoScaleVmProfile.getDestroyVmGraceperiod());
|
||||
lbAutoScaleVmProfile.getServiceOfferingId(), lbAutoScaleVmProfile.getTemplateId(), lbAutoScaleVmProfile.getNetworkId(),
|
||||
autoScaleVmProfile.getOtherDeployParams(), autoScaleVmProfile.getSnmpCommunity(), autoScaleVmProfile.getSnmpPort(),
|
||||
autoScaleVmProfile.getDestroyVmGraceperiod());
|
||||
|
||||
AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup();
|
||||
autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(),
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import com.cloud.user.Account;
|
|||
public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteVpnCustomerGatewayCmd.class.getName());
|
||||
|
||||
private static final String s_name = "deletecustomergatewayresponse";
|
||||
private static final String s_name = "deletevpncustomergatewayresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
|
|||
private String ip;
|
||||
|
||||
@SerializedName(ApiConstants.VPC_ID) @Param(description="the vpc id of this gateway")
|
||||
private Long vpcId;
|
||||
private IdentityProxy vpcId = new IdentityProxy("vpc");
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner")
|
||||
private String accountName;
|
||||
|
|
@ -57,7 +57,7 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
|
|||
}
|
||||
|
||||
public void setVpcId(Long vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
this.vpcId.setValue(vpcId);
|
||||
}
|
||||
|
||||
public void setRemoved(Date removed) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
// 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.network;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
// 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.network;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
// 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.network;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
// 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.network.element;
|
||||
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
|
|
|||
|
|
@ -307,8 +307,9 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
|||
private final String domainId;
|
||||
private final String serviceOfferingId;
|
||||
private final String templateId;
|
||||
private final String networkId;
|
||||
|
||||
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey, String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId, String templateId) {
|
||||
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey, String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId, String templateId, String networkId) {
|
||||
this.profile = profile;
|
||||
this.autoScaleUserApiKey = autoScaleUserApiKey;
|
||||
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
|
||||
|
|
@ -317,6 +318,7 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
|||
this.domainId = domainId;
|
||||
this.serviceOfferingId = serviceOfferingId;
|
||||
this.templateId = templateId;
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public AutoScaleVmProfile getProfile() {
|
||||
|
|
@ -350,6 +352,10 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
|
|||
public String getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public String getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LbAutoScaleVmGroup {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ import com.cloud.agent.api.ReadyCommand;
|
|||
import com.cloud.agent.api.RebootAnswer;
|
||||
import com.cloud.agent.api.RebootCommand;
|
||||
import com.cloud.agent.api.RebootRouterCommand;
|
||||
import com.cloud.agent.api.SetSourceNatAnswer;
|
||||
import com.cloud.agent.api.SetupAnswer;
|
||||
import com.cloud.agent.api.SetupCommand;
|
||||
import com.cloud.agent.api.SetupGuestNetworkAnswer;
|
||||
|
|
@ -135,6 +134,7 @@ import com.cloud.agent.api.routing.SetNetworkACLCommand;
|
|||
import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer;
|
||||
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
||||
import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand;
|
||||
import com.cloud.agent.api.routing.SetSourceNatAnswer;
|
||||
import com.cloud.agent.api.routing.SetSourceNatCommand;
|
||||
import com.cloud.agent.api.routing.SetStaticNatRulesAnswer;
|
||||
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
||||
|
|
@ -548,7 +548,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
throw new Exception(" vpc network usage plugin call failed ");
|
||||
}
|
||||
|
||||
if (option.equals("get")) {
|
||||
if (option.equals("get") || option.equals("vpn")) {
|
||||
String result = resultPair.second();
|
||||
if (result == null || result.isEmpty()) {
|
||||
throw new Exception(" vpc network usage get returns empty ");
|
||||
|
|
@ -1880,7 +1880,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
|
||||
String controlIp = getRouterSshControlIp(cmd);
|
||||
result = SshHelper.sshExecute(controlIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null,
|
||||
"/root/checkrouter.sh ");
|
||||
"/opt/cloud/bin/checkrouter.sh ");
|
||||
|
||||
if (!result.first()) {
|
||||
s_logger.error("check router command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + " failed, message: " + result.second());
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ import com.cloud.agent.api.RebootCommand;
|
|||
import com.cloud.agent.api.RebootRouterCommand;
|
||||
import com.cloud.agent.api.SecurityGroupRuleAnswer;
|
||||
import com.cloud.agent.api.SecurityGroupRulesCmd;
|
||||
import com.cloud.agent.api.SetSourceNatAnswer;
|
||||
import com.cloud.agent.api.SetupAnswer;
|
||||
import com.cloud.agent.api.SetupCommand;
|
||||
import com.cloud.agent.api.SetupGuestNetworkAnswer;
|
||||
|
|
@ -156,6 +155,7 @@ import com.cloud.agent.api.routing.SetNetworkACLCommand;
|
|||
import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer;
|
||||
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
||||
import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand;
|
||||
import com.cloud.agent.api.routing.SetSourceNatAnswer;
|
||||
import com.cloud.agent.api.routing.SetSourceNatCommand;
|
||||
import com.cloud.agent.api.routing.SetStaticNatRulesAnswer;
|
||||
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ public class XenServer56Resource extends CitrixResourceBase {
|
|||
}
|
||||
|
||||
String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
|
||||
if (option.equals("get")) {
|
||||
if (option.equals("get") || option.equals("vpn")) {
|
||||
long[] stats = new long[2];
|
||||
if (result != null) {
|
||||
String[] splitResult = result.split(":");
|
||||
|
|
|
|||
|
|
@ -1717,6 +1717,7 @@ public class NetscalerResource implements ServerResource {
|
|||
ApiConstants.ZONE_ID + "=" + profileTO.getZoneId()+ "&" +
|
||||
ApiConstants.SERVICE_OFFERING_ID + "=" + profileTO.getServiceOfferingId()+ "&" +
|
||||
ApiConstants.TEMPLATE_ID + "=" + profileTO.getTemplateId()+ "&" +
|
||||
((profileTO.getNetworkId() == null)? "" : (ApiConstants.NETWORK_IDS + "=" + profileTO.getNetworkId()+ "&")) +
|
||||
((profileTO.getOtherDeployParams() == null)? "" : (profileTO.getOtherDeployParams() + "&")) +
|
||||
"lbruleid=" + loadBalancerTO.getUuid();
|
||||
scaleUpAction.set_parameters(scaleUpParameters);
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ setup_redundant_router() {
|
|||
cp /root/redundant_router/arping_gateways.sh.templ $rrouter_bin_path/arping_gateways.sh
|
||||
cp /root/redundant_router/check_bumpup.sh $rrouter_bin_path/
|
||||
cp /root/redundant_router/disable_pubip.sh $rrouter_bin_path/
|
||||
cp /root/redundant_router/checkrouter.sh.templ /root/checkrouter.sh
|
||||
cp /root/redundant_router/checkrouter.sh.templ /opt/cloud/bin/checkrouter.sh
|
||||
sed -i "s/\[ROUTER_ID\]/$NAME/g" /etc/keepalived/keepalived.conf
|
||||
sed -i "s/\[ROUTER_IP\]/$GUEST_GW\/$GUEST_CIDR_SIZE/g" /etc/keepalived/keepalived.conf
|
||||
sed -i "s/\[BOARDCAST\]/$GUEST_BRD/g" /etc/keepalived/keepalived.conf
|
||||
|
|
@ -479,7 +479,7 @@ setup_redundant_router() {
|
|||
sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/primary-backup.sh
|
||||
sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/check_heartbeat.sh
|
||||
sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/arping_gateways.sh
|
||||
sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" /root/checkrouter.sh
|
||||
sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" /opt/cloud/bin/checkrouter.sh
|
||||
chmod a+x $rrouter_bin_path/*.sh
|
||||
|
||||
sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
|
|||
if [ $? -eq 0 ]
|
||||
then
|
||||
is_redundant=1
|
||||
sudo /root/checkrouter.sh --no-lock|grep "Status: MASTER" > /dev/null 2>&1
|
||||
sudo /opt/cloud/bin/checkrouter.sh --no-lock|grep "Status: MASTER" > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
is_master=1
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ create_usage_rules () {
|
|||
then
|
||||
iptables -N NETWORK_STATS_$ethDev > /dev/null;
|
||||
iptables -I FORWARD -j NETWORK_STATS_$ethDev > /dev/null;
|
||||
iptables -A NETWORK_STATS_$ethDev -i $ethDev -d $vcidr > /dev/null;
|
||||
iptables -A NETWORK_STATS_$ethDev -o $ethDev -s $vcidr > /dev/null;
|
||||
iptables -A NETWORK_STATS_$ethDev -i $ethDev -d $vcidr > /dev/null;
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
|
@ -46,8 +46,8 @@ create_vpn_usage_rules () {
|
|||
then
|
||||
iptables -t mangle -N VPN_STATS_$ethDev > /dev/null;
|
||||
iptables -t mangle -I FORWARD -j VPN_STATS_$ethDev > /dev/null;
|
||||
iptables -t mangle -A VPN_STATS_$ethDev -i $ethDev -m mark --mark $vpninmark > /dev/null;
|
||||
iptables -t mangle -A VPN_STATS_$ethDev -o $ethDev -m mark --mark $vpnoutmark > /dev/null;
|
||||
iptables -t mangle -A VPN_STATS_$ethDev -i $ethDev -m mark --mark $vpninmark > /dev/null;
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
|
@ -69,8 +69,10 @@ get_usage () {
|
|||
then
|
||||
# flush rules and remove chain
|
||||
iptables -F NETWORK_STATS_$i > /dev/null;
|
||||
iptables -D FORWARD -j NETWORK_STATS_$i > /dev/null;
|
||||
iptables -X NETWORK_STATS_$i > /dev/null;
|
||||
iptables -t mangle -F VPN_STATS_$i > /dev/null;
|
||||
iptables -t mangle -D FORWARD -j VPN_STATS_$i > /dev/null;
|
||||
iptables -t mangle -X VPN_STATS_$i > /dev/null;
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -828,12 +828,7 @@ def default_network_rules(session, args):
|
|||
try:
|
||||
for v in vifs:
|
||||
util.pread2(['iptables', '-A', 'BRIDGE-FIREWALL', '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-j', vmchain_default])
|
||||
util.pread2(['iptables', '-I', 'BRIDGE-FIREWALL', '2', '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-j', vmchain_default])
|
||||
util.pread2(['iptables', '-A', vmchain_default, '-m', 'state', '--state', 'RELATED,ESTABLISHED', '-j', 'ACCEPT'])
|
||||
#allow dhcp
|
||||
for v in vifs:
|
||||
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-p', 'udp', '--dport', '67', '--sport', '68', '-j', 'ACCEPT'])
|
||||
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-p', 'udp', '--dport', '68', '--sport', '67', '-j', 'ACCEPT'])
|
||||
util.pread2(['iptables', '-I', 'BRIDGE-FIREWALL', '4', '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-j', vmchain_default])
|
||||
|
||||
#don't let vm spoof its ip address
|
||||
for v in vifs:
|
||||
|
|
@ -841,8 +836,6 @@ def default_network_rules(session, args):
|
|||
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '--source', '!', vm_ip, '-j', 'DROP'])
|
||||
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '--destination', '!', vm_ip, '-j', 'DROP'])
|
||||
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '--source', vm_ip, '-j', vmchain_egress])
|
||||
|
||||
for v in vifs:
|
||||
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-j', vmchain])
|
||||
except:
|
||||
util.SMlog("Failed to program default rules for vm " + vm_name)
|
||||
|
|
@ -933,22 +926,27 @@ def network_rules_for_rebooted_vm(session, vmName):
|
|||
util.pread2(['ifconfig', tap])
|
||||
vifs.append(tap)
|
||||
except:
|
||||
tap = 'none'
|
||||
pass
|
||||
vmchain = chain_name(vm_name)
|
||||
vmchain_default = chain_name_def(vm_name)
|
||||
|
||||
for v in vifs:
|
||||
util.pread2(['iptables', '-A', 'BRIDGE-FIREWALL', '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-j', vmchain_default])
|
||||
util.pread2(['iptables', '-I', 'BRIDGE-FIREWALL', '2', '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-j', vmchain_default])
|
||||
util.pread2(['iptables', '-I', 'BRIDGE-FIREWALL', '4', '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-j', vmchain_default])
|
||||
|
||||
#change antispoof rule in vmchain
|
||||
try:
|
||||
delcmd = "iptables-save | grep '\-A " + vmchain_default + "' | grep physdev-in | sed 's/-A/-D/'"
|
||||
delcmd2 = "iptables-save | grep '\-A " + vmchain_default + "' | grep physdev-out | sed 's/-A/-D/'"
|
||||
inscmd = "iptables-save | grep '\-A " + vmchain_default + "' | grep physdev-in | grep vif | sed -r 's/vif[0-9]+.0/" + vif + "/' "
|
||||
inscmd2 = "iptables-save| grep '\-A " + vmchain_default + "' | grep physdev-in | grep tap | sed -r 's/tap[0-9]+.0/" + tap + "/' "
|
||||
inscmd3 = "iptables-save | grep '\-A " + vmchain_default + "' | grep physdev-out | grep vif | sed -r 's/vif[0-9]+.0/" + vif + "/' "
|
||||
inscmd4 = "iptables-save| grep '\-A " + vmchain_default + "' | grep physdev-out | grep tap | sed -r 's/tap[0-9]+.0/" + tap + "/' "
|
||||
if tap == 'none':
|
||||
inscmd2 = ''
|
||||
inscmd4 = ''
|
||||
else:
|
||||
inscmd2 = "iptables-save| grep '\-A " + vmchain_default + "' | grep physdev-in | grep tap | sed -r 's/tap[0-9]+.0/" + tap + "/' "
|
||||
inscmd4 = "iptables-save| grep '\-A " + vmchain_default + "' | grep physdev-out | grep tap | sed -r 's/tap[0-9]+.0/" + tap + "/' "
|
||||
|
||||
ipts = []
|
||||
for cmd in [delcmd, delcmd2, inscmd, inscmd2, inscmd3, inscmd4]:
|
||||
|
|
|
|||
|
|
@ -257,8 +257,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
@Inject
|
||||
NicDao _nicDao = null;
|
||||
@Inject
|
||||
FirewallRulesDao _fwRulesDao = null;
|
||||
@Inject
|
||||
RulesManager _rulesMgr;
|
||||
@Inject
|
||||
LoadBalancingRulesManager _lbMgr;
|
||||
|
|
@ -924,7 +922,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
List<PublicIp> publicIps) throws ResourceUnavailableException {
|
||||
boolean success = true;
|
||||
|
||||
Map<PublicIp, Set<Service>> ipToServices = getIpToServices(publicIps, rulesRevoked, false);
|
||||
Map<PublicIp, Set<Service>> ipToServices = getIpToServices(publicIps, rulesRevoked, true);
|
||||
Map<Provider, ArrayList<PublicIp>> providerToIpList = getProviderToIpList(network, ipToServices);
|
||||
|
||||
for (Provider provider : providerToIpList.keySet()) {
|
||||
|
|
@ -948,27 +946,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
} else {
|
||||
throw new CloudRuntimeException("Fail to get ip deployer for element: " + element);
|
||||
}
|
||||
//We would apply all the existed firewall rules for this IP, since the rule maybe discard by revoke PF/LB rules
|
||||
List<FirewallRule> firewallRules = new ArrayList<FirewallRule>();
|
||||
boolean applyFirewallRules = false;
|
||||
if (element instanceof FirewallServiceProvider &&
|
||||
isProviderSupportServiceInNetwork(network.getId(), Service.Firewall, provider)) {
|
||||
applyFirewallRules = true;
|
||||
}
|
||||
Set<Service> services = new HashSet<Service>();
|
||||
for (PublicIp ip : ips) {
|
||||
if (!ipToServices.containsKey(ip)) {
|
||||
continue;
|
||||
}
|
||||
services.addAll(ipToServices.get(ip));
|
||||
if (applyFirewallRules) {
|
||||
firewallRules.addAll(_fwRulesDao.listByIpAndPurpose(ip.getId(), Purpose.Firewall));
|
||||
}
|
||||
}
|
||||
deployer.applyIps(network, ips, services);
|
||||
if (applyFirewallRules && !firewallRules.isEmpty()) {
|
||||
((FirewallServiceProvider) element).applyFWRules(network, firewallRules);
|
||||
}
|
||||
} catch (ResourceUnavailableException e) {
|
||||
success = false;
|
||||
if (!continueOnError) {
|
||||
|
|
|
|||
|
|
@ -315,6 +315,9 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleService, Manager {
|
|||
|
||||
// validations
|
||||
HashMap<String, String> deployParams = cmd.getDeployParamMap();
|
||||
if(deployParams.containsKey("networks") && deployParams.get("networks").length() > 0) {
|
||||
throw new InvalidParameterValueException("'networks' is not a valid parameter, network for an AutoScaled VM is chosen automatically. An autoscaled VM is deployed in the loadbalancer's network", null);
|
||||
}
|
||||
/*
|
||||
* Just for making sure the values are right in other deploy params.
|
||||
* For ex. if projectId is given as a string instead of an long value, this
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import com.cloud.api.response.ServiceResponse;
|
|||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
|
|
@ -248,7 +250,7 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
|||
return null;
|
||||
}
|
||||
|
||||
private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, String currentState) {
|
||||
private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, String currentState, long networkId) {
|
||||
List<AutoScaleVmGroupPolicyMapVO> vmGroupPolicyMapList = _autoScaleVmGroupPolicyMapDao.listByVmGroupId(vmGroup.getId());
|
||||
List<LbAutoScalePolicy> autoScalePolicies = new ArrayList<LbAutoScalePolicy>();
|
||||
for (AutoScaleVmGroupPolicyMapVO vmGroupPolicyMap : vmGroupPolicyMapList) {
|
||||
|
|
@ -272,6 +274,18 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
|||
String domainId = _domainDao.findById(autoScaleVmProfile.getDomainId()).getUuid();
|
||||
String serviceOfferingId = _offeringsDao.findById(autoScaleVmProfile.getServiceOfferingId()).getUuid();
|
||||
String templateId = _templateDao.findById(autoScaleVmProfile.getTemplateId()).getUuid();
|
||||
String lbNetworkUuid = null;
|
||||
|
||||
DataCenter zone = _configMgr.getZone(vmGroup.getZoneId());
|
||||
if (zone == null) {
|
||||
throw new InvalidParameterValueException("Unable to find zone by id", null);
|
||||
} else {
|
||||
if (zone.getNetworkType() == NetworkType.Advanced) {
|
||||
NetworkVO lbNetwork = _networkDao.findById(networkId);
|
||||
lbNetworkUuid = lbNetwork.getUuid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (apiKey == null) {
|
||||
throw new InvalidParameterValueException("apiKey for user: " + user.getUsername() + " is empty. Please generate it", null);
|
||||
|
|
@ -285,18 +299,19 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
|||
throw new InvalidParameterValueException("Global setting endpointe.url has to be set to the Management Server's API end point", null);
|
||||
}
|
||||
|
||||
LbAutoScaleVmProfile lbAutoScaleVmProfile = new LbAutoScaleVmProfile(autoScaleVmProfile, apiKey, secretKey, csUrl, zoneId, domainId, serviceOfferingId, templateId);
|
||||
|
||||
LbAutoScaleVmProfile lbAutoScaleVmProfile = new LbAutoScaleVmProfile(autoScaleVmProfile, apiKey, secretKey, csUrl, zoneId, domainId, serviceOfferingId, templateId, lbNetworkUuid);
|
||||
return new LbAutoScaleVmGroup(vmGroup, autoScalePolicies, lbAutoScaleVmProfile, currentState);
|
||||
}
|
||||
|
||||
private boolean applyAutoScaleConfig(LoadBalancerVO lb, AutoScaleVmGroupVO vmGroup, String currentState) throws ResourceUnavailableException {
|
||||
LbAutoScaleVmGroup lbAutoScaleVmGroup = getLbAutoScaleVmGroup(vmGroup, currentState);
|
||||
LbAutoScaleVmGroup lbAutoScaleVmGroup = getLbAutoScaleVmGroup(vmGroup, currentState, lb.getNetworkId());
|
||||
/* Regular config like destinations need not be packed for applying autoscale config as of today.*/
|
||||
LoadBalancingRule rule = new LoadBalancingRule(lb, null, null);
|
||||
rule.setAutoScaleVmGroup(lbAutoScaleVmGroup);
|
||||
|
||||
if (!isRollBackAllowedForProvider(lb)) {
|
||||
// this is for Netscalar type of devices. if their is failure the db entries will be rollbacked.
|
||||
// this is for Netscaler type of devices. if their is failure the db entries will be rollbacked.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -714,6 +729,7 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
|||
if (_autoScaleVmGroupDao.isAutoScaleLoadBalancer(loadBalancerId)) {
|
||||
// Nothing needs to be done for an autoscaled loadbalancer,
|
||||
// just persist and proceed.
|
||||
_lb2VmMapDao.remove(loadBalancer.getId(), instanceIds, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2234,7 +2234,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
|
||||
// Get public Ips that should be handled by router
|
||||
Network network = _networkDao.findById(guestNetworkId);
|
||||
Map<PublicIp, Set<Service>> ipToServices = _networkMgr.getIpToServices(allPublicIps, false, false);
|
||||
Map<PublicIp, Set<Service>> ipToServices = _networkMgr.getIpToServices(allPublicIps, false, true);
|
||||
Map<Provider, ArrayList<PublicIp>> providerToIpList = _networkMgr.getProviderToIpList(network, ipToServices);
|
||||
// Only cover virtual router for now, if ELB use it this need to be modified
|
||||
|
||||
|
|
|
|||
|
|
@ -1720,7 +1720,16 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
|
|||
if (cmds != null) {
|
||||
resource.disconnected();
|
||||
}
|
||||
|
||||
if(host == null){
|
||||
if (cmds != null) {
|
||||
StartupCommand firstCmd = cmds[0];
|
||||
host = findHostByGuid(firstCmd.getGuid());
|
||||
if (host == null) {
|
||||
host = findHostByGuid(firstCmd.getGuidWithoutResource());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (host != null) {
|
||||
/* Change agent status to Alert */
|
||||
_agentMgr.agentStatusTransitTo(host, Status.Event.AgentDisconnected, _nodeId);
|
||||
|
|
|
|||
|
|
@ -1133,8 +1133,11 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager{
|
|||
*/
|
||||
@Override
|
||||
public List<Service> listNetworkOfferingServices(long networkOfferingId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
List<Service> supportedSvcs = new ArrayList<Service>();
|
||||
if (networkOfferingId != 2) {
|
||||
supportedSvcs.add(Service.SourceNat);
|
||||
}
|
||||
return supportedSvcs;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
@ -1313,8 +1316,9 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager{
|
|||
*/
|
||||
@Override
|
||||
public List<Provider> getNtwkOffDistinctProviders(long ntwkOffId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
List<Provider> providers = new ArrayList<Provider>();
|
||||
providers.add(Provider.VPCVirtualRouter);
|
||||
return providers;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import com.cloud.network.vpc.VpcGateway;
|
|||
import com.cloud.network.vpc.VpcManager;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.network.vpc.VpcService;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
|
|
@ -442,4 +443,13 @@ public class MockVpcManagerImpl implements VpcManager, Manager{
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.vpc.VpcManager#validateNtwkOffForVpc(com.cloud.offering.NetworkOffering, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void validateNtwkOffForVpc(NetworkOffering guestNtwkOff, List<Service> supportedSvcs) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9743,6 +9743,14 @@ div.ui-dialog div.acl div.multi-edit div.data div.data-body div.data-item table
|
|||
max-height: 600px;
|
||||
}
|
||||
|
||||
.ui-dialog div.autoscaler div.form-container div.form-item.disabled {
|
||||
/*+opacity:50%;*/
|
||||
filter: alpha(opacity=50);
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
||||
-moz-opacity: 0.5;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.ui-dialog div.autoscaler .detail-actions {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,53 @@
|
|||
var totalScaleDownCondition = 0;
|
||||
|
||||
cloudStack.autoscaler = {
|
||||
preFilter: function(args) {
|
||||
var $autoscaler = args.$autoscaler;
|
||||
var isAdvancedZone = false;
|
||||
|
||||
// Hide fields for advanced zone
|
||||
$.ajax({
|
||||
url: createURL('listZones'),
|
||||
data: {
|
||||
id: args.context.networks[0].zoneid,
|
||||
listAll: true
|
||||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var zone = json.listzonesresponse.zone[0];
|
||||
|
||||
if (zone.networktype == 'Advanced') {
|
||||
isAdvancedZone = true;
|
||||
}
|
||||
else
|
||||
isAdvancedZone = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Run pre-filter
|
||||
if (args.data == null) { //from a new LB rule
|
||||
$autoscaler.find('select[name=serviceOfferingId]').removeAttr('disabled');
|
||||
$autoscaler.find('select[name=securityGroups]').removeAttr('disabled');
|
||||
$autoscaler.find('select[name=diskOfferingId]').removeAttr('disabled');
|
||||
} else { //from an existing LB rule
|
||||
$autoscaler.find('select[name=serviceOfferingId]').attr('disabled', true);
|
||||
$autoscaler.find('select[name=securityGroups]').attr('disabled', true);
|
||||
$autoscaler.find('select[name=diskOfferingId]').attr('disabled', true);
|
||||
|
||||
if(args.data.isAdvanced != null) {
|
||||
$autoscaler.find('input[type=checkbox]').trigger('click');
|
||||
$autoscaler.find('input[type=checkbox]').attr('checked', 'checked');
|
||||
}
|
||||
}
|
||||
|
||||
if (isAdvancedZone) {
|
||||
$autoscaler.find('.form-item[rel=securityGroups]')
|
||||
.addClass('disabled')
|
||||
.attr('title', 'Security groups are only selectable for Basic zones');
|
||||
$autoscaler.find('select[name=securityGroups]').attr('disabled', true);
|
||||
}
|
||||
},
|
||||
|
||||
// UI actions to appear in dialog
|
||||
autoscaleActions: {
|
||||
enable: {
|
||||
|
|
@ -1063,77 +1110,117 @@
|
|||
var array1 = [];
|
||||
var apiCmd, apiCmdRes;
|
||||
if(!('multiRules' in args.context)) { //from a new LB
|
||||
apiCmd = 'createAutoScaleVmProfile';
|
||||
apiCmdRes = 'autoscalevmprofileresponse';
|
||||
|
||||
array1.push("&zoneid=" + args.context.networks[0].zoneid);
|
||||
array1.push("&serviceofferingid=" + args.data.serviceOfferingId);
|
||||
var array2 = [];
|
||||
if(args.data.diskOfferingId != "")
|
||||
var data = {
|
||||
zoneid: args.context.networks[0].zoneid,
|
||||
serviceofferingid: args.data.serviceOfferingId,
|
||||
templateid: args.data.templateNames,
|
||||
destroyvmgraceperiod: args.data.destroyVMgracePeriod,
|
||||
snmpcommunity: args.data.snmpCommunity,
|
||||
snmpport: args.data.snmpPort
|
||||
};
|
||||
|
||||
if(args.data.username != null && args.data.username.length > 0) {
|
||||
$.extend(data, {
|
||||
autoscaleuserid: args.data.username
|
||||
});
|
||||
}
|
||||
|
||||
var array2 = [];
|
||||
if(args.data.diskOfferingId != null && args.data.diskOfferingId.length > 0)
|
||||
array2.push("diskofferingid=" + args.data.diskOfferingId);
|
||||
if(args.data.securityGroups != ""){
|
||||
if(array2.join("") != "")
|
||||
if(args.data.securityGroups != null && args.data.securityGroups.length > 0){
|
||||
if(array2.length > 0)
|
||||
array2.push("&securitygroupids=" + args.data.securityGroups);
|
||||
else
|
||||
array2.push("securitygroupids=" + args.data.securityGroups);
|
||||
}
|
||||
if(array2.length > 0) {
|
||||
$.extend(data, {
|
||||
otherdeployparams: array2.join("")
|
||||
});
|
||||
}
|
||||
array2 = array2.join("");
|
||||
if(array2 != "")
|
||||
array1.push("&otherdeployparams=" + encodeURIComponent(array2));
|
||||
}
|
||||
else { //from an existing LB
|
||||
apiCmd = 'updateAutoScaleVmProfile';
|
||||
apiCmdRes = 'updateautoscalevmprofileresponse';
|
||||
|
||||
array1.push("&id=" + args.context.originalAutoscaleData.context.autoscaleVmProfile.id);
|
||||
}
|
||||
|
||||
//apply to both create and update
|
||||
array1.push("&templateid=" + args.data.templateNames);
|
||||
array1.push("&destroyvmgraceperiod=" + args.data.destroyVMgracePeriod);
|
||||
array1.push("&snmpcommunity=" + args.data.snmpCommunity);
|
||||
array1.push("&snmpport=" + args.data.snmpPort);
|
||||
if(args.data.username != null && args.data.username.length > 0)
|
||||
array1.push("&autoscaleuserid=" + args.data.username);
|
||||
|
||||
$.ajax({
|
||||
url: createURL(apiCmd + array1.join("")),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jobId = json[apiCmdRes].jobid;
|
||||
var autoscaleVmProfileTimer = setInterval(function(){
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(autoscaleVmProfileTimer);
|
||||
if (result.jobstatus == 1) {
|
||||
scaleVmProfileResponse = result.jobresult.autoscalevmprofile;
|
||||
if(!('multiRules' in args.context)) { //from a new LB
|
||||
loadBalancer(args); //create a load balancer rule
|
||||
|
||||
$.ajax({
|
||||
url: createURL('createAutoScaleVmProfile'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var jobId = json.autoscalevmprofileresponse.jobid;
|
||||
var autoscaleVmProfileTimer = setInterval(function(){
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(autoscaleVmProfileTimer);
|
||||
if (result.jobstatus == 1) {
|
||||
scaleVmProfileResponse = result.jobresult.autoscalevmprofile;
|
||||
loadBalancer(args); //create a load balancer rule
|
||||
}
|
||||
else { //from an existing LB
|
||||
autoScaleVmGroup(args); //update autoScaleVmGroup
|
||||
else if (result.jobstatus == 2) {
|
||||
args.response.error(_s(result.jobresult.errortext));
|
||||
}
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
args.response.error(_s(result.jobresult.errortext));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
|
||||
}
|
||||
});
|
||||
}
|
||||
else { //from an existing LB
|
||||
var data = {
|
||||
id: args.context.originalAutoscaleData.context.autoscaleVmProfile.id,
|
||||
templateid: args.data.templateNames,
|
||||
destroyvmgraceperiod: args.data.destroyVMgracePeriod,
|
||||
snmpcommunity: args.data.snmpCommunity,
|
||||
snmpport: args.data.snmpPort
|
||||
};
|
||||
|
||||
if(args.data.username != null && args.data.username.length > 0) {
|
||||
$.extend(data, {
|
||||
autoscaleuserid: args.data.username
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: createURL('updateAutoScaleVmProfile'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var jobId = json.updateautoscalevmprofileresponse.jobid;
|
||||
var autoscaleVmProfileTimer = setInterval(function(){
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(autoscaleVmProfileTimer);
|
||||
if (result.jobstatus == 1) {
|
||||
scaleVmProfileResponse = result.jobresult.autoscalevmprofile;
|
||||
autoScaleVmGroup(args); //update autoScaleVmGroup
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
args.response.error(_s(result.jobresult.errortext));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var loadBalancer = function(args){
|
||||
|
|
|
|||
|
|
@ -315,12 +315,10 @@
|
|||
|
||||
var networkObjs, vpcObjs;
|
||||
|
||||
// Get VPCs
|
||||
//listVPCs without account/domainid/listAll parameter will return only VPCs belonging to the current login. That's what should happen in Instances page's VM Wizard.
|
||||
//i.e. If the current login is root-admin, do not show VPCs belonging to regular-user/domain-admin in Instances page's VM Wizard.
|
||||
$.ajax({
|
||||
url: createURL('listVPCs'),
|
||||
data: isDomainAdmin() ?
|
||||
{ account: args.context.users[0].account, domainid: args.context.users[0].domainid } :
|
||||
{ listAll: true },
|
||||
url: createURL('listVPCs'),
|
||||
async: false,
|
||||
success: function(json) {
|
||||
vpcObjs = json.listvpcsresponse.vpc ? json.listvpcsresponse.vpc : [];
|
||||
|
|
|
|||
|
|
@ -1662,11 +1662,11 @@
|
|||
ipaddress: { label: 'IP' }
|
||||
},
|
||||
{
|
||||
id: { label: 'label.id' },
|
||||
networkname: { label: 'label.network.name' },
|
||||
networkid: { label: 'label.network.id' },
|
||||
id: { label: 'label.id' },
|
||||
associatednetworkid: { label: 'label.associated.network.id' },
|
||||
networkname: { label: 'Associated Network' },
|
||||
state: { label: 'label.state' },
|
||||
networkid: { label: 'label.network.id' },
|
||||
issourcenat: { label: 'label.source.nat', converter: cloudStack.converters.toBooleanText },
|
||||
isstaticnat: { label: 'label.static.nat', converter: cloudStack.converters.toBooleanText },
|
||||
issystem: { label: 'label.is.system', converter: cloudStack.converters.toBooleanText }, //(basic zone only)
|
||||
|
|
@ -1701,13 +1701,13 @@
|
|||
args.context.vpc ?
|
||||
args.context.vpc[0].network : args.context.networks,
|
||||
function(network) {
|
||||
return network.id = ipObj.networkid;
|
||||
return network.id = ipObj.associatednetworkid;
|
||||
})[0];
|
||||
|
||||
args.response.success({
|
||||
actionFilter: actionFilters.ipAddress,
|
||||
data: $.extend(ipObj, {
|
||||
networkname: network.name
|
||||
networkname: network ? network.name : ''
|
||||
})
|
||||
});
|
||||
},
|
||||
|
|
@ -3731,7 +3731,10 @@
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -4059,8 +4062,8 @@
|
|||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '', description: ''});
|
||||
items.push({id: 'modp1024', description: 'modp1024'});
|
||||
items.push({id: 'modp1536', description: 'modp1536'});
|
||||
items.push({id: 'modp1024', description: 'Group 2(modp1024)'});
|
||||
items.push({id: 'modp1536', description: 'Group 5(modp1536)'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
|
|
@ -4091,8 +4094,8 @@
|
|||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '', description: ''});
|
||||
items.push({id: 'modp1024', description: 'modp1024'});
|
||||
items.push({id: 'modp1536', description: 'modp1536'});
|
||||
items.push({id: 'modp1024', description: 'Group 2(modp1024)'});
|
||||
items.push({id: 'modp1536', description: 'Group 5(modp1536)'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
|
|
@ -4241,7 +4244,7 @@
|
|||
id: args.context.vpnCustomerGateway[0].id
|
||||
},
|
||||
success: function(json) {
|
||||
var jid = json.deletecustomergatewayresponse.jobid;
|
||||
var jid = json.deletevpncustomergatewayresponse.jobid;
|
||||
args.response.success(
|
||||
{_custom:
|
||||
{
|
||||
|
|
@ -4315,8 +4318,8 @@
|
|||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '', description: ''});
|
||||
items.push({id: 'modp1024', description: 'modp1024'});
|
||||
items.push({id: 'modp1536', description: 'modp1536'});
|
||||
items.push({id: 'modp1024', description: 'Group 2(modp1024)'});
|
||||
items.push({id: 'modp1536', description: 'Group 5(modp1536)'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
|
|
@ -4350,8 +4353,8 @@
|
|||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '', description: ''});
|
||||
items.push({id: 'modp1024', description: 'modp1024'});
|
||||
items.push({id: 'modp1536', description: 'modp1536'});
|
||||
items.push({id: 'modp1024', description: 'Group 2(modp1024)'});
|
||||
items.push({id: 'modp1536', description: 'Group 5(modp1536)'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -366,20 +366,12 @@
|
|||
$loading.remove();
|
||||
renderDialogContent(args);
|
||||
|
||||
if (args.data == null) { //from a new LB rule
|
||||
$autoscalerDialog.find('select[name=serviceOfferingId]').removeAttr('disabled');
|
||||
$autoscalerDialog.find('select[name=securityGroups]').removeAttr('disabled');
|
||||
$autoscalerDialog.find('select[name=diskOfferingId]').removeAttr('disabled');
|
||||
}
|
||||
else { //from an existing LB rule
|
||||
$autoscalerDialog.find('select[name=serviceOfferingId]').attr('disabled', true);
|
||||
$autoscalerDialog.find('select[name=securityGroups]').attr('disabled', true);
|
||||
$autoscalerDialog.find('select[name=diskOfferingId]').attr('disabled', true);
|
||||
|
||||
if(args.data.isAdvanced != null) {
|
||||
$autoscalerDialog.find('input[type=checkbox]').trigger('click');
|
||||
$autoscalerDialog.find('input[type=checkbox]').attr('checked', 'checked');
|
||||
}
|
||||
if (cloudStack.autoscaler.preFilter) {
|
||||
cloudStack.autoscaler.preFilter({
|
||||
data: args.data,
|
||||
$autoscaler: $autoscalerDialog,
|
||||
context: context
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@
|
|||
var $checkbox = $step.find('.new-network input[type=checkbox]');
|
||||
var $newNetwork = $checkbox.closest('.new-network');
|
||||
|
||||
if ($step.find('.select.my-networks .select-container .select').size()) {
|
||||
if ($step.find('.select.my-networks .select-container .select:visible').size()) {
|
||||
$checkbox.attr('checked', false);
|
||||
$newNetwork.addClass('unselected');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -840,7 +840,7 @@
|
|||
}).appendTo($td);
|
||||
} else if (field.addButton) {
|
||||
$addVM = $('<div>').addClass('button add-vm').html(
|
||||
_l(args.add.label)
|
||||
_l('label.add')
|
||||
).appendTo($td);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,16 @@
|
|||
(function($, cloudStack) {
|
||||
var aclMultiEdit = {
|
||||
noSelect: true,
|
||||
fieldPreFilter: function(args) {
|
||||
var context = args.context;
|
||||
var hiddenFields = [];
|
||||
|
||||
if (context.networks) { // from tier detail view
|
||||
hiddenFields.push('networkid');
|
||||
}
|
||||
|
||||
return hiddenFields; // Returns fields to be hidden
|
||||
},
|
||||
fields: {
|
||||
'cidrlist': { edit: true, label: 'label.cidr' },
|
||||
'protocol': {
|
||||
|
|
@ -124,7 +134,8 @@
|
|||
$.ajax({
|
||||
url: createURL('createNetworkACL'),
|
||||
data: $.extend(args.data, {
|
||||
networkid: args.data.networkid
|
||||
networkid: args.context.networks ?
|
||||
args.context.networks[0].id : args.data.networkid
|
||||
}),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue