|
19 | 19 | -include("ns_stats.hrl"). |
20 | 20 | -include("cut.hrl"). |
21 | 21 |
|
| 22 | +-define(MAGMA_MIN_RAMQUOTA, 256). |
| 23 | + |
22 | 24 | -ifdef(TEST). |
23 | 25 | -include_lib("eunit/include/eunit.hrl"). |
24 | 26 | -endif. |
@@ -771,13 +773,29 @@ additional_bucket_params_validation(Params, Ctx) -> |
771 | 773 | NumReplicas = get_value_from_parms_or_bucket(num_replicas, Params, Ctx), |
772 | 774 | DurabilityLevel = get_value_from_parms_or_bucket(durability_min_level, |
773 | 775 | Params, Ctx), |
774 | | - case {NumReplicas, DurabilityLevel} of |
775 | | - {3, none} -> []; |
776 | | - {3, _} -> [{durability_min_level, |
777 | | - <<"Durability minimum level cannot be specified with " |
778 | | - "3 replicas">>}]; |
779 | | - {_, _} -> [] |
780 | | - end. |
| 776 | + Err1 = case {NumReplicas, DurabilityLevel} of |
| 777 | + {3, none} -> []; |
| 778 | + {3, _} -> [{durability_min_level, |
| 779 | + <<"Durability minimum level cannot be specified with " |
| 780 | + "3 replicas">>}]; |
| 781 | + {_, _} -> [] |
| 782 | + end, |
| 783 | + |
| 784 | + StorageMode = get_value_from_parms_or_bucket(storage_mode, Params, Ctx), |
| 785 | + RamQuota = get_value_from_parms_or_bucket(ram_quota, Params, Ctx), |
| 786 | + |
| 787 | + Err2 = case {StorageMode, RamQuota} of |
| 788 | + {magma, RamQuota} |
| 789 | + when RamQuota < ?MAGMA_MIN_RAMQUOTA * 1024 * 1024 -> |
| 790 | + RamQ = list_to_binary(integer_to_list(?MAGMA_MIN_RAMQUOTA)), |
| 791 | + [{ramQuota, |
| 792 | + <<"Ram quota for magma must be at least ", RamQ/binary, |
| 793 | + " MiB">>}]; |
| 794 | + {_, _} -> |
| 795 | + [] |
| 796 | + end, |
| 797 | + |
| 798 | + Err1 ++ Err2. |
781 | 799 |
|
782 | 800 | %% Get the value from the params. If it wasn't specified and this isn't |
783 | 801 | %% a bucket creation then get the existing value from the bucket config. |
|
0 commit comments