1 Ganeti 2.0 cluster parameters
2 =============================
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:
13 - introducting new parameters
14 - writing command line interfaces or APIs for these parameters
15 - supporting new 2.0 features
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.
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.
33 Across all cluster configuration data, we have multiple classes of
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
42 #. instance specific parameters, e.g. the name of disks (LV), that
43 cannot be shared with other instances
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,
49 #. instance parameters that are hypervisor specific (e.g. kernel_path
57 The following definitions for instance parameters will be used below:
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).
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
71 For example: memory, vcpus, auto_balance
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"
77 a parameter whose value is unique to the instance (e.g. the name of a LV,
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.
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:
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
96 - beparams, a dictionary holding (for 2.0) a single element 'default',
97 which holds the default value for backend parameters
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).
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.
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,
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.
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).
133 Starting from the 1.2 list of instance parameters, here is how they
134 will be mapped to the three classes of parameters:
149 - hvm_boot_order (HV)
152 - hvm_cdrom_image_path (HV)
155 - vnc_bind_address (HV)
162 To support the new cluster parameter design, additional features will
163 be required from the hypervisor support implementations in Ganeti.
165 The hypervisor support implementation API will be extended with the
168 :PARAMETERS: class-level attribute holding the list of valid parameters
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
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)
180 Default value application
181 ~~~~~~~~~~~~~~~~~~~~~~~~~
183 The application of defaults to an instance is done in the Cluster
184 object, via two new methods as follows:
186 - ``Cluster.FillHV(instance)``, returns 'filled' hvparams dict, based on
187 instance's hvparams and cluster's ``hvparams[instance.hypervisor]``
189 - ``Cluster.FillBE(instance, be_type="default")``, which returns the
190 beparams dict, based on the instance and cluster beparams
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
197 LU code will need to self-call the transformation, if needed.
202 The parameter changes will have impact on the OpCodes, especially on
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
213 - OpModifyInstance, where the the modified parameters are sent as
216 Additionally, we will need new OpCodes to modify the cluster-level
217 defaults for the be/hv sets of parameters.
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.
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.
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.
237 E.g. for the drbd shared secrets, we could export these with the
238 values replaced by an empty string.