Revision 545d1f1a
b/doc/design-2.2.rst | ||
---|---|---|
809 | 809 |
Finally we'll look into namespaces and containers, although that might |
810 | 810 |
slip after the 2.2 release. |
811 | 811 |
|
812 |
|
|
812 | 813 |
External interface changes |
813 | 814 |
-------------------------- |
814 | 815 |
|
816 |
|
|
817 |
OS API |
|
818 |
~~~~~~ |
|
819 |
|
|
820 |
The OS variants implementation in Ganeti 2.1 didn't prove to be useful |
|
821 |
enough to alleviate the need to hack around the Ganeti API in order to |
|
822 |
provide flexible OS parameters. |
|
823 |
|
|
824 |
As such, for Ganeti 2.2 we will provide support for arbitrary OS |
|
825 |
parameters. However, since OSes are not registered in Ganeti, but |
|
826 |
instead discovered at runtime, the interface is not entirely |
|
827 |
straightforward. |
|
828 |
|
|
829 |
Furthermore, to support the system administrator in keeping OSes |
|
830 |
properly in sync across the nodes of a cluster, Ganeti will also verify |
|
831 |
(if existing) the consistence of a new ``os_version`` file. |
|
832 |
|
|
833 |
These changes to the OS API will bump the API version to 20. |
|
834 |
|
|
835 |
|
|
836 |
OS version |
|
837 |
++++++++++ |
|
838 |
|
|
839 |
A new ``os_version`` file will be supported by Ganeti. This file is not |
|
840 |
required, but if existing, its contents will be checked for consistency |
|
841 |
across nodes. The file should hold only one line of text (any extra data |
|
842 |
will be discarded), and its contents will be shown in the OS information |
|
843 |
and diagnose commands. |
|
844 |
|
|
845 |
It is recommended that OS authors increase the contents of this file for |
|
846 |
any changes; at a minimum, modifications that change the behaviour of |
|
847 |
import/export scripts must increase the version, since they break |
|
848 |
intra-cluster migration. |
|
849 |
|
|
850 |
Parameters |
|
851 |
++++++++++ |
|
852 |
|
|
853 |
The interface between Ganeti and the OS scripts will be based on |
|
854 |
environment variables, and as such the parameters and their values will |
|
855 |
need to be valid in this context. |
|
856 |
|
|
857 |
Names |
|
858 |
^^^^^ |
|
859 |
|
|
860 |
The parameter names will be declared in a new file, ``parameters.list``, |
|
861 |
together with a one-line documentation (whitespace-separated). Example:: |
|
862 |
|
|
863 |
$ cat parameters.list |
|
864 |
ns1 Specifies the first name server to add to /etc/resolv.conf |
|
865 |
extra_packages Specifies additional packages to install |
|
866 |
rootfs_size Specifies the root filesystem size (the rest will be left unallocated) |
|
867 |
track Specifies the distribution track, one of 'stable', 'testing' or 'unstable' |
|
868 |
|
|
869 |
As seen above, the documentation can be separate via multiple |
|
870 |
spaces/tabs from the names. |
|
871 |
|
|
872 |
The parameter names as read from the file will be used for the command |
|
873 |
line interface in lowercased form; as such, there shouldn't be any two |
|
874 |
parameters which differ in case only. |
|
875 |
|
|
876 |
Values |
|
877 |
^^^^^^ |
|
878 |
|
|
879 |
The values of the parameters are, from Ganeti's point of view, |
|
880 |
completely freeform. If a given parameter has, from the OS' point of |
|
881 |
view, a fixed set of valid values, these should be documented as such |
|
882 |
and verified by the OS, but Ganeti will not handle such parameters |
|
883 |
specially. |
|
884 |
|
|
885 |
An empty value must be handled identically as a missing parameter. In |
|
886 |
other words, the validation script should only test for non-empty |
|
887 |
values, and not for declared versus undeclared parameters. |
|
888 |
|
|
889 |
Furthermore, each parameter should have an (internal to the OS) default |
|
890 |
value, that will be used if not passed from Ganeti. More precisely, it |
|
891 |
should be possible for any parameter to specify a value that will have |
|
892 |
the same effect as not passing the parameter, and no in no case should |
|
893 |
the absence of a parameter be treated as an exceptional case (outside |
|
894 |
the value space). |
|
895 |
|
|
896 |
|
|
897 |
Environment variables |
|
898 |
+++++++++++++++++++++ |
|
899 |
|
|
900 |
The parameters will be exposed in the environment upper-case and |
|
901 |
prefixed with the string ``OSP_``. For example, a parameter declared in |
|
902 |
the 'parameters' file as ``ns1`` will appear in the environment as the |
|
903 |
variable ``OSP_NS1``. |
|
904 |
|
|
905 |
Validation |
|
906 |
++++++++++ |
|
907 |
|
|
908 |
For the purpose of parameter name/value validation, the OS scripts |
|
909 |
*must* provide an additional script, named ``verify``. This script will |
|
910 |
be called with the argument ``parameters``, and all the parameters will |
|
911 |
be passed in via environment variables, as described above. |
|
912 |
|
|
913 |
The script should signify result/failure based on its exit code, and |
|
914 |
show explanatory messages either on its standard output or standard |
|
915 |
error. These messages will be passed on to the master, and stored as in |
|
916 |
the OpCode result/error message. |
|
917 |
|
|
918 |
The parameters must be constructed to be independent of the instance |
|
919 |
specifications. In general, the validation script will only be called |
|
920 |
with the parameter variables set, but not with the normal per-instance |
|
921 |
variables, in order for Ganeti to be able to validate default parameters |
|
922 |
too, when they change. Validation will only be performed on one cluster |
|
923 |
node, and it will be up to the ganeti administrator to keep the OS |
|
924 |
scripts in sync between all nodes. |
|
925 |
|
|
926 |
Instance operations |
|
927 |
+++++++++++++++++++ |
|
928 |
|
|
929 |
The parameters will be passed, as described above, to all the other |
|
930 |
instance operations (creation, import, export). Ideally, these scripts |
|
931 |
will not abort with parameter validation errors, if the ``verify`` |
|
932 |
script has verified them correctly. |
|
933 |
|
|
934 |
Note: when changing an instance's OS type, any OS parameters defined at |
|
935 |
instance level will be kept as-is. If the parameters differ between the |
|
936 |
new and the old OS, the user should manually remove/update them as |
|
937 |
needed. |
|
938 |
|
|
939 |
Declaration and modification |
|
940 |
++++++++++++++++++++++++++++ |
|
941 |
|
|
942 |
Since the OSes are not registered in Ganeti, we will only make a 'weak' |
|
943 |
link between the parameters as declared in Ganeti and the actual OSes |
|
944 |
existing on the cluster. |
|
945 |
|
|
946 |
It will be possible to declare parameters either globally, per cluster |
|
947 |
(where they are indexed per OS/variant), or individually, per |
|
948 |
instance. The declaration of parameters will not be tied to current |
|
949 |
existing OSes. When specifying a parameter, if the OS exists, it will be |
|
950 |
validated; if not, then it will simply be stored as-is. |
|
951 |
|
|
952 |
A special note is that it will not be possible to 'unset' at instance |
|
953 |
level a parameter that is declared globally. Instead, at instance level |
|
954 |
the parameter should be given an explicit value, or the default value as |
|
955 |
explained above. |
|
956 |
|
|
957 |
CLI interface |
|
958 |
+++++++++++++ |
|
959 |
|
|
960 |
The modification of global (default) parameters will be done via the |
|
961 |
``gnt-os`` command, and the per-instance parameters via the |
|
962 |
``gnt-instance`` command. Both these commands will take an addition |
|
963 |
``--os-parameters`` or ``-O`` flag that specifies the parameters in the |
|
964 |
familiar comma-separated, key=value format. For removing a parameter, a |
|
965 |
``-key`` syntax will be used, e.g.:: |
|
966 |
|
|
967 |
# initial modification |
|
968 |
$ gnt-instance modify -O use_dchp=true instance1 |
|
969 |
# later revert (to the cluster default, or the OS default if not |
|
970 |
# defined at cluster level) |
|
971 |
$ gnt-instance modify -O -use_dhcp instance1 |
|
972 |
|
|
973 |
Internal storage |
|
974 |
++++++++++++++++ |
|
975 |
|
|
976 |
Internally, the OS parameters will be stored in a new ``osparams`` |
|
977 |
attribute. The global parameters will be stored on the cluster object, |
|
978 |
and the value of this attribute will be a dictionary indexed by OS name |
|
979 |
(this also accepts an OS+variant name, which will override a simple OS |
|
980 |
name, see below), and for values the key/name dictionary. For the |
|
981 |
instances, the value will be directly the key/name dictionary. |
|
982 |
|
|
983 |
Overriding rules |
|
984 |
++++++++++++++++ |
|
985 |
|
|
986 |
Any instance-specific parameters will override any variant-specific |
|
987 |
parameters, which in turn will override any global parameters. The |
|
988 |
global parameters, in turn, override the built-in defaults (of the OS |
|
989 |
scripts). |
|
990 |
|
|
991 |
|
|
815 | 992 |
.. vim: set textwidth=72 : |
993 |
.. Local Variables: |
|
994 |
.. mode: rst |
|
995 |
.. fill-column: 72 |
|
996 |
.. End: |
Also available in: Unified diff