feat(vm.deltaCopy): force param to bypass VDI chains check (#592)

This commit is contained in:
Julien Fontanet 2017-08-02 12:41:20 +02:00 committed by GitHub
parent 1ded2f8101
commit 68a94da44c
3 changed files with 13 additions and 6 deletions

View File

@ -755,11 +755,12 @@ exports.importDeltaBackup = importDeltaBackup
#--------------------------------------------------------------------- #---------------------------------------------------------------------
deltaCopy = ({ vm, sr }) -> @deltaCopyVm(vm, sr) deltaCopy = ({ force, vm, sr }) -> @deltaCopyVm(vm, sr, force)
deltaCopy.params = { deltaCopy.params = {
id: { type: 'string' }, id: { type: 'string' },
sr: { type: 'string' } sr: { type: 'string' },
force: { type: 'boolean', optional: true }
} }
deltaCopy.resolve = { deltaCopy.resolve = {

View File

@ -781,12 +781,17 @@ export default class Xapi extends XapiBase {
@cancellable @cancellable
@deferrable.onFailure @deferrable.onFailure
async exportDeltaVm ($onFailure, $cancelToken, vmId, baseVmId = undefined, { async exportDeltaVm ($onFailure, $cancelToken, vmId, baseVmId = undefined, {
snapshotNameLabel = undefined, bypassVdiChainsCheck = false,
// Contains a vdi.$id set of vmId. // Contains a vdi.$id set of vmId.
fullVdisRequired = [], fullVdisRequired = [],
disableBaseTags = false
disableBaseTags = false,
snapshotNameLabel = undefined
} = {}) { } = {}) {
this._assertHealthyVdiChains(this.getObject(vmId)) if (!bypassVdiChainsCheck) {
this._assertHealthyVdiChains(this.getObject(vmId))
}
const vm = await this.snapshotVm(vmId) const vm = await this.snapshotVm(vmId)
$onFailure(() => this._deleteVm(vm)) $onFailure(() => this._deleteVm(vm))

View File

@ -398,7 +398,7 @@ export default class {
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@deferrable.onFailure @deferrable.onFailure
async deltaCopyVm ($onFailure, srcVm, targetSr) { async deltaCopyVm ($onFailure, srcVm, targetSr, force = false) {
const srcXapi = this._xo.getXapi(srcVm) const srcXapi = this._xo.getXapi(srcVm)
const targetXapi = this._xo.getXapi(targetSr) const targetXapi = this._xo.getXapi(targetSr)
@ -420,6 +420,7 @@ export default class {
const dstVm = await (async () => { const dstVm = await (async () => {
const { cancel, token } = CancelToken.source() const { cancel, token } = CancelToken.source()
const delta = await srcXapi.exportDeltaVm(token, srcVm.$id, localBaseUuid, { const delta = await srcXapi.exportDeltaVm(token, srcVm.$id, localBaseUuid, {
bypassVdiChainsCheck: force,
snapshotNameLabel: `XO_DELTA_EXPORT: ${targetSr.name_label} (${targetSr.uuid})` snapshotNameLabel: `XO_DELTA_EXPORT: ${targetSr.name_label} (${targetSr.uuid})`
}) })
$onFailure(() => srcXapi.deleteVm(delta.vm.uuid)) $onFailure(() => srcXapi.deleteVm(delta.vm.uuid))