Skip to content

Commit 6130bf5

Browse files
authored
Merge pull request #608 from jeongda-young/ModifyingHostDevice
호스트디바이스 오류 수정
2 parents f961abe + 7585963 commit 6130bf5

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

ui/src/views/storage/HostDevicesTransfer.vue

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,29 @@ export default {
9898
}
9999
100100
this.loading = true
101-
102101
const vmId = this.form.virtualmachineid
103102
const hostDevicesName = this.resource.hostDevicesName
104103
105-
const xmlConfig = this.generateXmlConfig(hostDevicesName)
104+
api('listVirtualMachines', {
105+
id: vmId,
106+
details: 'min'
107+
}).then(response => {
108+
const vm = response.listvirtualmachinesresponse.virtualmachine[0]
109+
const details = vm.details || {}
110+
111+
const xmlConfig = this.generateXmlConfig(hostDevicesName)
106112
107-
const apiName = 'updateVirtualMachine'
113+
const params = { id: vmId }
108114
109-
if (!(apiName in this.$store.getters.apis)) {
110-
this.$message.error({
111-
message: this.$t('error.execute.api.failed') + ' ' + apiName,
112-
description: this.$t('message.user.not.permitted.api')
115+
// 기존 details 값을 유지하면서 새로운 값 추가
116+
Object.keys(details).forEach(key => {
117+
params[`details[0].${key}`] = details[key]
113118
})
114-
this.loading = false
115-
return
116-
}
117119
118-
api(apiName, {
119-
id: vmId,
120-
'details[0].extraconfig-1': xmlConfig
120+
// 필요한 추가 값 동적으로 설정
121+
params[`details[0].extraconfig-1`] = xmlConfig
122+
123+
return api('updateVirtualMachine', params)
121124
}).then(() => {
122125
this.$message.success(this.$t('message.success.update.vm'))
123126
this.closeAction()
@@ -142,7 +145,7 @@ export default {
142145
</source>
143146
</hostdev>
144147
</devices>
145-
`
148+
`.trim()
146149
},
147150
148151
closeAction () {

0 commit comments

Comments
 (0)