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
|
# TODO: Implement ACLs
|
||||||
create = $coroutine ({
|
create = $coroutine ({
|
||||||
|
clone
|
||||||
resourceSet
|
resourceSet
|
||||||
installation
|
installation
|
||||||
name_description
|
name_description
|
||||||
@ -143,6 +144,7 @@ create = $coroutine ({
|
|||||||
throw new Unauthorized()
|
throw new Unauthorized()
|
||||||
|
|
||||||
xapiVm = yield xapi.createVm(template._xapiId, {
|
xapiVm = yield xapi.createVm(template._xapiId, {
|
||||||
|
clone,
|
||||||
installRepository: installation && installation.repository,
|
installRepository: installation && installation.repository,
|
||||||
nameDescription: name_description,
|
nameDescription: name_description,
|
||||||
nameLabel: name_label,
|
nameLabel: name_label,
|
||||||
@ -163,6 +165,11 @@ create = $coroutine ({
|
|||||||
return vm.id
|
return vm.id
|
||||||
|
|
||||||
create.params = {
|
create.params = {
|
||||||
|
clone: {
|
||||||
|
type: 'boolean'
|
||||||
|
optional: true
|
||||||
|
}
|
||||||
|
|
||||||
resourceSet: {
|
resourceSet: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: true
|
optional: true
|
||||||
|
@ -1058,6 +1058,7 @@ export default class Xapi extends XapiBase {
|
|||||||
|
|
||||||
// TODO: clean up on error.
|
// TODO: clean up on error.
|
||||||
async createVm (templateId, {
|
async createVm (templateId, {
|
||||||
|
clone = true,
|
||||||
nameDescription = undefined,
|
nameDescription = undefined,
|
||||||
nameLabel = undefined,
|
nameLabel = undefined,
|
||||||
pvArgs = undefined,
|
pvArgs = undefined,
|
||||||
@ -1083,7 +1084,7 @@ export default class Xapi extends XapiBase {
|
|||||||
|
|
||||||
// Clones the template.
|
// Clones the template.
|
||||||
const vm = await this._getOrWaitObject(
|
const vm = await this._getOrWaitObject(
|
||||||
await this._cloneVm(template, nameLabel)
|
await this[clone ? '_cloneVm' : '_copyVm'](template, nameLabel)
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: copy BIOS strings?
|
// TODO: copy BIOS strings?
|
||||||
|
Loading…
Reference in New Issue
Block a user