Skip to content

Commit

Permalink
allow domain suffix update in shared networks (#9585)
Browse files Browse the repository at this point in the history
* allow domeain suffix update in shared networks

* add network domain edit for shared networks to UI
  • Loading branch information
DaanHoogland authored Sep 11, 2024
1 parent 68f459b commit b19c069
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3145,8 +3145,12 @@ public Network updateGuestNetwork(final UpdateNetworkCmd cmd) {
}

// network offering and domain suffix can be updated for Isolated networks only in 3.0
if ((networkOfferingId != null || domainSuffix != null) && network.getGuestType() != GuestType.Isolated) {
throw new InvalidParameterValueException("NetworkOffering and domain suffix upgrade can be performed for Isolated networks only");
if (networkOfferingId != null && network.getGuestType() != GuestType.Isolated) {
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;
Expand Down
10 changes: 8 additions & 2 deletions ui/src/views/network/UpdateNetwork.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
</template>
<a-switch v-model:checked="form.changecidr" />
</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>
<tooltip-label :title="$t('label.networkdomain')" :tooltip="apiParams.guestvmcidr.description"/>
</template>
Expand Down Expand Up @@ -274,7 +274,7 @@ export default {
ip6dns1: this.resource.ip6dns1,
ip6dns2: this.resource.ip6dns2
}
if (this.isUpdatingIsolatedNetwork) {
if (this.hasNetworkDomain) {
this.resourceValues.networkdomain = this.resource.networkdomain
}
for (var field in this.resourceValues) {
Expand All @@ -289,6 +289,12 @@ export default {
isUpdatingIsolatedNetwork () {
return this.resource && this.resource.type === 'Isolated'
},
isUpdatingSharedNetwork () {
return this.resource && this.resource.type === 'Shared'
},
hasNetworkDomain () {
return this.isUpdatingIsolatedNetwork || this.isUpdatingSharedNetwork
},
selectedNetworkOfferingSupportsDns () {
if (this.networkOffering) {
const services = this.networkOffering?.service || []
Expand Down

0 comments on commit b19c069

Please sign in to comment.