fix: fix the add value of quota in zun containers
Set the add value to 0 if the input value is greater than the left value Change-Id: If15b10290bc7c34c7e51ec6d7ef2c47fcfdee6c5
This commit is contained in:
parent
c3835d24c0
commit
6110deace4
@ -110,9 +110,18 @@ export class StepCreate extends StepAction {
|
||||
title: t('Containers'),
|
||||
};
|
||||
|
||||
const { left: cpuLeft = 0 } = cpu;
|
||||
const { left: memoryLeft = 0 } = memory;
|
||||
const { left: diskLeft = 0 } = disk;
|
||||
const canAdd =
|
||||
left &&
|
||||
(cpuLeft === -1 || cpuCount <= cpuLeft) &&
|
||||
(memoryLeft === -1 || memoryCount <= memoryLeft) &&
|
||||
(diskLeft === -1 || diskCount <= diskLeft);
|
||||
|
||||
const cpuQuotaInfo = {
|
||||
...cpu,
|
||||
add: cpuCount,
|
||||
add: canAdd ? cpuCount : 0,
|
||||
name: 'cpu',
|
||||
title: t('CPU'),
|
||||
type: 'line',
|
||||
@ -120,7 +129,7 @@ export class StepCreate extends StepAction {
|
||||
|
||||
const memoryQuotaInfo = {
|
||||
...memory,
|
||||
add: memoryCount,
|
||||
add: canAdd ? memoryCount : 0,
|
||||
name: 'memory',
|
||||
title: t('Memory (MiB)'),
|
||||
type: 'line',
|
||||
@ -128,7 +137,7 @@ export class StepCreate extends StepAction {
|
||||
|
||||
const diskQuotaInfo = {
|
||||
...disk,
|
||||
add: diskCount,
|
||||
add: canAdd ? diskCount : 0,
|
||||
name: 'disk',
|
||||
title: t('Disk (GiB)'),
|
||||
type: 'line',
|
||||
|
Loading…
Reference in New Issue
Block a user