Subversion Repositories havirt

Rev

Rev 23 | Rev 25 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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