Merge branch '4.16' into main

This commit is contained in:
Suresh Kumar Anaparti 2022-01-21 19:59:35 +05:30
commit 97d6cd50a0
No known key found for this signature in database
GPG Key ID: D7CEAE3A9E71D0AA
4 changed files with 44 additions and 15 deletions

View File

@ -164,6 +164,7 @@ import com.cloud.vm.dao.UserVmCloneSettingDao;
import com.cloud.vm.dao.UserVmDao;
import static com.cloud.storage.resource.StorageProcessor.REQUEST_TEMPLATE_RELOAD;
import java.util.Date;
public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrationService, Configurable {
@ -1975,6 +1976,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
vol.setPath(path);
vol.setChainInfo(chainInfo);
vol.setState(Volume.State.Ready);
vol.setAttached(new Date());
vol = _volsDao.persist(vol);
return toDiskProfile(vol, offering);
}

View File

@ -1357,12 +1357,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
performBasicPrivateVlanChecks(vlanId, secondaryVlanId, privateVlanType);
// Regular user can create Guest Isolated Source Nat enabled network only
if (_accountMgr.isNormalUser(caller.getId()) && (ntwkOff.getTrafficType() != TrafficType.Guest
|| ntwkOff.getGuestType() != Network.GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) {
throw new InvalidParameterValueException(
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,
Network.GuestType.Isolated, Service.SourceNat.getName()));
// Regular user can create Guest Isolated Source Nat enabled network or L2 network only
if (_accountMgr.isNormalUser(caller.getId())) {
validateNetworkOfferingForRegularUser(ntwkOff);
}
// Don't allow to specify vlan if the caller is not ROOT admin
@ -1454,6 +1451,23 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
return network;
}
private void validateNetworkOfferingForRegularUser(NetworkOfferingVO ntwkOff) {
if (ntwkOff.getTrafficType() != TrafficType.Guest) {
throw new InvalidParameterValueException("Regular users can only create a Guest network");
}
if (ntwkOff.getGuestType() == GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat)) {
s_logger.debug(String.format("Creating a network from network offerings having traffic type [%s] and network type [%s] with a service [%s] enabled.",
TrafficType.Guest, GuestType.Isolated, Service.SourceNat.getName()));
} else if (ntwkOff.getGuestType() == GuestType.L2) {
s_logger.debug(String.format("Creating a network from network offerings having traffic type [%s] and network type [%s].",
TrafficType.Guest, GuestType.L2));
} else {
throw new InvalidParameterValueException(
String.format("Regular users can only create an %s network with a service [%s] enabled, or a %s network.",
GuestType.Isolated, Service.SourceNat.getName(), GuestType.L2));
}
}
/**
* Retrieve information (if set) for private VLAN when creating the network
*/

View File

@ -51,10 +51,16 @@ export default {
label: 'label.remove.ldap',
message: 'message.remove.ldap',
dataView: true,
args: ['hostname'],
args: ['hostname', 'port', 'domainid'],
mapping: {
hostname: {
value: (record) => { return record.hostname }
},
port: {
value: (record) => { return record.port }
},
domainid: {
value: (record) => { return record.domainid }
}
}
}

View File

@ -123,7 +123,6 @@
initialValue: authMethod
}]"
buttonStyle="solid"
:defaultValue="authMethod"
@change="selected => { handleAuthMethodChange(selected.target.value) }">
<a-radio-button value="password">
{{ $t('label.password') }}
@ -321,22 +320,24 @@ export default {
this.loading = true
api('listZones', { showicon: true }).then(response => {
this.zonesList = response.listzonesresponse.zone || []
this.zoneId = this.zonesList[0].id || null
this.fetchPods()
this.zoneId = this.zonesList[0]?.id || null
this.fetchPods(this.zoneId)
}).catch(error => {
this.$notifyError(error)
}).finally(() => {
this.loading = false
})
},
fetchPods () {
fetchPods (zoneId) {
this.zoneId = zoneId
this.loading = true
api('listPods', {
zoneid: this.zoneId
}).then(response => {
this.podsList = response.listpodsresponse.pod || []
this.podId = this.podsList[0].id || null
this.fetchClusters()
this.podId = this.podsList[0]?.id || null
this.form.setFieldsValue({ podid: this.podId })
this.fetchClusters(this.podId)
}).catch(error => {
this.$notifyError(error)
this.podsList = []
@ -345,13 +346,19 @@ export default {
this.loading = false
})
},
fetchClusters () {
fetchClusters (podId) {
this.form.clearField('clusterid')
this.clusterId = null
this.clustersList = []
if (!podId) return
this.podId = podId
this.loading = true
api('listClusters', {
podid: this.podId
}).then(response => {
this.clustersList = response.listclustersresponse.cluster || []
this.clusterId = this.clustersList[0].id || null
this.clusterId = this.clustersList[0]?.id || null
this.form.setFieldsValue({ clusterid: this.clusterId })
if (this.clusterId) {
this.handleChangeCluster(this.clusterId)
}