Revision 425f3ffe

b/doc/design-node-add.rst
20 20
files being the same). Most of the logic and error handling is also done
21 21
on the connecting machine.
22 22

  
23
Once a node's SSH daemon has been configured, more than 25 files need to
24
be copied using ``scp`` before the node daemon can be started. No
25
verification is being done before files are copied. Once the node daemon
26
is started, an opcode is submitted to the master daemon, which will then
27
copy more files, such as the configuration and job queue for master
28
candidates, using RPC. This process is somewhat fragile and requires
29
initiating many SSH connections.
23 30

  
24 31
Proposed changes
25 32
----------------
26 33

  
34
SSH
35
~~~
36

  
27 37
The main goal is to move more logic to the newly added node. Instead of
28 38
having a relatively large script executed on the master node, most of it
29 39
is moved over to the added node.
......
42 52

  
43 53
Eventually ``setup-ssh`` can be removed.
44 54

  
55

  
56
Node daemon
57
~~~~~~~~~~~
58

  
59
Similar to SSH setup changes, the process of copying files and starting
60
the node daemon will be moved into a dedicated program. On its standard
61
input it will receive a standardized JSON structure (defined :ref:`below
62
<node-daemon-setup-json>`). Once the input data has been successfully
63
decoded and the received values were verified for sanity, the program
64
proceeds to write the values to files and then starts the node daemon
65
(``ganeti-noded``).
66

  
67
To add a new node to the cluster, the master node will have to gather
68
all values, build the data structure, and then invoke the newly added
69
``node-daemon-setup`` program via SSH. In this way only a single SSH
70
connection is needed and the values can be verified before being written
71
to files.
72

  
73
If the program exits successfully, the node is ready to be added to the
74
master daemon's configuration. The node daemon will be running, but
75
``OpNodeAdd`` needs to be run before it becomes a full node. The opcode
76
will copy more files, such as the :doc:`RAPI certificate <rapi>`.
77

  
78

  
79
Data structures
80
---------------
81

  
45 82
.. _prepare-node-join-json:
46 83

  
47
JSON structure
48
~~~~~~~~~~~~~~
84
JSON structure for SSH setup
85
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 86

  
50 87
The data is given in an object containing the keys described below.
51 88
Unless specified otherwise, all entries are optional.
......
78 115
    ("dsa", "-----BEGIN DSA PRIVATE KEY-----...", "ssh-dss AAAA..."),
79 116
  ]
80 117

  
118

  
119
.. _node-daemon-setup-json:
120

  
121
JSON structure for node daemon setup
122
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123

  
124
The data is given in an object containing the keys described below.
125
Unless specified otherwise, all entries are optional.
126

  
127
``cluster_name``
128
  Required string with the cluster name. If a local cluster name is
129
  found, the join process is aborted unless the passed cluster name
130
  matches the local name. The cluster name is also included in the
131
  dictionary given via the ``ssconf`` entry.
132
``node_daemon_certificate``
133
  Public and private part of cluster's node daemon certificate in PEM
134
  format. If a local node certificate is found, the process is aborted
135
  unless it matches.
136
``ssconf``
137
  Dictionary with ssconf names and their values. Both are strings.
138
  Example:
139

  
140
  .. highlight:: javascript
141

  
142
  ::
143

  
144
    {
145
      "cluster_name": "cluster.example.com",
146
      "master_ip": "192.168.2.1",
147
      "master_netdev": "br0",
148
      # …
149
    }
150

  
151
``start_node_daemon``
152
  Boolean denoting whether the node daemon should be started (or
153
  restarted if it was running for some reason).
154

  
81 155
.. vim: set textwidth=72 :
82 156
.. Local Variables:
83 157
.. mode: rst

Also available in: Unified diff