Skip to content

Commit c526244

Browse files
committed
Merge remote-tracking branch 'apache/4.17' into main
2 parents f76b6c6 + 7115e35 commit c526244

File tree

7 files changed

+38
-27
lines changed

7 files changed

+38
-27
lines changed

server/src/main/java/com/cloud/network/NetworkServiceImpl.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,20 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
370370

371371
private Map<String, String> _configs;
372372

373+
private void verifyDedicatedGuestVlansWithExistingDatacenterVlans(PhysicalNetwork physicalNetwork, Account vlanOwner, int startVlan, int endVlan) {
374+
for (int i = startVlan; i <= endVlan; i++) {
375+
List<DataCenterVnetVO> dataCenterVnet = _dcVnetDao.findVnet(physicalNetwork.getDataCenterId(), physicalNetwork.getId(), Integer.toString(i));
376+
if (CollectionUtils.isEmpty(dataCenterVnet)) {
377+
throw new InvalidParameterValueException(String.format("Guest vlan %d from this range %d-%d is not present in the system for physical network ID: %s", i, startVlan, endVlan, physicalNetwork.getUuid()));
378+
}
379+
// Verify guest vlans in the range don't belong to a network of a different account
380+
if (dataCenterVnet.get(0).getAccountId() != null && dataCenterVnet.get(0).getAccountId() != vlanOwner.getAccountId()) {
381+
throw new InvalidParameterValueException("Guest vlan from this range " + dataCenterVnet.get(0).getVnet() + " is allocated to a different account."
382+
+ " Can only dedicate a range which has no allocated vlans or has vlans allocated to the same account ");
383+
}
384+
}
385+
}
386+
373387
/* Get a list of IPs, classify them by service */
374388
protected Map<PublicIp, Set<Service>> getIpToServices(List<PublicIp> publicIps, boolean rulesRevoked, boolean includingFirewall) {
375389
Map<PublicIp, Set<Service>> ipToServices = new HashMap<PublicIp, Set<Service>>();
@@ -4073,18 +4087,7 @@ public GuestVlanRange dedicateGuestVlanRange(DedicateGuestVlanRangeCmd cmd) {
40734087
}
40744088
}
40754089

4076-
// Verify guest vlans in the range don't belong to a network of a different account
4077-
for (int i = startVlan; i <= endVlan; i++) {
4078-
List<DataCenterVnetVO> allocatedVlans = _dcVnetDao.listAllocatedVnetsInRange(physicalNetwork.getDataCenterId(), physicalNetwork.getId(), startVlan, endVlan);
4079-
if (allocatedVlans != null && !allocatedVlans.isEmpty()) {
4080-
for (DataCenterVnetVO allocatedVlan : allocatedVlans) {
4081-
if (allocatedVlan.getAccountId() != vlanOwner.getAccountId()) {
4082-
throw new InvalidParameterValueException("Guest vlan from this range " + allocatedVlan.getVnet() + " is allocated to a different account."
4083-
+ " Can only dedicate a range which has no allocated vlans or has vlans allocated to the same account ");
4084-
}
4085-
}
4086-
}
4087-
}
4090+
verifyDedicatedGuestVlansWithExistingDatacenterVlans(physicalNetwork, vlanOwner, startVlan, endVlan);
40884091

40894092
List<AccountGuestVlanMapVO> guestVlanMaps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByPhysicalNetwork(physicalNetworkId);
40904093
// Verify if vlan range is already dedicated

server/src/test/java/com/cloud/network/DedicateGuestVlanRangesTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,17 @@
2929
import java.util.List;
3030
import java.util.UUID;
3131

32-
import com.cloud.user.User;
33-
import junit.framework.Assert;
34-
32+
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
33+
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
34+
import org.apache.cloudstack.api.command.admin.network.ReleaseDedicatedGuestVlanRangeCmd;
35+
import org.apache.cloudstack.context.CallContext;
3536
import org.apache.log4j.Logger;
3637
import org.junit.After;
3738
import org.junit.Before;
3839
import org.junit.Test;
3940
import org.mockito.Mock;
4041
import org.mockito.MockitoAnnotations;
4142

42-
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
43-
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
44-
import org.apache.cloudstack.api.command.admin.network.ReleaseDedicatedGuestVlanRangeCmd;
45-
import org.apache.cloudstack.context.CallContext;
46-
4743
import com.cloud.dc.DataCenterVnetVO;
4844
import com.cloud.dc.dao.DataCenterVnetDao;
4945
import com.cloud.network.dao.AccountGuestVlanMapDao;
@@ -54,10 +50,13 @@
5450
import com.cloud.user.Account;
5551
import com.cloud.user.AccountManager;
5652
import com.cloud.user.AccountVO;
53+
import com.cloud.user.User;
5754
import com.cloud.user.UserVO;
5855
import com.cloud.user.dao.AccountDao;
5956
import com.cloud.utils.db.TransactionLegacy;
6057

58+
import junit.framework.Assert;
59+
6160
public class DedicateGuestVlanRangesTest {
6261

6362
private static final Logger s_logger = Logger.getLogger(DedicateGuestVlanRangesTest.class);
@@ -275,7 +274,7 @@ void runDedicateGuestVlanRangeAllocatedVlans() throws Exception {
275274
DataCenterVnetVO dataCenter = new DataCenterVnetVO("2-5", 1L, 1L);
276275
dataCenter.setAccountId(1L);
277276
dataCenterList.add(dataCenter);
278-
when(networkService._dcVnetDao.listAllocatedVnetsInRange(anyLong(), anyLong(), anyInt(), anyInt())).thenReturn(dataCenterList);
277+
when(networkService._dcVnetDao.findVnet(anyLong(), anyLong(), anyString())).thenReturn(dataCenterList);
279278

280279
try {
281280
networkService.dedicateGuestVlanRange(dedicateGuestVlanRangesCmd);
@@ -298,7 +297,8 @@ void runDedicateGuestVlanRangeDedicatedRange() throws Exception {
298297

299298
when(networkService._physicalNetworkDao.findById(anyLong())).thenReturn(physicalNetwork);
300299

301-
when(networkService._dcVnetDao.listAllocatedVnetsInRange(anyLong(), anyLong(), anyInt(), anyInt())).thenReturn(null);
300+
DataCenterVnetVO dataCenterVnetVO = new DataCenterVnetVO("2-5", 1L, 1L);
301+
when(networkService._dcVnetDao.findVnet(anyLong(), anyLong(), anyString())).thenReturn(List.of(dataCenterVnetVO));
302302

303303
List<AccountGuestVlanMapVO> guestVlanMaps = new ArrayList<AccountGuestVlanMapVO>();
304304
AccountGuestVlanMapVO accountGuestVlanMap = new AccountGuestVlanMapVO(1L, 1L);

ui/src/components/header/ProjectMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<span>{{ $t('label.projects') }}</span>
3434
</template>
3535
<span class="custom-suffix-icon">
36-
<ProjectOutlined v-if="!loading" />
36+
<ProjectOutlined v-if="!loading" class="ant-select-suffix" />
3737
<LoadingOutlined v-else />
3838
</span>
3939
</a-tooltip>

ui/src/components/header/SamlDomainSwitcher.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<span>{{ $t('label.domain') }}</span>
3737
</template>
3838
<span class="custom-suffix-icon">
39-
<BlockOutlined v-if="!loading" />
39+
<BlockOutlined v-if="!loading" class="ant-select-suffix" />
4040
<LoadingOutlined v-else />
4141
</span>
4242
</a-tooltip>

ui/src/style/ant-overwrite/ant-form.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@
1818
.ant-form .ant-form-item {
1919
margin-bottom: 6px;
2020
}
21+
22+
.ant-select-arrow .ant-select-suffix svg {
23+
transition: transform .3s, -webkit-transform .3s;
24+
}
25+
26+
.ant-select-open .ant-select-arrow .ant-select-suffix svg {
27+
transform: rotateZ(-180deg);
28+
}

ui/src/views/AutogenView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
:filterOption="(input, option) => {
6565
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
6666
}" >
67-
<template #suffixIcon><filter-outlined /></template>
67+
<template #suffixIcon><filter-outlined class="ant-select-suffix" /></template>
6868
<a-select-option
6969
v-if="['Admin', 'DomainAdmin'].includes($store.getters.userInfo.roletype) && ['vm', 'iso', 'template'].includes($route.name)"
7070
key="all"

ui/src/views/network/UpdateNetwork.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@
9595
:placeholder="apiParams.networkdomain.description"
9696
autoFocus />
9797
</a-form-item>
98-
<a-form-item name="maclearning" ref="maclearning" v-if="resource.redundantrouter">
98+
<a-form-item name="updateinsequence" ref="updateinsequence" v-if="resource.redundantrouter">
9999
<template #label>
100100
<tooltip-label :title="$t('label.updateinsequence')" :tooltip="apiParams.updateinsequence.description"/>
101101
</template>
102-
<a-switch v-model:checked="form.maclearning" />
102+
<a-switch v-model:checked="form.updateinsequence" />
103103
</a-form-item>
104104
<a-form-item name="displaynetwork" ref="displaynetwork" v-if="isAdmin()">
105105
<template #label>

0 commit comments

Comments
 (0)