Statistics
| Branch: | Tag: | Revision:

root / doc / virtual-cluster.rst @ ab6536ba

History | View | Annotate | Download (4.2 kB)

1 ab171697 Michael Hanselmann
Virtual cluster support
2 ab171697 Michael Hanselmann
=======================
3 ab171697 Michael Hanselmann
4 dad226e3 Thomas Thrainer
Documents Ganeti version 2.9
5 ab171697 Michael Hanselmann
6 ab171697 Michael Hanselmann
.. contents::
7 ab171697 Michael Hanselmann
8 ab171697 Michael Hanselmann
Introduction
9 ab171697 Michael Hanselmann
------------
10 ab171697 Michael Hanselmann
11 ab171697 Michael Hanselmann
This is a description of Ganeti's support for virtual clusters
12 ab171697 Michael Hanselmann
introduced in version 2.7. The original design is described
13 ab171697 Michael Hanselmann
in a separate :doc:`design document <design-virtual-clusters>`.
14 ab171697 Michael Hanselmann
15 ab171697 Michael Hanselmann
A virtual cluster consists of multiple virtual nodes (instances of
16 ab171697 Michael Hanselmann
Ganeti daemons) running on the same physical machine within one
17 ab171697 Michael Hanselmann
operating system. This way multiple (virtual) nodes can be simulated
18 ab171697 Michael Hanselmann
using a single machine. Virtual clusters can be run as a user without
19 ab171697 Michael Hanselmann
root privileges (see :ref:`limitations <limitations>`).
20 ab171697 Michael Hanselmann
21 ab171697 Michael Hanselmann
While not implemented in the helper setup script at the time of this
22 ab171697 Michael Hanselmann
writing, virtual clusters can also be split over multiple physical
23 ab171697 Michael Hanselmann
machines, allowing for even more virtual nodes.
24 ab171697 Michael Hanselmann
25 ab171697 Michael Hanselmann
26 ab171697 Michael Hanselmann
.. _limitations:
27 ab171697 Michael Hanselmann
28 ab171697 Michael Hanselmann
Limitations
29 ab171697 Michael Hanselmann
-----------
30 ab171697 Michael Hanselmann
31 ab171697 Michael Hanselmann
Due to historical and practical design decisions virtual clusters
32 ab171697 Michael Hanselmann
have several limitations.
33 ab171697 Michael Hanselmann
34 ab171697 Michael Hanselmann
- "fake" hypervisor only
35 ab171697 Michael Hanselmann
- Instances must be diskless or file-backed
36 ab171697 Michael Hanselmann
- Node information is the same over multiple virtual nodes (e.g. free
37 ab171697 Michael Hanselmann
  memory)
38 ab171697 Michael Hanselmann
- If running as a user without root privileges, certain operations are
39 ab171697 Michael Hanselmann
  not available; some operations are not useful even when running as
40 ab171697 Michael Hanselmann
  root (e.g. powercycle)
41 ab171697 Michael Hanselmann
- OS definitions must be prepared for this setup
42 ab171697 Michael Hanselmann
- Setup is partially manual, especially when not running as root
43 ab171697 Michael Hanselmann
44 ab171697 Michael Hanselmann
45 ab171697 Michael Hanselmann
Basics
46 ab171697 Michael Hanselmann
------
47 ab171697 Michael Hanselmann
48 ab171697 Michael Hanselmann
Ganeti programs act as running on a virtual node if the environment
49 ab171697 Michael Hanselmann
variables ``GANETI_ROOTDIR`` and ``GANETI_HOSTNAME`` are set. The former
50 ab171697 Michael Hanselmann
must be an absolute path to a directory with the last component being
51 ab171697 Michael Hanselmann
equal to the value of ``GANETI_HOSTNAME``, which contains the name of
52 ab171697 Michael Hanselmann
the virtual node. The reason for this requirement is that one virtual
53 ab171697 Michael Hanselmann
node must be able to compute an absolute path on another node for
54 ab171697 Michael Hanselmann
copying files via SSH.
55 ab171697 Michael Hanselmann
56 ab171697 Michael Hanselmann
The whole content of ``GANETI_ROOTDIR`` is the node directory, its
57 ab171697 Michael Hanselmann
parent directory (without hostname) is the cluster directory.
58 ab171697 Michael Hanselmann
59 ab171697 Michael Hanselmann
Example for environment variables::
60 ab171697 Michael Hanselmann
61 ab171697 Michael Hanselmann
  GANETI_ROOTDIR=/tmp/vcluster/node1.example.com
62 ab171697 Michael Hanselmann
  GANETI_HOSTNAME=node1.example.com
63 ab171697 Michael Hanselmann
64 ab171697 Michael Hanselmann
65 ab171697 Michael Hanselmann
With this example the node directory is
66 ab171697 Michael Hanselmann
``/tmp/vcluster/node1.example.com`` and the cluster directory
67 ab171697 Michael Hanselmann
``/tmp/vcluster``.
68 ab171697 Michael Hanselmann
69 ab171697 Michael Hanselmann
70 ab171697 Michael Hanselmann
.. _vcluster-setup:
71 ab171697 Michael Hanselmann
72 ab171697 Michael Hanselmann
Setup
73 ab171697 Michael Hanselmann
-----
74 ab171697 Michael Hanselmann
75 ab171697 Michael Hanselmann
A script to configure virtual clusters is included with Ganeti as
76 ab171697 Michael Hanselmann
``tools/vcluster-setup`` (usually installed as
77 ab171697 Michael Hanselmann
``/usr/lib/ganeti/tools/vcluster-setup``). Running it with the ``-h``
78 ab171697 Michael Hanselmann
option prints a usage description. The script creates all necessary
79 ab171697 Michael Hanselmann
directories, configures network interfaces, adds or updates entries in
80 ab171697 Michael Hanselmann
``/etc/hosts`` and generates a small number of helper scripts.
81 ab171697 Michael Hanselmann
82 ab171697 Michael Hanselmann
.. TODO: Describe setup of non-root virtual cluster
83 ab171697 Michael Hanselmann
84 ab171697 Michael Hanselmann
85 ab171697 Michael Hanselmann
Use
86 ab171697 Michael Hanselmann
---
87 ab171697 Michael Hanselmann
88 ab171697 Michael Hanselmann
Once the virtual cluster has been :ref:`set up <vcluster-setup>`, the
89 ab171697 Michael Hanselmann
cluster can be initialized. The instructions for doing so have been
90 ab171697 Michael Hanselmann
printed by the ``vcluster-setup`` script together with other useful
91 ab171697 Michael Hanselmann
information, such as the list of virtual nodes. The commands printed
92 ab171697 Michael Hanselmann
should be used to configure the list of enabled hypervisors and other
93 ab171697 Michael Hanselmann
settings.
94 ab171697 Michael Hanselmann
95 ab171697 Michael Hanselmann
To run commands for a specific virtual node, the script named ``cmd``
96 ab171697 Michael Hanselmann
located in the node directory can be used. It takes a command as its
97 ab171697 Michael Hanselmann
argument(s), sets the environment variables ``GANETI_ROOTDIR`` and
98 ab171697 Michael Hanselmann
``GANETI_HOSTNAME`` and then runs the command. Example:
99 ab171697 Michael Hanselmann
100 ab171697 Michael Hanselmann
.. highlight:: shell-example
101 ab171697 Michael Hanselmann
102 ab171697 Michael Hanselmann
::
103 ab171697 Michael Hanselmann
104 ab171697 Michael Hanselmann
  # Let's create a cluster with node1 as its master node
105 ab171697 Michael Hanselmann
  $ cd /tmp/vcluster
106 ab171697 Michael Hanselmann
  $ node1.example.com/cmd gnt-cluster info
107 ab171697 Michael Hanselmann
  Cluster name: cluster.example.com
108 ab171697 Michael Hanselmann
109 ab171697 Michael Hanselmann
  Master node: node1.example.com
110 ab171697 Michael Hanselmann
111 ab171697 Michael Hanselmann
  # Configure cluster as per "vcluster-setup" script
112 ab171697 Michael Hanselmann
  $ node1.example.com/cmd gnt-cluster modify …
113 ab171697 Michael Hanselmann
114 ab171697 Michael Hanselmann
Scripts are provided in the cluster root directory to start, stop or
115 ab171697 Michael Hanselmann
restart all daemons for all virtual nodes. These are named
116 ab171697 Michael Hanselmann
``start-all``, ``stop-all`` and ``restart-all``. ``ganeti-watcher`` can
117 ab171697 Michael Hanselmann
be run for all virtual nodes using ``watcher-all``.
118 ab171697 Michael Hanselmann
119 ab171697 Michael Hanselmann
Adding an instance (assuming node1.example.com is the master node as per
120 ab171697 Michael Hanselmann
the example above):
121 ab171697 Michael Hanselmann
122 ab171697 Michael Hanselmann
.. highlight:: shell-example
123 ab171697 Michael Hanselmann
124 ab171697 Michael Hanselmann
::
125 ab171697 Michael Hanselmann
126 ab171697 Michael Hanselmann
  $ node1.example.com/cmd gnt-instance add --os-size 1G \
127 ab171697 Michael Hanselmann
    --disk-template=file --os-type dummy -B memory=192 -I hail \
128 ab171697 Michael Hanselmann
    instance1.example.com
129 ab171697 Michael Hanselmann
130 ab171697 Michael Hanselmann
.. vim: set textwidth=72 :
131 ab171697 Michael Hanselmann
.. Local Variables:
132 ab171697 Michael Hanselmann
.. mode: rst
133 ab171697 Michael Hanselmann
.. fill-column: 72
134 ab171697 Michael Hanselmann
.. End: