~openstackbook/openstackbook/cactus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?xml version="1.0" encoding="UTF-8"?><chapter xmlns:db="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook" xml:id="Instance_Management-d1e1646" version="5.0" xml:base="Instance.xml">
    <title>Instance Management</title>
<section xml:id="Introduction-d1e1651">
<title>Introduction</title>
<para>An instance is a virtual machine provisioned by OpenStack on one of the nova-compute servers. 
When you launch an instance, a series of steps are triggered on various components of the OpenStack. 
During the life cycles of an instance, it moves through various stages as shown in the diagram below:
</para>
<para>
<mediaobject>
    <imageobject role="fo">
        <imagedata fileref="images/lifecycle.png"
            format="PNG" scale="60"/>
    </imageobject>
    <imageobject role="html">
        <imagedata fileref="images/lifecyclehtml.png"
            format="PNG" />
    </imageobject>
</mediaobject></para>
<para>
There are four interfaces that can be used for managing instances in nova.</para>
<itemizedlist>
<listitem><para>Firefox with Hybridfox Plugin</para></listitem>
<listitem><para> Command line tools like euca2ools</para></listitem>
<listitem><para>OpenStack Dashboard</para></listitem>
<listitem><para>Custom applications developed using EC2 APIs</para></listitem>
</itemizedlist>
</section>
<section xml:id="Hybridfox-d1e1691">
<title>Hybridfox</title>
<para>
ElasticFox is an open source Mozilla Firefox extension that works on Firefox Version 2.0 or later to help you with managing AWS compute and associated resources - Launch new instances, mount Elastic Block Storage volumes, map Elastic IP addresses, and more. 
This was originally written for EC2, but, it has become possible to use to manage resources from other cloud platforms that are API compatible with EC2 as well, particularly Eucalyptus.
</para>
<para>
Hybridfox is a fork from ElasticFox to make it usable with Eucalyptus, when ElasticFox worked only with AWS. The aim of Hybridfox was to be usable as the single interface to AWS and Eucalyptus as well as other cloud platforms API compatible with AWS. Recent versions of Hybridfox have been quick to add support for newer features from AWS such as handling streaming media etc.
</para>
<section xml:id="Features-d1e1702">
<title>Features</title>
<itemizedlist>
<listitem><para>List available Machine images (AMI)</para></listitem>
<listitem><para>List running instances</para></listitem>
<listitem><para>Launch new instances of an AMI</para></listitem>
<listitem><para>Manage security groups and rules</para></listitem>
<listitem><para>Manage Snapshots/EBS volumes</para></listitem>
</itemizedlist>
</section>
<section xml:id="Installation-d1e1731">
<title>Installation</title>
<para>You can install the extension from http://code.google.com/p/hybridfox/downloads/list. The latest version (at the time of writing) is hybridfox-1.6.000040.xpi.</para>
</section>
<section xml:id="Configuration-d1e1741">
<title>Configuration</title>

<para>Define a Region</para>

<itemizedlist>
<listitem><para>Click on Regions button</para></listitem>
<listitem><para>Enter a logical name for the region (Example:"Eucalyptus" , "MyEucalyptus" etc.)</para></listitem>
<listitem><para>Enter the value of EC2_URL from your eucarc file as the Endpoint URL(http://192.168.10.121:8773/services/Eucalyptus in our sample setup)</para></listitem>
</itemizedlist>

<para>Define Credentials</para>
<itemizedlist>
    <listitem><para>Click on Credentials button</para></listitem>
    <listitem><para>Enter a logical name for the credential set (Example: "EucaAcc1" etc.)</para></listitem>
    <listitem><para>Enter EC2_ACCESS_KEY and EC2_SECRET_KEY from your eucarc file as the AWS Access Key and AWS Secret Access Key respectively</para></listitem>
</itemizedlist>

<para>Define Key Pairs</para>
<itemizedlist>
     <listitem><para>Click on KeyPairs tab</para></listitem>
     <listitem><para>Click on "Create a new keypair" icon</para></listitem>
     <listitem><para>Enter a name for the key pair (Example: "eucakey" etc.)</para></listitem>
     <listitem><para>Choose location on the client machine to save the id file to (You will need this to use with putty etc. to make an SSH connection)</para></listitem>
</itemizedlist>
<para>Define Security Groups</para>
<itemizedlist>
    <listitem><para>Click on SecurityGroups tab</para></listitem>
    <listitem><para>Enter a name for the group (Example: "Eucalyptus", "EucaGroup" etc.)</para></listitem>
    <listitem><para>Enter the description and click on create button</para></listitem>
</itemizedlist>
<para>You will have an option to specify some basic ports like SSH/RDP to be opened up while creating the group itself. After the group is created, you can add rules any time by choosing the security group in the left pane titled "Your groups" and adding rules in the right pane titled "Group Permissions"</para>
</section>
</section>
<section xml:id="Euca2ools-Command_Line_Tools-d1e1828">
<title>Euca2ools-Command Line Tools</title>
<para>Euca2ools from Eucalyptus provide a bunch of command line tools to manage the eucalyptus setup. These commands help you manage images, instances, storage, networking etc. A few commands related to managing the instances are given below.</para>
<para>For a complete list of commands, see Appendix.</para>
<section xml:id="Installation-d1e1839">

<title>Installation</title>

<programlisting>
sudo apt-get install euca2ools
</programlisting>
</section>

<section xml:id="Creation_of_Key_Pairs-d1e1848">
<title>Creation of Key Pairs</title>
<para>OpenStack expects the client tools to use 2 kinds of credentials. One set of credentials are called Access Key and Secret Key that all clients would need to use to make any requests to the Cloud Controller. Each user registered on the web interface has this set created for him. You can download it from the web interface as mentioned in the chapter on "Web Interface".</para>

<para>You will also need to generate a keypair consisting of private key/public key to be able to launch instances on Eucalyptus. These keys are injected into the instances to make password-less SSH access to the instance possible. This depends on the way the necessary tools are bundled into the images. Please refer to the chapter on Image Management for more details. </para>

<para>Keypairs can also be generated using the following commands.</para>
<programlisting>
cd ~/creds
euca-add-keypair mykey &gt; mykey.priv
chmod 600 mykey.priv
</programlisting>
<para>This creates a new keypair called mykey. The private key mykey.priv is saved locally which can be used to connect to an instance launched with mykey as the keypair. euca-describe-keypairs command to list the available keypairs.</para><para>The output should like this:
</para>
<programlisting>
uecadmin@client1:~$ euca-describe-keypairs
KEYPAIR mykey   f7:ac:8e:f5:05:19:2b:31:28:8c:9b:d7:b8:07:0c:3c:b6:34:8f:79
KEYPAIR helloworld      12:96:b3:21:34:8d:6a:3f:92:2e:2b:70:23:ff:7f:51:b5:b7:ad:37
KEYPAIR ubuntu f6:af:9a:59:65:35:32:c4:3a:c4:62:0e:e1:44:0f:71:29:03:2d:91
KEYPAIR lucid  74:04:70:33:ed:57:7a:30:36:1f:ca:c6:ec:d5:4f:10:34:1a:52:51
KEYPAIR karmic   01:f9:aa:5f:4d:20:e2:53:d1:29:d0:0f:e2:f3:8c:21:91:70:7e:c8
</programlisting>
<para>To delete an existing keypair:</para>
<programlisting>
euca-delete-keypair helloworld
</programlisting>
<para>The above tasks can be achieved using Hybridfox from the "Keypairs" tab.</para>
</section>
<section xml:id="Launch_and_manage_instances-d1e1885">
<title>Launch and manage instances</title>
<para>There are several commands that help in managing the instances. Here are a few examples:</para>
<programlisting>
$ euca-run-instances emi-721D0EBA -k mykey -t c1.medium
RESERVATION     r-55560977      admin   admin-default
INSTANCE        i-50630A2A      emi-721D0EBA    0.0.0.0 0.0.0.0 pending mykey 2010-05-07T07:17:48.23Z eki-675412F5    eri-A1E113E0

$ euca-describe-instances
RESERVATION     r-55560977      admin   default
INSTANCE        i-50630A2A      emi-721D0EBA    192.168.3.130    192.168.3.130  running  mykey   0       c1.medium       2010-05-07T07:17:48.23Z         myueccluster    eki-675412F5    eri-A1E113E0

$ euca-reboot-instances i-50630A2A

$ euca-terminate-instances i-50630A2A

$ euca-run-instances ami-XXXXXXXX -k mykey

$ euca-get-console-output i-50630A2A
i-50630A2A
2010-05-07T07:22:40.795Z
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.32-21-server (buildd@yellow) (gcc version 4.
4.3 (Ubuntu 4.4.3-4ubuntu5) ) #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 (Ub
untu 2.6.32-21.32-server 2.6.32.11+drm33.2)
[    0.000000] Command line: root=/dev/sda1 console=ttyS0
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
[    0.000000]  BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved)
.............
</programlisting>
 <para>You can make password less ssh access to the instance as follows:</para>
<programlisting>
ssh -i mykey.priv user@192.168.3.130
</programlisting>
<para>Make sure that you launch the instance with the correct VM type. If it is launched with a smaller VM type,then the following error is encountered.</para>
<programlisting>error: insufficient disk capacity remaining</programlisting>
<para>By default, m1.small is the VM type that is used which comes with a 2GB Hard Disk. So if you have a disk image of size 5GB, instead of</para>
<programlisting>euca-run-instances ami-XXXXXXXX -k mykey</programlisting>
<para>use</para>
<programlisting>euca-run-instances ami-XXXXXXXX -k mykey -t c1.medium</programlisting>
<para>VM type also has implications for amount of RAM and number of CPUs allocated to the instance.</para>
<para>Check the VM types available.</para>
<programlisting>sudo nova-manage instance_type list</programlisting>
</section>
</section>
<section xml:id="Using_the_OpenStack_Dashboard-d1e1933"><title>Using the OpenStack Dashboard</title>

<section xml:id="Creating_Keypairs-d1e1937"><title>Creating Keypairs</title>
<para><mediaobject>
<imageobject>
    <imagedata fileref="images/ckeypairs.png" scale="70" format="PNG"/>
</imageobject>
</mediaobject></para>
</section>
<section xml:id="Launching_an_instance-d1e1951"><title>Launching an instance</title>
<para><mediaobject>
<imageobject>
    <imagedata fileref="images/linstance.png" scale="70" format="PNG"/>
</imageobject>
</mediaobject></para>
</section>

<section xml:id="Terminating_an_instance-d1e1965"><title>Terminating an instance</title>
<para><mediaobject>
<imageobject>
    <imagedata fileref="images/tinstance.png" scale="70" format="PNG"/>
</imageobject>
</mediaobject></para>
</section>

<section xml:id="Displaying_the_Console_Output-d1e1979"><title>Displaying the Console Output</title>
<para><mediaobject>
<imageobject>
    <imagedata fileref="images/coutput.png" scale="70" format="PNG"/>
</imageobject>
</mediaobject></para>
</section>
</section>
</chapter>