Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public APIMessage intercept(APIMessage msg) throws ApiMessageInterceptionExcepti
validate((APIPullSdnControllerTenantMsg) msg);
} else if (msg instanceof APIChangeSdnControllerMsg) {
validate((APIChangeSdnControllerMsg) msg);
} else if (msg instanceof APIRemoveSdnControllerMsg) {
validate((APIRemoveSdnControllerMsg) msg);
}

setServiceId(msg);
Expand Down Expand Up @@ -311,6 +313,17 @@ private boolean isOverlappedVlanRange(int start, int end, Integer startVlan, Int
(start <= startVlan && end >= endVlan);
}

private void validate(APIRemoveSdnControllerMsg msg) {
long poolCount = Q.New(HardwareL2VxlanNetworkPoolVO.class)
.eq(HardwareL2VxlanNetworkPoolVO_.sdnControllerUuid, msg.getUuid())
.count();
if (poolCount > 0) {
throw new ApiMessageInterceptionException(argerr(ORG_ZSTACK_SDNCONTROLLER_10031,
"could not remove sdn controller[uuid:%s] because it still has %d L2 vxlan network pool(s) attached. Please detach them first",
msg.getUuid(), poolCount));
}
}

private void validate(APIChangeSdnControllerMsg msg) {
if (msg.getVlanRanges() != null && !msg.getVlanRanges().isEmpty()) {
validateVlanRanges(msg.getVlanRanges());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15264,6 +15264,8 @@ public class CloudOperationsErrorCode {

public static final String ORG_ZSTACK_SDNCONTROLLER_10030 = "ORG_ZSTACK_SDNCONTROLLER_10030";

public static final String ORG_ZSTACK_SDNCONTROLLER_10031 = "ORG_ZSTACK_SDNCONTROLLER_10031";

public static final String ORG_ZSTACK_TEST_INTEGRATION_PREMIUM_ZSV_SNAPSHOT_10000 = "ORG_ZSTACK_TEST_INTEGRATION_PREMIUM_ZSV_SNAPSHOT_10000";

public static final String ORG_ZSTACK_TEST_INTEGRATION_PREMIUM_ZSV_SNAPSHOT_10001 = "ORG_ZSTACK_TEST_INTEGRATION_PREMIUM_ZSV_SNAPSHOT_10001";
Expand Down