PR comment review

This commit is contained in:
Olivier Lambert 2015-12-21 19:00:36 +01:00
parent 412a1bd62a
commit 9928d47fa2
3 changed files with 12 additions and 9 deletions

View File

@ -26,7 +26,7 @@ exports.delete = delete_
disconnect = $coroutine ({vbd}) ->
xapi = @getXAPI vbd
yield xapi.disconnectVBD(vbd._xapiRef)
yield xapi.disconnectVbd(vbd._xapiRef)
return
disconnect.params = {
@ -43,7 +43,7 @@ exports.disconnect = disconnect
connect = $coroutine ({vbd}) ->
xapi = @getXAPI vbd
yield xapi.connectVBD(vbd._xapiRef)
yield xapi.connectVbd(vbd._xapiRef)
return
connect.params = {

View File

@ -1026,6 +1026,7 @@ export default class Xapi extends XapiBase {
let host
let snapshotRef
// It's not needed to snapshot the VM to get the metadata
if (isVmRunning(vm) && !onlyMetadata) {
host = vm.$resident_on
snapshotRef = await this._snapshotVm(vm)
@ -1514,11 +1515,11 @@ export default class Xapi extends XapiBase {
)
}
async connectVBD (vbdId) {
async connectVbd (vbdId) {
await this.call('VBD.plug', vbdId)
}
async disconnectVBD (vbdId) {
async disconnectVbd (vbdId) {
// TODO: check if VBD is attached before
await this.call('VBD.unplug_force', vbdId)
}
@ -1526,7 +1527,7 @@ export default class Xapi extends XapiBase {
async destroyVbdsFromVm (vmId) {
await Promise.all(
mapToArray(this.getObject(vmId).$VBDs, async vbd => {
await this.disconnectVBD(vbd.$ref).catch(noop)
await this.disconnectVbd(vbd.$ref).catch(noop)
return this.call('VBD.destroy', vbd.$ref)
})
)

View File

@ -782,7 +782,7 @@ export default class Xo extends EventEmitter {
const files = await fs.readdir(`${path}/${deltaDir}`)
const deltaBackups = filter(files, xvaFilter)
Array.prototype.push.apply(backups, mapToArray(deltaBackups, deltaBackup => `${deltaDir}/${deltaBackup}`))
backups.push(...mapToArray(deltaBackups, deltaBackup => `${deltaDir}/${deltaBackup}`))
}
return backups
@ -951,7 +951,7 @@ export default class Xo extends EventEmitter {
})
const targetStream = fs.createWriteStream(backupFullPath, { flags: 'wx' })
sourceStream.on('error', () => targetStream.emit('error'))
sourceStream.on('error', error => targetStream.emit('error', error))
await eventToPromise(sourceStream.pipe(targetStream), 'finish')
} catch (e) {
// Remove backup. (corrupt)
@ -974,7 +974,8 @@ export default class Xo extends EventEmitter {
async _importVdiBackupContent (xapi, file, vdiId) {
const [ stream, length ] = await this._openAndwaitReadableFile(
file, 'VDI to import not found in this remote')
file, 'VDI to import not found in this remote'
)
await xapi.importVdiContent(vdiId, stream, {
length,
@ -1097,7 +1098,8 @@ export default class Xo extends EventEmitter {
async _importVmMetadata (xapi, file) {
const [ stream, length ] = await this._openAndwaitReadableFile(
file, 'VM metadata to import not found in this remote')
file, 'VM metadata to import not found in this remote'
)
return await xapi.importVm(stream, length, { onlyMetadata: true })
}