feat(xo-server/createVdi): allow setting sm_config (#4841)

This commit is contained in:
Julien Fontanet 2020-03-04 08:43:28 +01:00 committed by GitHub
parent b244126d60
commit 6d5a5a46e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1718,25 +1718,31 @@ export default class Xapi extends XapiBase {
return this.callAsync('VDI.clone', vdi.$ref).then(extractOpaqueRef)
}
async createVdi({
// blindly copying `sm_config` from another VDI can create problems,
// therefore it is ignored by this method
//
// see https://github.com/vatesfr/xen-orchestra/issues/4482
name_description,
name_label,
other_config = {},
read_only = false,
sharable = false,
SR,
tags,
type = 'user',
virtual_size,
xenstore_data,
async createVdi(
{
name_description,
name_label,
other_config = {},
read_only = false,
sharable = false,
sm_config,
SR,
tags,
type = 'user',
virtual_size,
xenstore_data,
size,
sr = SR !== undefined && SR !== NULL_REF ? SR : this.pool.default_SR,
}) {
size,
sr = SR !== undefined && SR !== NULL_REF ? SR : this.pool.default_SR,
},
{
// blindly copying `sm_config` from another VDI can create problems,
// therefore it is ignored by default by this method
//
// see https://github.com/vatesfr/xen-orchestra/issues/4482
setSmConfig = false,
} = {}
) {
sr = this.getObject(sr)
log.debug(`Creating VDI ${name_label} on ${sr.name_label}`)
@ -1750,6 +1756,7 @@ export default class Xapi extends XapiBase {
SR: sr.$ref,
tags,
type,
sm_config: setSmConfig ? sm_config : undefined,
virtual_size: size !== undefined ? parseSize(size) : virtual_size,
xenstore_data,
}).then(extractOpaqueRef)