Skip to content

Commit bb42a47

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
bugfix/CSTACKEX-135: added Netapp ontap screen during zone creation
1 parent ea40967 commit bb42a47

3 files changed

Lines changed: 84 additions & 5 deletions

File tree

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ export default {
215215
message: this.$t(field.message)
216216
})
217217
}
218+
if (field.number) {
219+
this.rules[field.key].push({
220+
validator: this.checkNumberFormat,
221+
message: this.$t('message.error.number')
222+
})
223+
}
218224
},
219225
getPrefilled (field) {
220226
if (field.key === 'authmethod' && this.hypervisor !== 'KVM') {
@@ -247,6 +253,15 @@ export default {
247253
return Promise.resolve()
248254
}
249255
},
256+
async checkNumberFormat (rule, value) {
257+
if (!value || value === '') {
258+
return Promise.resolve()
259+
} else if (!/^\d+$/.test(String(value).replace(/,/g, ''))) {
260+
return Promise.reject(rule.message)
261+
} else {
262+
return Promise.resolve()
263+
}
264+
},
250265
isDisplayInput (field) {
251266
if (!field.display && !field.hidden) {
252267
return true

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

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,14 +589,14 @@ export default {
589589
title: 'label.capacityiops',
590590
key: 'capacityIops',
591591
hidden: {
592-
provider: ['DefaultPrimary', 'PowerFlex', 'Linstor']
592+
provider: ['DefaultPrimary', 'PowerFlex', 'Linstor', 'NetApp ONTAP']
593593
}
594594
},
595595
{
596596
title: 'label.url',
597597
key: 'url',
598598
hidden: {
599-
provider: ['DefaultPrimary', 'PowerFlex', 'Linstor']
599+
provider: ['DefaultPrimary', 'PowerFlex', 'Linstor', 'NetApp ONTAP']
600600
}
601601
},
602602
{
@@ -636,6 +636,43 @@ export default {
636636
provider: 'PowerFlex'
637637
}
638638
},
639+
{
640+
title: 'label.ontap.ip',
641+
key: 'ontapIP',
642+
required: true,
643+
placeHolder: 'message.error.input.value',
644+
display: {
645+
provider: 'NetApp ONTAP'
646+
}
647+
},
648+
{
649+
title: 'label.username',
650+
key: 'ontapUsername',
651+
required: true,
652+
placeHolder: 'message.error.input.value',
653+
display: {
654+
provider: 'NetApp ONTAP'
655+
}
656+
},
657+
{
658+
title: 'label.password',
659+
key: 'ontapPassword',
660+
required: true,
661+
placeHolder: 'message.error.input.value',
662+
password: true,
663+
display: {
664+
provider: 'NetApp ONTAP'
665+
}
666+
},
667+
{
668+
title: 'label.ontap.svm.name',
669+
key: 'ontapSvmName',
670+
required: true,
671+
placeHolder: 'message.error.input.value',
672+
display: {
673+
provider: 'NetApp ONTAP'
674+
}
675+
},
639676
{
640677
title: 'label.storage.tags',
641678
key: 'primaryStorageTags',
@@ -909,9 +946,9 @@ export default {
909946
},
910947
watch: {
911948
'prefillContent.provider' (newVal, oldVal) {
912-
if (['SolidFire', 'PowerFlex'].includes(newVal) && !['SolidFire', 'PowerFlex'].includes(oldVal)) {
949+
if (['SolidFire', 'PowerFlex', 'NetApp ONTAP'].includes(newVal) && !['SolidFire', 'PowerFlex', 'NetApp ONTAP'].includes(oldVal)) {
913950
this.$emit('fieldsChanged', { primaryStorageProtocol: undefined })
914-
} else if (!['SolidFire', 'PowerFlex'].includes(newVal) && ['SolidFire', 'PowerFlex'].includes(oldVal)) {
951+
} else if (!['SolidFire', 'PowerFlex', 'NetApp ONTAP'].includes(newVal) && ['SolidFire', 'PowerFlex', 'NetApp ONTAP'].includes(oldVal)) {
915952
this.$emit('fieldsChanged', { primaryStorageProtocol: undefined })
916953
}
917954
@@ -996,6 +1033,17 @@ export default {
9961033
this.primaryStorageScopes = scope
9971034
},
9981035
fetchProtocol () {
1036+
const provider = this.prefillContent?.provider || null
1037+
if (provider === 'NetApp ONTAP') {
1038+
this.primaryStorageProtocols = [
1039+
{ id: 'NFS3', description: 'NFS3' },
1040+
{ id: 'ISCSI', description: 'ISCSI' }
1041+
]
1042+
if (!['NFS3', 'ISCSI'].includes(this.prefillContent?.primaryStorageProtocol)) {
1043+
this.$emit('fieldsChanged', { primaryStorageProtocol: 'NFS3' })
1044+
}
1045+
return
1046+
}
9991047
const hypervisor = this.prefillContent?.hypervisor || null
10001048
const protocols = []
10011049
if (hypervisor === 'KVM') {

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ export default {
15841584
}
15851585
15861586
params.url = url
1587-
if (this.prefillContent.provider !== 'DefaultPrimary' && this.prefillContent.provider !== 'PowerFlex') {
1587+
if (this.prefillContent.provider !== 'DefaultPrimary' && this.prefillContent.provider !== 'PowerFlex' && this.prefillContent.provider !== 'NetApp ONTAP') {
15881588
if (this.prefillContent.managed) {
15891589
params.managed = true
15901590
} else {
@@ -1604,6 +1604,18 @@ export default {
16041604
params.url = this.powerflexURL(this.prefillContent.powerflexGateway, this.prefillContent.powerflexGatewayUsername,
16051605
this.prefillContent.powerflexGatewayPassword, this.prefillContent.powerflexStoragePool)
16061606
}
1607+
if (this.prefillContent.provider === 'NetApp ONTAP') {
1608+
params['details[0].storageIP'] = this.prefillContent.ontapIP
1609+
params['details[0].username'] = this.prefillContent.ontapUsername
1610+
params['details[0].password'] = btoa(this.prefillContent.ontapPassword)
1611+
params['details[0].svmName'] = this.prefillContent.ontapSvmName
1612+
params['details[0].protocol'] = this.prefillContent.primaryStorageProtocol
1613+
params.managed = true
1614+
params.url = this.ontapURL(this.prefillContent.ontapIP)
1615+
if (this.prefillContent.capacityBytes && this.prefillContent.capacityBytes.length > 0) {
1616+
params.capacityBytes = this.prefillContent.capacityBytes.split(',').join('')
1617+
}
1618+
}
16071619
16081620
params.tags = this.prefillContent?.primaryStorageTags || ''
16091621
@@ -2486,6 +2498,10 @@ export default {
24862498
var url = 'powerflex://' + encodeURIComponent(username) + ':' + encodeURIComponent(password) + '@' +
24872499
gateway + '/' + encodeURIComponent(pool)
24882500
return url
2501+
},
2502+
ontapURL (ontapIp) {
2503+
var url = 'https://' + ontapIp
2504+
return url
24892505
}
24902506
}
24912507
}

0 commit comments

Comments
 (0)