Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss

This commit is contained in:
nit 2011-01-18 20:09:11 +05:30
commit 14da3be3c1
3 changed files with 24 additions and 24 deletions

View File

@ -51,14 +51,14 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd implements LoadBalancer
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="name of the load balancer rule")
private String loadBalancerRuleName;
@Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.STRING, required=true, description="the private port of the private ip address/virtual machine where the network traffic will be load balanced to")
private String privatePort;
@Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.INTEGER, required=true, description="the private port of the private ip address/virtual machine where the network traffic will be load balanced to")
private Integer privatePort;
@Parameter(name=ApiConstants.PUBLIC_IP, type=CommandType.STRING, required=true, description="public ip address from where the network traffic will be load balanced from")
private String publicIp;
@Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.STRING, required=true, description="the public port from where the network traffic will be load balanced from")
private String publicPort;
@Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.INTEGER, required=true, description="the public port from where the network traffic will be load balanced from")
private Integer publicPort;
/////////////////////////////////////////////////////
@ -79,7 +79,7 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd implements LoadBalancer
return loadBalancerRuleName;
}
public String getPrivatePort() {
public Integer getPrivatePort() {
return privatePort;
}
@ -87,7 +87,7 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd implements LoadBalancer
return publicIp;
}
public String getPublicPort() {
public Integer getPublicPort() {
return publicPort;
}
@ -136,12 +136,12 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd implements LoadBalancer
@Override
public int getSourcePortStart() {
return Integer.parseInt(publicPort);
return publicPort.intValue();
}
@Override
public int getSourcePortEnd() {
return Integer.parseInt(publicPort);
return publicPort.intValue();
}
@Override
@ -176,12 +176,12 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd implements LoadBalancer
@Override
public int getDefaultPortStart() {
return Integer.parseInt(privatePort);
return privatePort.intValue();
}
@Override
public int getDefaultPortEnd() {
return Integer.parseInt(privatePort);
return privatePort.intValue();
}
}

View File

@ -47,14 +47,14 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required=true, description="the IP address of the port forwarding rule")
private String ipAddress;
@Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.STRING, required=true, description="the private port of the port forwarding rule")
private String privatePort;
@Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.INTEGER, required=true, description="the private port of the port forwarding rule")
private Integer privatePort;
@Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, required=true, description="the protocol for the port fowarding rule. Valid values are TCP or UDP.")
private String protocol;
@Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.STRING, required=true, description=" the public port of the port forwarding rule")
private String publicPort;
@Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.INTEGER, required=true, description=" the public port of the port forwarding rule")
private Integer publicPort;
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine for the port forwarding rule")
private Long virtualMachineId;
@ -68,8 +68,8 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements
return ipAddress;
}
public String getPrivatePort() {
return privatePort.trim();
public Integer getPrivatePort() {
return privatePort;
}
@Override
@ -77,8 +77,8 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements
return protocol.trim();
}
public String getPublicPort() {
return publicPort.trim();
public Integer getPublicPort() {
return publicPort;
}
@Override
@ -138,12 +138,12 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements
@Override
public int getSourcePortStart() {
return Integer.parseInt(publicPort.trim());
return publicPort.intValue();
}
@Override
public int getSourcePortEnd() {
return Integer.parseInt(publicPort.trim());
return publicPort.intValue();
}
@Override
@ -178,12 +178,12 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements
@Override
public int getDestinationPortStart() {
return Integer.parseInt(privatePort.trim());
return privatePort.intValue();
}
@Override
public int getDestinationPortEnd() {
return Integer.parseInt(privatePort.trim());
return privatePort.intValue();
}
@Override

View File

@ -241,7 +241,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
if (!_ipAddressDao.update(addr.getAddress(), addr)) {
throw new CloudRuntimeException("Found address to allocate but unable to update: " + addr);
}
if(!sourceNat){
if(!sourceNat && (owner.getAccountId() != Account.ACCOUNT_ID_SYSTEM)){
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_NET_IP_ASSIGN, owner.getAccountId(), dcId, 0, addr.getAddress().toString());
_usageEventDao.persist(usageEvent);
}
@ -657,7 +657,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
if (success) {
_ipAddressDao.unassignIpAddress(addr);
s_logger.debug("released a public ip: " + addr);
if(!ip.isSourceNat()){
if(!ip.isSourceNat() && (ownerId != Account.ACCOUNT_ID_SYSTEM)){
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_NET_IP_RELEASE, ownerId, ip.getDataCenterId(), 0, addr.toString());
_usageEventDao.persist(usageEvent);
}