fix(Xapi#createCloudInitConfigDrive): ignore VDI_IO_ERROR while importing

This commit is contained in:
Julien Fontanet 2017-06-26 17:11:04 +02:00
parent fd81f24030
commit 168f48eea9

View File

@ -2091,16 +2091,24 @@ export default class Xapi extends XapiBase {
// Then, generate a FAT fs
const fs = promisifyAll(fatfs.createFileSystem(fatfsBuffer(buffer)))
// Create Cloud config folders
await fs.mkdir('openstack')
await fs.mkdir('openstack/latest')
// Create the meta_data file
await fs.writeFile('openstack/latest/meta_data.json', '{\n "uuid": "' + vm.uuid + '"\n}\n')
// Create the user_data file
await fs.writeFile('openstack/latest/user_data', config)
await Promise.all([
fs.writeFile(
'openstack/latest/meta_data.json',
'{\n "uuid": "' + vm.uuid + '"\n}\n'
),
fs.writeFile('openstack/latest/user_data', config)
])
// ignore VDI_IO_ERROR errors, I (JFT) don't understand why they
// are emitted because it works
await this._importVdiContent(vdi, buffer, VDI_FORMAT_RAW)::pCatch(
{ code: 'VDI_IO_ERROR' },
console.warn
)
// Transform the buffer into a stream
await this._importVdiContent(vdi, buffer, VDI_FORMAT_RAW)
await this._createVbd(vm, vdi)
}