feat(vm.rollingDrCopy): accepts a sr param (#315)
See vatesfr/xo-web#955
This commit is contained in:
parent
86a6871ee8
commit
536a6c5c60
@ -837,21 +837,30 @@ exports.rollingBackup = rollingBackup
|
|||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
rollingDrCopy = ({vm, pool, tag, depth}) ->
|
rollingDrCopy = ({vm, pool, sr, tag, depth}) ->
|
||||||
if vm.$pool is pool.id
|
unless sr
|
||||||
throw new GenericError('Disaster Recovery attempts to copy on the same pool')
|
unless pool
|
||||||
return @rollingDrCopyVm({vm, sr: @getObject(pool.default_SR, 'SR'), tag, depth})
|
throw new InvalidParameters('either pool or sr param should be specified')
|
||||||
|
|
||||||
|
if vm.$pool is pool.id
|
||||||
|
throw new GenericError('Disaster Recovery attempts to copy on the same pool')
|
||||||
|
|
||||||
|
sr = @getObject(pool.default_SR, 'SR')
|
||||||
|
|
||||||
|
return @rollingDrCopyVm({vm, sr, tag, depth})
|
||||||
|
|
||||||
rollingDrCopy.params = {
|
rollingDrCopy.params = {
|
||||||
id: { type: 'string' }
|
|
||||||
pool: { type: 'string' }
|
|
||||||
tag: { type: 'string'}
|
|
||||||
depth: { type: 'number' }
|
depth: { type: 'number' }
|
||||||
|
id: { type: 'string' }
|
||||||
|
pool: { type: 'string', optional: true }
|
||||||
|
sr: { type: 'string', optional: true }
|
||||||
|
tag: { type: 'string'}
|
||||||
}
|
}
|
||||||
|
|
||||||
rollingDrCopy.resolve = {
|
rollingDrCopy.resolve = {
|
||||||
vm: ['id', ['VM', 'VM-snapshot'], 'administrate'],
|
vm: ['id', ['VM', 'VM-snapshot'], 'administrate'],
|
||||||
pool: ['pool', 'pool', 'administrate']
|
pool: ['pool', 'pool', 'administrate']
|
||||||
|
sr: ['sr', 'SR', 'administrate']
|
||||||
}
|
}
|
||||||
|
|
||||||
rollingDrCopy.description = 'Copies a VM to a different pool, with a tagged name, and removes the oldest VM with the same tag from this pool, according to depth'
|
rollingDrCopy.description = 'Copies a VM to a different pool, with a tagged name, and removes the oldest VM with the same tag from this pool, according to depth'
|
||||||
|
Loading…
Reference in New Issue
Block a user