mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3947: Fix similar issues related to getSyncObjType / getSyncObjId
(cherry picked from commit 5cfc69a7aa)
This commit is contained in:
parent
7fd71d708a
commit
2b980ef88f
|
|
@ -26,6 +26,7 @@ import org.apache.cloudstack.api.response.UserVmResponse;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
|
@ -127,4 +128,22 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
|
|||
// throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update port forwarding rule");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return getIp().getAssociatedWithNetworkId();
|
||||
}
|
||||
|
||||
private IpAddress getIp() {
|
||||
IpAddress ip = _networkService.getIp(publicIpId);
|
||||
if (ip == null) {
|
||||
throw new InvalidParameterValueException("Unable to find ip address by id " + publicIpId);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
|
|
@ -380,5 +381,14 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
|||
return AsyncJob.Type.FirewallRule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return getNetworkId();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.apache.cloudstack.api.response.LoadBalancerResponse;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
|
@ -113,4 +114,18 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
|
|||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update load balancer rule");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
LoadBalancer lb = _lbService.findById(getId());
|
||||
if (lb == null) {
|
||||
throw new InvalidParameterValueException("Unable to find load balancer rule " + getId());
|
||||
}
|
||||
return lb.getNetworkId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,4 +158,14 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
|
|||
public String getEventType() {
|
||||
return EventTypes.EVENT_NETWORK_UPDATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,4 +101,13 @@ public class DeleteVPCCmd extends BaseAsyncCmd{
|
|||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.vpcSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return getId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,14 @@ public class RestartVPCCmd extends BaseAsyncCmd{
|
|||
public String getEventDescription() {
|
||||
return "restarting VPC id=" + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.vpcSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return getId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,4 +105,14 @@ public class UpdateVPCCmd extends BaseAsyncCmd{
|
|||
public String getEventDescription() {
|
||||
return "updating VPC id=" + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.vpcSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return getId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue