parent
fb804e99f0
commit
edd606563f
@ -878,15 +878,12 @@ exports.resume = resume
|
|||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
# revert a snapshot to its parent VM
|
revert = ({snapshot, snapshotBefore}) ->
|
||||||
revert = $coroutine ({snapshot}) ->
|
return @getXapi(snapshot).revertVm(snapshot._xapiId, snapshotBefore)
|
||||||
# Attempts a revert from this snapshot to its parent VM
|
|
||||||
yield @getXapi(snapshot).call 'VM.revert', snapshot._xapiRef
|
|
||||||
|
|
||||||
return true
|
|
||||||
|
|
||||||
revert.params = {
|
revert.params = {
|
||||||
id: { type: 'string' }
|
id: { type: 'string' },
|
||||||
|
snapshotBefore: { type: 'boolean', optional: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
revert.resolve = {
|
revert.resolve = {
|
||||||
|
@ -326,5 +326,13 @@ export default {
|
|||||||
|
|
||||||
async editVm (id, props) {
|
async editVm (id, props) {
|
||||||
return /* await */ this._editVm(this.getObject(id), props)
|
return /* await */ this._editVm(this.getObject(id), props)
|
||||||
|
},
|
||||||
|
|
||||||
|
async revertVm (snapshotId, snapshotBefore = true) {
|
||||||
|
const snapshot = this.getObject(snapshotId)
|
||||||
|
if (snapshotBefore) {
|
||||||
|
await this._snapshotVm(snapshot.$snapshot_of)
|
||||||
|
}
|
||||||
|
return this.call('VM.revert', snapshot.$ref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user