feat(xo-server/snapshotVm): tag xo-disable-quiesce (#3350)
This commit is contained in:
parent
92a93e4393
commit
4d2909567c
@ -1489,25 +1489,31 @@ export default class Xapi extends XapiBase {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let ref
|
let ref
|
||||||
try {
|
do {
|
||||||
ref = await this.callAsync(
|
if (!vm.tags.includes('xo-disable-quiesce')) {
|
||||||
$cancelToken,
|
try {
|
||||||
'VM.snapshot_with_quiesce',
|
ref = await this.callAsync(
|
||||||
vm.$ref,
|
$cancelToken,
|
||||||
nameLabel
|
'VM.snapshot_with_quiesce',
|
||||||
).then(extractOpaqueRef)
|
vm.$ref,
|
||||||
this.addTag(ref, 'quiesce')::ignoreErrors()
|
nameLabel
|
||||||
} catch (error) {
|
).then(extractOpaqueRef)
|
||||||
const { code } = error
|
this.addTag(ref, 'quiesce')::ignoreErrors()
|
||||||
if (
|
|
||||||
code !== 'VM_SNAPSHOT_WITH_QUIESCE_NOT_SUPPORTED' &&
|
break
|
||||||
// quiesce only work on a running VM
|
} catch (error) {
|
||||||
code !== 'VM_BAD_POWER_STATE' &&
|
const { code } = error
|
||||||
// quiesce failed, fallback on standard snapshot
|
if (
|
||||||
// TODO: emit warning
|
code !== 'VM_SNAPSHOT_WITH_QUIESCE_NOT_SUPPORTED' &&
|
||||||
code !== 'VM_SNAPSHOT_WITH_QUIESCE_FAILED'
|
// quiesce only work on a running VM
|
||||||
) {
|
code !== 'VM_BAD_POWER_STATE' &&
|
||||||
throw error
|
// quiesce failed, fallback on standard snapshot
|
||||||
|
// TODO: emit warning
|
||||||
|
code !== 'VM_SNAPSHOT_WITH_QUIESCE_FAILED'
|
||||||
|
) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ref = await this.callAsync(
|
ref = await this.callAsync(
|
||||||
$cancelToken,
|
$cancelToken,
|
||||||
@ -1515,7 +1521,8 @@ export default class Xapi extends XapiBase {
|
|||||||
vm.$ref,
|
vm.$ref,
|
||||||
nameLabel
|
nameLabel
|
||||||
).then(extractOpaqueRef)
|
).then(extractOpaqueRef)
|
||||||
}
|
} while (false)
|
||||||
|
|
||||||
// Convert the template to a VM and wait to have receive the up-
|
// Convert the template to a VM and wait to have receive the up-
|
||||||
// to-date object.
|
// to-date object.
|
||||||
const [, snapshot] = await Promise.all([
|
const [, snapshot] = await Promise.all([
|
||||||
|
Loading…
Reference in New Issue
Block a user