]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/nova/manifests/quota.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / nova / manifests / quota.pp
1 # == Class: nova::quota
2 #
3 # Class for overriding the default quota settings.
4 #
5 # === Parameters:
6 #
7 # [*quota_instances*]
8 #   (optional) Number of instances
9 #   Defaults to 10
10 #
11 # [*quota_cores*]
12 #   (optional) Number of cores
13 #   Defaults to 20
14 #
15 # [*quota_ram*]
16 #   (optional) Ram in MB
17 #   Defaults to 51200
18 #
19 # [*quota_volumes*]
20 #   (optional) Deprecated. This parameter does nothing and will be removed.
21 #   Defaults to undef
22 #
23 # [*quota_gigabytes*]
24 #   (optional) Deprecated. This parameter does nothing and will be removed.
25 #   Defaults to undef
26 #
27 # [*quota_floating_ips*]
28 #   (optional) Number of floating IPs
29 #   Defaults to 10
30 #
31 # [*quota_fixed_ips*]
32 #   (optional) Number of fixed IPs (this should be at least the number of instances allowed)
33 #   Defaults to -1
34 #
35 # [*quota_metadata_items*]
36 #   (optional) Number of metadata items per instance
37 #   Defaults to 128
38 #
39 # [*quota_max_injected_files*]
40 #   (optional) Deprecated. Use quota_injected_files instead
41 #   Defaults to undef
42 #
43 # [*quota_max_injected_file_content_bytes*]
44 #   (optional) Deprecated. Use quota_injected_file_content_bytes instead
45 #   Defaults to undef
46 #
47 # [*quota_max_injected_file_path_bytes*]
48 #   (optional) Deprecated. Use quota_injected_file_path_bytes instead
49 #   Defaults to undef
50 #
51 # [*quota_injected_files*]
52 #   (optional) Number of files that can be injected per instance
53 #   Defaults to 5
54 #
55 # [*quota_injected_file_content_bytes*]
56 #   (optional) Maximum size in bytes of injected files
57 #   Defaults to 10240
58 #
59 # [*quota_injected_file_path_bytes*]
60 #   (optional) Deprecated. Use quota_injected_file_path_length instead
61 #   Defaults to undef
62 #
63 # [*quota_injected_file_path_length*]
64 #   (optional) Maximum size in bytes of injected file path
65 #   Defaults to 255
66 #
67 # [*quota_security_groups*]
68 #   (optional) Number of security groups
69 #   Defaults to 10
70 #
71 # [*quota_security_group_rules*]
72 #   (optional) Number of security group rules
73 #   Defaults to 20
74 #
75 # [*quota_key_pairs*]
76 #   (optional) Number of key pairs
77 #   Defaults to 100
78 #
79 # [*reservation_expire*]
80 #   (optional) Time until reservations expire in seconds
81 #   Defaults to 86400
82 #
83 # [*until_refresh*]
84 #   (optional) Count of reservations until usage is refreshed
85 #   Defaults to 0
86 #
87 # [*max_age*]
88 #   (optional) Number of seconds between subsequent usage refreshes
89 #   Defaults to 0
90 #
91 # [*quota_driver*]
92 #   (optional) Driver to use for quota checks
93 #   Defaults to 'nova.quota.DbQuotaDriver'
94 #
95 class nova::quota(
96   $quota_instances = 10,
97   $quota_cores = 20,
98   $quota_ram = 51200,
99   $quota_floating_ips = 10,
100   $quota_fixed_ips = -1,
101   $quota_metadata_items = 128,
102   $quota_injected_files = 5,
103   $quota_injected_file_content_bytes = 10240,
104   $quota_injected_file_path_length = 255,
105   $quota_security_groups = 10,
106   $quota_security_group_rules = 20,
107   $quota_key_pairs = 100,
108   $reservation_expire = 86400,
109   $until_refresh = 0,
110   $max_age = 0,
111   $quota_driver = 'nova.quota.DbQuotaDriver',
112   # DEPRECATED PARAMETERS
113   $quota_volumes = undef,
114   $quota_gigabytes = undef,
115   $quota_max_injected_files = undef,
116   $quota_injected_file_path_bytes = undef,
117   $quota_max_injected_file_content_bytes = undef,
118   $quota_max_injected_file_path_bytes = undef
119 ) {
120
121   if $quota_volumes {
122     warning('The quota_volumes parameter is deprecated and has no effect.')
123   }
124
125   if $quota_gigabytes {
126     warning('The quota_gigabytes parameter is deprecated and has no effect.')
127   }
128
129   if $quota_max_injected_files {
130     warning('The quota_max_injected_files parameter is deprecated, use quota_injected_files instead.')
131     $quota_injected_files_real = $quota_max_injected_files
132   } else {
133     $quota_injected_files_real = $quota_injected_files
134   }
135
136   if $quota_max_injected_file_content_bytes {
137     warning('The quota_max_injected_file_content_bytes is deprecated, use quota_injected_file_content_bytes instead.')
138     $quota_injected_file_content_bytes_real = $quota_max_injected_file_content_bytes
139   } else {
140     $quota_injected_file_content_bytes_real = $quota_injected_file_content_bytes
141   }
142
143   if $quota_max_injected_file_path_bytes {
144     fail('The quota_max_injected_file_path_bytes parameter is deprecated, use quota_injected_file_path_length instead.')
145   }
146
147   if $quota_injected_file_path_bytes {
148     warning('The quota_injected_file_path_bytes parameter is deprecated, use quota_injected_file_path_length instead.')
149     $quota_injected_file_path_length_real = $quota_injected_file_path_bytes
150   } else {
151     $quota_injected_file_path_length_real = $quota_injected_file_path_length
152   }
153
154   nova_config {
155     'DEFAULT/quota_instances':                   value => $quota_instances;
156     'DEFAULT/quota_cores':                       value => $quota_cores;
157     'DEFAULT/quota_ram':                         value => $quota_ram;
158     'DEFAULT/quota_floating_ips':                value => $quota_floating_ips;
159     'DEFAULT/quota_fixed_ips':                   value => $quota_fixed_ips;
160     'DEFAULT/quota_metadata_items':              value => $quota_metadata_items;
161     'DEFAULT/quota_injected_files':              value => $quota_injected_files_real;
162     'DEFAULT/quota_injected_file_content_bytes': value => $quota_injected_file_content_bytes_real;
163     'DEFAULT/quota_injected_file_path_length':   value => $quota_injected_file_path_length_real;
164     'DEFAULT/quota_security_groups':             value => $quota_security_groups;
165     'DEFAULT/quota_security_group_rules':        value => $quota_security_group_rules;
166     'DEFAULT/quota_key_pairs':                   value => $quota_key_pairs;
167     'DEFAULT/reservation_expire':                value => $reservation_expire;
168     'DEFAULT/until_refresh':                     value => $until_refresh;
169     'DEFAULT/max_age':                           value => $max_age;
170     'DEFAULT/quota_driver':                      value => $quota_driver
171   }
172
173 }