fix(xo-server/Xapi#checkpointVm): returns the created snapshot (#3810)

This commit is contained in:
badrAZ
2018-12-21 11:27:54 +01:00
committed by Julien Fontanet
parent 267be8e904
commit 0c64596a17

View File

@@ -5,7 +5,12 @@ import { NULL_REF } from 'xen-api'
import { forEach, mapToArray, parseSize } from '../../utils'
import { isVmHvm, isVmRunning, makeEditObject } from '../utils'
import {
extractOpaqueRef,
isVmHvm,
isVmRunning,
makeEditObject,
} from '../utils'
// According to: https://xenserver.org/blog/entry/vga-over-cirrus-in-xenserver-6-2.html.
const XEN_VGA_VALUES = ['std', 'cirrus']
@@ -13,13 +18,14 @@ const XEN_VIDEORAM_VALUES = [1, 2, 4, 8, 16]
export default {
// https://xapi-project.github.io/xen-api/classes/vm.html#checkpoint
checkpointVm(vmId, nameLabel) {
async checkpointVm(vmId, nameLabel) {
const vm = this.getObject(vmId)
return this.asyncCall(
const ref = await this.callAsync(
'VM.checkpoint',
vm.$ref,
nameLabel != null ? nameLabel : vm.name_label
)
).then(extractOpaqueRef)
return this.barrier(ref)
},
// TODO: clean up on error.