root / doc / design-2.0-cluster-parameters.rst @ 10799c59
History | View | Annotate | Download (8.2 kB)
1 |
Ganeti 2.0 cluster parameters |
---|---|
2 |
============================= |
3 |
|
4 |
.. contents:: |
5 |
|
6 |
Objective |
7 |
--------- |
8 |
|
9 |
We need to enhance the way attributes for instances and other clusters |
10 |
parameters are handled internally within Ganeti in order to have |
11 |
better flexibility in the following cases: |
12 |
|
13 |
- introducting new parameters |
14 |
- writing command line interfaces or APIs for these parameters |
15 |
- supporting new 2.0 features |
16 |
|
17 |
Background |
18 |
---------- |
19 |
|
20 |
When the HVM hypervisor was introduced in Ganeti 1.2, the additional |
21 |
instance parameters needed for it were simply added to the instance |
22 |
namespace, as were additional parameters for the PVM hypervisor. |
23 |
|
24 |
As a result of this, wether a particular parameter is valid for the |
25 |
actual hypervisor could either be guessed from the name but only |
26 |
really checked by following the code using it. Similar to this case, |
27 |
other parameters are not valid in all cases, and were simply added to |
28 |
the top-level instance objects. |
29 |
|
30 |
Overview |
31 |
-------- |
32 |
|
33 |
Across all cluster configuration data, we have multiple classes of |
34 |
parameters: |
35 |
|
36 |
A. cluster-wide parameters (e.g. name of the cluster, the master); |
37 |
these are the ones that we have today, and are unchanged from the |
38 |
current model |
39 |
|
40 |
#. node parameters |
41 |
|
42 |
#. instance specific parameters, e.g. the name of disks (LV), that |
43 |
cannot be shared with other instances |
44 |
|
45 |
#. instance parameters, that are or can be the same for many |
46 |
instances, but are not hypervisor related; e.g. the number of VCPUs, |
47 |
or the size of memory |
48 |
|
49 |
#. instance parameters that are hypervisor specific (e.g. kernel_path |
50 |
or PAE mode) |
51 |
|
52 |
|
53 |
|
54 |
Detailed Design |
55 |
--------------- |
56 |
|
57 |
The following definitions for instance parameters will be used below: |
58 |
|
59 |
hypervisor parameter |
60 |
a hypervisor parameter (or hypervisor specific parameter) is defined |
61 |
as a parameter that is interpreted by the hypervisor support code in |
62 |
Ganeti and usually is specific to a particular hypervisor (like the |
63 |
kernel path for PVM which makes no sense for HVM). |
64 |
|
65 |
backend parameter |
66 |
a backend parameter is defined as an instance parameter that can be |
67 |
shared among a list of instances, and is either generic enough not |
68 |
to be tied to a given hypervisor or cannot influence at all the |
69 |
hypervisor behaviour. |
70 |
|
71 |
For example: memory, vcpus, auto_balance |
72 |
|
73 |
All these parameters will be encoded into constants.py with the prefix "BE_" |
74 |
and the whole list of parameters will exist in the set "BES_PARAMETERS" |
75 |
|
76 |
proper parameter |
77 |
a parameter whose value is unique to the instance (e.g. the name of a LV, |
78 |
or the MAC of a NIC) |
79 |
|
80 |
As a general rule, for all kind of parameters, “None” (or in |
81 |
JSON-speak, “nil”) will no longer be a valid value for a parameter. As |
82 |
such, only non-default parameters will be saved as part of objects in |
83 |
the serialization step, reducing the size of the serialized format. |
84 |
|
85 |
Cluster parameters |
86 |
~~~~~~~~~~~~~~~~~~ |
87 |
|
88 |
Cluster parameters remain as today, attributes at the top level of the |
89 |
Cluster object. In addition, two new attributes at this level will |
90 |
hold defaults for the instances: |
91 |
|
92 |
- hvparams, a dictionary indexed by hypervisor type, holding default |
93 |
values for hypervisor parameters that are not defined/overrided by |
94 |
the instances of this hypervisor type |
95 |
|
96 |
- beparams, a dictionary holding (for 2.0) a single element 'default', |
97 |
which holds the default value for backend parameters |
98 |
|
99 |
Node parameters |
100 |
~~~~~~~~~~~~~~~ |
101 |
|
102 |
Node-related parameters are very few, and we will continue using the |
103 |
same model for these as previously (attributes on the Node object). |
104 |
|
105 |
Instance parameters |
106 |
~~~~~~~~~~~~~~~~~~~ |
107 |
|
108 |
As described before, the instance parameters are split in three: |
109 |
instance proper parameters, unique to each instance, instance |
110 |
hypervisor parameters and instance backend parameters. |
111 |
|
112 |
The “hvparams” and “beparams” are kept in two dictionaries at instance |
113 |
level. Only non-default parameters are stored (but once customized, a |
114 |
parameter will be kept, even with the same value as the default one, |
115 |
until reset). |
116 |
|
117 |
The names for hypervisor parameters in the instance.hvparams subtree |
118 |
should be choosen as generic as possible, especially if specific |
119 |
parameters could conceivably be useful for more than one hypervisor, |
120 |
e.g. instance.hvparams.vnc_console_port instead of using both |
121 |
instance.hvparams.hvm_vnc_console_port and |
122 |
instance.hvparams.kvm_vnc_console_port. |
123 |
|
124 |
There are some special cases related to disks and NICs (for example): |
125 |
a disk has both ganeti-related parameters (e.g. the name of the LV) |
126 |
and hypervisor-related parameters (how the disk is presented to/named |
127 |
in the instance). The former parameters remain as proper-instance |
128 |
parameters, while the latter value are migrated to the hvparams |
129 |
structure. In 2.0, we will have only globally-per-instance such |
130 |
hypervisor parameters, and not per-disk ones (e.g. all NICs will be |
131 |
exported as of the same type). |
132 |
|
133 |
Starting from the 1.2 list of instance parameters, here is how they |
134 |
will be mapped to the three classes of parameters: |
135 |
|
136 |
- name (P) |
137 |
- primary_node (P) |
138 |
- os (P) |
139 |
- hypervisor (P) |
140 |
- status (P) |
141 |
- memory (BE) |
142 |
- vcpus (BE) |
143 |
- nics (P) |
144 |
- disks (P) |
145 |
- disk_template (P) |
146 |
- network_port (P) |
147 |
- kernel_path (HV) |
148 |
- initrd_path (HV) |
149 |
- hvm_boot_order (HV) |
150 |
- hvm_acpi (HV) |
151 |
- hvm_pae (HV) |
152 |
- hvm_cdrom_image_path (HV) |
153 |
- hvm_nic_type (HV) |
154 |
- hvm_disk_type (HV) |
155 |
- vnc_bind_address (HV) |
156 |
- serial_no (P) |
157 |
|
158 |
|
159 |
Parameter validation |
160 |
~~~~~~~~~~~~~~~~~~~~ |
161 |
|
162 |
To support the new cluster parameter design, additional features will |
163 |
be required from the hypervisor support implementations in Ganeti. |
164 |
|
165 |
The hypervisor support implementation API will be extended with the |
166 |
following features: |
167 |
|
168 |
:PARAMETERS: class-level attribute holding the list of valid parameters |
169 |
for this hypervisor |
170 |
:CheckParamSyntax(hvparams): checks that the given parameters are |
171 |
valid (as in the names are valid) for this hypervisor; usually just |
172 |
comparing hvparams.keys() and cls.PARAMETERS; this is a class method |
173 |
that can be called from within master code (i.e. cmdlib) and should |
174 |
be safe to do so |
175 |
:ValidateParameters(hvparams): verifies the values of the provided |
176 |
parameters against this hypervisor; this is a method that will be |
177 |
called on the target node, from backend.py code, and as such can |
178 |
make node-specific checks (e.g. kernel_path checking) |
179 |
|
180 |
Default value application |
181 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
182 |
|
183 |
The application of defaults to an instance is done in the Cluster |
184 |
object, via two new methods as follows: |
185 |
|
186 |
- ``Cluster.FillHV(instance)``, returns 'filled' hvparams dict, based on |
187 |
instance's hvparams and cluster's ``hvparams[instance.hypervisor]`` |
188 |
|
189 |
- ``Cluster.FillBE(instance, be_type="default")``, which returns the |
190 |
beparams dict, based on the instance and cluster beparams |
191 |
|
192 |
The FillHV/BE transformations will be used, for example, in the RpcRunner |
193 |
when sending an instance for activation/stop, and the sent instance |
194 |
hvparams/beparams will have the final value (noded code doesn't know |
195 |
about defaults). |
196 |
|
197 |
LU code will need to self-call the transformation, if needed. |
198 |
|
199 |
Opcode changes |
200 |
~~~~~~~~~~~~~~ |
201 |
|
202 |
The parameter changes will have impact on the OpCodes, especially on |
203 |
the following ones: |
204 |
|
205 |
- OpCreateInstance, where the new hv and be parameters will be sent as |
206 |
dictionaries; note that all hv and be parameters are now optional, as |
207 |
the values can be instead taken from the cluster |
208 |
- OpQueryInstances, where we have to be able to query these new |
209 |
parameters; the syntax for names will be ``hvparam/$NAME`` and |
210 |
``beparam/$NAME`` for querying an individual parameter out of one |
211 |
dictionary, and ``hvparams``, respectively ``beparams``, for the whole |
212 |
dictionaries |
213 |
- OpModifyInstance, where the the modified parameters are sent as |
214 |
dictionaries |
215 |
|
216 |
Additionally, we will need new OpCodes to modify the cluster-level |
217 |
defaults for the be/hv sets of parameters. |
218 |
|
219 |
Caveats |
220 |
------- |
221 |
|
222 |
One problem that might appear is that our classification is not |
223 |
complete or not good enough, and we'll need to change this model. As |
224 |
the last resort, we will need to rollback and keep 1.2 style. |
225 |
|
226 |
Another problem is that classification of one parameter is unclear |
227 |
(e.g. ``network_port``, is this BE or HV?); in this case we'll take |
228 |
the risk of having to move parameters later between classes. |
229 |
|
230 |
Security |
231 |
-------- |
232 |
|
233 |
The only security issue that we foresee is if some new parameters will |
234 |
have sensitive value. If so, we will need to have a way to export the |
235 |
config data while purging the sensitive value. |
236 |
|
237 |
E.g. for the drbd shared secrets, we could export these with the |
238 |
values replaced by an empty string. |