Fix delete vpc ip ranges concurrently
Resolve
@@ -180,6 +180,14 @@ public class L3BasicNetwork implements L3Network {
}
private void handle(IpRangeDeletionMsg msg) {
+ thdf.chainSubmit(new ChainTask(msg) {
+ @Override
+ public String getSyncSignature() {
+ return getSyncId();
+ }
+
+ @Override
+ public void run(SyncTaskChain chain) {
IpRangeDeletionReply reply = new IpRangeDeletionReply();
List<IpRangeDeletionExtensionPoint> exts = pluginRgty.getExtensionList(IpRangeDeletionExtensionPoint.class);
@@ -213,6 +221,15 @@ public class L3BasicNetwork implements L3Network {
});
bus.reply(msg, reply);
+ chain.next();
+ }
+
+ @Override
+ public String getName() {
+ return String.format("ip-range-%s-deletion", msg.getIpRangeUuid());
+ }
+ });
+
}
private void handle(L3NetworkDeletionMsg msg) {
@@ -683,14 +700,6 @@ public class L3BasicNetwork implements L3Network {
IpRangeVO vo = dbf.findByUuid(msg.getUuid(), IpRangeVO.class);
self = dbf.findByUuid(msg.getL3NetworkUuid(), L3NetworkVO.class);
- thdf.chainSubmit(new ChainTask(msg) {
- @Override
- public String getSyncSignature() {
- return getSyncId();
- }
-
- @Override
- public void run(SyncTaskChain chainTask) {
final APIDeleteIpRangeEvent evt = new APIDeleteIpRangeEvent(msg.getId());
final String issuer = IpRangeVO.class.getSimpleName();
final List<IpRangeInventory> ctx = IpRangeInventory.valueOf(Arrays.asList(vo));
@@ -752,26 +761,16 @@ public class L3BasicNetwork implements L3Network {
public void handle(Map data) {
casf.asyncCascadeFull(CascadeConstant.DELETION_CLEANUP_CODE, issuer, ctx, new NopeCompletion());
bus.publish(evt);
- chainTask.next();
}
}).error(new FlowErrorHandler(msg) {
@Override
public void handle(ErrorCode errCode, Map data) {
evt.setError(errf.instantiateErrorCode(SysErrors.DELETE_RESOURCE_ERROR, errCode));
bus.publish(evt);
- chainTask.next();
}
}).start();
}
- @Override
- public String getName() {
- return String.format("delete-ip-range-%s", msg.getIpRangeUuid());
- }
- });
-
- }
-
private void handle(APIDeleteL3NetworkMsg msg) {
final APIDeleteL3NetworkEvent evt = new APIDeleteL3NetworkEvent(msg.getId());
final String issuer = L3NetworkVO.class.getSimpleName();
