Merge branch '4.17'

This commit is contained in:
nvazquez 2022-06-08 08:56:04 -03:00
commit 7526c5fc08
No known key found for this signature in database
GPG Key ID: 656E1BCC8CB54F84
3 changed files with 28 additions and 17 deletions

View File

@ -3840,6 +3840,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
rootDiskOfferingId = diskOfferingId;
diskOfferingId = null;
}
if (!customParameters.containsKey(VmDetailConstants.ROOT_DISK_SIZE)) {
customParameters.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(diskSize));
}
}
if (!offering.getDiskOfferingStrictness() && overrideDiskOfferingId != null) {
rootDiskOfferingId = overrideDiskOfferingId;

View File

@ -332,18 +332,8 @@ export default {
label: 'label.action.create.volume',
dataView: true,
show: (record) => { return record.state === 'BackedUp' },
args: (record, store) => {
var fields = ['snapshotid', 'name']
if (record.volumetype === 'ROOT') {
fields.push('diskofferingid')
}
return fields
},
mapping: {
snapshotid: {
value: (record) => { return record.id }
}
}
popup: true,
component: shallowRef(defineAsyncComponent(() => import('@/views/storage/CreateVolume.vue')))
},
{
api: 'revertSnapshot',

View File

@ -35,7 +35,7 @@
v-model:value="form.name"
:placeholder="apiParams.name.description" />
</a-form-item>
<a-form-item ref="zoneid" name="zoneid">
<a-form-item ref="zoneid" name="zoneid" v-if="!createVolumeFromSnapshot">
<template #label>
<tooltip-label :title="$t('label.zoneid')" :tooltip="apiParams.zoneid.description"/>
</template>
@ -62,7 +62,7 @@
</a-select-option>
</a-select>
</a-form-item>
<a-form-item ref="diskofferingid" name="diskofferingid">
<a-form-item ref="diskofferingid" name="diskofferingid" v-if="!createVolumeFromSnapshot || (createVolumeFromSnapshot && resource.volumetype === 'ROOT')">
<template #label>
<tooltip-label :title="$t('label.diskofferingid')" :tooltip="apiParams.diskofferingid.description || 'Disk Offering'"/>
</template>
@ -134,6 +134,12 @@ export default {
ResourceIcon,
TooltipLabel
},
props: {
resource: {
type: Object,
default: () => {}
}
},
data () {
return {
zones: [],
@ -143,6 +149,11 @@ export default {
isCustomizedDiskIOps: false
}
},
computed: {
createVolumeFromSnapshot () {
return this.$route.path.startsWith('/snapshot')
}
},
beforeCreate () {
this.apiParams = this.$getApiParams('createVolume')
},
@ -155,9 +166,7 @@ export default {
this.formRef = ref()
this.form = reactive({})
this.rules = reactive({
name: [{ required: true, message: this.$t('message.error.volume.name') }],
zoneid: [{ required: true, message: this.$t('message.error.zone') }],
diskofferingid: [{ required: true, message: this.$t('message.error.select') }],
size: [{ required: true, message: this.$t('message.error.custom.disk.size') }],
miniops: [{
validator: async (rule, value) => {
@ -176,6 +185,10 @@ export default {
}
}]
})
if (!this.createVolumeFromSnapshot) {
this.rules.name = [{ required: true, message: this.$t('message.error.volume.name') }]
this.rules.diskofferingid = [{ required: true, message: this.$t('message.error.select') }]
}
},
fetchData () {
this.loading = true
@ -194,7 +207,9 @@ export default {
listall: true
}).then(json => {
this.offerings = json.listdiskofferingsresponse.diskoffering || []
this.form.diskofferingid = this.offerings[0].id || ''
if (!this.createVolumeFromSnapshot) {
this.form.diskofferingid = this.offerings[0].id || ''
}
this.customDiskOffering = this.offerings[0].iscustomized || false
this.isCustomizedDiskIOps = this.offerings[0]?.iscustomizediops || false
}).finally(() => {
@ -206,6 +221,9 @@ export default {
this.formRef.value.validate().then(() => {
const formRaw = toRaw(this.form)
const values = this.handleRemoveFields(formRaw)
if (this.createVolumeFromSnapshot) {
values.snapshotid = this.resource.id
}
this.loading = true
api('createVolume', values).then(response => {
this.$pollJob({