chore(xo-server): Xapi#exportDeltaVm accept a snapshot
This commit is contained in:
parent
052817ccbf
commit
a2ab64b142
@ -782,7 +782,8 @@ export default class Xapi extends XapiBase {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a snapshot of the VM and returns a delta export object.
|
// Create a snapshot (if necessary) of the VM and returns a delta export
|
||||||
|
// object.
|
||||||
@cancelable
|
@cancelable
|
||||||
@deferrable
|
@deferrable
|
||||||
async exportDeltaVm (
|
async exportDeltaVm (
|
||||||
@ -800,16 +801,18 @@ export default class Xapi extends XapiBase {
|
|||||||
snapshotNameLabel = undefined,
|
snapshotNameLabel = undefined,
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
|
let vm = this.getObject(vmId)
|
||||||
if (!bypassVdiChainsCheck) {
|
if (!bypassVdiChainsCheck) {
|
||||||
this._assertHealthyVdiChains(this.getObject(vmId))
|
this._assertHealthyVdiChains(this.getObject(vm))
|
||||||
}
|
}
|
||||||
|
if (!vm.is_a_snapshot) {
|
||||||
const vm = await this.snapshotVm(vmId)
|
vm = await this.snapshotVm(vmId)
|
||||||
$defer.onFailure(() => this._deleteVm(vm))
|
$defer.onFailure(() => this._deleteVm(vm))
|
||||||
if (snapshotNameLabel) {
|
if (snapshotNameLabel) {
|
||||||
;this._setObjectProperties(vm, {
|
;this._setObjectProperties(vm, {
|
||||||
nameLabel: snapshotNameLabel,
|
nameLabel: snapshotNameLabel,
|
||||||
})::ignoreErrors()
|
})::ignoreErrors()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseVm = baseVmId && this.getObject(baseVmId)
|
const baseVm = baseVmId && this.getObject(baseVmId)
|
||||||
|
Loading…
Reference in New Issue
Block a user