feat(vm.create): clone param may be use to disable cloning (#318)
See vatesfr/xo-web#960
This commit is contained in:
parent
6358accece
commit
e7feb99f8d
@ -55,6 +55,7 @@ checkPermissionOnSrs = (vm, permission = 'operate') -> (
|
||||
|
||||
# TODO: Implement ACLs
|
||||
create = $coroutine ({
|
||||
clone
|
||||
resourceSet
|
||||
installation
|
||||
name_description
|
||||
@ -143,6 +144,7 @@ create = $coroutine ({
|
||||
throw new Unauthorized()
|
||||
|
||||
xapiVm = yield xapi.createVm(template._xapiId, {
|
||||
clone,
|
||||
installRepository: installation && installation.repository,
|
||||
nameDescription: name_description,
|
||||
nameLabel: name_label,
|
||||
@ -163,6 +165,11 @@ create = $coroutine ({
|
||||
return vm.id
|
||||
|
||||
create.params = {
|
||||
clone: {
|
||||
type: 'boolean'
|
||||
optional: true
|
||||
}
|
||||
|
||||
resourceSet: {
|
||||
type: 'string',
|
||||
optional: true
|
||||
|
@ -1058,6 +1058,7 @@ export default class Xapi extends XapiBase {
|
||||
|
||||
// TODO: clean up on error.
|
||||
async createVm (templateId, {
|
||||
clone = true,
|
||||
nameDescription = undefined,
|
||||
nameLabel = undefined,
|
||||
pvArgs = undefined,
|
||||
@ -1083,7 +1084,7 @@ export default class Xapi extends XapiBase {
|
||||
|
||||
// Clones the template.
|
||||
const vm = await this._getOrWaitObject(
|
||||
await this._cloneVm(template, nameLabel)
|
||||
await this[clone ? '_cloneVm' : '_copyVm'](template, nameLabel)
|
||||
)
|
||||
|
||||
// TODO: copy BIOS strings?
|
||||
|
Loading…
Reference in New Issue
Block a user