diff --git a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java b/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java index b9e9a6638ab..ef3be811870 100644 --- a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java +++ b/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java @@ -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; diff --git a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java b/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java index 9401b47be65..a736eab35ea 100644 --- a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java +++ b/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java @@ -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; diff --git a/api/src/com/cloud/agent/api/SetSourceNatAnswer.java b/api/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java similarity index 92% rename from api/src/com/cloud/agent/api/SetSourceNatAnswer.java rename to api/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java index b8837e20aa0..bea44b73f7c 100644 --- a/api/src/com/cloud/agent/api/SetSourceNatAnswer.java +++ b/api/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java @@ -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 diff --git a/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java b/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java index f9ec641ff15..97db2f96cc3 100644 --- a/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java +++ b/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java @@ -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 { diff --git a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java index 2f3fcdce237..64c85c035a3 100644 --- a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java +++ b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java @@ -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(), diff --git a/api/src/com/cloud/api/commands/DeleteVpnCustomerGatewayCmd.java b/api/src/com/cloud/api/commands/DeleteVpnCustomerGatewayCmd.java index 2e133f0fba2..fb7fe4655fc 100644 --- a/api/src/com/cloud/api/commands/DeleteVpnCustomerGatewayCmd.java +++ b/api/src/com/cloud/api/commands/DeleteVpnCustomerGatewayCmd.java @@ -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 ///////////////////// diff --git a/api/src/com/cloud/api/response/Site2SiteVpnGatewayResponse.java b/api/src/com/cloud/api/response/Site2SiteVpnGatewayResponse.java index 20a596a4af6..601bf2ce0e2 100644 --- a/api/src/com/cloud/api/response/Site2SiteVpnGatewayResponse.java +++ b/api/src/com/cloud/api/response/Site2SiteVpnGatewayResponse.java @@ -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) { diff --git a/api/src/com/cloud/network/Site2SiteCustomerGateway.java b/api/src/com/cloud/network/Site2SiteCustomerGateway.java index 623721b0f82..8950c771705 100644 --- a/api/src/com/cloud/network/Site2SiteCustomerGateway.java +++ b/api/src/com/cloud/network/Site2SiteCustomerGateway.java @@ -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; diff --git a/api/src/com/cloud/network/Site2SiteVpnConnection.java b/api/src/com/cloud/network/Site2SiteVpnConnection.java index d613203e90d..6cf52a94943 100644 --- a/api/src/com/cloud/network/Site2SiteVpnConnection.java +++ b/api/src/com/cloud/network/Site2SiteVpnConnection.java @@ -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; diff --git a/api/src/com/cloud/network/Site2SiteVpnGateway.java b/api/src/com/cloud/network/Site2SiteVpnGateway.java index f435f07ee6f..52ec5971c14 100644 --- a/api/src/com/cloud/network/Site2SiteVpnGateway.java +++ b/api/src/com/cloud/network/Site2SiteVpnGateway.java @@ -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; diff --git a/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java b/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java index 0dc4a5ad190..8063cbb5642 100644 --- a/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java +++ b/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java @@ -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; diff --git a/api/src/com/cloud/network/lb/LoadBalancingRule.java b/api/src/com/cloud/network/lb/LoadBalancingRule.java index a2471fe1dd5..9d9caec097b 100644 --- a/api/src/com/cloud/network/lb/LoadBalancingRule.java +++ b/api/src/com/cloud/network/lb/LoadBalancingRule.java @@ -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 { diff --git a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index d7b0e9bf236..4d612b18e3e 100755 --- a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -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()); diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index db50d1ee1ae..e9c132e9957 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -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; diff --git a/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java b/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java index bf486376f2a..fb1a1362942 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java +++ b/core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java @@ -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(":"); diff --git a/core/src/com/cloud/network/resource/NetscalerResource.java b/core/src/com/cloud/network/resource/NetscalerResource.java index a42b7074537..ee8555475c5 100644 --- a/core/src/com/cloud/network/resource/NetscalerResource.java +++ b/core/src/com/cloud/network/resource/NetscalerResource.java @@ -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); diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index 0adcef37c89..a5ef37c5eac 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -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 diff --git a/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh b/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh index 61c729d105d..5ec95526dcd 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh @@ -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 diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh index 4d423fc2334..71deec0ea07 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh @@ -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 diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops index d089e46b9f1..d9ea3945a91 100755 --- a/scripts/vm/hypervisor/xenserver/vmops +++ b/scripts/vm/hypervisor/xenserver/vmops @@ -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]: diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 6ccfe9f226c..a1784bc6e82 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -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 publicIps) throws ResourceUnavailableException { boolean success = true; - Map> ipToServices = getIpToServices(publicIps, rulesRevoked, false); + Map> ipToServices = getIpToServices(publicIps, rulesRevoked, true); Map> 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 firewallRules = new ArrayList(); - boolean applyFirewallRules = false; - if (element instanceof FirewallServiceProvider && - isProviderSupportServiceInNetwork(network.getId(), Service.Firewall, provider)) { - applyFirewallRules = true; - } Set services = new HashSet(); 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) { diff --git a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java index 0eefca09a6d..460e8a4e159 100644 --- a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java @@ -315,6 +315,9 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { // validations HashMap 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 diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index d1e03203cfe..e2fce3d2d81 100755 --- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -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 implements LoadBalancingRulesMa return null; } - private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, String currentState) { + private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, String currentState, long networkId) { List vmGroupPolicyMapList = _autoScaleVmGroupPolicyMapDao.listByVmGroupId(vmGroup.getId()); List autoScalePolicies = new ArrayList(); for (AutoScaleVmGroupPolicyMapVO vmGroupPolicyMap : vmGroupPolicyMapList) { @@ -272,6 +274,18 @@ public class LoadBalancingRulesManagerImpl 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 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 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; } diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index bf57bc794ed..f332192275b 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -2234,7 +2234,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian // Get public Ips that should be handled by router Network network = _networkDao.findById(guestNetworkId); - Map> ipToServices = _networkMgr.getIpToServices(allPublicIps, false, false); + Map> ipToServices = _networkMgr.getIpToServices(allPublicIps, false, true); Map> providerToIpList = _networkMgr.getProviderToIpList(network, ipToServices); // Only cover virtual router for now, if ELB use it this need to be modified diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index cfc3a1dbbd5..255488a4b75 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -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); diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java index 7dde2ccfa1c..985b2ca58da 100644 --- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java @@ -1133,8 +1133,11 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager{ */ @Override public List listNetworkOfferingServices(long networkOfferingId) { - // TODO Auto-generated method stub - return null; + List supportedSvcs = new ArrayList(); + if (networkOfferingId != 2) { + supportedSvcs.add(Service.SourceNat); + } + return supportedSvcs; } /* (non-Javadoc) @@ -1313,8 +1316,9 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager{ */ @Override public List getNtwkOffDistinctProviders(long ntwkOffId) { - // TODO Auto-generated method stub - return null; + List providers = new ArrayList(); + providers.add(Provider.VPCVirtualRouter); + return providers; } /* (non-Javadoc) diff --git a/server/test/com/cloud/vpc/MockVpcManagerImpl.java b/server/test/com/cloud/vpc/MockVpcManagerImpl.java index 8fb2aee7c74..575ed2b1042 100644 --- a/server/test/com/cloud/vpc/MockVpcManagerImpl.java +++ b/server/test/com/cloud/vpc/MockVpcManagerImpl.java @@ -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 supportedSvcs) { + // TODO Auto-generated method stub + + } + } diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 1e92aa20907..f046d55bdb4 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -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 { } diff --git a/ui/scripts/autoscaler.js b/ui/scripts/autoscaler.js index a039fca2109..352386537c7 100644 --- a/ui/scripts/autoscaler.js +++ b/ui/scripts/autoscaler.js @@ -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){ diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index f4e43adca29..0598fb6f39d 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -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 : []; diff --git a/ui/scripts/network.js b/ui/scripts/network.js index d4d24d5e09f..829a1946f0f 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -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}); } }, diff --git a/ui/scripts/ui-custom/autoscaler.js b/ui/scripts/ui-custom/autoscaler.js index 881c0dcff56..3afc8b3414e 100644 --- a/ui/scripts/ui-custom/autoscaler.js +++ b/ui/scripts/ui-custom/autoscaler.js @@ -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 + }); } } } diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index 990747d8c0d..07fc78cf054 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -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 { diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js index d0b73ad4d32..eafec673175 100644 --- a/ui/scripts/ui/widgets/multiEdit.js +++ b/ui/scripts/ui/widgets/multiEdit.js @@ -840,7 +840,7 @@ }).appendTo($td); } else if (field.addButton) { $addVM = $('
').addClass('button add-vm').html( - _l(args.add.label) + _l('label.add') ).appendTo($td); } diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index 66a5437654f..564d2f3d2b1 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -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) {