mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 22:18:17 +00:00
config-tools: ivshmem.vm_name changes with name edit
This patch is to fix the issue that when user edits VM name, the VM_NAME field in IVSHMEM data doesn't sync. To fix this, configForm emits a 'vmNameChange' when VM name is edited. Then old name is replaced with new name. And when deleting VM, the old name is replaced with null. Tracked-On: #7445 Signed-off-by: Zhou, Wu <wu.zhou@intel.com>
This commit is contained in:
parent
c4f9146746
commit
c12f3adee0
@ -67,6 +67,7 @@
|
|||||||
|
|
||||||
@deleteVM="deleteVM"
|
@deleteVM="deleteVM"
|
||||||
@scenarioConfigFormDataUpdate="scenarioConfigFormDataUpdate"
|
@scenarioConfigFormDataUpdate="scenarioConfigFormDataUpdate"
|
||||||
|
@vmNameChange="vmNameChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -212,6 +213,7 @@ export default {
|
|||||||
this.scenario.vm.splice(postvmlist[i], 1);
|
this.scenario.vm.splice(postvmlist[i], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.vmNameChange('', this.scenario.vm[currentVMIndex].name)
|
||||||
this.scenario.vm.splice(currentVMIndex, 1);
|
this.scenario.vm.splice(currentVMIndex, 1);
|
||||||
this.updateCurrentFormSchema()
|
this.updateCurrentFormSchema()
|
||||||
this.updateCurrentFormData()
|
this.updateCurrentFormData()
|
||||||
@ -230,6 +232,18 @@ export default {
|
|||||||
}
|
}
|
||||||
this.updateCurrentFormData()
|
this.updateCurrentFormData()
|
||||||
},
|
},
|
||||||
|
vmNameChange(newname, oldname) {
|
||||||
|
let hvdata = this.scenario.hv
|
||||||
|
for (let key in hvdata.FEATURES.IVSHMEM.IVSHMEM_REGION) {
|
||||||
|
let region = hvdata.FEATURES.IVSHMEM.IVSHMEM_REGION[key]
|
||||||
|
for (let key1 in region.IVSHMEM_VMS.IVSHMEM_VM) {
|
||||||
|
let ivshmem_vm = region.IVSHMEM_VMS.IVSHMEM_VM[key1];
|
||||||
|
if (ivshmem_vm.VM_NAME === oldname) {
|
||||||
|
ivshmem_vm.VM_NAME = newname
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
assignVMID() {
|
assignVMID() {
|
||||||
let vm_priority = {
|
let vm_priority = {
|
||||||
'PRE_LAUNCHED_VM': 0,
|
'PRE_LAUNCHED_VM': 0,
|
||||||
|
@ -62,7 +62,7 @@ i18n.useLocal(localizeEn);
|
|||||||
export default {
|
export default {
|
||||||
name: "ConfigForm",
|
name: "ConfigForm",
|
||||||
components: {Icon, Minus, VueForm},
|
components: {Icon, Minus, VueForm},
|
||||||
emits: ['scenarioConfigFormDataUpdate', 'deleteVM'],
|
emits: ['scenarioConfigFormDataUpdate', 'deleteVM', 'vmNameChange'],
|
||||||
props: {
|
props: {
|
||||||
currentActiveVMID: {type: Number},
|
currentActiveVMID: {type: Number},
|
||||||
currentFormSchema: {type: Object},
|
currentFormSchema: {type: Object},
|
||||||
@ -109,6 +109,10 @@ export default {
|
|||||||
let newID = newValue.hasOwnProperty('@id') ? newValue['@id'] : -1;
|
let newID = newValue.hasOwnProperty('@id') ? newValue['@id'] : -1;
|
||||||
let oldID = oldValue.hasOwnProperty('@id') ? oldValue['@id'] : -1;
|
let oldID = oldValue.hasOwnProperty('@id') ? oldValue['@id'] : -1;
|
||||||
if (newID === oldID) {
|
if (newID === oldID) {
|
||||||
|
if (oldValue.name != newValue.name) {
|
||||||
|
this.$emit('vmNameChange', newValue.name, oldValue.name)
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit('scenarioConfigFormDataUpdate', newID, newValue)
|
this.$emit('scenarioConfigFormDataUpdate', newID, newValue)
|
||||||
}
|
}
|
||||||
// this.$emit('update:scenarioData', this.formData)
|
// this.$emit('update:scenarioData', this.formData)
|
||||||
|
Loading…
Reference in New Issue
Block a user