Skip to content

Commit cc80ffe

Browse files
Prashanth Reddyclaude
andcommitted
network: scope routed network/VPC subnets to a zone
The ip4_guest_subnet_network_map table had no zone column, so the subnet bookkeeping for routed networks and VPCs was global. Creating a routed VPC or network with a CIDR already used in another zone failed with "The subnet is in use", even though the two zones are independent. Add a nullable data_center_id column to ip4_guest_subnet_network_map and scope the subnet lookup and the parentless overlap check by zone, so the same CIDR can be used once per zone. Existing rows are backfilled from their parent zone subnet, VPC or network. Fixes apache#14419 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017rnv8vT6LQSKfwkzp8tvg9
1 parent c7667d8 commit cc80ffe

6 files changed

Lines changed: 77 additions & 24 deletions

File tree

‎engine/schema/src/main/java/org/apache/cloudstack/network/Ipv4GuestSubnetNetworkMapVO.java‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public class Ipv4GuestSubnetNetworkMapVO implements Ipv4GuestSubnetNetworkMap {
4646
@Column(name = "parent_id")
4747
private Long parentId;
4848

49+
@Column(name = "data_center_id")
50+
private Long dataCenterId;
51+
4952
@Column(name = "subnet")
5053
private String subnet;
5154

@@ -72,8 +75,9 @@ protected Ipv4GuestSubnetNetworkMapVO() {
7275
uuid = UUID.randomUUID().toString();
7376
}
7477

75-
protected Ipv4GuestSubnetNetworkMapVO(Long parentId, String subnet, Long networkId, Ipv4GuestSubnetNetworkMap.State state) {
78+
protected Ipv4GuestSubnetNetworkMapVO(Long parentId, Long dataCenterId, String subnet, Long networkId, Ipv4GuestSubnetNetworkMap.State state) {
7679
this.parentId = parentId;
80+
this.dataCenterId = dataCenterId;
7781
this.subnet = subnet;
7882
this.networkId = networkId;
7983
this.state = state;
@@ -95,6 +99,14 @@ public Long getParentId() {
9599
return parentId;
96100
}
97101

102+
public Long getDataCenterId() {
103+
return dataCenterId;
104+
}
105+
106+
public void setDataCenterId(Long dataCenterId) {
107+
this.dataCenterId = dataCenterId;
108+
}
109+
98110
@Override
99111
public String getSubnet() {
100112
return subnet;

‎engine/schema/src/main/java/org/apache/cloudstack/network/dao/Ipv4GuestSubnetNetworkMapDao.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public interface Ipv4GuestSubnetNetworkMapDao extends GenericDao<Ipv4GuestSubnet
3131
Ipv4GuestSubnetNetworkMapVO findFirstAvailable(long parentId, long cidrSize);
3232
Ipv4GuestSubnetNetworkMapVO findByNetworkId(long networkId);
3333
Ipv4GuestSubnetNetworkMapVO findByVpcId(long vpcId);
34-
Ipv4GuestSubnetNetworkMapVO findBySubnet(String subnet);
34+
Ipv4GuestSubnetNetworkMapVO findBySubnetAndDataCenterId(String subnet, Long dataCenterId);
3535
List<Ipv4GuestSubnetNetworkMapVO> findSubnetsInStates(Ipv4GuestSubnetNetworkMap.State... states);
3636
void deleteByParentId(long parentId);
37-
List<Ipv4GuestSubnetNetworkMapVO> listAllNoParent();
37+
List<Ipv4GuestSubnetNetworkMapVO> listAllNoParentByDataCenterId(Long dataCenterId);
3838
}

‎engine/schema/src/main/java/org/apache/cloudstack/network/dao/Ipv4GuestSubnetNetworkMapDaoImpl.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ public void init() {
6363
ParentIdSearch.done();
6464
NoParentSearch = createSearchBuilder();
6565
NoParentSearch.and("parentId", NoParentSearch.entity().getParentId(), SearchCriteria.Op.NULL);
66+
NoParentSearch.and("dataCenterId", NoParentSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
6667
NoParentSearch.done();
6768
NetworkIdSearch = createSearchBuilder();
6869
NetworkIdSearch.and("networkId", NetworkIdSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
6970
NetworkIdSearch.and("vpcId", NetworkIdSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
7071
NetworkIdSearch.done();
7172
SubnetSearch = createSearchBuilder();
7273
SubnetSearch.and("subnet", SubnetSearch.entity().getSubnet(), SearchCriteria.Op.EQ);
74+
SubnetSearch.and("dataCenterId", SubnetSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
7375
SubnetSearch.done();
7476
StatesSearch = createSearchBuilder();
7577
StatesSearch.and("state", StatesSearch.entity().getState(), SearchCriteria.Op.IN);
@@ -142,9 +144,10 @@ public Ipv4GuestSubnetNetworkMapVO findByVpcId(long vpcId) {
142144
}
143145

144146
@Override
145-
public Ipv4GuestSubnetNetworkMapVO findBySubnet(String subnet) {
147+
public Ipv4GuestSubnetNetworkMapVO findBySubnetAndDataCenterId(String subnet, Long dataCenterId) {
146148
SearchCriteria<Ipv4GuestSubnetNetworkMapVO> sc = SubnetSearch.create();
147149
sc.setParameters("subnet", subnet);
150+
sc.setParameters("dataCenterId", dataCenterId);
148151
return findOneBy(sc);
149152
}
150153

@@ -163,8 +166,9 @@ public void deleteByParentId(long parentId) {
163166
}
164167

165168
@Override
166-
public List<Ipv4GuestSubnetNetworkMapVO> listAllNoParent() {
169+
public List<Ipv4GuestSubnetNetworkMapVO> listAllNoParentByDataCenterId(Long dataCenterId) {
167170
SearchCriteria<Ipv4GuestSubnetNetworkMapVO> sc = NoParentSearch.create();
171+
sc.setParameters("dataCenterId", dataCenterId);
168172
return listBy(sc, null);
169173
}
170174
}

‎engine/schema/src/main/resources/META-INF/db/schema-42210to42220.sql‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,23 @@ UPDATE op_dc_vnet_alloc a
3131
a.reservation_id = NULL,
3232
a.taken = NULL
3333
WHERE n.removed IS NOT NULL;
34+
35+
-- Scope routed network/VPC subnets to a zone, so that the same CIDR can be used in more than one zone. See #14419.
36+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.ip4_guest_subnet_network_map', 'data_center_id', 'bigint unsigned DEFAULT NULL COMMENT "zone it belongs to"');
37+
38+
UPDATE `cloud`.`ip4_guest_subnet_network_map` m
39+
JOIN `cloud`.`dc_ip4_guest_subnets` p ON p.id = m.parent_id
40+
SET m.data_center_id = p.data_center_id
41+
WHERE m.data_center_id IS NULL;
42+
43+
UPDATE `cloud`.`ip4_guest_subnet_network_map` m
44+
JOIN `cloud`.`vpc` v ON v.id = m.vpc_id
45+
SET m.data_center_id = v.zone_id
46+
WHERE m.data_center_id IS NULL;
47+
48+
UPDATE `cloud`.`ip4_guest_subnet_network_map` m
49+
JOIN `cloud`.`networks` n ON n.id = m.network_id
50+
SET m.data_center_id = n.data_center_id
51+
WHERE m.data_center_id IS NULL;
52+
53+
CALL `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.ip4_guest_subnet_network_map', 'fk_ip4_guest_subnet_network_map__data_center_id', '(`data_center_id`)', '`data_center`(`id`)');

‎server/src/main/java/org/apache/cloudstack/network/RoutedIpv4ManagerImpl.java‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ protected Ipv4GuestSubnetNetworkMap getOrCreateIpv4SubnetForGuestNetworkOrVpcInt
650650
}
651651

652652
protected void getOrCreateIpv4SubnetForGuestNetworkOrVpcInternal(String networkCidr, Long ownerDomainId, Long ownerAccountId, Long zoneId) {
653-
Ipv4GuestSubnetNetworkMapVO subnetMap = ipv4GuestSubnetNetworkMapDao.findBySubnet(networkCidr);
653+
Ipv4GuestSubnetNetworkMapVO subnetMap = ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(networkCidr, zoneId);
654654
if (subnetMap != null) {
655655
// check if the subnet is in use
656656
if (subnetMap.getNetworkId() != null || subnetMap.getVpcId() != null) {
@@ -672,7 +672,7 @@ protected void getOrCreateIpv4SubnetForGuestNetworkOrVpcInternal(String networkC
672672

673673
// Create new record without networkId
674674
final Long parentId = parent != null ? parent.getId() : null;
675-
subnetMap = new Ipv4GuestSubnetNetworkMapVO(parentId, NetUtils.transformCidr(networkCidr), null, State.Free);
675+
subnetMap = new Ipv4GuestSubnetNetworkMapVO(parentId, zoneId, NetUtils.transformCidr(networkCidr), null, State.Free);
676676
ipv4GuestSubnetNetworkMapDao.persist(subnetMap);
677677
}
678678

@@ -698,7 +698,7 @@ protected DataCenterIpv4GuestSubnet getParentOfNetworkCidr(Long zoneId, String n
698698
}
699699
}
700700
// check conflicts
701-
List<Ipv4GuestSubnetNetworkMapVO> subnetsForNetworkNoParents = ipv4GuestSubnetNetworkMapDao.listAllNoParent();
701+
List<Ipv4GuestSubnetNetworkMapVO> subnetsForNetworkNoParents = ipv4GuestSubnetNetworkMapDao.listAllNoParentByDataCenterId(zoneId);
702702
checkConflicts(subnetsForNetworkNoParents, networkCidr);
703703
return null;
704704
}
@@ -730,7 +730,7 @@ private List<DataCenterIpv4GuestSubnetVO> getZoneSubnetsForAccount(long domainId
730730
protected Ipv4GuestSubnetNetworkMap createIpv4SubnetFromParentSubnet(DataCenterIpv4GuestSubnet parent, Integer networkCidrSize) {
731731
String networkCidr = createIpv4SubnetStringFromParentSubnet(parent, networkCidrSize);
732732
// create DB record
733-
Ipv4GuestSubnetNetworkMapVO subnetMap = new Ipv4GuestSubnetNetworkMapVO(parent.getId(), NetUtils.transformCidr(networkCidr), null, State.Free);
733+
Ipv4GuestSubnetNetworkMapVO subnetMap = new Ipv4GuestSubnetNetworkMapVO(parent.getId(), parent.getDataCenterId(), NetUtils.transformCidr(networkCidr), null, State.Free);
734734
return ipv4GuestSubnetNetworkMapDao.persist(subnetMap);
735735
}
736736

@@ -767,19 +767,19 @@ protected String createIpv4SubnetStringFromParentSubnet(DataCenterIpv4GuestSubne
767767
}
768768

769769
// Allocate a subnet automatically
770-
String networkCidr = getFreeNetworkCidr(subnetsInFreeIpRanges, networkCidrSize);
770+
String networkCidr = getFreeNetworkCidr(subnetsInFreeIpRanges, networkCidrSize, parent.getDataCenterId());
771771
if (networkCidr == null) {
772772
throw new InvalidParameterValueException("Failed to automatically allocate a subnet with specified cidrsize");
773773
}
774774
return networkCidr;
775775
}
776776

777-
private String getFreeNetworkCidr(List<Pair<Long, Integer>> subnetsInFreeIpRanges, int networkCidrSize) {
777+
private String getFreeNetworkCidr(List<Pair<Long, Integer>> subnetsInFreeIpRanges, int networkCidrSize, Long dataCenterId) {
778778
for (int cidrSize = networkCidrSize; cidrSize >= 1; cidrSize--) {
779779
for (Pair<Long, Integer> freeSubnet : subnetsInFreeIpRanges) {
780780
if (freeSubnet.second().equals(cidrSize)) {
781781
String networkCidr = String.format("%s/%s", NetUtils.long2Ip(freeSubnet.first()), networkCidrSize);
782-
if (ipv4GuestSubnetNetworkMapDao.findBySubnet(networkCidr) == null) {
782+
if (ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(networkCidr, dataCenterId) == null) {
783783
return networkCidr;
784784
}
785785
}
@@ -798,7 +798,7 @@ protected Ipv4GuestSubnetNetworkMap createIpv4SubnetFromParentSubnet(DataCenterI
798798
checkConflicts(existingSubnets, networkCidr);
799799

800800
// create DB record
801-
Ipv4GuestSubnetNetworkMapVO subnetMap = new Ipv4GuestSubnetNetworkMapVO(parent.getId(), NetUtils.transformCidr(networkCidr), null, State.Free);
801+
Ipv4GuestSubnetNetworkMapVO subnetMap = new Ipv4GuestSubnetNetworkMapVO(parent.getId(), parent.getDataCenterId(), NetUtils.transformCidr(networkCidr), null, State.Free);
802802
return ipv4GuestSubnetNetworkMapDao.persist(subnetMap);
803803
}
804804

@@ -807,7 +807,7 @@ public void assignIpv4SubnetToNetwork(Network network) {
807807
if (network == null || network.getCidr() == null) {
808808
return;
809809
}
810-
Ipv4GuestSubnetNetworkMapVO subnetMap = ipv4GuestSubnetNetworkMapDao.findBySubnet(network.getCidr());
810+
Ipv4GuestSubnetNetworkMapVO subnetMap = ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(network.getCidr(), network.getDataCenterId());
811811
if (subnetMap != null) {
812812
if (network.getId() > 0L) {
813813
subnetMap.setNetworkId(network.getId());
@@ -823,7 +823,7 @@ public void assignIpv4SubnetToVpc(Vpc vpc) {
823823
if (vpc == null || vpc.getCidr() == null) {
824824
return;
825825
}
826-
Ipv4GuestSubnetNetworkMapVO subnetMap = ipv4GuestSubnetNetworkMapDao.findBySubnet(vpc.getCidr());
826+
Ipv4GuestSubnetNetworkMapVO subnetMap = ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(vpc.getCidr(), vpc.getZoneId());
827827
if (subnetMap != null) {
828828
if (vpc != null && vpc.getId() > 0L) {
829829
subnetMap.setVpcId(vpc.getId());

‎server/src/test/java/org/apache/cloudstack/network/RoutedIpv4ManagerImplTest.java‎

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
import org.junit.BeforeClass;
9090
import org.junit.Test;
9191
import org.junit.runner.RunWith;
92+
import org.mockito.ArgumentCaptor;
9293
import org.mockito.InjectMocks;
9394
import org.mockito.Mock;
9495
import org.mockito.Mockito;
@@ -498,7 +499,7 @@ public void testCreateIpv4SubnetForGuestNetworkResponse() {
498499

499500
@Test
500501
public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidr1() {
501-
when(ipv4GuestSubnetNetworkMapDao.findBySubnet(subnet)).thenReturn(ipv4GuestSubnetNetworkMap);
502+
when(ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(subnet, zoneId)).thenReturn(ipv4GuestSubnetNetworkMap);
502503
when(ipv4GuestSubnetNetworkMap.getNetworkId()).thenReturn(null);
503504
when(ipv4GuestSubnetNetworkMap.getVpcId()).thenReturn(null);
504505
when(ipv4GuestSubnetNetworkMap.getParentId()).thenReturn(zoneSubnetId);
@@ -511,7 +512,7 @@ public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidr1() {
511512

512513
@Test
513514
public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidr2() {
514-
when(ipv4GuestSubnetNetworkMapDao.findBySubnet(subnet)).thenReturn(null);
515+
when(ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(subnet, zoneId)).thenReturn(null);
515516

516517
routedIpv4Manager.getOrCreateIpv4SubnetForGuestNetworkOrVpcInternal(subnet, domainId, accountId, zoneId);
517518

@@ -520,7 +521,7 @@ public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidr2() {
520521

521522
@Test
522523
public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidr3() {
523-
when(ipv4GuestSubnetNetworkMapDao.findBySubnet(subnet)).thenReturn(null);
524+
when(ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(subnet, zoneId)).thenReturn(null);
524525
when(routedIpv4Manager.getParentOfNetworkCidr(zoneId, subnet)).thenReturn(subnetVO);
525526
when(subnetVO.getDomainId()).thenReturn(domainId);
526527
when(subnetVO.getAccountId()).thenReturn(accountId);
@@ -530,6 +531,20 @@ public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidr3() {
530531
verify(ipv4GuestSubnetNetworkMapDao).persist(any(Ipv4GuestSubnetNetworkMapVO.class));
531532
}
532533

534+
@Test
535+
public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidrInAnotherZone() {
536+
Long otherZoneId = zoneId + 1L;
537+
// The same subnet is already allocated in another zone, which must not block this zone
538+
when(ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(subnet, otherZoneId)).thenReturn(null);
539+
540+
routedIpv4Manager.getOrCreateIpv4SubnetForGuestNetworkOrVpcInternal(subnet, domainId, accountId, otherZoneId);
541+
542+
ArgumentCaptor<Ipv4GuestSubnetNetworkMapVO> captor = ArgumentCaptor.forClass(Ipv4GuestSubnetNetworkMapVO.class);
543+
verify(ipv4GuestSubnetNetworkMapDao).persist(captor.capture());
544+
Assert.assertEquals(otherZoneId, captor.getValue().getDataCenterId());
545+
Assert.assertEquals(subnet, captor.getValue().getSubnet());
546+
}
547+
533548
@Test
534549
public void testGetOrCreateIpv4SubnetForGuestNetworkOrVpcInternalByCidrSize1() {
535550
Ipv4GuestSubnetNetworkMap result = routedIpv4Manager.getOrCreateIpv4SubnetForGuestNetworkOrVpcInternal(cidrSize, domainId, accountId, zoneId);
@@ -629,8 +644,8 @@ public void testCreateIpv4SubnetFromParentSubnetByCidrSize() {
629644
when(subnetVO.getId()).thenReturn(zoneSubnetId);
630645
when(dataCenterIpv4GuestSubnetDao.findById(zoneSubnetId)).thenReturn(subnetVO);
631646

632-
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap1 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, "172.16.1.0/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
633-
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap2 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, "172.16.1.64/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
647+
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap1 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, zoneId, "172.16.1.0/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
648+
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap2 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, zoneId, "172.16.1.64/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
634649
when(ipv4GuestSubnetNetworkMapDao.listByParent(zoneSubnetId)).thenReturn(Arrays.asList(ipv4GuestSubnetNetworkMap1, ipv4GuestSubnetNetworkMap2));
635650
when(subnetVO.getSubnet()).thenReturn("172.16.1.0/24");
636651

@@ -643,8 +658,8 @@ public void testCreateIpv4SubnetFromParentSubnetByCidrSize() {
643658
networkCidr = routedIpv4Manager.createIpv4SubnetStringFromParentSubnet(subnetVO, 25);
644659
Assert.assertEquals("172.16.1.128/25", networkCidr);
645660

646-
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap3 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, "172.16.1.16/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
647-
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap4 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, "172.16.1.128/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
661+
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap3 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, zoneId, "172.16.1.16/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
662+
Ipv4GuestSubnetNetworkMapVO ipv4GuestSubnetNetworkMap4 = new Ipv4GuestSubnetNetworkMapVO(zoneSubnetId, zoneId, "172.16.1.128/28", null, Ipv4GuestSubnetNetworkMap.State.Free);
648663
when(ipv4GuestSubnetNetworkMapDao.listByParent(zoneSubnetId)).thenReturn(Arrays.asList(ipv4GuestSubnetNetworkMap1, ipv4GuestSubnetNetworkMap2,
649664
ipv4GuestSubnetNetworkMap3, ipv4GuestSubnetNetworkMap4));
650665
networkCidr = routedIpv4Manager.createIpv4SubnetStringFromParentSubnet(subnetVO, 28);
@@ -665,7 +680,8 @@ public void testCreateIpv4SubnetFromParentSubnetByCidrSize() {
665680
public void testAssignIpv4SubnetToNetwork() {
666681
when(network.getId()).thenReturn(networkId);
667682
when(network.getCidr()).thenReturn(subnet);
668-
when(ipv4GuestSubnetNetworkMapDao.findBySubnet(subnet)).thenReturn(ipv4GuestSubnetNetworkMap);
683+
when(network.getDataCenterId()).thenReturn(zoneId);
684+
when(ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(subnet, zoneId)).thenReturn(ipv4GuestSubnetNetworkMap);
669685
when(ipv4GuestSubnetNetworkMap.getId()).thenReturn(ipv4GuestSubnetNetworkMapId);
670686

671687
routedIpv4Manager.assignIpv4SubnetToNetwork(network);
@@ -677,7 +693,8 @@ public void testAssignIpv4SubnetToNetwork() {
677693
public void testAssignIpv4SubnetToVpc() {
678694
when(vpc.getId()).thenReturn(vpcId);
679695
when(vpc.getCidr()).thenReturn(subnet);
680-
when(ipv4GuestSubnetNetworkMapDao.findBySubnet(subnet)).thenReturn(ipv4GuestSubnetNetworkMap);
696+
when(vpc.getZoneId()).thenReturn(zoneId);
697+
when(ipv4GuestSubnetNetworkMapDao.findBySubnetAndDataCenterId(subnet, zoneId)).thenReturn(ipv4GuestSubnetNetworkMap);
681698
when(ipv4GuestSubnetNetworkMap.getId()).thenReturn(ipv4GuestSubnetNetworkMapId);
682699

683700
routedIpv4Manager.assignIpv4SubnetToVpc(vpc);

0 commit comments

Comments
 (0)