Skip to content

Commit 3556d74

Browse files
Add copy template flag in zone wizard and remove NFS checks
1 parent 1797f46 commit 3556d74

File tree

4 files changed

+36
-20
lines changed

4 files changed

+36
-20
lines changed

ui/public/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@
590590
"label.copyid": "Copy ID",
591591
"label.copy.password": "Copy password",
592592
"label.copy.templates.from.other.secondary.storages": "Copy templates from other storages instead of fetching from URLs",
593+
"label.copy.templates.from.other.secondary.storages.add.zone": "Copy templates from other storages",
593594
"label.core": "Core",
594595
"label.core.zone.type": "Core Zone type",
595596
"label.counter": "Counter",
@@ -3017,7 +3018,7 @@
30173018
"message.desc.importmigratefromvmwarewizard": "By selecting an existing or external VMware Datacenter and an instance to import, CloudStack migrates the selected instance from VMware to KVM on a conversion host using virt-v2v and imports it into a KVM Cluster",
30183019
"message.desc.primary.storage": "Each Cluster must contain one or more primary storage servers. We will add the first one now. Primary storage contains the disk volumes for all the Instances running on hosts in the cluster. Use any standards-compliant protocol that is supported by the underlying hypervisor.",
30193020
"message.desc.reset.ssh.key.pair": "Please specify a ssh key pair that you would like to add to this Instance.",
3020-
"message.desc.secondary.storage": "Each Zone must have at least one NFS or secondary storage server. We will add the first one now. Secondary storage stores Instance Templates, ISO images, and Instance disk volume Snapshots. This server must be available to all hosts in the zone.<br/><br/>Provide the IP address and exported path.",
3021+
"message.desc.secondary.storage": "Each Zone must have at least one NFS or secondary storage server. We will add the first one now. Secondary storage stores Instance Templates, ISO images, and Instance disk volume Snapshots. This server must be available to all hosts in the zone.<br/><br/>Provide the IP address and exported path.<br/><br/> \"Copy templates from other secondary storages\" checkbox can be used to automatically copy existing templates from secondary storages in other zones instead of fetching from their URLs.",
30213022
"message.desc.register.user.data": "Please fill in the following to register new User Data.",
30223023
"message.desc.registered.user.data": "Registered a User Data.",
30233024
"message.desc.zone": "A Zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. A zone consists of one or more Pods (each of which contains hosts and primary storage servers) and a secondary storage server which is shared by all pods in the zone.",

ui/src/views/infra/AddSecondaryStorage.vue

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
<a-form-item name="zone" ref="zone" :label="$t('label.zone')">
4949
<a-select
5050
v-model:value="form.zone"
51-
@change="() => {
52-
fetchCopyTemplatesConfig()
53-
checkOtherSecondaryStorages()
54-
}"
5551
showSearch
5652
optionFilterProp="label"
5753
:filterOption="(input, option) => {
@@ -163,7 +159,7 @@
163159
<a-input v-model:value="form.secondaryStorageNFSPath"/>
164160
</a-form-item>
165161
</div>
166-
<div v-if="form.provider === 'NFS' && showCopyTemplatesToggle">
162+
<div v-if="showCopyTemplatesToggle">
167163
<a-form-item
168164
name="copyTemplatesFromOtherSecondaryStorages"
169165
ref="copyTemplatesFromOtherSecondaryStorages"
@@ -243,6 +239,8 @@ export default {
243239
},
244240
fetchData () {
245241
this.listZones()
242+
this.fetchCopyTemplatesConfig()
243+
this.checkOtherSecondaryStorages()
246244
},
247245
closeModal () {
248246
this.$emit('close-action')
@@ -274,25 +272,15 @@ export default {
274272
275273
if (this.zones.length > 0) {
276274
this.form.zone = this.zones[0].id || ''
277-
this.fetchCopyTemplatesConfig()
278-
this.checkOtherSecondaryStorages()
279275
}
280276
}
281277
})
282278
},
283279
checkOtherSecondaryStorages () {
284-
api('listImageStores', {
285-
listall: true
286-
}).then(json => {
280+
api('listImageStores', { listall: true }).then(json => {
287281
const stores = json?.listimagestoresresponse?.imagestore || []
288282
289-
this.showCopyTemplatesToggle = stores.some(store => {
290-
if (store.providername !== 'NFS') {
291-
return false
292-
}
293-
294-
return store.zoneid !== this.form.zone || store.zoneid === this.form.zone
295-
})
283+
this.showCopyTemplatesToggle = stores.length > 0
296284
})
297285
},
298286
onCopyTemplatesToggleChanged (val) {
@@ -422,7 +410,6 @@ export default {
422410
}
423411
424412
if (
425-
provider === 'NFS' &&
426413
this.showCopyTemplatesToggle &&
427414
this.copyTemplatesTouched
428415
) {

ui/src/views/infra/zone/ZoneWizardAddResources.vue

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,13 @@ export default {
840840
display: {
841841
secondaryStorageProvider: ['Swift']
842842
}
843+
},
844+
{
845+
title: 'label.copy.templates.from.other.secondary.storages.add.zone',
846+
key: 'copyTemplatesFromOtherSecondaryStorages',
847+
required: false,
848+
switch: true,
849+
checked: this.copytemplate,
843850
}
844851
]
845852
}
@@ -860,7 +867,8 @@ export default {
860867
}],
861868
storageProviders: [],
862869
currentStep: null,
863-
options: ['primaryStorageScope', 'primaryStorageProtocol', 'provider', 'primaryStorageProvider']
870+
options: ['primaryStorageScope', 'primaryStorageProtocol', 'provider', 'primaryStorageProvider'],
871+
copytemplate: true
864872
}
865873
},
866874
created () {
@@ -885,6 +893,7 @@ export default {
885893
primaryStorageScope: null
886894
})
887895
}
896+
this.applyCopyTemplatesOptionFromGlobalSettingDuringSecondaryStorageAddition()
888897
}
889898
},
890899
watch: {
@@ -1108,6 +1117,20 @@ export default {
11081117
this.storageProviders = storageProviders
11091118
})
11101119
},
1120+
applyCopyTemplatesOptionFromGlobalSettingDuringSecondaryStorageAddition () {
1121+
api('listConfigurations', {
1122+
name: 'copy.templates.from.other.secondary.storages'
1123+
}).then(json => {
1124+
const config = json?.listconfigurationsresponse?.configuration?.[0]
1125+
1126+
if (!config || config.value === undefined) {
1127+
return
1128+
}
1129+
1130+
const value = String(config.value).toLowerCase() === 'true'
1131+
this.copytemplate = value
1132+
})
1133+
},
11111134
fetchPrimaryStorageProvider () {
11121135
this.primaryStorageProviders = []
11131136
api('listStorageProviders', { type: 'primary' }).then(json => {

ui/src/views/infra/zone/ZoneWizardLaunchZone.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,11 @@ export default {
15801580
params.provider = this.prefillContent.secondaryStorageProvider
15811581
params.zoneid = this.stepData.zoneReturned.id
15821582
params.url = url
1583+
if (this.prefillContent.copyTemplatesFromOtherSecondaryStorages !== undefined) {
1584+
params['details[0].key'] = 'copytemplatesfromothersecondarystorages'
1585+
params['details[0].value'] =
1586+
this.prefillContent.copyTemplatesFromOtherSecondaryStorages
1587+
}
15831588
} else if (this.prefillContent.secondaryStorageProvider === 'SMB') {
15841589
const nfsServer = this.prefillContent.secondaryStorageServer
15851590
const path = this.prefillContent.secondaryStoragePath

0 commit comments

Comments
 (0)