Add copy template flag in zone wizard and remove NFS checks

This commit is contained in:
Harikrishna Patnala 2025-12-29 14:44:01 +05:30
parent 8edf96fab8
commit 555e6b36ca
4 changed files with 36 additions and 20 deletions

View File

@ -590,6 +590,7 @@
"label.copyid": "Copy ID",
"label.copy.password": "Copy password",
"label.copy.templates.from.other.secondary.storages": "Copy templates from other storages instead of fetching from URLs",
"label.copy.templates.from.other.secondary.storages.add.zone": "Copy templates from other storages",
"label.core": "Core",
"label.core.zone.type": "Core Zone type",
"label.counter": "Counter",
@ -3017,7 +3018,7 @@
"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",
"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.",
"message.desc.reset.ssh.key.pair": "Please specify a ssh key pair that you would like to add to this Instance.",
"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.",
"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.",
"message.desc.register.user.data": "Please fill in the following to register new User Data.",
"message.desc.registered.user.data": "Registered a User Data.",
"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.",

View File

@ -48,10 +48,6 @@
<a-form-item name="zone" ref="zone" :label="$t('label.zone')">
<a-select
v-model:value="form.zone"
@change="() => {
fetchCopyTemplatesConfig()
checkOtherSecondaryStorages()
}"
showSearch
optionFilterProp="label"
:filterOption="(input, option) => {
@ -163,7 +159,7 @@
<a-input v-model:value="form.secondaryStorageNFSPath"/>
</a-form-item>
</div>
<div v-if="form.provider === 'NFS' && showCopyTemplatesToggle">
<div v-if="showCopyTemplatesToggle">
<a-form-item
name="copyTemplatesFromOtherSecondaryStorages"
ref="copyTemplatesFromOtherSecondaryStorages"
@ -243,6 +239,8 @@ export default {
},
fetchData () {
this.listZones()
this.fetchCopyTemplatesConfig()
this.checkOtherSecondaryStorages()
},
closeModal () {
this.$emit('close-action')
@ -274,25 +272,15 @@ export default {
if (this.zones.length > 0) {
this.form.zone = this.zones[0].id || ''
this.fetchCopyTemplatesConfig()
this.checkOtherSecondaryStorages()
}
}
})
},
checkOtherSecondaryStorages () {
api('listImageStores', {
listall: true
}).then(json => {
api('listImageStores', { listall: true }).then(json => {
const stores = json?.listimagestoresresponse?.imagestore || []
this.showCopyTemplatesToggle = stores.some(store => {
if (store.providername !== 'NFS') {
return false
}
return store.zoneid !== this.form.zone || store.zoneid === this.form.zone
})
this.showCopyTemplatesToggle = stores.length > 0
})
},
onCopyTemplatesToggleChanged (val) {
@ -422,7 +410,6 @@ export default {
}
if (
provider === 'NFS' &&
this.showCopyTemplatesToggle &&
this.copyTemplatesTouched
) {

View File

@ -840,6 +840,13 @@ export default {
display: {
secondaryStorageProvider: ['Swift']
}
},
{
title: 'label.copy.templates.from.other.secondary.storages.add.zone',
key: 'copyTemplatesFromOtherSecondaryStorages',
required: false,
switch: true,
checked: this.copytemplate,
}
]
}
@ -860,7 +867,8 @@ export default {
}],
storageProviders: [],
currentStep: null,
options: ['primaryStorageScope', 'primaryStorageProtocol', 'provider', 'primaryStorageProvider']
options: ['primaryStorageScope', 'primaryStorageProtocol', 'provider', 'primaryStorageProvider'],
copytemplate: true
}
},
created () {
@ -885,6 +893,7 @@ export default {
primaryStorageScope: null
})
}
this.applyCopyTemplatesOptionFromGlobalSettingDuringSecondaryStorageAddition()
}
},
watch: {
@ -1108,6 +1117,20 @@ export default {
this.storageProviders = storageProviders
})
},
applyCopyTemplatesOptionFromGlobalSettingDuringSecondaryStorageAddition () {
api('listConfigurations', {
name: 'copy.templates.from.other.secondary.storages'
}).then(json => {
const config = json?.listconfigurationsresponse?.configuration?.[0]
if (!config || config.value === undefined) {
return
}
const value = String(config.value).toLowerCase() === 'true'
this.copytemplate = value
})
},
fetchPrimaryStorageProvider () {
this.primaryStorageProviders = []
api('listStorageProviders', { type: 'primary' }).then(json => {

View File

@ -1580,6 +1580,11 @@ export default {
params.provider = this.prefillContent.secondaryStorageProvider
params.zoneid = this.stepData.zoneReturned.id
params.url = url
if (this.prefillContent.copyTemplatesFromOtherSecondaryStorages !== undefined) {
params['details[0].key'] = 'copytemplatesfromothersecondarystorages'
params['details[0].value'] =
this.prefillContent.copyTemplatesFromOtherSecondaryStorages
}
} else if (this.prefillContent.secondaryStorageProvider === 'SMB') {
const nfsServer = this.prefillContent.secondaryStorageServer
const path = this.prefillContent.secondaryStoragePath