@@ -312,9 +313,12 @@ export default {
if (this.hypervisorType === 'KVM') {
this.protocols = ['nfs', 'SharedMountPoint', 'RBD', 'CLVM', 'Gluster', 'custom']
} else if (this.hypervisorType === 'XenServer') {
- this.protocols = ['nfs', 'preSetup', 'iscsi', 'custom']
+ this.protocols = ['nfs', 'PreSetup', 'iscsi', 'custom']
} else if (this.hypervisorType === 'VMware') {
this.protocols = ['nfs', 'vmfs', 'custom']
+ if ('importVsphereStoragePolicies' in this.$store.getters.apis) {
+ this.protocols = ['nfs', 'PreSetup', 'datastorecluster', 'custom']
+ }
} else if (this.hypervisorType === 'Hyperv') {
this.protocols = ['SMB']
} else if (this.hypervisorType === 'Ovm') {
@@ -358,6 +362,15 @@ export default {
}
return url
},
+ datastoreclusterURL (server, path) {
+ var url
+ if (server.indexOf('://') === -1) {
+ url = 'datastorecluster://' + server + path
+ } else {
+ url = server + path
+ }
+ return url
+ },
ocfs2URL (server, path) {
var url
if (server.indexOf('://') === -1) {
@@ -475,8 +488,22 @@ export default {
Object.keys(smbParams).forEach((key, index) => {
params['details[' + index.toString() + '].' + key] = smbParams[key]
})
- } else if (values.protocol === 'PreSetup') {
+ } else if (values.protocol === 'PreSetup' && values.hypervisor !== 'VMware') {
url = this.presetupURL(server, path)
+ } else if (values.protocol === 'PreSetup' && values.hypervisor === 'VMware') {
+ path = values.vCenterDataCenter
+ if (path.substring(0, 1) !== '/') {
+ path = '/' + path
+ }
+ path += '/' + values.vCenterDataStore
+ url = this.presetupURL(server, path)
+ } else if (values.protocol === 'datastorecluster' && values.hypervisor === 'VMware') {
+ path = values.vCenterDataCenter
+ if (path.substring(0, 1) !== '/') {
+ path = '/' + path
+ }
+ path += '/' + values.vCenterDataStore
+ url = this.datastoreclusterURL(server, path)
} else if (values.protocol === 'ocfs2') {
url = this.ocfs2URL(server, path)
} else if (values.protocol === 'SharedMountPoint') {
diff --git a/ui/src/views/offering/AddComputeOffering.vue b/ui/src/views/offering/AddComputeOffering.vue
index 5de5205ddaf..80b7c41170d 100644
--- a/ui/src/views/offering/AddComputeOffering.vue
+++ b/ui/src/views/offering/AddComputeOffering.vue
@@ -688,6 +688,7 @@
:filterOption="(input, option) => {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
+ @select="val => fetchvSphereStoragePolicies(val)"
:loading="zoneLoading"
:placeholder="this.$t('label.zoneid')">
@@ -695,6 +696,21 @@
+
+
+ {{ $t('label.vmware.storage.policy') }}
+
+
+
+
+
+
+ {{ policy.name || policy.id }}
+
+
+
{{ this.$t('label.cancel') }}
@@ -727,9 +743,11 @@ export default {
domains: [],
domainLoading: false,
selectedZones: [],
+ selectedZoneIndex: [],
zones: [],
zoneLoading: false,
selectedDeployementPlanner: null,
+ storagePolicies: null,
storageTags: [],
storageTagLoading: false,
deploymentPlanners: [],
@@ -760,7 +778,11 @@ export default {
}
},
beforeCreate () {
- this.form = this.$form.createForm(this)
+ this.form = this.$form.createForm(this, {
+ onValuesChange: (_, values) => {
+ this.selectedZoneIndex = values.zoneid
+ }
+ })
this.apiParams = {}
var apiConfig = this.$store.getters.apis.createServiceOffering || {}
apiConfig.params.forEach(param => {
@@ -848,6 +870,21 @@ export default {
this.deploymentPlannerLoading = false
})
},
+ fetchvSphereStoragePolicies (zoneIndex) {
+ if (zoneIndex === 0 || this.selectedZoneIndex.length > 1) {
+ this.storagePolicies = null
+ return
+ }
+ const zoneid = this.zones[zoneIndex].id
+ if ('importVsphereStoragePolicies' in this.$store.getters.apis) {
+ this.storagePolicies = []
+ api('listVsphereStoragePolicies', {
+ zoneid: zoneid
+ }).then(response => {
+ this.storagePolicies = response.listvspherestoragepoliciesresponse.StoragePolicy || []
+ })
+ }
+ },
handleStorageTypeChange (val) {
this.storageType = val
},
@@ -1016,6 +1053,9 @@ export default {
if (zoneId) {
params.zoneid = zoneId
}
+ if (values.storagepolicy) {
+ params.storagepolicy = values.storagepolicy
+ }
api('createServiceOffering', params).then(json => {
const message = this.isSystem
? `${this.$t('message.create.service.offering')}: `
diff --git a/ui/src/views/offering/AddDiskOffering.vue b/ui/src/views/offering/AddDiskOffering.vue
index 0a5ddaf86b8..a38fc57f980 100644
--- a/ui/src/views/offering/AddDiskOffering.vue
+++ b/ui/src/views/offering/AddDiskOffering.vue
@@ -398,6 +398,7 @@
:filterOption="(input, option) => {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
+ @select="val => fetchvSphereStoragePolicies(val)"
:loading="zoneLoading"
:placeholder="this.$t('label.zoneid')">
@@ -405,6 +406,21 @@
+
+
+ {{ $t('label.vmware.storage.policy') }}
+
+
+
+
+
+
+ {{ policy.name || policy.id }}
+
+
+