9 |
rodolico |
1 |
Script to macro manage cluster of nodes (hypervisors) and the domains
|
|
|
2 |
(virtuals) on them.
|
|
|
3 |
|
|
|
4 |
Used as an extension to virsh, which it calls quite often.
|
|
|
5 |
|
|
|
6 |
All nodes must be able to make an ssh connection to all other nodes using
|
|
|
7 |
public key (no passwords). Note that this includes being able to make an ssh
|
|
|
8 |
connection to itself as, at this time, it simply makes an ssh connection to
|
|
|
9 |
whatever node is defined over.
|
|
|
10 |
|
|
|
11 |
There are two subdirectories, conf/ and var/.
|
|
|
12 |
|
|
|
13 |
conf/ is NOT what you think; the app does not have a static configuration.
|
|
|
14 |
conf/ contains domain (virtual) configurations in an XML format. They are
|
|
|
15 |
acquired using virsh dumpxml.
|
|
|
16 |
|
|
|
17 |
var/ contains YAML representations of Perl hashes which contains information
|
|
|
18 |
about nodes, domains and the relationship between them.
|
|
|
19 |
|
|
|
20 |
===== NOT IMPLEMENTED YET =====
|
|
|
21 |
havirt can be installed on any node, or on a completely separate machine. If
|
|
|
22 |
installed on multiple nodes, it can be safely be run simultaneously on multiple
|
|
|
23 |
nodes as file locking is enabled on any code which writes to /var
|
|
|
24 |
|
|
|
25 |
=== Installation
|
|
|
26 |
|
|
|
27 |
There is no fancy installer. Simply grab the files via subversion.
|
|
|
28 |
|
|
|
29 |
svn co http://svn.dailydata.net/svn/havirt/stable /path/to/install
|
|
|
30 |
ln -s /path/to/install/havirt /usr/local/bin/havirt
|
|
|
31 |
|
|
|
32 |
Some Perl modules are needed.
|
|
|
33 |
Exporter
|
|
|
34 |
Getopt::Long
|
|
|
35 |
version
|
|
|
36 |
YAML::Tiny
|
|
|
37 |
Data::Dumper
|
|
|
38 |
|
|
|
39 |
Most may be on your system already, but you can run the following command on
|
|
|
40 |
Debian based systems to add the ones not in the base install.
|
|
|
41 |
|
|
|
42 |
apt install -y libdata-dump-perl libyaml-tiny-perl
|
|
|
43 |
|
|
|
44 |
=== Setup
|
|
|
45 |
|
|
|
46 |
Ensure all nodes can talk to each other (including themselves) via public
|
|
|
47 |
key encryption (no password). If havirt is on a separate machine, it
|
|
|
48 |
must be able to talk to all nodes.
|
|
|
49 |
|
|
|
50 |
Each should be able to talk to the other. I generally create a
|
|
|
51 |
/root/.ssh/config which contains aliases for simplicity.
|
|
|
52 |
|
|
|
53 |
Once you are sure all of your nodes can talk to each other, run the following
|
|
|
54 |
command for each node.
|
|
|
55 |
|
|
|
56 |
havirt node add NAMEOFNODE
|
|
|
57 |
|
|
|
58 |
where NAMEOFNODE is accessible either via DNS or an ssh alias.
|
|
|
59 |
|
|
|
60 |
When all nodes are added, you can list them with
|
|
|
61 |
|
|
|
62 |
havirt node list -t tsv
|
|
|
63 |
|
|
|
64 |
which will dump a tab delimited text file to STDOUT.
|
|
|
65 |
|
|
|
66 |
Now it is time to populate all of the domains currently running
|
|
|
67 |
|
|
|
68 |
havirt node scan # scan all nodes for running domains
|
|
|
69 |
havirt domain update # get conf for all domains and store in conf/
|
|
|
70 |
havirt domain list # show all domains
|
|
|
71 |
|
13 |
rodolico |
72 |
Note: domain list will not show nodes which have no domains on them.
|