You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2014/01/23 14:00:54 UTC
[1/3] git commit: updated refs/heads/master to c53778c
Updated Branches:
refs/heads/master f999a0183 -> c53778c33
CLOUDSTACK-2031:support for number of ips per nic limit needs to be added for the multiple ip address per nic
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4925b9f6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4925b9f6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4925b9f6
Branch: refs/heads/master
Commit: 4925b9f6a126454215531998c461bf376ac6ab67
Parents: 4b3784a
Author: Damodar Reddy <da...@citrix.com>
Authored: Thu Jan 23 17:35:37 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Thu Jan 23 18:14:12 2014 +0530
----------------------------------------------------------------------
.../api/command/user/vm/AddIpToVmNicCmd.java | 2 +-
.../schema/src/com/cloud/vm/dao/NicSecondaryIpDao.java | 2 ++
.../src/com/cloud/vm/dao/NicSecondaryIpDaoImpl.java | 13 +++++++++++++
server/src/com/cloud/configuration/Config.java | 4 ++++
server/src/com/cloud/network/NetworkServiceImpl.java | 8 ++++++++
setup/db/db/schema-430to440.sql | 2 +-
6 files changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4925b9f6/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
index c0e8d3e..439879a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
@@ -130,7 +130,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
try {
result = _networkService.allocateSecondaryGuestIP(getNicId(), getIpaddress());
} catch (InsufficientAddressCapacityException e) {
- throw new InvalidParameterValueException("Allocating guest ip for nic failed");
+ throw new InvalidParameterValueException("Allocating guest ip for nic failed : " + e.getMessage());
}
if (result != null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4925b9f6/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDao.java b/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDao.java
index 9fbfa27..39b8470 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDao.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDao.java
@@ -51,4 +51,6 @@ public interface NicSecondaryIpDao extends GenericDao<NicSecondaryIpVO, Long> {
NicSecondaryIpVO findByIp4AddressAndNetworkIdAndInstanceId(long networkId, Long vmId, String vmIp);
List<String> getSecondaryIpAddressesForNic(long nicId);
+
+ Long countByNicId(long nicId);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4925b9f6/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDaoImpl.java
index 2f3cc29..29af019 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpDaoImpl.java
@@ -35,6 +35,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
public class NicSecondaryIpDaoImpl extends GenericDaoBase<NicSecondaryIpVO, Long> implements NicSecondaryIpDao {
private final SearchBuilder<NicSecondaryIpVO> AllFieldsSearch;
private final GenericSearchBuilder<NicSecondaryIpVO, String> IpSearch;
+ protected GenericSearchBuilder<NicSecondaryIpVO, Long> CountByNicId;
protected NicSecondaryIpDaoImpl() {
super();
@@ -50,6 +51,11 @@ public class NicSecondaryIpDaoImpl extends GenericDaoBase<NicSecondaryIpVO, Long
IpSearch.and("network", IpSearch.entity().getNetworkId(), Op.EQ);
IpSearch.and("address", IpSearch.entity().getIp4Address(), Op.NNULL);
IpSearch.done();
+
+ CountByNicId = createSearchBuilder(Long.class);
+ CountByNicId.select(null, Func.COUNT, null);
+ CountByNicId.and("nic", CountByNicId.entity().getNicId(), SearchCriteria.Op.EQ);
+ CountByNicId.done();
}
@Override
@@ -135,4 +141,11 @@ public class NicSecondaryIpDaoImpl extends GenericDaoBase<NicSecondaryIpVO, Long
sc.setParameters("address", vmIp);
return findOneBy(sc);
}
+
+ @Override
+ public Long countByNicId(long nicId) {
+ SearchCriteria<Long> sc = CountByNicId.create();
+ sc.setParameters("nic", nicId);
+ return customSearch(sc, null).get(0);
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4925b9f6/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 9117bc4..6ba6774 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -402,6 +402,10 @@ public enum Config {
"10",
"The maximum number of subnets per customer gateway",
null),
+ MaxNumberOfSecondaryIPsPerNIC(
+ "Network", ManagementServer.class, Integer.class,
+ "vm.network.nic.max.secondary.ipaddresses", "256",
+ "Specify the number of secondary ip addresses per nic per vm", null),
// Console Proxy
ConsoleProxyCapacityStandby(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4925b9f6/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 056190f..399f086 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -669,6 +669,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
throw new InvalidParameterValueException("Invalid network id is given");
}
+ int maxAllowedIpsPerNic = NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()), 10);
+ Long nicWiseIpCount = _nicSecondaryIpDao.countByNicId(nicId);
+ if(nicWiseIpCount.intValue() >= maxAllowedIpsPerNic) {
+ s_logger.error("Maximum Number of Ips \"vm.network.nic.max.secondary.ipaddresses = \"" + maxAllowedIpsPerNic + " per Nic has been crossed for the nic " + nicId + ".");
+ throw new InsufficientAddressCapacityException("Maximum Number of Ips per Nic has been crossed.", Nic.class, nicId);
+ }
+
+
s_logger.debug("Calling the ip allocation ...");
String ipaddr = null;
//Isolated network can exist in Basic zone only, so no need to verify the zone type
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4925b9f6/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index 1b6a9ab..0ce9202 100644
--- a/setup/db/db/schema-430to440.sql
+++ b/setup/db/db/schema-430to440.sql
@@ -443,4 +443,4 @@ CREATE VIEW `cloud`.`user_vm_view` AS
left join
`cloud`.`user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_ram_size`.`name` = 'memory')));
-
+INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('NetworkManager', 'DEFAULT', 'management-server', 'vm.network.nic.max.secondary.ipaddresses', NULL, 'Specify the number of secondary ip addresses per nic per vm', '256') ON DUPLICATE KEY UPDATE category='NetworkManager';
\ No newline at end of file
[2/3] git commit: updated refs/heads/master to c53778c
Posted by ja...@apache.org.
CLOUDSTACK-5938 Failing add host in security group enabled zone, when CSP is not installed
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4b3784a9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4b3784a9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4b3784a9
Branch: refs/heads/master
Commit: 4b3784a98e57bc22bc0a8dd53462d452c322cb8c
Parents: f999a01
Author: Jayapal <ja...@apache.org>
Authored: Thu Jan 23 16:33:37 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Thu Jan 23 18:14:12 2014 +0530
----------------------------------------------------------------------
.../com/cloud/hypervisor/xen/resource/CitrixResourceBase.java | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b3784a9/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index ed9eec1..853fd42 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -4986,6 +4986,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
if (_securityGroupEnabled) {
_canBridgeFirewall = can_bridge_firewall(conn);
+ if (!_canBridgeFirewall) {
+ String msg = "Failed to configure brige firewall";
+ s_logger.warn(msg);
+ s_logger.warn("Check host " + _host.ip +" for CSP is installed or not and check network mode for bridge");
+ return new SetupAnswer(cmd, msg);
+ }
+
}
String result = callHostPluginPremium(conn, "heartbeat", "host", _host.uuid, "interval", Integer.toString(_heartbeatInterval));
[3/3] git commit: updated refs/heads/master to c53778c
Posted by ja...@apache.org.
CLOUDSTACK-5810 updated null checks and preparestmt and resultset close
Closing the prepare statement and result set and assigning null to the object after close.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c53778c3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c53778c3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c53778c3
Branch: refs/heads/master
Commit: c53778c33306f4a87387b932d9d9a9cb6069bdd5
Parents: 4925b9f6a
Author: Jayapal <ja...@apache.org>
Authored: Thu Jan 23 18:13:45 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Thu Jan 23 18:27:03 2014 +0530
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade430to440.java | 64 +++++++-------------
1 file changed, 21 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c53778c3/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
index 052c56c..3b967e7 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
@@ -126,43 +126,17 @@ public class Upgrade430to440 implements DbUpgrade {
}
}
-
-
- if (networkRs != null) {
- try {
- networkRs.close();
- } catch (SQLException e) {
- }
- }
-
-
- if (pstmtNw != null) {
- try {
- pstmtNw.close();
-
- } catch (SQLException e) {
- }
- }
-
- }
- } //if
-
-
- if (vmRs != null) {
- try {
- vmRs.close();
- } catch (SQLException e) {
- }
- }
-
- if (networkRs != null) {
- try {
networkRs.close();
- } catch (SQLException e) {
+ networkRs = null;
+ pstmtNw.close();
+ pstmtNw = null;
}
- }
-
+ } //if
+ pstmtVm.close();
+ pstmtVm = null;
+ vmRs.close();
+ vmRs = null;
} // while
@@ -179,36 +153,40 @@ public class Upgrade430to440 implements DbUpgrade {
}
- if (pstmtVm != null) {
+ if (rs1 != null) {
try {
- pstmtVm.close();
+ rs1.close();
} catch (SQLException e) {
}
}
- if (pstmtNw != null) {
- try {
- pstmtNw.close();
+ if (pstmtVm != null) {
+ try {
+ pstmtVm.close();
} catch (SQLException e) {
}
}
- if (rs1 != null) {
+ if (vmRs != null) {
try {
- rs1.close();
+ vmRs.close();
} catch (SQLException e) {
}
}
- if (vmRs != null) {
+
+
+ if (pstmtNw != null) {
try {
- vmRs.close();
+ pstmtNw.close();
+
} catch (SQLException e) {
}
}
+
if (networkRs != null) {
try {
networkRs.close();