~annegentle/openstackbook/epubtest

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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<?xml version="1.0" encoding="UTF-8"?>
<chapter xmlns:db="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook" xml:id="OpenStack_Commands-d1e2584" version="5.0" xml:base="Commands.xml">
<title>OpenStack Commands</title>
<section xml:id="Nova_Manage_Commands-d1e2589">
<title>Nova Manage Commands</title>
<para>OpenStack provides commands for administrative tasks such as user/role management,  network management etc. In all the examples we will use username as "novadmin" and project name as "proj". All the nova-manage commands will need to be run as "root". Either run them as root or run them under sudo.</para>
<section xml:id="User_Role_Management-d1e2597">
<title>User/Role Management</title>
<para>Add a new user</para>
<programlisting>
nova-manage user create --name=novaadmin
</programlisting>
<para>Add a user along with access and secret keys.</para>
<programlisting>
nova-manage user create --name=novaadmin --access=myaccess --secret=mysecret
</programlisting>
<para>Add a user with admin privileges</para>
<programlisting>
nova-manage user admin --name=novaadmin --access=myaccess --secret=mysecret
</programlisting>

<para>List existing users</para>
<programlisting>
nova-manage user list
</programlisting>

<para>Delete an existing user</para>
<programlisting>
nova-manage user delete --name=novaadmin
</programlisting>

<para>Associate a user to a specific existing project</para>
<programlisting>
nova-manage project add --project=proj --user=novaadmin
</programlisting>

<para>Remove a  user from a specific existing project.</para>
<programlisting>
nova-manage project remove --project=proj --user=novaadmin
</programlisting>

<para>View access key and secret keys of particular user.</para>
<programlisting>
nova-manage user exports --name=novaadmin
</programlisting>

<para>Adding a user sitewide role.</para>
<programlisting>
nova-manage role add --user=novaadmin --role=netadmin
</programlisting>

<para>Remove a sitewide role from a particular user</para>
<programlisting>
nova-manage role remove --user=novaadmin --role=netadmin
</programlisting>
<para>Adding a user project specific role.</para>
<programlisting>
nova-manage role add --user=novaadmin --role=netadmin --project=proj
</programlisting>

<para>Remove a project specific role from a particular user</para>
<programlisting>
nova-manage role remove --user=novaadmin --role=netadmin --project=proj
</programlisting>

<para>With the command below, you can change any or all of access key, secret key and admin role flag for a particular user.</para>
<programlisting>
Syntax:
nova-manage user modify   username new_access_key new_secret_key admin_flag &lt;admin flag - T or F&gt;

nova-manage user modify --name=novaadmin  --access=mygreatnewaccesskey "" ""

nova-manage user modify --name=novaadmin "" --secret=mygreatsecretkey "" ""

nova-manage user modify --name=novaadmin "" ""  --is_admin=T
</programlisting>

<para>Check if a particular user has a specific role or not. The role can be either local or global. The output of the command will be True or False</para>
<programlisting>
nova-manage role has --user=novaadmin --role=cloudadmin
True

nova-manage role has --role=novaadmin --role=netadmin --project=proj
False
</programlisting>
</section>

<section xml:id="Project_Management-d1e2672">
<title>Project Management</title>

<para>The following commands help you create and manage projects.  "nova-manage account" command is an alias to "nova-manage project" and you can use them interchangeably.</para>

<para>Create a project. It requires you to mention name of the project admin as well. css1 is the name of the project and user5 is the name of the project admin here.</para>
<programlisting>nova-manage project create --project=css1 --user=user5 --desc="My new project"</programlisting>

<para>List the registered projects.</para>
<programlisting>
nova-manage project list
</programlisting>

<para>Download the credentials and associated file for a specific project. Please refer to the chapter on "Installation &amp; Configuration" for more details.</para>
<programlisting>
nova-manage project zipfile --project=csscorp --user=user5 --file=/home/user5/mysec.zip
</programlisting>

<para>Delete an existing project.</para>
<programlisting>
nova-manage project delete --project=css1
</programlisting>

<para>Check the project wise resource allocation. The output will look like this:</para>
<programlisting>
nova-manage project quota --project=css1
	metadata_items: 128
	gigabytes: 1000
	floating_ips: 10
	instances: 10
	volumes: 10
	cores: 20
</programlisting>
</section>

<section xml:id="Database_Management-d1e2713"><title>Database Management</title>

<para>Nova stores the data related to the projects, users, resources etc. in a database, by default in a MySQL database.</para>

<para>Print the current database version.</para>
<programlisting>
nova-manage db version
</programlisting>

<para>Sync the DB schema to be in sync with the current configuration.</para>
<programlisting>
nova-manage db sync
</programlisting>
</section>

<section xml:id="Instance_Type_Management-d1e2734"><title>Instance Type Management</title>
<para>Nova has the concept of instance types. Each instance type is defined with certain amount of RAM and certain size of the hard disk. When an instance is launched with a particular instance type, Nova resizes the disk image to suit the instance type and allocates the RAM as defined for the instance type chosen. Nova calls instance types as 'flavors' and lets you add to the list of flavors. By default Nova has 5 types - m1.tiny, m1.small, m1.medium, m1.large and m1.xlarge.</para>

<para>List the current instance types</para>
<programlisting>
nova-manage flavor list
	m1.medium: Memory: 4096MB, VCPUS: 2, Storage: 40GB, FlavorID: 3, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
	m1.large: Memory: 8192MB, VCPUS: 4, Storage: 80GB, FlavorID: 4, Swap: 0GB,
RXTX Quota: 0GB, RXTX Cap: 0MB
	m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0GB,
RXTX Quota: 0GB, RXTX Cap: 0MB
	m1.xlarge: Memory: 16384MB, VCPUS: 8, Storage: 160GB, FlavorID: 5, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
	m1.small: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB,
RXTX Quota: 0GB, RXTX Cap: 0MB
</programlisting>

<para>Define a new instance type</para>
<programlisting>
nova-manage flavor create --name=m1.miniscule --memory=128 --cpu=1 --local_gb=20 --flavor=6 --swap=0 --rxtx_quota=0 --rxtx_cap=0
</programlisting>

<para>Remove an existing instance type.</para>
<programlisting>
nova-manage flavor delete --name=m1.miniscule
m1.miniscule deleted
</programlisting>
</section>

<section xml:id="Service_Management-d1e2761"><title>Service Management</title>

<para>Check state of available services.</para>
<programlisting>
nova-manage service list
	server1 nova-scheduler enabled  :- ) 2011-04-06 17:01:21
	server1 nova-network enabled  :- ) 2011-04-06 17:01:30
	server1  nova-compute enabled  :- ) 2011-04-06 17:01:22
	server2 nova-compute enabled  :- ) 2011-04-06 17:01:28
</programlisting>

<para>Disable a running service</para>
<programlisting>
nova-manage service disable &lt;hostname&gt; &lt;service&gt;
nova-manage service disable --host=server2 --service=nova-compute

nova-manage service list
	server1 nova-network enabled  :- ) 2011-04-06 17:05:11
	server1 nova-compute enabled  :- ) 2011-04-06 17:05:13
	server1 nova-scheduler enabled :- ) 2011-04-06 17:05:17
	server2 nova-compute disabled  :- ) 2011-04-06 17:05:19
</programlisting>

<para>Re-enable a service that is currently disabled</para>
<programlisting>
Syntax: nova-manage service enable &lt;hostname&gt; &lt;service&gt;
nova-manage service enable --host=server2 --service=nova-compute

nova-manage service list
	server1 nova-scheduler enabled  :- ) 2011-04-06 17:08:23
	server1 nova-network enabled  :- ) 2011-04-06 17:08:22
	server1 nova-compute enabled  :- ) 2011-04-06 17:08:23
	server2 nova-compute enabled  :- ) 2011-04-06 17:08:19
</programlisting>

<para>Get Information about resource utilization of the OpenStack components</para>
<programlisting>
Syntax: nova-manage service describe_resource &lt;hostname&gt;

nova-manage service describe_resource --host=server1
HOST		PROJECT		cpu	mem(mb)		disk(gb)
server1(total)  		2	3961		224
server1(used)			1	654		30
server1		proj		2	1024		0
</programlisting>
</section>

<section xml:id="Euca2ools_Commands-d1e2791"><title>Euca2ools Commands</title>

<para>euca2ools provide a set of commands to communicate with the cloud. All these commands require you to authenticate and this is done by sourcing novarc file as detailed in the chapter on "Installation &amp; Configuration"</para>

<para>Most of the euca2ools command line utilities work with OpenStack, just as they work with EC2 of AWS. There may be some differences due to some of the functionality that is yet to be implemented in OpenStack. Help is available for each of these commands  with the switch --help.</para>

<itemizedlist>
	  <listitem><para>euca-add-group</para></listitem>
	  <listitem><para>euca-delete-bundle</para></listitem>
  	  <listitem><para>euca-describe-instances</para></listitem>
	  <listitem><para>euca-register</para></listitem>
	  <listitem><para>euca-add-keypair</para></listitem>
	  <listitem><para>euca-delete-group</para></listitem>
	  <listitem><para>euca-describe-keypairs</para></listitem>
	  <listitem><para>euca-release-address</para></listitem>
	  <listitem><para>euca-allocate-address</para></listitem>
	  <listitem><para>euca-delete-keypair</para></listitem>
	  <listitem><para>euca-describe-regions</para></listitem>
	  <listitem><para>euca-reset-image-attribute</para></listitem>
	  <listitem><para>euca-associate-address</para></listitem>
	  <listitem><para>euca-delete-snapshot</para></listitem>
	  <listitem><para>euca-describe-snapshots</para></listitem>
	  <listitem><para>euca-revoke</para></listitem>
	  <listitem><para>euca-attach-volume</para></listitem>
	  <listitem><para>euca-delete-volume</para></listitem>
	  <listitem><para>euca-describe-volumes</para></listitem>
	  <listitem><para>euca-run-instances</para></listitem>
	  <listitem><para>euca-authorize</para></listitem>
	  <listitem><para>euca-deregister</para></listitem>
	  <listitem><para>euca-detach-volume</para></listitem>
	  <listitem><para>euca-terminate-instances</para></listitem>
	  <listitem><para>euca-bundle-image</para></listitem>
	  <listitem><para>euca-describe-addresses</para></listitem>
	  <listitem><para>euca-disassociate-address</para></listitem>
	  <listitem><para>euca-unbundle</para></listitem>
	  <listitem><para>euca-bundle-vol</para></listitem>
	  <listitem><para>euca-describe-availabity-zones</para></listitem>
	  <listitem><para>euca-download-bundle</para></listitem>
	  <listitem><para>euca-upload-bundle</para></listitem>
	  <listitem><para>euca-confirm-product-instance</para></listitem>
	  <listitem><para>euca-describe-groups</para></listitem>
	  <listitem><para>euca-get-console-output</para></listitem>
	  <listitem><para>euca-version</para></listitem>
	  <listitem><para>euca-create-snapshot</para></listitem>
	  <listitem><para>euca-describe-image-attribute</para></listitem>
	  <listitem><para>euca-modify-image-attribute</para></listitem>
	  <listitem><para>euca-create-volume</para></listitem>
	  <listitem><para>euca-describe-images</para></listitem>
	  <listitem><para>euca-reboot-instances</para></listitem>
</itemizedlist>
</section>
</section>
</chapter>