feat(xo-server/backup-ng): emit warning task when zstd is chosen but not supported (#4375)

See #3892
This commit is contained in:
badrAZ
2019-09-10 11:55:57 +02:00
committed by Pierre Donias
parent 54bc384d37
commit f0996fcfa7
2 changed files with 17 additions and 1 deletions

View File

@@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [VM/Advanced] Fix `"vm.set_domain_type" is not a function` error on switching virtualization mode (PV/HVM) [#4348](https://github.com/vatesfr/xen-orchestra/issues/4348) (PR [#4504](https://github.com/vatesfr/xen-orchestra/pull/4504))
- [Backup NG/logs] Show warning when zstd compression is selected but not supported [#3892](https://github.com/vatesfr/xen-orchestra/issues/3892) (PR [#4375](https://github.com/vatesfr/xen-orchestra/pull/4375)
### Released packages

View File

@@ -1146,6 +1146,21 @@ export default class BackupNg {
$defer.call(xapi, 'deleteVm', snapshot)
}
let compress = getJobCompression(job)
const pool = snapshot.$pool
if (
compress === 'zstd' &&
pool.restrictions.restrict_zstd_export !== 'false'
) {
compress = false
logger.warning(
`Zstd is not supported on the pool ${pool.name_label}, the VM will be exported without compression`,
{
event: 'task.warning',
taskId,
}
)
}
let xva: any = await wrapTask(
{
logger,
@@ -1153,7 +1168,7 @@ export default class BackupNg {
parentId: taskId,
},
xapi.exportVm($cancelToken, snapshot, {
compress: getJobCompression(job),
compress,
})
)
const exportTask = xva.task