Compare commits
3 Commits
fix_vmware
...
fix_xovmdk
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9797e6aecf | ||
|
|
aefcce45ff | ||
|
|
367fb4d8a6 |
@@ -282,33 +282,20 @@ export default class Esxi extends EventEmitter {
|
||||
const networks = []
|
||||
|
||||
for (const key of Object.keys(vmx)) {
|
||||
const matches = key.match(/^(scsi|ide|ethernet)[0-9]+$/)
|
||||
if (matches === null) {
|
||||
continue
|
||||
}
|
||||
const channelType = matches[1]
|
||||
if (channelType === 'ide' || channelType === 'scsi') {
|
||||
const diskChannel = vmx[key]
|
||||
for (const diskIndex in Object.values(diskChannel)) {
|
||||
const disk = diskChannel[diskIndex]
|
||||
if (typeof disk !== 'object') {
|
||||
if (key.match('^scsi([0-9]+)$') !== null) {
|
||||
const scsiChannel = vmx[key]
|
||||
for (const diskIndex in Object.values(scsiChannel)) {
|
||||
const disk = scsiChannel[diskIndex]
|
||||
if (typeof disk !== 'object' || disk.deviceType !== 'scsi-hardDisk') {
|
||||
continue
|
||||
}
|
||||
// can be something other than a disk, like a controller card
|
||||
if (channelType === 'scsi' && disk.deviceType !== 'scsi-hardDisk') {
|
||||
continue
|
||||
}
|
||||
// ide hard disk don't have deviceType, but cdroms have one
|
||||
if (channelType === 'ide' && disk.deviceType === 'atapi-cdrom') {
|
||||
continue
|
||||
}
|
||||
|
||||
disks.push({
|
||||
...(await this.#inspectVmdk(dataStores, dataStore, dirname(vmxPath), disk.fileName)),
|
||||
node: `${key}:${diskIndex}`,
|
||||
})
|
||||
}
|
||||
} else if (channelType === 'ethernet') {
|
||||
}
|
||||
if (key.match('^ethernet([0-9]+)$') !== null) {
|
||||
const ethernet = vmx[key]
|
||||
|
||||
networks.push({
|
||||
@@ -328,7 +315,7 @@ export default class Esxi extends EventEmitter {
|
||||
for (const diskIndex in snapshot.disks) {
|
||||
const fileName = snapshot.disks[diskIndex].fileName
|
||||
snapshot.disks[diskIndex] = {
|
||||
node: snapshot.disks[diskIndex]?.node, // 'scsi0:0' , 'ide0:0', ...,
|
||||
node: snapshot.disks[diskIndex]?.node, // 'scsi0:0',
|
||||
...(await this.#inspectVmdk(dataStores, dataStore, dirname(vmxPath), fileName)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
- [Remotes] Correctly clear error when the remote is tested with success
|
||||
- [Import/VMWare] Fix importing last snapshot (PR [#7370](https://github.com/vatesfr/xen-orchestra/pull/7370))
|
||||
- [Host/Reboot] Fix false positive warning when restarting an host after updates (PR [#7366](https://github.com/vatesfr/xen-orchestra/pull/7366))
|
||||
- [Import/VMWare] Handle VMs with IDE disks
|
||||
|
||||
### Packages to release
|
||||
|
||||
@@ -43,7 +42,6 @@
|
||||
|
||||
- @xen-orchestra/backups patch
|
||||
- @xen-orchestra/fs patch
|
||||
- @xen-orchestra/vmware-explorer patch
|
||||
- @xen-orchestra/xapi patch
|
||||
- vhd-lib patch
|
||||
- xo-server minor
|
||||
|
||||
27
packages/xo-server/src/api/pusb.mjs
Normal file
27
packages/xo-server/src/api/pusb.mjs
Normal file
@@ -0,0 +1,27 @@
|
||||
export async function scan({ host }) {
|
||||
await this.getXapi(host).call('PUSB.scan', host._xapiRef)
|
||||
}
|
||||
|
||||
scan.params = {
|
||||
host: { type: 'string' },
|
||||
}
|
||||
scan.resolve = {
|
||||
host: ['host', 'host', 'operate'],
|
||||
}
|
||||
|
||||
export async function set({ pusb, enabled }) {
|
||||
const xapi = this.getXapi(pusb)
|
||||
|
||||
if (enabled !== undefined && enabled !== pusb.passthroughEnabled) {
|
||||
await xapi.call('PUSB.set_passthrough_enabled', pusb._xapiRef, enabled)
|
||||
}
|
||||
}
|
||||
|
||||
set.params = {
|
||||
id: { type: 'string' },
|
||||
enabled: { type: 'boolean', optional: true },
|
||||
}
|
||||
|
||||
set.resolve = {
|
||||
pusb: ['id', 'PUSB', 'administrate'],
|
||||
}
|
||||
@@ -889,6 +889,17 @@ const TRANSFORMS = {
|
||||
vm: link(obj, 'VM'),
|
||||
}
|
||||
},
|
||||
|
||||
pusb(obj) {
|
||||
return {
|
||||
type: 'PUSB',
|
||||
|
||||
description: obj.description,
|
||||
host: link(obj, 'host'),
|
||||
passthroughEnabled: obj.passthrough_enabled,
|
||||
usbGroup: link(obj, 'USB_group'),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
@@ -99,7 +99,7 @@ test('An ova file is generated correctly', async () => {
|
||||
try {
|
||||
await execXmllint(xml, [
|
||||
'--schema',
|
||||
path.join(__dirname, 'ova-schema', 'dsp8023_1.1.1.xsd'),
|
||||
path.join(__dirname, '..', 'src', 'ova-schema', 'dsp8023_1.1.1.xsd'),
|
||||
'--noout',
|
||||
'--nonet',
|
||||
'-',
|
||||
|
||||
Reference in New Issue
Block a user