allow domain suffix update in shared networks (#9585)

* allow domeain suffix update in shared networks

* add network domain edit for shared networks to UI
This commit is contained in:
dahn 2024-09-11 14:57:53 +02:00 committed by GitHub
parent 68f459b334
commit b19c069ade
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 4 deletions

View File

@ -3145,8 +3145,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
} }
// network offering and domain suffix can be updated for Isolated networks only in 3.0 // network offering and domain suffix can be updated for Isolated networks only in 3.0
if ((networkOfferingId != null || domainSuffix != null) && network.getGuestType() != GuestType.Isolated) { if (networkOfferingId != null && network.getGuestType() != GuestType.Isolated) {
throw new InvalidParameterValueException("NetworkOffering and domain suffix upgrade can be performed for Isolated networks only"); throw new InvalidParameterValueException("NetworkOffering update can be performed for Isolated networks only.");
}
// network offering and domain suffix can be updated for Isolated networks only in 3.0
if (domainSuffix != null && ! Arrays.asList(GuestType.Isolated, GuestType.Shared).contains(network.getGuestType())) {
throw new InvalidParameterValueException("Domain suffix update can only be performed for Isolated and shared networks.");
} }
boolean networkOfferingChanged = false; boolean networkOfferingChanged = false;

View File

@ -141,7 +141,7 @@
</template> </template>
<a-switch v-model:checked="form.changecidr" /> <a-switch v-model:checked="form.changecidr" />
</a-form-item> </a-form-item>
<a-form-item name="networkdomain" ref="networkdomain" v-if="isUpdatingIsolatedNetwork"> <a-form-item name="networkdomain" ref="networkdomain" v-if="hasNetworkDomain">
<template #label> <template #label>
<tooltip-label :title="$t('label.networkdomain')" :tooltip="apiParams.guestvmcidr.description"/> <tooltip-label :title="$t('label.networkdomain')" :tooltip="apiParams.guestvmcidr.description"/>
</template> </template>
@ -274,7 +274,7 @@ export default {
ip6dns1: this.resource.ip6dns1, ip6dns1: this.resource.ip6dns1,
ip6dns2: this.resource.ip6dns2 ip6dns2: this.resource.ip6dns2
} }
if (this.isUpdatingIsolatedNetwork) { if (this.hasNetworkDomain) {
this.resourceValues.networkdomain = this.resource.networkdomain this.resourceValues.networkdomain = this.resource.networkdomain
} }
for (var field in this.resourceValues) { for (var field in this.resourceValues) {
@ -289,6 +289,12 @@ export default {
isUpdatingIsolatedNetwork () { isUpdatingIsolatedNetwork () {
return this.resource && this.resource.type === 'Isolated' return this.resource && this.resource.type === 'Isolated'
}, },
isUpdatingSharedNetwork () {
return this.resource && this.resource.type === 'Shared'
},
hasNetworkDomain () {
return this.isUpdatingIsolatedNetwork || this.isUpdatingSharedNetwork
},
selectedNetworkOfferingSupportsDns () { selectedNetworkOfferingSupportsDns () {
if (this.networkOffering) { if (this.networkOffering) {
const services = this.networkOffering?.service || [] const services = this.networkOffering?.service || []