1) Updated schema for data_center - provider fields can have NULL values.

2) Fixed deletePortForwarding/deleteIpForwardingRule commands to return false when delete rule fails.
This commit is contained in:
alena 2010-12-28 16:21:42 -08:00
parent 383f524725
commit 085824d524
6 changed files with 18 additions and 22 deletions

View File

@ -66,8 +66,9 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd {
@Override
public void execute(){
PortForwardingRule rule = _rulesService.revokePortForwardingRule(id, true);
if (rule != null) {
boolean result = _rulesService.revokePortForwardingRule(id, true);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {

View File

@ -81,8 +81,9 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
@Override
public void execute() throws ResourceUnavailableException {
PortForwardingRule result = _rulesService.revokePortForwardingRule(id, true);
if (result != null) {
boolean result = _rulesService.revokePortForwardingRule(id, true);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {

View File

@ -44,7 +44,7 @@ public interface RulesService {
* @param caller
* @return
*/
PortForwardingRule revokePortForwardingRule(long ruleId, boolean apply);
boolean revokePortForwardingRule(long ruleId, boolean apply);
/**
* List port forwarding rules assigned to an ip address
* @param cmd the command object holding the criteria for listing port forwarding rules (the ipAddress)

View File

@ -33,7 +33,6 @@ import com.cloud.utils.net.Ip;
* Rules Manager manages the network rules created for different networks.
*/
public interface RulesManager extends RulesService {
PortForwardingRule revokePortForwardingRule(String ruleId, Account caller);
boolean applyPortForwardingRules(Ip ip, boolean continueOnError);

View File

@ -301,7 +301,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
}
@Override
public PortForwardingRule revokePortForwardingRule(long ruleId, boolean apply) {
public boolean revokePortForwardingRule(long ruleId, boolean apply) {
UserContext ctx = UserContext.current();
Account caller = ctx.getAccount();
@ -314,15 +314,10 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
revokeRule(rule, caller, ctx.getUserId());
if (apply) {
applyPortForwardingRules(rule.getSourceIpAddress(), true);
return applyPortForwardingRules(rule.getSourceIpAddress(), true);
} else {
return true;
}
return rule;
}
@Override
public PortForwardingRule revokePortForwardingRule(String ruleId, Account caller) {
// FIXME: Not working yet.
return null;
}
@Override

View File

@ -407,13 +407,13 @@ CREATE TABLE `cloud`.`data_center` (
`domain` varchar(100) COMMENT 'Network domain name of the Vms of the zone',
`domain_id` bigint unsigned COMMENT 'domain id for the parent domain to this zone (null signifies public zone)',
`networktype` varchar(255) NOT NULL DEFAULT 'Basic' COMMENT 'Network type of the zone',
`dns_provider` char(64) NOT NULL DEFAULT 'VirtualRouter',
`gateway_provider` char(64) NOT NULL DEFAULT 'VirtualRouter',
`firewall_provider` char(64) NOT NULL DEFAULT 'VirtualRouter',
`dhcp_provider` char(64) NOT NULL DEFAULT 'VirtualRouter',
`lb_provider` char(64) NOT NULL DEFAULT 'VirtualRouter',
`vpn_provider` char(64) NOT NULL DEFAULT 'VirtualRouter',
`userdata_provider` char(64) NOT NULL DEFAULT 'VirtualRouter',
`dns_provider` char(64) DEFAULT 'VirtualRouter',
`gateway_provider` char(64) DEFAULT 'VirtualRouter',
`firewall_provider` char(64) DEFAULT 'VirtualRouter',
`dhcp_provider` char(64) DEFAULT 'VirtualRouter',
`lb_provider` char(64) DEFAULT 'VirtualRouter',
`vpn_provider` char(64) DEFAULT 'VirtualRouter',
`userdata_provider` char(64) DEFAULT 'VirtualRouter',
`enable` tinyint NOT NULL DEFAULT 1 COMMENT 'Is this data center enabled for activities',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;