feat(xapi/VM_create): generateMacSeed option

This commit is contained in:
Julien Fontanet 2021-03-25 16:33:10 +01:00
parent ad3b8fa59f
commit 6c12dd4f16

View File

@ -3,6 +3,7 @@ const defer = require('golike-defer').default
const groupBy = require('lodash/groupBy')
const pickBy = require('lodash/pickBy')
const ignoreErrors = require('promise-toolbox/ignoreErrors')
const omit = require('lodash/omit')
const pCatch = require('promise-toolbox/catch')
const pRetry = require('promise-toolbox/retry')
const { asyncMap } = require('@xen-orchestra/async-map')
@ -196,6 +197,17 @@ module.exports = class Vm {
// not supported by `VM.create`, therefore it should be passed explicitly
bios_strings,
// The field `other_config.mac_seed` is used (in conjunction with VIFs'
// devices) to generate MAC addresses of VIFs for this VM.
//
// It's automatically generated by VM.create if missing.
//
// If this is true, it will be filtered out by this method to ensure a
// new one is generated.
//
// See https://github.com/xapi-project/xen-api/blob/0a6d6de0704ca2cc439326c35af7cf45128a17d5/ocaml/xapi/xapi_vm.ml#L628
generateMacSeed = true,
// if set, will create the VM in Suspended power_state with this VDI
//
// it's a separate param because it's not supported for all versions of
@ -215,7 +227,7 @@ module.exports = class Vm {
memory_dynamic_min,
memory_static_max,
memory_static_min,
other_config,
other_config: generateMacSeed ? omit(other_config, 'mac_seed') : other_config,
PCI_bus,
platform,
PV_args,