fix(xo-server/backup legacy/delta import): autofix path (#2941)
Because the path might be incorrect and be `_full.vhd` instead of `_delta.vhd`. I know…
This commit is contained in:
parent
bcb66a4145
commit
2f256291ae
@ -815,10 +815,17 @@ export default class {
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
mapToArray(delta.vdis, async (vdi, id) => {
|
mapToArray(delta.vdis, async (vdi, id) => {
|
||||||
streams[`${id}.vhd`] = await createVhdReadStream(
|
let path = `${basePath}/${vdi.xoPath}`
|
||||||
handler,
|
try {
|
||||||
`${basePath}/${vdi.xoPath}`
|
await handler.getSize(path)
|
||||||
)
|
} catch (error) {
|
||||||
|
if (error == null || error.code !== 'ENOENT') {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
|
||||||
|
path = path.replace(/_delta\.vhd$/, '_full')
|
||||||
|
}
|
||||||
|
streams[`${id}.vhd`] = await createVhdReadStream(handler, path)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user