Compare commits

...

3 Commits

Author SHA1 Message Date
Julien Fontanet
29dba3bbd7 typo 2023-08-31 09:57:33 +02:00
Florent BEAUCHAMP
616f6fb31a fix 2023-08-29 13:28:43 +02:00
Florent BEAUCHAMP
fbfa34f945 feat(Backups/full): ensure full xva is written on disk 2023-08-29 09:32:53 +02:00
3 changed files with 20 additions and 5 deletions

View File

@@ -683,11 +683,17 @@ export class RemoteAdapter {
async outputStream(path, input, { checksum = true, validator = noop } = {}) {
const container = watchStreamSize(input)
await this._handler.outputStream(path, input, {
const handler = this._handler
await handler.outputStream(path, input, {
checksum,
dirMode: this._dirMode,
async validator() {
async validator(tmpPath) {
await input.task
// size on file system can be bigger when encrypted ( IV + alignment padding)
const size = await handler.getSize(tmpPath, { exact: false })
if (Math.abs(size - container.size) > handler.getSizeApproximationMargin()) {
return false
}
return validator.apply(this, arguments)
},
})

View File

@@ -227,11 +227,19 @@ export default class RemoteHandlerAbstract {
// when using encryption, the file size is aligned with the encryption block size ( 16 bytes )
// that means that the size will be 1 to 16 bytes more than the content size + the initialized vector length (16 bytes)
async getSize(file) {
assert.strictEqual(this.isEncrypted, false, `Can't compute size of an encrypted file ${file}`)
async getSize(file, { exact = true } = {}) {
exact && assert.strictEqual(this.isEncrypted, false, `Can't compute size of an encrypted file ${file}`)
const size = await timeout.call(this._getSize(typeof file === 'string' ? normalizePath(file) : file), this._timeout)
return size - this.#encryptor.ivLength
return size
}
getSizeApproximationMargin() {
if (this.isEncrypted) {
// on block for initialization vector + at most 1 bloc - 1 byte for aligment padding
return this.#encryptor.ivLength * 2 - 1
}
return 0
}
async __list(dir, { filter, ignoreMissing = false, prependDir = false } = {}) {

View File

@@ -10,6 +10,7 @@
- [Netbox] Synchronize VM tags [#5899](https://github.com/vatesfr/xen-orchestra/issues/5899) [Forum#6902](https://xcp-ng.org/forum/topic/6902) (PR [#6957](https://github.com/vatesfr/xen-orchestra/pull/6957))
- [REST API] Add support for `filter` and `limit` parameters to `backups/logs` and `restore/logs` collections [Forum#64789](https://xcp-ng.org/forum/post/64789)
- [Pool/Advanced] Ability to set a crash dump SR [#5060](https://github.com/vatesfr/xen-orchestra/issues/5060) (PR [#6973](https://github.com/vatesfr/xen-orchestra/pull/6973))
- [Backup/full] Ensure full xva is written (PR [#7005](https://github.com/vatesfr/xen-orchestra/pull/7005))
### Bug fixes