Skip to content

Commit 2b62555

Browse files
committed
revert changes
1 parent 50f7dc2 commit 2b62555

File tree

2 files changed

+20
-31
lines changed

2 files changed

+20
-31
lines changed

Diff for: CHANGELOG.unreleased.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
> Users must be able to say: “I had this issue, happy to know it's fixed”
1717
18-
- [New VM] Fix `DEVICE_ALREADY_EXISTS(#)` (PR [#https://github.com/vatesfr/xen-orchestra/pull/8473](https://github.com/vatesfr/xen-orchestra/pull/8473))
18+
- [New VM] Fix `DEVICE_ALREADY_EXISTS(#)` (PR [#8473](https://github.com/vatesfr/xen-orchestra/pull/8473))
1919

2020
### Packages to release
2121

Diff for: packages/xo-server/src/xapi/mixins/vm.mjs

+19-30
Original file line numberDiff line numberDiff line change
@@ -211,38 +211,27 @@ const methods = {
211211

212212
// TODO: set vm.suspend_SR
213213
// Creates the user defined VDIs.
214-
const allowedUserDevices = await this.call('VM.get_allowed_VBD_devices', vm.$ref)
215-
await Promise.all(
216-
_vdisToCreate.map(async (vdi, i) => {
217-
const vdiRef = await this.VDI_create({
218-
name_description: vdi.name_description,
219-
name_label: vdi.name_label,
220-
virtual_size: vdi.size,
221-
SR: this.getObject(vdi.sr, 'SR').$ref,
222-
})
223-
$defer.onFailure(() => this.VDI_destroy(vdiRef))
224-
225-
// Either the CD or the 1st disk is bootable (only useful for PV VMs)
226-
let bootable = false
227-
if (!hasBootableDisk && i === 0) {
228-
bootable = true
229-
}
214+
for (const [i, vdi] of _vdisToCreate.entries()) {
215+
const vdiRef = await this.VDI_create({
216+
name_description: vdi.name_description,
217+
name_label: vdi.name_label,
218+
virtual_size: vdi.size,
219+
SR: this.getObject(vdi.sr, 'SR').$ref,
220+
})
221+
$defer.onFailure(() => this.VDI_destroy(vdiRef))
230222

231-
let userdevice = vdi.userdevice
232-
if (userdevice === undefined) {
233-
userdevice = allowedUserDevices.shift()
234-
if (userdevice === '3') {
235-
userdevice = allowedUserDevices.shift()
236-
}
237-
}
238-
await this.VBD_create({
239-
bootable,
240-
userdevice,
241-
VDI: vdiRef,
242-
VM: vm.$ref,
243-
})
223+
// Either the CD or the 1st disk is bootable (only useful for PV VMs)
224+
let bootable = false
225+
if (!hasBootableDisk && i === 0) {
226+
bootable = true
227+
}
228+
await this.VBD_create({
229+
bootable,
230+
userdevice: vdi.userdevice,
231+
VDI: vdiRef,
232+
VM: vm.$ref,
244233
})
245-
)
234+
}
246235

247236
// Modify existing (previous template) disks if necessary
248237
// Wait until all VDIs are created, otherwise VBD_create may throw an OTHER_OPERATION_IN_PROGRESS error

0 commit comments

Comments
 (0)