fix(Xapi#importVdiContent): find first attached PBD (#279)

This commit is contained in:
Julien Fontanet 2016-04-27 09:37:30 +02:00
parent 4778274c97
commit ee1105b6dd

View File

@ -2164,14 +2164,17 @@ export default class Xapi extends XapiBase {
vdi: vdi.$ref vdi: vdi.$ref
} }
const host = vdi.$SR.$PBDs[0].$host const pbd = find(vdi.$SR.$PBDs, 'currently_attached')
if (!pbd) {
throw new Error('no valid PBDs found')
}
const task = this._watchTask(taskRef) const task = this._watchTask(taskRef)
await Promise.all([ await Promise.all([
stream.checksumVerified, stream.checksumVerified,
task, task,
put(stream, { put(stream, {
hostname: host.address, hostname: pbd.$host.address,
method: 'put', method: 'put',
path: '/import_raw_vdi/', path: '/import_raw_vdi/',
query query