mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
B OpenNebula/one#6716: Correct instances amount when instantiate (#3223)
* Now instantiates the correct number of instances specified for a service ServiceTemplate * Default number of instances set to 1 Signed-off-by: Victor Hansson <vhansson@opennebula.io> (cherry picked from commit 212aa91a3c59a5a9fa351d1be6fbd9e3d0f10a33)
This commit is contained in:
parent
1e3757d845
commit
8e3ec6fcee
@ -36,7 +36,9 @@ const INSTANCE_FIELD = {
|
||||
name: 'INSTANCES',
|
||||
label: T.NumberOfInstances,
|
||||
type: INPUT_TYPES.TEXT,
|
||||
validation: number().required(),
|
||||
validation: number()
|
||||
.required()
|
||||
.default(() => 1),
|
||||
fieldProps: {
|
||||
type: 'number',
|
||||
},
|
||||
|
@ -120,6 +120,7 @@ const Steps = createSteps([General, UserInputs, Network, Charter], {
|
||||
),
|
||||
})),
|
||||
name: generalData?.NAME,
|
||||
instances: generalData?.INSTANCES,
|
||||
}
|
||||
|
||||
return formatTemplate
|
||||
|
@ -62,11 +62,18 @@ function CreateServiceTemplate() {
|
||||
useGetDatastoresQuery(undefined, { refetchOnMountOrArgChange: false })
|
||||
|
||||
const onSubmit = async (jsonTemplate) => {
|
||||
const { instances = 1 } = jsonTemplate
|
||||
|
||||
try {
|
||||
await instantiate({
|
||||
id: templateId,
|
||||
template: jsonTemplate,
|
||||
}).unwrap()
|
||||
await Promise.all(
|
||||
Array.from({ length: instances }, async () =>
|
||||
instantiate({
|
||||
id: templateId,
|
||||
template: jsonTemplate,
|
||||
}).unwrap()
|
||||
)
|
||||
)
|
||||
|
||||
history.push(PATH.INSTANCE.SERVICES.LIST)
|
||||
enqueueSuccess(T.SuccessServiceTemplateInitiated, [templateId, NAME])
|
||||
} catch {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user