Skip to content

Commit 97d6cd5

Browse files
Merge branch '4.16' into main
2 parents 7f000f5 + f639f56 commit 97d6cd5

4 files changed

Lines changed: 44 additions & 15 deletions

File tree

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
import com.cloud.vm.dao.UserVmDao;
165165

166166
import static com.cloud.storage.resource.StorageProcessor.REQUEST_TEMPLATE_RELOAD;
167+
import java.util.Date;
167168

168169
public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrationService, Configurable {
169170

@@ -1975,6 +1976,7 @@ public DiskProfile importVolume(Type type, String name, DiskOffering offering, L
19751976
vol.setPath(path);
19761977
vol.setChainInfo(chainInfo);
19771978
vol.setState(Volume.State.Ready);
1979+
vol.setAttached(new Date());
19781980
vol = _volsDao.persist(vol);
19791981
return toDiskProfile(vol, offering);
19801982
}

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,12 +1357,9 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapac
13571357

13581358
performBasicPrivateVlanChecks(vlanId, secondaryVlanId, privateVlanType);
13591359

1360-
// Regular user can create Guest Isolated Source Nat enabled network only
1361-
if (_accountMgr.isNormalUser(caller.getId()) && (ntwkOff.getTrafficType() != TrafficType.Guest
1362-
|| ntwkOff.getGuestType() != Network.GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) {
1363-
throw new InvalidParameterValueException(
1364-
String.format("Regular users can only create a network from network offerings having traffic type [%s] and network type [%s] with a service [%s] enabled.", TrafficType.Guest,
1365-
Network.GuestType.Isolated, Service.SourceNat.getName()));
1360+
// Regular user can create Guest Isolated Source Nat enabled network or L2 network only
1361+
if (_accountMgr.isNormalUser(caller.getId())) {
1362+
validateNetworkOfferingForRegularUser(ntwkOff);
13661363
}
13671364

13681365
// Don't allow to specify vlan if the caller is not ROOT admin
@@ -1454,6 +1451,23 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapac
14541451
return network;
14551452
}
14561453

1454+
private void validateNetworkOfferingForRegularUser(NetworkOfferingVO ntwkOff) {
1455+
if (ntwkOff.getTrafficType() != TrafficType.Guest) {
1456+
throw new InvalidParameterValueException("Regular users can only create a Guest network");
1457+
}
1458+
if (ntwkOff.getGuestType() == GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat)) {
1459+
s_logger.debug(String.format("Creating a network from network offerings having traffic type [%s] and network type [%s] with a service [%s] enabled.",
1460+
TrafficType.Guest, GuestType.Isolated, Service.SourceNat.getName()));
1461+
} else if (ntwkOff.getGuestType() == GuestType.L2) {
1462+
s_logger.debug(String.format("Creating a network from network offerings having traffic type [%s] and network type [%s].",
1463+
TrafficType.Guest, GuestType.L2));
1464+
} else {
1465+
throw new InvalidParameterValueException(
1466+
String.format("Regular users can only create an %s network with a service [%s] enabled, or a %s network.",
1467+
GuestType.Isolated, Service.SourceNat.getName(), GuestType.L2));
1468+
}
1469+
}
1470+
14571471
/**
14581472
* Retrieve information (if set) for private VLAN when creating the network
14591473
*/

ui/src/config/section/config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,16 @@ export default {
5151
label: 'label.remove.ldap',
5252
message: 'message.remove.ldap',
5353
dataView: true,
54-
args: ['hostname'],
54+
args: ['hostname', 'port', 'domainid'],
5555
mapping: {
5656
hostname: {
5757
value: (record) => { return record.hostname }
58+
},
59+
port: {
60+
value: (record) => { return record.port }
61+
},
62+
domainid: {
63+
value: (record) => { return record.domainid }
5864
}
5965
}
6066
}

ui/src/views/infra/HostAdd.vue

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
initialValue: authMethod
124124
}]"
125125
buttonStyle="solid"
126-
:defaultValue="authMethod"
127126
@change="selected => { handleAuthMethodChange(selected.target.value) }">
128127
<a-radio-button value="password">
129128
{{ $t('label.password') }}
@@ -321,22 +320,24 @@ export default {
321320
this.loading = true
322321
api('listZones', { showicon: true }).then(response => {
323322
this.zonesList = response.listzonesresponse.zone || []
324-
this.zoneId = this.zonesList[0].id || null
325-
this.fetchPods()
323+
this.zoneId = this.zonesList[0]?.id || null
324+
this.fetchPods(this.zoneId)
326325
}).catch(error => {
327326
this.$notifyError(error)
328327
}).finally(() => {
329328
this.loading = false
330329
})
331330
},
332-
fetchPods () {
331+
fetchPods (zoneId) {
332+
this.zoneId = zoneId
333333
this.loading = true
334334
api('listPods', {
335335
zoneid: this.zoneId
336336
}).then(response => {
337337
this.podsList = response.listpodsresponse.pod || []
338-
this.podId = this.podsList[0].id || null
339-
this.fetchClusters()
338+
this.podId = this.podsList[0]?.id || null
339+
this.form.setFieldsValue({ podid: this.podId })
340+
this.fetchClusters(this.podId)
340341
}).catch(error => {
341342
this.$notifyError(error)
342343
this.podsList = []
@@ -345,13 +346,19 @@ export default {
345346
this.loading = false
346347
})
347348
},
348-
fetchClusters () {
349+
fetchClusters (podId) {
350+
this.form.clearField('clusterid')
351+
this.clusterId = null
352+
this.clustersList = []
353+
if (!podId) return
354+
this.podId = podId
349355
this.loading = true
350356
api('listClusters', {
351357
podid: this.podId
352358
}).then(response => {
353359
this.clustersList = response.listclustersresponse.cluster || []
354-
this.clusterId = this.clustersList[0].id || null
360+
this.clusterId = this.clustersList[0]?.id || null
361+
this.form.setFieldsValue({ clusterid: this.clusterId })
355362
if (this.clusterId) {
356363
this.handleChangeCluster(this.clusterId)
357364
}

0 commit comments

Comments
 (0)