Statistics
| Branch: | Tag: | Revision:

root / doc / design-2.0-cluster-parameters.rst @ 5d672980

History | View | Annotate | Download (8 kB)

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