Ambiente » History » Version 59

Beraldo Leal, 20 Jul 2012 09:53

1 1 Beraldo Leal
h1. Ambiente de Desenvolvimento
2 1 Beraldo Leal
3 1 Beraldo Leal
h2. Lista de Servidores
4 1 Beraldo Leal
5 14 Beraldo Leal
* educloud00 - 200.145.46.166
6 14 Beraldo Leal
* educloud01 - 200.145.46.167
7 14 Beraldo Leal
* educloud02 - 200.145.46.168
8 14 Beraldo Leal
* educloud03 - 200.145.46.169
9 14 Beraldo Leal
* educloud04 - 200.145.46.170
10 14 Beraldo Leal
* educloud05 - 200.145.46.174
11 1 Beraldo Leal
* educloud06 - 200.145.46.175
12 1 Beraldo Leal
* educloud07 - 200.145.46.173
13 15 Beraldo Leal
14 16 Beraldo Leal
h3. Desabilitados
15 16 Beraldo Leal
16 15 Beraldo Leal
* educloud05 - 200.145.46.171
17 15 Beraldo Leal
* educloud06 - 200.145.46.172
18 3 Beraldo Leal
19 53 Beraldo Leal
h1. Introduction
20 59 Beraldo Leal
21 55 Beraldo Leal
This document refers to the installation manual of the main components of
22 55 Beraldo Leal
OpenStack. The version of each component used can be found in the respective
23 55 Beraldo Leal
sections of the components.
24 1 Beraldo Leal
25 55 Beraldo Leal
This document was produced by the Center for Scientific Computing, UNESP, with
26 55 Beraldo Leal
funding from Intel and UNESP.
27 1 Beraldo Leal
28 1 Beraldo Leal
OpenStack OpenStack is a global collaboration of developers and cloud computing
29 58 Beraldo Leal
technologists producing the ubiquitous open source cloud computing platform for 
30 55 Beraldo Leal
public and private clouds. The project aims to deliver solutions for all types
31 55 Beraldo Leal
of clouds by being simple to implement, massively scalable, and feature rich.
32 55 Beraldo Leal
The technology consists of a series of interrelated projects delivering various
33 55 Beraldo Leal
components for a cloud infrastructure solution.
34 1 Beraldo Leal
35 1 Beraldo Leal
The OpenStack project is divided into sub projects that have a specific role in
36 55 Beraldo Leal
the big picture.
37 1 Beraldo Leal
38 58 Beraldo Leal
The main components are: Cloud Compute (Nova) Cloud Storage (Swift), Image 
39 55 Beraldo Leal
registration and delivery (Glance), Identity (Keystone) and Dashboard
40 55 Beraldo Leal
(Horizon).
41 1 Beraldo Leal
42 1 Beraldo Leal
Each component is independent of each other and can be installed on separate
43 1 Beraldo Leal
machines, or all in one. In the environment of UNESP, OpenStack was installed in
44 55 Beraldo Leal
seven machines, described in section "Environment used."
45 56 Beraldo Leal
46 58 Beraldo Leal
This document is modified version of OpenStack Install and Deploy Manual [1] 
47 58 Beraldo Leal
with minor adjustments and changes to resolve problems encountered during 
48 58 Beraldo Leal
installation and adjustment to the environment in which it was installed.
49 55 Beraldo Leal
50 58 Beraldo Leal
51 55 Beraldo Leal
h1. OpenStack Core Components
52 55 Beraldo Leal
53 55 Beraldo Leal
OpenStack is a collection of open source technology that provides massively
54 55 Beraldo Leal
scalable open source cloud computing software. Currently OpenStack develops two
55 55 Beraldo Leal
related projects: OpenStack Compute, which offers computing power through
56 55 Beraldo Leal
virtual machine and network management, and OpenStack Object Storage which is
57 55 Beraldo Leal
software for redundant, scalable object storage capacity. Closely related to the
58 55 Beraldo Leal
OpenStack Compute project is the Image Service project, named Glance. OpenStack
59 55 Beraldo Leal
can be used by corporations, service providers, VARS, SMBs, researchers, and
60 55 Beraldo Leal
global data centers looking to deploy large-scale cloud deployments for private
61 55 Beraldo Leal
or public clouds.
62 55 Beraldo Leal
63 55 Beraldo Leal
The main components are: Cloud Compute (Nova) Cloud Storage (Swift), Image
64 1 Beraldo Leal
registration and delivery (Glance), Identity (Keystone) and Dashboard
65 1 Beraldo Leal
(Horizon).
66 1 Beraldo Leal
67 1 Beraldo Leal
They are presented here in an order for educational purposes only to a 
68 1 Beraldo Leal
straightforward procedure for installation. But following a brief description of
69 1 Beraldo Leal
each component.
70 1 Beraldo Leal
71 58 Beraldo Leal
h2. Keystone
72 58 Beraldo Leal
73 58 Beraldo Leal
Keystone is an OpenStack project that provides Identity, Token, Catalog and 
74 58 Beraldo Leal
Policy services for use specifically by projects in the OpenStack family. It
75 58 Beraldo Leal
implements OpenStack’s Identity API.
76 58 Beraldo Leal
77 58 Beraldo Leal
78 55 Beraldo Leal
h2. Cloud Compute (Nova)
79 55 Beraldo Leal
80 55 Beraldo Leal
Nova is the project name for OpenStack Compute, a cloud computing fabric
81 55 Beraldo Leal
controller, the main part of an IaaS system. Individuals and organizations can
82 55 Beraldo Leal
use Nova to host and manage their own cloud computing systems. Nova originated
83 55 Beraldo Leal
as a project out of NASA Ames Research Laboratory.
84 55 Beraldo Leal
85 55 Beraldo Leal
h2. Object Storage (Swift)
86 55 Beraldo Leal
87 55 Beraldo Leal
OpenStack Object Storage (Swift) is a system to store objects in a massively
88 55 Beraldo Leal
scalable large capacity system with built-in redundancy and failover. Object
89 55 Beraldo Leal
Storage has a variety of applications, such as backing up or archiving data,
90 55 Beraldo Leal
serving graphics or videos (streaming data to a user's browser), storing
91 55 Beraldo Leal
secondary or tertiary static data, developing new applications with data
92 55 Beraldo Leal
storage integration, storing data when predicting storage capacity is difficult,
93 55 Beraldo Leal
and creating the elasticity and flexibility of cloud-based storage for your web
94 55 Beraldo Leal
applications.
95 1 Beraldo Leal
96 1 Beraldo Leal
h2. Image Service (Glance)
97 1 Beraldo Leal
98 1 Beraldo Leal
OpenStack Image Service (Glance) is a lookup and retrieval system for virtual
99 1 Beraldo Leal
machine images. It can be configured in three ways: using OpenStack Object Store
100 1 Beraldo Leal
to store images; using Amazon's Simple Storage Solution (S3) storage directly;
101 1 Beraldo Leal
or using S3 storage with Object Store as the intermediate for S3 access.
102 58 Beraldo Leal
103 58 Beraldo Leal
104 58 Beraldo Leal
h1. Environment Proposed
105 58 Beraldo Leal
106 58 Beraldo Leal
This document aims to guide you in setting up a test environment or development.
107 58 Beraldo Leal
The original documentation suggests many machines. To install OpenStack here,
108 58 Beraldo Leal
you will need only one or two machines.
109 58 Beraldo Leal
110 58 Beraldo Leal
You can install all services on one machine only (all-in-one). Or you can
111 58 Beraldo Leal
install OpenStack controller (all services except the nova-compute) on machine A
112 58 Beraldo Leal
and a compute cloud controller on machine B.
113 58 Beraldo Leal
114 58 Beraldo Leal
For a production environment it is advisable to separate the elements to ensure
115 58 Beraldo Leal
a high availability and redundancy.
116 58 Beraldo Leal
117 58 Beraldo Leal
Settings used in this document:
118 58 Beraldo Leal
119 58 Beraldo Leal
 - Cloud Controller:
120 58 Beraldo Leal
121 58 Beraldo Leal
122 58 Beraldo Leal
 - Cloud Computer Node:
123 58 Beraldo Leal
124 58 Beraldo Leal
All machines are installed with Ubuntu Server 12.04 LTS.
125 58 Beraldo Leal
126 58 Beraldo Leal
h1. Initial configuration
127 58 Beraldo Leal
128 58 Beraldo Leal
Before starting the installation and configuration of each component must first
129 58 Beraldo Leal
to make some adjustments.
130 58 Beraldo Leal
131 58 Beraldo Leal
h2. Network Configuration
132 58 Beraldo Leal
133 58 Beraldo Leal
For both conserving network resources and ensuring that network administrators
134 58 Beraldo Leal
understand the needs for networks and public IP addresses for accessing the APIs
135 58 Beraldo Leal
and VMs as necessary, this section offers recommendations and required minimum
136 58 Beraldo Leal
sizes. Throughput of at least 1000 Mbps is suggested.
137 58 Beraldo Leal
138 58 Beraldo Leal
For OpenStack Compute, networking is configured on multi-node installations
139 58 Beraldo Leal
between the physical machines on a single subnet. For networking between virtual
140 58 Beraldo Leal
machine instances, three network options are available: flat, DHCP, and VLAN.
141 58 Beraldo Leal
Two NICs (Network Interface Cards) are recommended on the server running
142 58 Beraldo Leal
nova-network.
143 58 Beraldo Leal
144 58 Beraldo Leal
Management Network (RFC1918 IP Range, not publicly routable): This network is
145 58 Beraldo Leal
utilized for all inter-server communications within the cloud infrastructure.
146 58 Beraldo Leal
Recommended size: 255 IPs (CIDR /24)
147 58 Beraldo Leal
148 58 Beraldo Leal
Public Network (Publicly routable IP range): This network is utilized for
149 58 Beraldo Leal
providing Public IP accessibility to the API endpoints within the cloud
150 58 Beraldo Leal
infrastructure. Minimum size: 8 IPs (CIDR /29)
151 58 Beraldo Leal
152 58 Beraldo Leal
VM Network (RFC1918 IP Range, not publicly routable): This network is utilized
153 58 Beraldo Leal
for providing primary IP addresses to the cloud instances. Recommended size:
154 58 Beraldo Leal
1024 IPs (CIDR /22)
155 58 Beraldo Leal
156 58 Beraldo Leal
Floating IP network (Publicly routable IP Range): This network is utilized for
157 58 Beraldo Leal
providing Public IP accessibility to selected cloud instances. Minimum size:
158 58 Beraldo Leal
16 IPs (CIDR /28)
159 58 Beraldo Leal
160 58 Beraldo Leal
In this installation we will use eth0 to public interface and eth1 for
161 58 Beraldo Leal
management interface.
162 58 Beraldo Leal
163 58 Beraldo Leal
h2. Installing Network Time Protocol (NTP)
164 58 Beraldo Leal
165 58 Beraldo Leal
To keep all the services in sync, you need to install NTP, and if you do a
166 58 Beraldo Leal
multi-node configuration you will configure one server to be the reference
167 58 Beraldo Leal
server.
168 58 Beraldo Leal
169 58 Beraldo Leal
# apt-get install -y ntp
170 58 Beraldo Leal
171 58 Beraldo Leal
Set up the NTP server on your controller node so that it receives data by
172 58 Beraldo Leal
modifying the ntp.conf file and restarting the service. As root:
173 58 Beraldo Leal
174 58 Beraldo Leal
# sed -i 's/server ntp.ubuntu.com/server ntp.ubuntu.com\nserver 127.127.1.0\
175 58 Beraldo Leal
nfudge 127.127.1.0 stratum 10/g' /etc/ntp.conf
176 58 Beraldo Leal
# service ntp restart
177 58 Beraldo Leal
178 58 Beraldo Leal
Set up the NTP client on your compute node so that the time between controller
179 58 Beraldo Leal
node and compute node is synchronized. Do the following as a cron job on compute
180 58 Beraldo Leal
node.
181 58 Beraldo Leal
182 58 Beraldo Leal
# ntpdate 'controllernode ip'
183 58 Beraldo Leal
# hwclock -w
184 58 Beraldo Leal
185 58 Beraldo Leal
h2. Storage
186 58 Beraldo Leal
187 58 Beraldo Leal
Many cloud computing use cases require persistent remote storage. Storage
188 58 Beraldo Leal
solutions are often divided into three categories: object storage, block
189 58 Beraldo Leal
storage, and file storage.
190 58 Beraldo Leal
191 58 Beraldo Leal
Here we will use a "object storage" and a "block storage".
192 58 Beraldo Leal
193 58 Beraldo Leal
h3. Object storage (swift)
194 58 Beraldo Leal
195 58 Beraldo Leal
With object storage, files are exposed through an HTTP interface, typically with
196 58 Beraldo Leal
a REST API. All client data access is done at the user level: the operating
197 58 Beraldo Leal
system is unaware of the presence of the remote storage system. In OpenStack,
198 58 Beraldo Leal
the Object Storage service provides this type of functionality. Users access and
199 58 Beraldo Leal
modify files by making HTTP requests. Because the data accesss interface provided
200 58 Beraldo Leal
by an object storage system is at a low level of abstraction, people often build
201 58 Beraldo Leal
on top of object storage to build file-based applications that provide a higher
202 58 Beraldo Leal
level of abstraction. For example, the OpenStack Image service can be configured
203 58 Beraldo Leal
to use the Object Storage service as a backend. Another use for object storage
204 58 Beraldo Leal
solutions is as a content delivery network (CDN) for hosting static web content
205 58 Beraldo Leal
(e.g., images, and media files), since object storage already provides an HTTP
206 58 Beraldo Leal
interface.
207 58 Beraldo Leal
208 58 Beraldo Leal
h3. Block storage (SAN)
209 58 Beraldo Leal
210 58 Beraldo Leal
With block storage, files are exposed through a low-level computer bus interface
211 58 Beraldo Leal
such as SCSI or ATA, that is accessible over the network. Block storage is
212 58 Beraldo Leal
synonymous with SAN (storage area network). Clients access data through the
213 58 Beraldo Leal
operating system at the device level: users access the data by mounting the
214 58 Beraldo Leal
remote device in a similar manner to how they would mount a local, physical disk
215 58 Beraldo Leal
(e.g., using the "mount" command in Linux). In OpenStack, the nova-volume
216 58 Beraldo Leal
service that forms part of the Compute service provides this type of
217 58 Beraldo Leal
functionality, and uses iSCSI to expose remote data as a SCSI disk that is
218 58 Beraldo Leal
attached to the network.
219 58 Beraldo Leal
220 58 Beraldo Leal
Because the data is exposed as a physical device, the end-user is responsible
221 58 Beraldo Leal
for creating partitions and formatting the exposed disk device. In addition,
222 58 Beraldo Leal
in OpenStack Compute a device can only be attached to one server at a time, so
223 58 Beraldo Leal
block storage cannot be used for to share data across virtual machine instances
224 58 Beraldo Leal
concurrently.
225 58 Beraldo Leal
226 58 Beraldo Leal
h1. Installation Assumptions
227 58 Beraldo Leal
228 58 Beraldo Leal
OpenStack Compute has a large number of configuration options. To simplify this
229 58 Beraldo Leal
installation guide, we make a number of assumptions about the target
230 58 Beraldo Leal
installation:
231 58 Beraldo Leal
232 58 Beraldo Leal
 * You have a collection of compute nodes, each installed with Ubuntu Server
233 58 Beraldo Leal
12.04
234 58 Beraldo Leal
235 58 Beraldo Leal
 * You have designated one of the nodes as the Cloud Controller, which will run
236 58 Beraldo Leal
all of the services (RabbitMQ, MySQL, Identity, Image, nova-api, nova-network,
237 58 Beraldo Leal
nova-scheduler, nova-volume) except for nova-compute.
238 58 Beraldo Leal
239 58 Beraldo Leal
 * The disk partitions on your cloud controller are being managed by the Logical
240 58 Beraldo Leal
Volume Manager (LVM)
241 58 Beraldo Leal
242 58 Beraldo Leal
 * Your Cloud Controller has an LVM volume group named "nova-volumes" to provide
243 58 Beraldo Leal
persistent storage to guest VMs. Either create this during the installation or
244 58 Beraldo Leal
leave some free space to create it prior to installing nova services.
245 58 Beraldo Leal
246 58 Beraldo Leal
 * Ensure that the server can resolve its own hostname, otherwise you may have
247 58 Beraldo Leal
problems if you are using RabbitMQ as the messaging backend (RabbitMQ is the default
248 58 Beraldo Leal
messaging back-end on Ubuntu, on Fedora the default backend is Qpid).
249 58 Beraldo Leal
250 58 Beraldo Leal
 * 192.168.69.1 is the primary IP for our controller host on eth0 and
251 58 Beraldo Leal
192.168.69.2 is the primary IP for our computer node on eth0.
252 58 Beraldo Leal
253 58 Beraldo Leal
 * FlatDHCP with a single network interface.
254 58 Beraldo Leal
255 58 Beraldo Leal
 * KVM as the hypervisor.
256 58 Beraldo Leal
257 58 Beraldo Leal
 * Ensure the operating system is up-to-date by running apt-get update and
258 58 Beraldo Leal
apt-get upgrade prior to the installation.
259 58 Beraldo Leal
260 58 Beraldo Leal
 * Ensure that all hosts are with ntp and correct time.
261 58 Beraldo Leal
262 58 Beraldo Leal
263 58 Beraldo Leal
This installation process walks through installing a cloud controller node and a
264 58 Beraldo Leal
compute node using a set of packages that are known to work with each other.
265 58 Beraldo Leal
The cloud controller node contains all the nova- services including the API
266 58 Beraldo Leal
server and the database server. The compute node needs to run only the
267 58 Beraldo Leal
nova-compute service. You only need one nova-network service running in a
268 58 Beraldo Leal
multi-node install.
269 53 Beraldo Leal
270 53 Beraldo Leal
271 37 Beraldo Leal
h1. Installing OpenStack Identity Service - Keystone
272 30 Beraldo Leal
273 43 Beraldo Leal
O Keystone é um projeto que provê serviços de "Identidade", "Token", "Catalog" and "Policy" para os componentes do OpenStack. O pacote *_keystone_* foi instalado no servidor _educloud01_.
274 4 Beraldo Leal
275 4 Beraldo Leal
Este software é feito em python, e por sua vez instala a dependencia *_keystone-python_*, uma biblioteca em python para uso do próprio keystone.
276 4 Beraldo Leal
277 4 Beraldo Leal
Os arquivos de configuração do keystone ficam em /etc/keystone e hoje ele está utilizando como um backend para armazenar os usuários uma base sqlite3, mas ele também permite que seja utilizado uma base LDAP.
278 4 Beraldo Leal
279 1 Beraldo Leal
Além do daemon (servidor) foi instalado o cliente (também feito em python) *_python-keystoneclient_*.
280 5 Beraldo Leal
281 37 Beraldo Leal
h2. Instalando e configurando o keystone
282 5 Beraldo Leal
283 1 Beraldo Leal
<pre>
284 18 Beraldo Leal
# apt-get install keystone
285 18 Beraldo Leal
</pre>
286 18 Beraldo Leal
287 18 Beraldo Leal
Delete the keystone.db file created in the /var/lib/keystone directory.
288 18 Beraldo Leal
289 18 Beraldo Leal
<pre>
290 18 Beraldo Leal
# rm /var/lib/keystone/keystone.db
291 18 Beraldo Leal
</pre>
292 18 Beraldo Leal
293 18 Beraldo Leal
Install mysql:
294 18 Beraldo Leal
295 18 Beraldo Leal
<pre>
296 18 Beraldo Leal
# apt-get install python-mysqldb mysql-server
297 11 Beraldo Leal
</pre>
298 19 Beraldo Leal
299 19 Beraldo Leal
Use sed to edit /etc/mysql/my.cnf to change bind-address from localhost
300 19 Beraldo Leal
(127.0.0.1) to any (0.0.0.0) and restart the mysql service, as root:
301 19 Beraldo Leal
302 19 Beraldo Leal
<pre>
303 19 Beraldo Leal
# sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
304 19 Beraldo Leal
# service mysql restart
305 19 Beraldo Leal
</pre>
306 19 Beraldo Leal
307 19 Beraldo Leal
To configure the MySQL database, create the keystone database.
308 19 Beraldo Leal
309 19 Beraldo Leal
<pre>
310 19 Beraldo Leal
# mysql -u root -p
311 19 Beraldo Leal
mysql> CREATE DATABASE keystone;
312 19 Beraldo Leal
mysql> GRANT ALL ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystonepass';
313 19 Beraldo Leal
mysql> FLUSH PRIVILEGES;
314 19 Beraldo Leal
mysql> quit;
315 19 Beraldo Leal
</pre>
316 20 Beraldo Leal
317 20 Beraldo Leal
Edit _*keystone.conf*_ to use mysql:
318 20 Beraldo Leal
319 20 Beraldo Leal
<pre>
320 20 Beraldo Leal
[sql]
321 20 Beraldo Leal
connection = mysql://keystone:keystonepass@192.168.69.1/keystone
322 21 Beraldo Leal
</pre>
323 21 Beraldo Leal
324 21 Beraldo Leal
Change in _*keystone.conf*_ the ADMIN_TOKEN:
325 21 Beraldo Leal
326 20 Beraldo Leal
<pre>
327 21 Beraldo Leal
admin_token = 012345SECRET99TOKEN012345
328 21 Beraldo Leal
</pre>
329 22 Beraldo Leal
330 22 Beraldo Leal
Restarte o keystone e inicialize o banco:
331 22 Beraldo Leal
332 22 Beraldo Leal
<pre>
333 22 Beraldo Leal
# service keystone restart
334 1 Beraldo Leal
# keystone-manage db_sync
335 22 Beraldo Leal
</pre>
336 23 Beraldo Leal
337 37 Beraldo Leal
h2. Configuring Services to work with Keystone
338 23 Beraldo Leal
339 23 Beraldo Leal
Crie o arquivo _*/root/openstackrc*_, com o seguinte conteudo:
340 23 Beraldo Leal
341 23 Beraldo Leal
<pre>
342 23 Beraldo Leal
export SERVICE_ENDPOINT=http://192.168.69.1:35357/v2.0/
343 23 Beraldo Leal
export SERVICE_TOKEN=012345SECRET99TOKEN012345
344 23 Beraldo Leal
</pre>
345 23 Beraldo Leal
346 23 Beraldo Leal
Estas variaveis de ambiente sao uteis para evitar ficar passando as opcoes --token e --endpoint para os utilitarios de linha de comando. 
347 23 Beraldo Leal
348 23 Beraldo Leal
Carrege o arquivo:
349 23 Beraldo Leal
350 23 Beraldo Leal
<pre>
351 23 Beraldo Leal
# source /root/openstackrc
352 23 Beraldo Leal
</pre>
353 24 Beraldo Leal
354 26 Beraldo Leal
Crie os *tenants* _openstackDemo_ e _service_:
355 24 Beraldo Leal
356 24 Beraldo Leal
<pre>
357 24 Beraldo Leal
# keystone tenant-create --name openstackDemo --description "Default Tenant"  --enabled true
358 24 Beraldo Leal
# keystone tenant-create --name service --description "Service Tenant"  --enabled true
359 24 Beraldo Leal
</pre>
360 25 Beraldo Leal
361 27 Beraldo Leal
Crie o *user* _admin_, substitua o tenant_id pelo tentant_id do openstackDemo, criado no item anterior:
362 25 Beraldo Leal
363 1 Beraldo Leal
<pre>
364 1 Beraldo Leal
# keystone user-create --tenant_id 9c401c9d2b9d41bcabda6919d4aec63a --name admin --pass adminpass --enabled true
365 26 Beraldo Leal
</pre>
366 26 Beraldo Leal
367 26 Beraldo Leal
Crie os *roles* _admin_ e _user_:
368 26 Beraldo Leal
369 26 Beraldo Leal
<pre>
370 26 Beraldo Leal
# keystone role-create --name admin
371 1 Beraldo Leal
# keystone role-create --name user
372 27 Beraldo Leal
</pre>
373 27 Beraldo Leal
374 27 Beraldo Leal
Adicione o *user* _admin_ ao *role* _admin_, fazendo as devidas substituicoes:
375 27 Beraldo Leal
376 27 Beraldo Leal
<pre>
377 29 Beraldo Leal
# keystone user-role-add --user [admin_user_id] --tenant_id [openstackDemo_tenant_id] --role [admin_role]
378 29 Beraldo Leal
</pre>
379 29 Beraldo Leal
380 29 Beraldo Leal
Crie um usuario para cada servico, e substitua o tenant_id pelo id do tenant *service*:
381 29 Beraldo Leal
382 29 Beraldo Leal
<pre>
383 29 Beraldo Leal
# keystone user-create --tenant_id 92920816c7704a8a95c916d34dc7a05c --name glance --pass glancepass --enabled true
384 29 Beraldo Leal
# keystone user-create --tenant_id 92920816c7704a8a95c916d34dc7a05c --name nova --pass novapass --enabled true
385 29 Beraldo Leal
# keystone user-create --tenant_id 92920816c7704a8a95c916d34dc7a05c --name swift --pass swiftpass --enabled true
386 29 Beraldo Leal
</pre>
387 29 Beraldo Leal
388 29 Beraldo Leal
Adicione os users acima ao *role* _admin_, fazendo as devidas substituicoes:
389 29 Beraldo Leal
390 29 Beraldo Leal
<pre>
391 29 Beraldo Leal
# keystone user-role-add --user [glance_user_id] --tenant_id [service_tenant_id] --role [admin_role]
392 1 Beraldo Leal
# keystone user-role-add --user [nova_user_id] --tenant_id [service_tenant_id] --role [admin_role]
393 29 Beraldo Leal
# keystone user-role-add --user [swift_user_id] --tenant_id [service_tenant_id] --role [admin_role]
394 25 Beraldo Leal
</pre>
395 31 Beraldo Leal
396 37 Beraldo Leal
h2. Definindo os servicos:
397 31 Beraldo Leal
398 31 Beraldo Leal
Ate agora, apenas criamos: tenants, users e roles. O Keystone tambem gerencia os servicos e seus endpoins. Desta forma os componentes do openstack consulta o keystone onde determinado servico encontra-se.
399 31 Beraldo Leal
400 31 Beraldo Leal
Crie os servicos:
401 31 Beraldo Leal
402 31 Beraldo Leal
<pre>
403 31 Beraldo Leal
# keystone service-create --name keystone --type identity --description "Keystone Identity Service" 
404 31 Beraldo Leal
# keystone service-create --name nova --type compute --description "Nova Compute Service"
405 31 Beraldo Leal
# keystone service-create --name volume --type volume --description "Nova Volume Service"
406 31 Beraldo Leal
# keystone service-create --name glance --type image --description "Glance Image Service"
407 41 Beraldo Leal
# keystone service-create --name swift --type object-store --description "Object Storage Service"
408 31 Beraldo Leal
</pre>
409 32 Beraldo Leal
410 32 Beraldo Leal
Crie os endpoints para os respectivos servicos:
411 32 Beraldo Leal
412 32 Beraldo Leal
<pre>
413 33 Beraldo Leal
# keystone endpoint-create --region RegionOne --service_id [keystone_service_id] --publicurl http://192.168.69.1:5000/v2.0 --internalurl http://192.168.69.1:5000/v2.0 --adminurl http://192.168.69.1:35357/v2.0
414 33 Beraldo Leal
# keystone endpoint-create --region RegionOne --service_id [compute_service_id] --publicurl 'http://192.168.69.1:8774/v2/%(tenant_id)s' --internalurl 'http://192.168.69.1:8774/v2/%(tenant_id)s' --adminurl 'http://192.168.69.1:8774/v2/%(tenant_id)s'
415 1 Beraldo Leal
# keystone endpoint-create --region RegionOne --service_id [volume_service_id] --publicurl 'http://192.168.69.1:8776/v1/%(tenant_id)s' --internalurl 'http://192.168.69.1:8776/v1/%(tenant_id)s' --adminurl 'http://192.168.69.1:8776/v1/%(tenant_id)s'
416 33 Beraldo Leal
# keystone endpoint-create --region RegionOne --service_id [glance_service_id] --publicurl http://192.168.69.1:9292/v1 --internalurl http://192.168.69.1:9292/v1 --adminurl http://192.168.69.1:9292/v1
417 33 Beraldo Leal
# keystone endpoint-create --region RegionOne --service_id [swift_service_id] --publicurl 'http://192.168.69.1:8888/v1/AUTH_%(tenant_id)s' --adminurl 'http://192.168.69.1:8888/' --internalurl 'http://192.168.69.1:8888/v1/AUTH_%(tenant_id)s'
418 32 Beraldo Leal
</pre>
419 34 Beraldo Leal
420 37 Beraldo Leal
h2. Verificando a instalacao:
421 34 Beraldo Leal
422 34 Beraldo Leal
<pre>
423 34 Beraldo Leal
# sudo apt-get install curl openssl
424 34 Beraldo Leal
</pre>
425 34 Beraldo Leal
426 34 Beraldo Leal
Faca uma requisicao REST para a API do keystone usando o curl:
427 34 Beraldo Leal
428 34 Beraldo Leal
<pre>
429 34 Beraldo Leal
# curl -d '{"auth": {"tenantName": "openstackDemo", "passwordCredentials": {"username": "admin", "password": "adminpass"}}}' -H "Content-type: application/json" http://192.168.69.1:35357/v2.0/tokens  | python -mjson.tool
430 34 Beraldo Leal
</pre>
431 34 Beraldo Leal
432 35 Beraldo Leal
O retorno deve conter todos os servicos, endpoins e um token que expira em 24 horas:
433 34 Beraldo Leal
434 34 Beraldo Leal
<pre>
435 34 Beraldo Leal
{
436 34 Beraldo Leal
    "access": {
437 34 Beraldo Leal
        "serviceCatalog": [
438 34 Beraldo Leal
            {
439 34 Beraldo Leal
                "endpoints": [
440 34 Beraldo Leal
                    {
441 34 Beraldo Leal
                        "adminURL": "http://192.168.69.1:8776/v1/9c401c9d2b9d41bcabda6919d4aec63a", 
442 34 Beraldo Leal
                        "internalURL": "http://192.168.69.1:8776/v1/9c401c9d2b9d41bcabda6919d4aec63a", 
443 34 Beraldo Leal
                        "publicURL": "http://192.168.69.1:8776/v1/9c401c9d2b9d41bcabda6919d4aec63a", 
444 34 Beraldo Leal
                        "region": "RegionOne"
445 34 Beraldo Leal
                    }
446 34 Beraldo Leal
                ], 
447 34 Beraldo Leal
                "endpoints_links": [], 
448 34 Beraldo Leal
                "name": "volume", 
449 34 Beraldo Leal
                "type": "volume"
450 34 Beraldo Leal
            }, 
451 34 Beraldo Leal
            {
452 34 Beraldo Leal
                "endpoints": [
453 34 Beraldo Leal
                    {
454 34 Beraldo Leal
                        "adminURL": "http://192.168.69.1:9292/v1", 
455 34 Beraldo Leal
                        "internalURL": "http://192.168.69.1:9292/v1", 
456 34 Beraldo Leal
                        "publicURL": "http://192.168.69.1:9292/v1", 
457 34 Beraldo Leal
                        "region": "RegionOne"
458 34 Beraldo Leal
                    }
459 34 Beraldo Leal
                ], 
460 34 Beraldo Leal
                "endpoints_links": [], 
461 34 Beraldo Leal
                "name": "glance", 
462 34 Beraldo Leal
                "type": "image"
463 34 Beraldo Leal
            }, 
464 34 Beraldo Leal
            {
465 34 Beraldo Leal
                "endpoints": [
466 34 Beraldo Leal
                    {
467 34 Beraldo Leal
                        "adminURL": "http://192.168.69.1:8774/v2/9c401c9d2b9d41bcabda6919d4aec63a", 
468 34 Beraldo Leal
                        "internalURL": "http://192.168.69.1:8774/v2/9c401c9d2b9d41bcabda6919d4aec63a", 
469 34 Beraldo Leal
                        "publicURL": "http://192.168.69.1:8774/v2/9c401c9d2b9d41bcabda6919d4aec63a", 
470 34 Beraldo Leal
                        "region": "RegionOne"
471 34 Beraldo Leal
                    }
472 34 Beraldo Leal
                ], 
473 34 Beraldo Leal
                "endpoints_links": [], 
474 34 Beraldo Leal
                "name": "nova", 
475 34 Beraldo Leal
                "type": "compute"
476 34 Beraldo Leal
            }, 
477 34 Beraldo Leal
            {
478 34 Beraldo Leal
                "endpoints": [
479 34 Beraldo Leal
                    {
480 34 Beraldo Leal
                        "adminURL": "http://192.168.69.1:35357/v2.0", 
481 34 Beraldo Leal
                        "internalURL": "http://192.168.69.1:5000/v2.0", 
482 34 Beraldo Leal
                        "publicURL": "http://192.168.69.1:5000/v2.0", 
483 34 Beraldo Leal
                        "region": "RegionOne"
484 34 Beraldo Leal
                    }
485 34 Beraldo Leal
                ], 
486 34 Beraldo Leal
                "endpoints_links": [], 
487 34 Beraldo Leal
                "name": "keystone", 
488 34 Beraldo Leal
                "type": "identity"
489 34 Beraldo Leal
            }, 
490 34 Beraldo Leal
            {
491 34 Beraldo Leal
                "endpoints": [
492 34 Beraldo Leal
                    {
493 34 Beraldo Leal
                        "adminURL": "http://192.168.69.1:8888/", 
494 34 Beraldo Leal
                        "internalURL": "http://192.168.69.1:8888/v1/AUTH_9c401c9d2b9d41bcabda6919d4aec63a", 
495 34 Beraldo Leal
                        "publicURL": "http://192.168.69.1:8888/v1/AUTH_9c401c9d2b9d41bcabda6919d4aec63a", 
496 34 Beraldo Leal
                        "region": "RegionOne"
497 34 Beraldo Leal
                    }
498 34 Beraldo Leal
                ], 
499 34 Beraldo Leal
                "endpoints_links": [], 
500 34 Beraldo Leal
                "name": "swift", 
501 41 Beraldo Leal
                "type": "object-store"
502 34 Beraldo Leal
            }
503 34 Beraldo Leal
        ], 
504 34 Beraldo Leal
        "token": {
505 34 Beraldo Leal
            "expires": "2012-06-08T15:31:46Z", 
506 34 Beraldo Leal
            "id": "05b818ff23564d5599c97ea5e1df7bbe", 
507 34 Beraldo Leal
            "tenant": {
508 34 Beraldo Leal
                "description": "Default Tenant", 
509 34 Beraldo Leal
                "enabled": true, 
510 34 Beraldo Leal
                "id": "9c401c9d2b9d41bcabda6919d4aec63a", 
511 34 Beraldo Leal
                "name": "openstackDemo"
512 34 Beraldo Leal
            }
513 34 Beraldo Leal
        }, 
514 34 Beraldo Leal
        "user": {
515 34 Beraldo Leal
            "id": "1fcfbe778fc3428aa30db782056b34d7", 
516 34 Beraldo Leal
            "name": "admin", 
517 34 Beraldo Leal
            "roles": [
518 34 Beraldo Leal
                {
519 34 Beraldo Leal
                    "id": "a2d6da77c0a54105aab94484e0d2088b", 
520 34 Beraldo Leal
                    "name": "admin"
521 34 Beraldo Leal
                }
522 34 Beraldo Leal
            ], 
523 34 Beraldo Leal
            "roles_links": [], 
524 34 Beraldo Leal
            "username": "admin"
525 34 Beraldo Leal
        }
526 34 Beraldo Leal
    }
527 34 Beraldo Leal
}
528 34 Beraldo Leal
529 34 Beraldo Leal
</pre>
530 36 Beraldo Leal
531 36 Beraldo Leal
Voce pode tambem listar usuarios, roles, tenants e services:
532 36 Beraldo Leal
533 36 Beraldo Leal
<pre>
534 36 Beraldo Leal
# keystone user-list
535 39 Beraldo Leal
+----------------------------------+---------+-------+--------+
536 39 Beraldo Leal
|                id                | enabled | email |  name  |
537 39 Beraldo Leal
+----------------------------------+---------+-------+--------+
538 39 Beraldo Leal
| 029c5749548946f7b560b2706d31d488 | True    | None  | glance |
539 39 Beraldo Leal
| 1fcfbe778fc3428aa30db782056b34d7 | True    | None  | admin  |
540 39 Beraldo Leal
| 4b75079aeb1b408ebdb286bfb85e719f | True    | None  | swift  |
541 39 Beraldo Leal
| e25f81d50eb84bdb92907adbd0e41f25 | True    | None  | nova   |
542 39 Beraldo Leal
+----------------------------------+---------+-------+--------+
543 40 Beraldo Leal
</pre>
544 39 Beraldo Leal
545 40 Beraldo Leal
<pre>
546 36 Beraldo Leal
# keystone role-list
547 39 Beraldo Leal
+----------------------------------+-------+
548 39 Beraldo Leal
|                id                |  name |
549 39 Beraldo Leal
+----------------------------------+-------+
550 39 Beraldo Leal
| 845e83e4d9bf4d8d8188b1e261dfe103 | user  |
551 39 Beraldo Leal
| a2d6da77c0a54105aab94484e0d2088b | admin |
552 39 Beraldo Leal
+----------------------------------+-------+
553 40 Beraldo Leal
</pre>
554 1 Beraldo Leal
555 40 Beraldo Leal
<pre>
556 36 Beraldo Leal
# keystone tenant-list
557 39 Beraldo Leal
+----------------------------------+---------------+---------+
558 39 Beraldo Leal
|                id                |      name     | enabled |
559 39 Beraldo Leal
+----------------------------------+---------------+---------+
560 39 Beraldo Leal
| 92920816c7704a8a95c916d34dc7a05c | service       | True    |
561 39 Beraldo Leal
| 9c401c9d2b9d41bcabda6919d4aec63a | openstackDemo | True    |
562 1 Beraldo Leal
+----------------------------------+---------------+---------+
563 40 Beraldo Leal
</pre>
564 1 Beraldo Leal
565 40 Beraldo Leal
<pre>
566 36 Beraldo Leal
# keystone service-list
567 39 Beraldo Leal
+----------------------------------+----------+----------------+---------------------------+
568 39 Beraldo Leal
|                id                |   name   |      type      |        description        |
569 39 Beraldo Leal
+----------------------------------+----------+----------------+---------------------------+
570 39 Beraldo Leal
| 00486163c7c64c6a86f577627071aafc | nova     | compute        | Nova Compute Service      |
571 39 Beraldo Leal
| 69d3a6b21c9348acb1042d7d9386ff81 | volume   | volume         | Nova Volume Service       |
572 41 Beraldo Leal
| 7b09782f9faf448781f5a460acabe258 | swift    | object-store   | Object Storage Service    |
573 39 Beraldo Leal
| d6b32583a6694e9b828b2a50037623ba | keystone | identity       | Keystone Identity Service |
574 39 Beraldo Leal
| f7f964a71e2a45119dcaede68fafbd78 | glance   | image          | Glance Image Service      |
575 39 Beraldo Leal
+----------------------------------+----------+----------------+---------------------------+
576 36 Beraldo Leal
</pre>
577 38 Beraldo Leal
578 38 Beraldo Leal
h1. Installing OpenStack Object Storage - Swift
579 42 Beraldo Leal
580 1 Beraldo Leal
[Descrever o Swift aqui]
581 44 Beraldo Leal
582 44 Beraldo Leal
Como neste ambiente de desenvolvimento temos apenas um no para storage e este sera o mesmo no que estara instalado o swift-proxy, todos os passos abaixo, sao executados na mesma maquina: _educloud01_.
583 44 Beraldo Leal
584 44 Beraldo Leal
Em um ambiente de producao aconselha-se ter pelo menos 05 object storage nodes e 01 object proxy node.
585 44 Beraldo Leal
586 44 Beraldo Leal
h2. Instalando e configurando o swift
587 44 Beraldo Leal
588 44 Beraldo Leal
<pre>
589 44 Beraldo Leal
# apt-get install swift python-xattr python-memcache rsync memcached python-netifaces
590 44 Beraldo Leal
</pre>
591 44 Beraldo Leal
592 44 Beraldo Leal
Infelizmente no momento da escrita deste manual o pacote do swift nao automatiza algumas tarefas, como por exemplo, a criacao dos arquivos de configuracao. Teremos que fazer isso manualmente:
593 44 Beraldo Leal
594 44 Beraldo Leal
<pre>
595 44 Beraldo Leal
# mkdir /etc/swift
596 44 Beraldo Leal
</pre>
597 44 Beraldo Leal
598 44 Beraldo Leal
Crie o arquivo de configuracao _/etc/swift/swift.conf_:
599 44 Beraldo Leal
600 44 Beraldo Leal
<pre>
601 44 Beraldo Leal
[swift-hash]
602 44 Beraldo Leal
# random unique string that can never change (DO NOT LOSE)
603 44 Beraldo Leal
swift_hash_path_suffix = fLIbertYgibbitZ
604 44 Beraldo Leal
</pre>
605 44 Beraldo Leal
606 44 Beraldo Leal
h2. Instalando e configurando os "object nodes"
607 44 Beraldo Leal
608 44 Beraldo Leal
<pre>
609 44 Beraldo Leal
# apt-get install swift-account swift-container swift-object xfsprogs
610 44 Beraldo Leal
</pre>
611 44 Beraldo Leal
612 44 Beraldo Leal
Cada "Object node" pode ter muitos dispositivos ligados a eles. 'E necessario que seja utilizado o sistema de arquivos xfs. 
613 44 Beraldo Leal
614 44 Beraldo Leal
<pre>
615 44 Beraldo Leal
# fdisk /dev/sdb (set up a single partition)
616 44 Beraldo Leal
# mkfs.xfs -i size=1024 /dev/sdb1
617 44 Beraldo Leal
</pre>
618 44 Beraldo Leal
619 44 Beraldo Leal
620 44 Beraldo Leal
Este dispositivo deve estar montando em /srv/node/
621 44 Beraldo Leal
622 44 Beraldo Leal
<pre>
623 44 Beraldo Leal
echo "/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
624 44 Beraldo Leal
mkdir -p /srv/node/sdb1
625 44 Beraldo Leal
mount /srv/node/sdb1
626 44 Beraldo Leal
chown -R swift:swift /srv/node
627 44 Beraldo Leal
</pre>
628 44 Beraldo Leal
629 44 Beraldo Leal
h2. Configure o _rsyncd.conf_
630 44 Beraldo Leal
631 44 Beraldo Leal
<pre>
632 44 Beraldo Leal
uid = swift
633 44 Beraldo Leal
gid = swift
634 44 Beraldo Leal
log file = /var/log/rsyncd.log
635 44 Beraldo Leal
pid file = /var/run/rsyncd.pid
636 44 Beraldo Leal
address = 192.168.69.1
637 44 Beraldo Leal
638 44 Beraldo Leal
[account]
639 44 Beraldo Leal
max connections = 2
640 44 Beraldo Leal
path = /srv/node/
641 44 Beraldo Leal
read only = false
642 44 Beraldo Leal
lock file = /var/lock/account.lock
643 44 Beraldo Leal
644 44 Beraldo Leal
[container]
645 44 Beraldo Leal
max connections = 2
646 44 Beraldo Leal
path = /srv/node/
647 44 Beraldo Leal
read only = false
648 44 Beraldo Leal
lock file = /var/lock/container.lock
649 44 Beraldo Leal
650 44 Beraldo Leal
[object]
651 44 Beraldo Leal
max connections = 2
652 44 Beraldo Leal
path = /srv/node/
653 44 Beraldo Leal
read only = false
654 44 Beraldo Leal
lock file = /var/lock/object.lock
655 44 Beraldo Leal
</pre>
656 44 Beraldo Leal
657 44 Beraldo Leal
Edite o _/etc/default/rsync_:
658 44 Beraldo Leal
659 44 Beraldo Leal
<pre>
660 44 Beraldo Leal
RSYNC_ENABLE = true
661 44 Beraldo Leal
</pre>
662 44 Beraldo Leal
663 44 Beraldo Leal
Restarte o rsync:
664 44 Beraldo Leal
665 44 Beraldo Leal
<pre>
666 44 Beraldo Leal
service rsync restart
667 44 Beraldo Leal
</pre>
668 44 Beraldo Leal
669 44 Beraldo Leal
Crie o _/etc/swift/account-server.conf_:
670 44 Beraldo Leal
671 44 Beraldo Leal
<pre>
672 44 Beraldo Leal
[DEFAULT]
673 44 Beraldo Leal
bind_ip = 192.168.69.1
674 44 Beraldo Leal
workers = 2
675 44 Beraldo Leal
676 44 Beraldo Leal
[pipeline:main]
677 44 Beraldo Leal
pipeline = account-server
678 44 Beraldo Leal
679 44 Beraldo Leal
[app:account-server]
680 44 Beraldo Leal
use = egg:swift#account
681 44 Beraldo Leal
682 44 Beraldo Leal
[account-replicator]
683 44 Beraldo Leal
684 44 Beraldo Leal
[account-auditor]
685 44 Beraldo Leal
686 44 Beraldo Leal
[account-reaper]
687 44 Beraldo Leal
</pre>
688 44 Beraldo Leal
689 44 Beraldo Leal
Crie o _/etc/swift/container-server.conf_:
690 44 Beraldo Leal
691 44 Beraldo Leal
<pre>
692 44 Beraldo Leal
[DEFAULT]
693 44 Beraldo Leal
bind_ip = 192.168.69.1
694 44 Beraldo Leal
workers = 2
695 44 Beraldo Leal
696 44 Beraldo Leal
[pipeline:main]
697 44 Beraldo Leal
pipeline = container-server
698 44 Beraldo Leal
699 44 Beraldo Leal
[app:container-server]
700 44 Beraldo Leal
use = egg:swift#container
701 44 Beraldo Leal
702 44 Beraldo Leal
[container-replicator]
703 44 Beraldo Leal
704 44 Beraldo Leal
[container-updater]
705 44 Beraldo Leal
706 44 Beraldo Leal
[container-auditor]
707 44 Beraldo Leal
</pre>
708 44 Beraldo Leal
709 44 Beraldo Leal
Crie o _/etc/swift/object-server.conf_:
710 44 Beraldo Leal
711 44 Beraldo Leal
<pre>
712 44 Beraldo Leal
[DEFAULT]
713 44 Beraldo Leal
bind_ip = 192.168.69.1
714 44 Beraldo Leal
workers = 2
715 44 Beraldo Leal
716 44 Beraldo Leal
[pipeline:main]
717 44 Beraldo Leal
pipeline = object-server
718 44 Beraldo Leal
719 44 Beraldo Leal
[app:object-server]
720 44 Beraldo Leal
use = egg:swift#object
721 44 Beraldo Leal
722 44 Beraldo Leal
[object-replicator]
723 44 Beraldo Leal
724 44 Beraldo Leal
[object-updater]
725 44 Beraldo Leal
726 44 Beraldo Leal
[object-auditor]
727 44 Beraldo Leal
</pre>
728 44 Beraldo Leal
729 44 Beraldo Leal
730 44 Beraldo Leal
h2. Instale e configure o swift-proxy
731 44 Beraldo Leal
732 44 Beraldo Leal
<pre>
733 44 Beraldo Leal
# apt-get install swift-proxy memcached
734 44 Beraldo Leal
</pre>
735 44 Beraldo Leal
736 44 Beraldo Leal
Crie o certificado SSL auto assinado:
737 44 Beraldo Leal
738 44 Beraldo Leal
<pre>
739 44 Beraldo Leal
cd /etc/swift
740 44 Beraldo Leal
openssl req -new -x509 -nodes -out cert.crt -keyout cert.key
741 44 Beraldo Leal
</pre>
742 44 Beraldo Leal
743 44 Beraldo Leal
Modifique o memcached para ouvir na interface da sua rede interna. Edite a seguinte linha no /etc/memcached.conf, mudando
744 44 Beraldo Leal
745 44 Beraldo Leal
<pre>
746 44 Beraldo Leal
-l 127.0.0.1
747 44 Beraldo Leal
to
748 44 Beraldo Leal
-l 192.168.69.1
749 44 Beraldo Leal
</pre>
750 44 Beraldo Leal
751 44 Beraldo Leal
Restart o memcached:
752 44 Beraldo Leal
753 44 Beraldo Leal
<pre>
754 44 Beraldo Leal
service memcached restart
755 44 Beraldo Leal
</pre>
756 44 Beraldo Leal
757 44 Beraldo Leal
Crie o arquivo _/etc/swift/proxy-server.conf_:
758 44 Beraldo Leal
759 44 Beraldo Leal
<pre>
760 44 Beraldo Leal
[DEFAULT]
761 44 Beraldo Leal
bind_port = 8888
762 44 Beraldo Leal
user = swift
763 44 Beraldo Leal
764 44 Beraldo Leal
[pipeline:main]
765 44 Beraldo Leal
pipeline = catch_errors healthcheck cache authtoken keystone proxy-server
766 44 Beraldo Leal
767 44 Beraldo Leal
[app:proxy-server]
768 44 Beraldo Leal
use = egg:swift#proxy
769 44 Beraldo Leal
account_autocreate = true
770 44 Beraldo Leal
771 44 Beraldo Leal
[filter:keystone]
772 44 Beraldo Leal
paste.filter_factory = keystone.middleware.swift_auth:filter_factory
773 44 Beraldo Leal
operator_roles = admin, swiftoperator
774 44 Beraldo Leal
775 44 Beraldo Leal
[filter:authtoken]
776 44 Beraldo Leal
paste.filter_factory = keystone.middleware.auth_token:filter_factory
777 44 Beraldo Leal
# Delaying the auth decision is required to support token-less
778 44 Beraldo Leal
# usage for anonymous referrers ('.r:*').
779 44 Beraldo Leal
delay_auth_decision = 10
780 44 Beraldo Leal
service_port = 5000
781 44 Beraldo Leal
service_host = 192.168.69.1
782 44 Beraldo Leal
auth_port = 35357
783 44 Beraldo Leal
auth_host = 192.168.69.1
784 44 Beraldo Leal
auth_token = 012345SECRET99TOKEN012345
785 44 Beraldo Leal
admin_token = 012345SECRET99TOKEN012345
786 44 Beraldo Leal
auth_protocol = http
787 44 Beraldo Leal
788 44 Beraldo Leal
[filter:cache]
789 44 Beraldo Leal
use = egg:swift#memcache
790 44 Beraldo Leal
set log_name = cache
791 44 Beraldo Leal
792 44 Beraldo Leal
[filter:catch_errors]
793 44 Beraldo Leal
use = egg:swift#catch_errors
794 44 Beraldo Leal
795 44 Beraldo Leal
[filter:healthcheck]
796 44 Beraldo Leal
use = egg:swift#healthcheck
797 44 Beraldo Leal
</pre>
798 44 Beraldo Leal
799 45 Beraldo Leal
800 45 Beraldo Leal
Create the account, container and object rings. The builder command is basically creating a builder file with a few parameters. The parameter with the value of 18 represents 2 ^ 18th, the value that the partition will be sized to. Set this "partition power" value based on the total amount of storage you expect your entire ring to use. The value of 1 represents the number of replicas of each object, with the last value being the number of hours to restrict moving a partition more than once.
801 45 Beraldo Leal
802 45 Beraldo Leal
<pre>
803 45 Beraldo Leal
cd /etc/swift
804 45 Beraldo Leal
swift-ring-builder account.builder create 18 1 1
805 45 Beraldo Leal
swift-ring-builder container.builder create 18 1 1
806 45 Beraldo Leal
swift-ring-builder object.builder create 18 1 1
807 45 Beraldo Leal
</pre>
808 45 Beraldo Leal
809 45 Beraldo Leal
For every storage device on each node add entries to each ring:
810 45 Beraldo Leal
811 45 Beraldo Leal
<pre>
812 45 Beraldo Leal
swift-ring-builder account.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP>:6002/<DEVICE> 100
813 45 Beraldo Leal
swift-ring-builder container.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6001/<DEVICE> 100
814 45 Beraldo Leal
swift-ring-builder object.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6000/<DEVICE> 100
815 45 Beraldo Leal
</pre>
816 45 Beraldo Leal
817 45 Beraldo Leal
Como no nosso caso, apenas temos uma zona, em um storage node e com um device (sdb1), o comando acima ficaria:
818 45 Beraldo Leal
819 45 Beraldo Leal
<pre>
820 45 Beraldo Leal
swift-ring-builder account.builder add z1-192.168.69.1:6002/sdb1 100
821 45 Beraldo Leal
swift-ring-builder container.builder add z1-192.168.69.1:6001/sdb1 100
822 45 Beraldo Leal
swift-ring-builder object.builder add z1-192.168.69.1:6000/sdb1 100
823 45 Beraldo Leal
</pre>
824 45 Beraldo Leal
825 45 Beraldo Leal
Verify the ring contents for each ring:
826 45 Beraldo Leal
827 45 Beraldo Leal
<pre>
828 45 Beraldo Leal
swift-ring-builder account.builder
829 45 Beraldo Leal
swift-ring-builder container.builder
830 45 Beraldo Leal
swift-ring-builder object.builder
831 45 Beraldo Leal
</pre>
832 45 Beraldo Leal
833 45 Beraldo Leal
Rebalance the rings:
834 45 Beraldo Leal
835 45 Beraldo Leal
<pre>
836 45 Beraldo Leal
swift-ring-builder account.builder rebalance
837 45 Beraldo Leal
swift-ring-builder container.builder rebalance
838 45 Beraldo Leal
swift-ring-builder object.builder rebalance
839 45 Beraldo Leal
</pre>
840 45 Beraldo Leal
841 44 Beraldo Leal
Altere as permissoes dos arquivos de configuracao:
842 44 Beraldo Leal
843 44 Beraldo Leal
<pre>
844 44 Beraldo Leal
# chown -R swift:swift /etc/swift/
845 44 Beraldo Leal
</pre>
846 45 Beraldo Leal
847 45 Beraldo Leal
Inicie o swift-proxy:
848 45 Beraldo Leal
849 45 Beraldo Leal
<pre>
850 45 Beraldo Leal
swift-init proxy start
851 45 Beraldo Leal
</pre>
852 45 Beraldo Leal
853 45 Beraldo Leal
Inicie todos os servicos:
854 45 Beraldo Leal
855 45 Beraldo Leal
<pre>
856 45 Beraldo Leal
swift-init main start
857 45 Beraldo Leal
swift-init rest start
858 45 Beraldo Leal
</pre>
859 45 Beraldo Leal
860 45 Beraldo Leal
861 45 Beraldo Leal
h2. Verificando a instalacao
862 45 Beraldo Leal
863 45 Beraldo Leal
O arquivo _/root/openstackrc_ vai receber novas variaveis de ambiente, ele deve ficar assim:
864 45 Beraldo Leal
865 45 Beraldo Leal
<pre>
866 45 Beraldo Leal
# Used for Keystone
867 45 Beraldo Leal
export SERVICE_ENDPOINT=http://192.168.69.1:35357/v2.0/
868 45 Beraldo Leal
export SERVICE_TOKEN=012345SECRET99TOKEN012345
869 45 Beraldo Leal
870 45 Beraldo Leal
# Used for swift
871 45 Beraldo Leal
export ST_AUTH=http://192.168.69.1:5000/v2.0
872 45 Beraldo Leal
export ST_USER=openstackDemo:admin
873 45 Beraldo Leal
export ST_KEY=adminpass
874 45 Beraldo Leal
export OS_REGION_NAME=RegionOne
875 45 Beraldo Leal
</pre>
876 45 Beraldo Leal
877 45 Beraldo Leal
Carregue o arquivo:
878 45 Beraldo Leal
879 45 Beraldo Leal
<pre>
880 45 Beraldo Leal
# source /root/openstackrc
881 45 Beraldo Leal
</pre>
882 45 Beraldo Leal
883 45 Beraldo Leal
Tente obter status do swift:
884 45 Beraldo Leal
885 45 Beraldo Leal
<pre>
886 45 Beraldo Leal
# swift -V 2.0 stat
887 45 Beraldo Leal
</pre>
888 45 Beraldo Leal
889 45 Beraldo Leal
# Liste os containers:
890 45 Beraldo Leal
891 45 Beraldo Leal
<pre>
892 45 Beraldo Leal
# swift -V 2.0 list
893 45 Beraldo Leal
</pre>
894 46 Beraldo Leal
895 46 Beraldo Leal
Suba alguns arquivos para o swift:
896 46 Beraldo Leal
897 45 Beraldo Leal
<pre>
898 46 Beraldo Leal
# swift -V 2.0 upload myfiles bigfile1.tgz
899 46 Beraldo Leal
# swift -V 2.0 upload myfiles bigfile2.tgz
900 46 Beraldo Leal
</pre>
901 46 Beraldo Leal
902 46 Beraldo Leal
Baixe o container "myfiles":
903 46 Beraldo Leal
<pre>
904 46 Beraldo Leal
# cd /tmp/
905 46 Beraldo Leal
# swift -V 2.0 download myfiles
906 46 Beraldo Leal
</pre>
907 46 Beraldo Leal
908 46 Beraldo Leal
h1. Installing OpenStack Image Service - Glance
909 47 Beraldo Leal
910 47 Beraldo Leal
[descrever o glance aqui]
911 47 Beraldo Leal
912 47 Beraldo Leal
O glance esta instalado na _educloud01_.
913 47 Beraldo Leal
914 47 Beraldo Leal
h2. Instalando e configurando o glance
915 47 Beraldo Leal
916 47 Beraldo Leal
<pre>
917 47 Beraldo Leal
# apt-get install glance
918 47 Beraldo Leal
</pre>
919 47 Beraldo Leal
920 47 Beraldo Leal
Remova o arquivo sqlite.
921 47 Beraldo Leal
922 47 Beraldo Leal
<pre>
923 47 Beraldo Leal
# rm /var/lib/glance/glance.sqlite
924 47 Beraldo Leal
</pre>
925 47 Beraldo Leal
926 47 Beraldo Leal
h2. Configuring the Image Service database backend
927 47 Beraldo Leal
928 47 Beraldo Leal
<pre>
929 47 Beraldo Leal
# mysql -u root -p
930 47 Beraldo Leal
mysql> CREATE DATABASE glance;
931 47 Beraldo Leal
mysql> GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glancepass';
932 47 Beraldo Leal
mysql> FLUSH PRIVILEGES;
933 47 Beraldo Leal
mysql> quit;
934 47 Beraldo Leal
</pre>
935 47 Beraldo Leal
936 47 Beraldo Leal
937 47 Beraldo Leal
Substitua os seguintes arquivos de configuracao em _/etc/glance/_:
938 47 Beraldo Leal
939 47 Beraldo Leal
*/etc/glance/glance-api.conf*:
940 47 Beraldo Leal
<pre>
941 47 Beraldo Leal
[DEFAULT]
942 47 Beraldo Leal
# Show more verbose log output (sets INFO log level output)
943 47 Beraldo Leal
verbose = True
944 47 Beraldo Leal
945 47 Beraldo Leal
# Show debugging output in logs (sets DEBUG log level output)
946 47 Beraldo Leal
debug = False
947 47 Beraldo Leal
948 47 Beraldo Leal
# Which backend store should Glance use by default is not specified
949 47 Beraldo Leal
# in a request to add a new image to Glance? Default: 'file'
950 47 Beraldo Leal
# Available choices are 'file', 'swift', and 's3'
951 47 Beraldo Leal
default_store = swift
952 47 Beraldo Leal
953 47 Beraldo Leal
# Address to bind the API server
954 47 Beraldo Leal
bind_host = 0.0.0.0
955 47 Beraldo Leal
956 47 Beraldo Leal
# Port the bind the API server to
957 47 Beraldo Leal
bind_port = 9292
958 47 Beraldo Leal
959 47 Beraldo Leal
# Log to this file. Make sure you do not set the same log
960 47 Beraldo Leal
# file for both the API and registry servers!
961 47 Beraldo Leal
log_file = /var/log/glance/api.log
962 47 Beraldo Leal
963 47 Beraldo Leal
# Backlog requests when creating socket
964 47 Beraldo Leal
backlog = 4096
965 47 Beraldo Leal
966 47 Beraldo Leal
# Number of Glance API worker processes to start.
967 47 Beraldo Leal
# On machines with more than one CPU increasing this value
968 47 Beraldo Leal
# may improve performance (especially if using SSL with
969 47 Beraldo Leal
# compression turned on). It is typically recommended to set
970 47 Beraldo Leal
# this value to the number of CPUs present on your machine.
971 47 Beraldo Leal
workers = 0
972 47 Beraldo Leal
973 47 Beraldo Leal
# Role used to identify an authenticated user as administrator
974 47 Beraldo Leal
#admin_role = admin
975 47 Beraldo Leal
976 47 Beraldo Leal
# ================= Syslog Options ============================
977 47 Beraldo Leal
978 47 Beraldo Leal
# Send logs to syslog (/dev/log) instead of to file specified
979 47 Beraldo Leal
# by `log_file`
980 47 Beraldo Leal
use_syslog = False
981 47 Beraldo Leal
982 47 Beraldo Leal
# Facility to use. If unset defaults to LOG_USER.
983 47 Beraldo Leal
# syslog_log_facility = LOG_LOCAL0
984 47 Beraldo Leal
985 47 Beraldo Leal
# ================= SSL Options ===============================
986 47 Beraldo Leal
987 47 Beraldo Leal
# Certificate file to use when starting API server securely
988 47 Beraldo Leal
# cert_file = /path/to/certfile
989 47 Beraldo Leal
990 47 Beraldo Leal
# Private key file to use when starting API server securely
991 47 Beraldo Leal
# key_file = /path/to/keyfile
992 47 Beraldo Leal
993 47 Beraldo Leal
# ================= Security Options ==========================
994 47 Beraldo Leal
995 47 Beraldo Leal
# AES key for encrypting store 'location' metadata, including
996 47 Beraldo Leal
# -- if used -- Swift or S3 credentials
997 47 Beraldo Leal
# Should be set to a random string of length 16, 24 or 32 bytes
998 47 Beraldo Leal
# metadata_encryption_key = <16, 24 or 32 char registry metadata key>
999 47 Beraldo Leal
1000 47 Beraldo Leal
# ============ Registry Options ===============================
1001 47 Beraldo Leal
1002 47 Beraldo Leal
# Address to find the registry server
1003 47 Beraldo Leal
registry_host = 0.0.0.0
1004 47 Beraldo Leal
1005 47 Beraldo Leal
# Port the registry server is listening on
1006 47 Beraldo Leal
registry_port = 9191
1007 47 Beraldo Leal
1008 47 Beraldo Leal
# What protocol to use when connecting to the registry server?
1009 47 Beraldo Leal
# Set to https for secure HTTP communication
1010 47 Beraldo Leal
registry_client_protocol = http
1011 47 Beraldo Leal
1012 47 Beraldo Leal
# The path to the key file to use in SSL connections to the
1013 47 Beraldo Leal
# registry server, if any. Alternately, you may set the
1014 47 Beraldo Leal
# GLANCE_CLIENT_KEY_FILE environ variable to a filepath of the key file
1015 47 Beraldo Leal
# registry_client_key_file = /path/to/key/file
1016 47 Beraldo Leal
1017 47 Beraldo Leal
# The path to the cert file to use in SSL connections to the
1018 47 Beraldo Leal
# registry server, if any. Alternately, you may set the
1019 47 Beraldo Leal
# GLANCE_CLIENT_CERT_FILE environ variable to a filepath of the cert file
1020 47 Beraldo Leal
# registry_client_cert_file = /path/to/cert/file
1021 47 Beraldo Leal
1022 47 Beraldo Leal
# The path to the certifying authority cert file to use in SSL connections
1023 47 Beraldo Leal
# to the registry server, if any. Alternately, you may set the
1024 47 Beraldo Leal
# GLANCE_CLIENT_CA_FILE environ variable to a filepath of the CA cert file
1025 47 Beraldo Leal
# registry_client_ca_file = /path/to/ca/file
1026 47 Beraldo Leal
1027 47 Beraldo Leal
# ============ Notification System Options =====================
1028 47 Beraldo Leal
1029 47 Beraldo Leal
# Notifications can be sent when images are create, updated or deleted.
1030 47 Beraldo Leal
# There are three methods of sending notifications, logging (via the
1031 47 Beraldo Leal
# log_file directive), rabbit (via a rabbitmq queue), qpid (via a Qpid
1032 47 Beraldo Leal
# message queue), or noop (no notifications sent, the default)
1033 47 Beraldo Leal
notifier_strategy = noop
1034 47 Beraldo Leal
1035 47 Beraldo Leal
# Configuration options if sending notifications via rabbitmq (these are
1036 47 Beraldo Leal
# the defaults)
1037 47 Beraldo Leal
rabbit_host = localhost
1038 47 Beraldo Leal
rabbit_port = 5672
1039 47 Beraldo Leal
rabbit_use_ssl = false
1040 47 Beraldo Leal
rabbit_userid = guest
1041 47 Beraldo Leal
rabbit_password = guest
1042 47 Beraldo Leal
rabbit_virtual_host = /
1043 47 Beraldo Leal
rabbit_notification_exchange = glance
1044 47 Beraldo Leal
rabbit_notification_topic = glance_notifications
1045 47 Beraldo Leal
1046 47 Beraldo Leal
# Configuration options if sending notifications via Qpid (these are
1047 47 Beraldo Leal
# the defaults)
1048 47 Beraldo Leal
qpid_notification_exchange = glance
1049 47 Beraldo Leal
qpid_notification_topic = glance_notifications
1050 47 Beraldo Leal
qpid_host = localhost
1051 47 Beraldo Leal
qpid_port = 5672
1052 47 Beraldo Leal
qpid_username =
1053 47 Beraldo Leal
qpid_password =
1054 47 Beraldo Leal
qpid_sasl_mechanisms =
1055 47 Beraldo Leal
qpid_reconnect_timeout = 0
1056 47 Beraldo Leal
qpid_reconnect_limit = 0
1057 47 Beraldo Leal
qpid_reconnect_interval_min = 0
1058 47 Beraldo Leal
qpid_reconnect_interval_max = 0
1059 47 Beraldo Leal
qpid_reconnect_interval = 0
1060 47 Beraldo Leal
qpid_heartbeat = 5
1061 47 Beraldo Leal
# Set to 'ssl' to enable SSL
1062 47 Beraldo Leal
qpid_protocol = tcp
1063 47 Beraldo Leal
qpid_tcp_nodelay = True
1064 47 Beraldo Leal
1065 47 Beraldo Leal
# ============ Filesystem Store Options ========================
1066 47 Beraldo Leal
1067 47 Beraldo Leal
# Directory that the Filesystem backend store
1068 47 Beraldo Leal
# writes image data to
1069 47 Beraldo Leal
filesystem_store_datadir = /var/lib/glance/images/
1070 47 Beraldo Leal
1071 47 Beraldo Leal
# ============ Swift Store Options =============================
1072 47 Beraldo Leal
1073 47 Beraldo Leal
# Version of the authentication service to use
1074 47 Beraldo Leal
# Valid versions are '2' for keystone and '1' for swauth and rackspace
1075 47 Beraldo Leal
swift_store_auth_version = 2
1076 47 Beraldo Leal
1077 47 Beraldo Leal
# Address where the Swift authentication service lives
1078 47 Beraldo Leal
# Valid schemes are 'http://' and 'https://'
1079 47 Beraldo Leal
# If no scheme specified,  default to 'https://'
1080 47 Beraldo Leal
# For swauth, use something like '127.0.0.1:8080/v1.0/'
1081 47 Beraldo Leal
swift_store_auth_address = http://192.168.69.1:35357/v2.0/
1082 47 Beraldo Leal
1083 47 Beraldo Leal
# User to authenticate against the Swift authentication service
1084 47 Beraldo Leal
# If you use Swift authentication service, set it to 'account':'user'
1085 47 Beraldo Leal
# where 'account' is a Swift storage account and 'user'
1086 47 Beraldo Leal
# is a user in that account
1087 47 Beraldo Leal
swift_store_user = service:glance
1088 47 Beraldo Leal
1089 47 Beraldo Leal
# Auth key for the user authenticating against the
1090 47 Beraldo Leal
# Swift authentication service
1091 47 Beraldo Leal
swift_store_key = glancepass
1092 47 Beraldo Leal
1093 47 Beraldo Leal
# Container within the account that the account should use
1094 47 Beraldo Leal
# for storing images in Swift
1095 47 Beraldo Leal
swift_store_container = glance
1096 47 Beraldo Leal
1097 47 Beraldo Leal
# Do we create the container if it does not exist?
1098 47 Beraldo Leal
swift_store_create_container_on_put = True
1099 47 Beraldo Leal
1100 47 Beraldo Leal
# What size, in MB, should Glance start chunking image files
1101 47 Beraldo Leal
# and do a large object manifest in Swift? By default, this is
1102 47 Beraldo Leal
# the maximum object size in Swift, which is 5GB
1103 47 Beraldo Leal
swift_store_large_object_size = 5120
1104 47 Beraldo Leal
1105 47 Beraldo Leal
# When doing a large object manifest, what size, in MB, should
1106 47 Beraldo Leal
# Glance write chunks to Swift? This amount of data is written
1107 47 Beraldo Leal
# to a temporary disk buffer during the process of chunking
1108 47 Beraldo Leal
# the image file, and the default is 200MB
1109 47 Beraldo Leal
swift_store_large_object_chunk_size = 200
1110 47 Beraldo Leal
1111 47 Beraldo Leal
# Whether to use ServiceNET to communicate with the Swift storage servers.
1112 47 Beraldo Leal
# (If you aren't RACKSPACE, leave this False!)
1113 47 Beraldo Leal
#
1114 47 Beraldo Leal
# To use ServiceNET for authentication, prefix hostname of
1115 47 Beraldo Leal
# `swift_store_auth_address` with 'snet-'.
1116 47 Beraldo Leal
# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
1117 47 Beraldo Leal
swift_enable_snet = False
1118 47 Beraldo Leal
1119 47 Beraldo Leal
# ============ S3 Store Options =============================
1120 47 Beraldo Leal
1121 47 Beraldo Leal
# Address where the S3 authentication service lives
1122 47 Beraldo Leal
# Valid schemes are 'http://' and 'https://'
1123 47 Beraldo Leal
# If no scheme specified,  default to 'http://'
1124 47 Beraldo Leal
s3_store_host = 127.0.0.1:8080/v1.0/
1125 47 Beraldo Leal
1126 47 Beraldo Leal
# User to authenticate against the S3 authentication service
1127 47 Beraldo Leal
s3_store_access_key = <20-char AWS access key>
1128 47 Beraldo Leal
1129 47 Beraldo Leal
# Auth key for the user authenticating against the
1130 47 Beraldo Leal
# S3 authentication service
1131 47 Beraldo Leal
s3_store_secret_key = <40-char AWS secret key>
1132 47 Beraldo Leal
1133 47 Beraldo Leal
# Container within the account that the account should use
1134 47 Beraldo Leal
# for storing images in S3. Note that S3 has a flat namespace,
1135 47 Beraldo Leal
# so you need a unique bucket name for your glance images. An
1136 47 Beraldo Leal
# easy way to do this is append your AWS access key to "glance".
1137 47 Beraldo Leal
# S3 buckets in AWS *must* be lowercased, so remember to lowercase
1138 47 Beraldo Leal
# your AWS access key if you use it in your bucket name below!
1139 47 Beraldo Leal
s3_store_bucket = <lowercased 20-char aws access key>glance
1140 47 Beraldo Leal
1141 47 Beraldo Leal
# Do we create the bucket if it does not exist?
1142 47 Beraldo Leal
s3_store_create_bucket_on_put = False
1143 47 Beraldo Leal
1144 47 Beraldo Leal
# When sending images to S3, the data will first be written to a
1145 47 Beraldo Leal
# temporary buffer on disk. By default the platform's temporary directory
1146 47 Beraldo Leal
# will be used. If required, an alternative directory can be specified here.
1147 47 Beraldo Leal
# s3_store_object_buffer_dir = /path/to/dir
1148 47 Beraldo Leal
1149 47 Beraldo Leal
# ============ RBD Store Options =============================
1150 47 Beraldo Leal
1151 47 Beraldo Leal
# Ceph configuration file path
1152 47 Beraldo Leal
# If using cephx authentication, this file should
1153 47 Beraldo Leal
# include a reference to the right keyring
1154 47 Beraldo Leal
# in a client.<USER> section
1155 47 Beraldo Leal
rbd_store_ceph_conf = /etc/ceph/ceph.conf
1156 47 Beraldo Leal
1157 47 Beraldo Leal
# RADOS user to authenticate as (only applicable if using cephx)
1158 47 Beraldo Leal
rbd_store_user = glance
1159 47 Beraldo Leal
1160 47 Beraldo Leal
# RADOS pool in which images are stored
1161 47 Beraldo Leal
rbd_store_pool = images
1162 47 Beraldo Leal
1163 47 Beraldo Leal
# Images will be chunked into objects of this size (in megabytes).
1164 47 Beraldo Leal
# For best performance, this should be a power of two
1165 47 Beraldo Leal
rbd_store_chunk_size = 8
1166 47 Beraldo Leal
1167 47 Beraldo Leal
# ============ Delayed Delete Options =============================
1168 47 Beraldo Leal
1169 47 Beraldo Leal
# Turn on/off delayed delete
1170 47 Beraldo Leal
delayed_delete = False
1171 47 Beraldo Leal
1172 47 Beraldo Leal
# Delayed delete time in seconds
1173 47 Beraldo Leal
scrub_time = 43200
1174 47 Beraldo Leal
1175 47 Beraldo Leal
# Directory that the scrubber will use to remind itself of what to delete
1176 47 Beraldo Leal
# Make sure this is also set in glance-scrubber.conf
1177 47 Beraldo Leal
scrubber_datadir = /var/lib/glance/scrubber
1178 47 Beraldo Leal
1179 47 Beraldo Leal
# =============== Image Cache Options =============================
1180 47 Beraldo Leal
1181 47 Beraldo Leal
# Base directory that the Image Cache uses
1182 47 Beraldo Leal
image_cache_dir = /var/lib/glance/image-cache/
1183 47 Beraldo Leal
1184 47 Beraldo Leal
[paste_deploy]
1185 47 Beraldo Leal
flavor = keystone
1186 47 Beraldo Leal
</pre>
1187 47 Beraldo Leal
1188 47 Beraldo Leal
*/etc/glance/glance-api-paste.ini*:
1189 47 Beraldo Leal
1190 47 Beraldo Leal
<pre>
1191 47 Beraldo Leal
# Default minimal pipeline
1192 47 Beraldo Leal
[pipeline:glance-api]
1193 47 Beraldo Leal
pipeline = versionnegotiation context apiv1app authtoken
1194 47 Beraldo Leal
1195 47 Beraldo Leal
# Use the following pipeline for keystone auth
1196 47 Beraldo Leal
# i.e. in glance-api.conf:
1197 47 Beraldo Leal
#   [paste_deploy]
1198 47 Beraldo Leal
#   flavor = keystone
1199 47 Beraldo Leal
#
1200 47 Beraldo Leal
[pipeline:glance-api-keystone]
1201 47 Beraldo Leal
pipeline = versionnegotiation authtoken context apiv1app
1202 47 Beraldo Leal
1203 47 Beraldo Leal
# Use the following pipeline to enable transparent caching of image files
1204 47 Beraldo Leal
# i.e. in glance-api.conf:
1205 47 Beraldo Leal
#   [paste_deploy]
1206 47 Beraldo Leal
#   flavor = caching
1207 47 Beraldo Leal
#
1208 47 Beraldo Leal
[pipeline:glance-api-caching]
1209 47 Beraldo Leal
pipeline = versionnegotiation context cache apiv1app
1210 47 Beraldo Leal
1211 47 Beraldo Leal
# Use the following pipeline for keystone auth with caching
1212 47 Beraldo Leal
# i.e. in glance-api.conf:
1213 47 Beraldo Leal
#   [paste_deploy]
1214 47 Beraldo Leal
#   flavor = keystone+caching
1215 47 Beraldo Leal
#
1216 47 Beraldo Leal
[pipeline:glance-api-keystone+caching]
1217 47 Beraldo Leal
pipeline = versionnegotiation authtoken context cache apiv1app
1218 47 Beraldo Leal
1219 47 Beraldo Leal
# Use the following pipeline to enable the Image Cache Management API
1220 47 Beraldo Leal
# i.e. in glance-api.conf:
1221 47 Beraldo Leal
#   [paste_deploy]
1222 47 Beraldo Leal
#   flavor = cachemanagement
1223 47 Beraldo Leal
#
1224 47 Beraldo Leal
[pipeline:glance-api-cachemanagement]
1225 47 Beraldo Leal
pipeline = versionnegotiation context cache cachemanage apiv1app
1226 47 Beraldo Leal
1227 47 Beraldo Leal
# Use the following pipeline for keystone auth with cache management
1228 47 Beraldo Leal
# i.e. in glance-api.conf:
1229 47 Beraldo Leal
#   [paste_deploy]
1230 47 Beraldo Leal
#   flavor = keystone+cachemanagement
1231 47 Beraldo Leal
#
1232 47 Beraldo Leal
[pipeline:glance-api-keystone+cachemanagement]
1233 47 Beraldo Leal
pipeline = versionnegotiation authtoken context cache cachemanage apiv1app
1234 47 Beraldo Leal
1235 47 Beraldo Leal
[app:apiv1app]
1236 47 Beraldo Leal
paste.app_factory = glance.common.wsgi:app_factory
1237 47 Beraldo Leal
glance.app_factory = glance.api.v1.router:API
1238 47 Beraldo Leal
1239 47 Beraldo Leal
[filter:versionnegotiation]
1240 47 Beraldo Leal
paste.filter_factory = glance.common.wsgi:filter_factory
1241 47 Beraldo Leal
glance.filter_factory = glance.api.middleware.version_negotiation:VersionNegotiationFilter
1242 47 Beraldo Leal
1243 47 Beraldo Leal
[filter:cache]
1244 47 Beraldo Leal
paste.filter_factory = glance.common.wsgi:filter_factory
1245 47 Beraldo Leal
glance.filter_factory = glance.api.middleware.cache:CacheFilter
1246 47 Beraldo Leal
1247 47 Beraldo Leal
[filter:cachemanage]
1248 47 Beraldo Leal
paste.filter_factory = glance.common.wsgi:filter_factory
1249 47 Beraldo Leal
glance.filter_factory = glance.api.middleware.cache_manage:CacheManageFilter
1250 47 Beraldo Leal
1251 47 Beraldo Leal
[filter:context]
1252 47 Beraldo Leal
paste.filter_factory = glance.common.wsgi:filter_factory
1253 47 Beraldo Leal
glance.filter_factory = glance.common.context:ContextMiddleware
1254 47 Beraldo Leal
1255 47 Beraldo Leal
[filter:authtoken]
1256 47 Beraldo Leal
paste.filter_factory = keystone.middleware.auth_token:filter_factory
1257 47 Beraldo Leal
service_protocol = http
1258 47 Beraldo Leal
service_host = 192.168.69.1
1259 47 Beraldo Leal
service_port = 5000
1260 47 Beraldo Leal
auth_host = 192.168.69.1
1261 47 Beraldo Leal
auth_port = 35357
1262 47 Beraldo Leal
auth_protocol = http
1263 47 Beraldo Leal
auth_uri = http://192.168.69.1:5000/
1264 47 Beraldo Leal
admin_tenant_name = service
1265 47 Beraldo Leal
admin_user = glance
1266 47 Beraldo Leal
admin_password = glancepass
1267 47 Beraldo Leal
</pre>
1268 48 Beraldo Leal
1269 48 Beraldo Leal
*/etc/glance/glance-registry.conf*:
1270 48 Beraldo Leal
1271 48 Beraldo Leal
<pre>
1272 48 Beraldo Leal
[DEFAULT]
1273 48 Beraldo Leal
# Show more verbose log output (sets INFO log level output)
1274 48 Beraldo Leal
verbose = True
1275 48 Beraldo Leal
1276 48 Beraldo Leal
# Show debugging output in logs (sets DEBUG log level output)
1277 48 Beraldo Leal
debug = True
1278 48 Beraldo Leal
1279 48 Beraldo Leal
# Address to bind the registry server
1280 48 Beraldo Leal
bind_host = 0.0.0.0
1281 48 Beraldo Leal
1282 48 Beraldo Leal
# Port the bind the registry server to
1283 48 Beraldo Leal
bind_port = 9191
1284 48 Beraldo Leal
1285 48 Beraldo Leal
# Log to this file. Make sure you do not set the same log
1286 48 Beraldo Leal
# file for both the API and registry servers!
1287 48 Beraldo Leal
log_file = /var/log/glance/registry.log
1288 48 Beraldo Leal
1289 48 Beraldo Leal
# Backlog requests when creating socket
1290 48 Beraldo Leal
backlog = 4096
1291 48 Beraldo Leal
1292 48 Beraldo Leal
# SQLAlchemy connection string for the reference implementation
1293 48 Beraldo Leal
# registry server. Any valid SQLAlchemy connection string is fine.
1294 48 Beraldo Leal
# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
1295 48 Beraldo Leal
sql_connection = mysql://glance:glancepass@192.168.69.1/glance
1296 48 Beraldo Leal
1297 48 Beraldo Leal
# Period in seconds after which SQLAlchemy should reestablish its connection
1298 48 Beraldo Leal
# to the database.
1299 48 Beraldo Leal
#
1300 48 Beraldo Leal
# MySQL uses a default `wait_timeout` of 8 hours, after which it will drop
1301 48 Beraldo Leal
# idle connections. This can result in 'MySQL Gone Away' exceptions. If you
1302 48 Beraldo Leal
# notice this, you can lower this value to ensure that SQLAlchemy reconnects
1303 48 Beraldo Leal
# before MySQL can drop the connection.
1304 48 Beraldo Leal
sql_idle_timeout = 3600
1305 48 Beraldo Leal
1306 48 Beraldo Leal
# Limit the api to return `param_limit_max` items in a call to a container. If
1307 48 Beraldo Leal
# a larger `limit` query param is provided, it will be reduced to this value.
1308 48 Beraldo Leal
api_limit_max = 1000
1309 48 Beraldo Leal
1310 48 Beraldo Leal
# If a `limit` query param is not provided in an api request, it will
1311 48 Beraldo Leal
# default to `limit_param_default`
1312 48 Beraldo Leal
limit_param_default = 25
1313 48 Beraldo Leal
1314 48 Beraldo Leal
# Role used to identify an authenticated user as administrator
1315 48 Beraldo Leal
#admin_role = admin
1316 48 Beraldo Leal
1317 48 Beraldo Leal
# ================= Syslog Options ============================
1318 48 Beraldo Leal
1319 48 Beraldo Leal
# Send logs to syslog (/dev/log) instead of to file specified
1320 48 Beraldo Leal
# by `log_file`
1321 48 Beraldo Leal
use_syslog = True
1322 48 Beraldo Leal
1323 48 Beraldo Leal
# Facility to use. If unset defaults to LOG_USER.
1324 48 Beraldo Leal
# syslog_log_facility = LOG_LOCAL1
1325 48 Beraldo Leal
1326 48 Beraldo Leal
# ================= SSL Options ===============================
1327 48 Beraldo Leal
1328 48 Beraldo Leal
# Certificate file to use when starting registry server securely
1329 48 Beraldo Leal
# cert_file = /path/to/certfile
1330 48 Beraldo Leal
1331 48 Beraldo Leal
# Private key file to use when starting registry server securely
1332 48 Beraldo Leal
# key_file = /path/to/keyfile
1333 48 Beraldo Leal
1334 48 Beraldo Leal
[paste_deploy]
1335 48 Beraldo Leal
flavor = keystone
1336 48 Beraldo Leal
</pre>
1337 48 Beraldo Leal
1338 48 Beraldo Leal
1339 48 Beraldo Leal
*/etc/glance/glance-registry-paste.ini*:
1340 48 Beraldo Leal
1341 48 Beraldo Leal
<pre>
1342 48 Beraldo Leal
# Default minimal pipeline
1343 48 Beraldo Leal
[pipeline:glance-registry]
1344 48 Beraldo Leal
pipeline = context registryapp authtoken
1345 48 Beraldo Leal
1346 48 Beraldo Leal
# Use the following pipeline for keystone auth
1347 48 Beraldo Leal
# i.e. in glance-registry.conf:
1348 48 Beraldo Leal
#   [paste_deploy]
1349 48 Beraldo Leal
#   flavor = keystone
1350 48 Beraldo Leal
#
1351 48 Beraldo Leal
[pipeline:glance-registry-keystone]
1352 48 Beraldo Leal
pipeline = authtoken context registryapp
1353 48 Beraldo Leal
1354 48 Beraldo Leal
[app:registryapp]
1355 48 Beraldo Leal
paste.app_factory = glance.common.wsgi:app_factory
1356 48 Beraldo Leal
glance.app_factory = glance.registry.api.v1:API
1357 48 Beraldo Leal
1358 48 Beraldo Leal
[filter:context]
1359 48 Beraldo Leal
context_class = glance.registry.context.RequestContext
1360 48 Beraldo Leal
paste.filter_factory = glance.common.wsgi:filter_factory
1361 48 Beraldo Leal
glance.filter_factory = glance.common.context:ContextMiddleware
1362 48 Beraldo Leal
1363 48 Beraldo Leal
[filter:authtoken]
1364 48 Beraldo Leal
paste.filter_factory = keystone.middleware.auth_token:filter_factory
1365 48 Beraldo Leal
service_protocol = http
1366 48 Beraldo Leal
service_host = 192.168.69.1
1367 48 Beraldo Leal
service_port = 5000
1368 48 Beraldo Leal
auth_host = 192.168.69.1
1369 48 Beraldo Leal
auth_port = 35357
1370 48 Beraldo Leal
auth_protocol = http
1371 48 Beraldo Leal
auth_uri = http://192.168.69.1:5000/
1372 48 Beraldo Leal
admin_tenant_name = service
1373 48 Beraldo Leal
admin_user = glance
1374 48 Beraldo Leal
admin_password = glancepass
1375 49 Beraldo Leal
</pre>
1376 48 Beraldo Leal
1377 49 Beraldo Leal
*/etc/glance/glance-scrubber.conf*:
1378 49 Beraldo Leal
1379 49 Beraldo Leal
<pre>
1380 49 Beraldo Leal
[DEFAULT]
1381 49 Beraldo Leal
# Show more verbose log output (sets INFO log level output)
1382 49 Beraldo Leal
verbose = True
1383 49 Beraldo Leal
1384 49 Beraldo Leal
# Show debugging output in logs (sets DEBUG log level output)
1385 49 Beraldo Leal
debug = False
1386 49 Beraldo Leal
1387 49 Beraldo Leal
# Log to this file. Make sure you do not set the same log
1388 49 Beraldo Leal
# file for both the API and registry servers!
1389 49 Beraldo Leal
log_file = /var/log/glance/scrubber.log
1390 49 Beraldo Leal
1391 49 Beraldo Leal
# Send logs to syslog (/dev/log) instead of to file specified by `log_file`
1392 49 Beraldo Leal
use_syslog = False
1393 49 Beraldo Leal
1394 49 Beraldo Leal
# Should we run our own loop or rely on cron/scheduler to run us
1395 49 Beraldo Leal
daemon = False
1396 49 Beraldo Leal
1397 49 Beraldo Leal
# Loop time between checking for new items to schedule for delete
1398 49 Beraldo Leal
wakeup_time = 300
1399 49 Beraldo Leal
1400 49 Beraldo Leal
sql_connection = mysql://glance:glancepass@192.168.69.1/glance
1401 49 Beraldo Leal
1402 49 Beraldo Leal
# Directory that the scrubber will use to remind itself of what to delete
1403 49 Beraldo Leal
# Make sure this is also set in glance-api.conf
1404 49 Beraldo Leal
scrubber_datadir = /var/lib/glance/scrubber
1405 49 Beraldo Leal
1406 49 Beraldo Leal
# Only one server in your deployment should be designated the cleanup host
1407 49 Beraldo Leal
cleanup_scrubber = False
1408 49 Beraldo Leal
1409 49 Beraldo Leal
# pending_delete items older than this time are candidates for cleanup
1410 49 Beraldo Leal
cleanup_scrubber_time = 86400
1411 49 Beraldo Leal
1412 49 Beraldo Leal
# Address to find the registry server for cleanups
1413 49 Beraldo Leal
registry_host = 0.0.0.0
1414 49 Beraldo Leal
1415 49 Beraldo Leal
# Port the registry server is listening on
1416 49 Beraldo Leal
registry_port = 9191
1417 48 Beraldo Leal
</pre>
1418 50 Beraldo Leal
1419 50 Beraldo Leal
h2. Sincronizando o banco e reiniciando os servicos:
1420 50 Beraldo Leal
1421 50 Beraldo Leal
<pre>
1422 50 Beraldo Leal
# glance-manage version_control 0
1423 50 Beraldo Leal
# glance-manage db_sync
1424 50 Beraldo Leal
# service glance-registry restart
1425 50 Beraldo Leal
# service glance-api restart
1426 50 Beraldo Leal
</pre>
1427 50 Beraldo Leal
1428 50 Beraldo Leal
h2. Testando a instalacao do Glance:
1429 50 Beraldo Leal
1430 52 Beraldo Leal
O arquivo _/root/openstackrc_ recebera novas variaveis de ambiente. Ele deve ficar assim:
1431 52 Beraldo Leal
<pre>
1432 52 Beraldo Leal
# Used for Keystone
1433 52 Beraldo Leal
export SERVICE_ENDPOINT=http://192.168.69.1:35357/v2.0/
1434 52 Beraldo Leal
export SERVICE_TOKEN=012345SECRET99TOKEN012345
1435 52 Beraldo Leal
1436 52 Beraldo Leal
# Used for swift
1437 52 Beraldo Leal
export ST_AUTH=http://192.168.69.1:5000/v2.0
1438 52 Beraldo Leal
export ST_USER=openstackDemo:admin
1439 52 Beraldo Leal
export ST_KEY=adminpass
1440 52 Beraldo Leal
export OS_REGION_NAME=RegionOne
1441 52 Beraldo Leal
1442 52 Beraldo Leal
# Used for glance
1443 52 Beraldo Leal
export OS_USERNAME=admin
1444 52 Beraldo Leal
export OS_TENANT_NAME=openstackDemo
1445 52 Beraldo Leal
export OS_PASSWORD=adminpass
1446 52 Beraldo Leal
export OS_AUTH_URL=http://192.168.69.1:5000/v2.0/
1447 52 Beraldo Leal
export OS_REGION_NAME=RegionOne
1448 52 Beraldo Leal
</pre>
1449 52 Beraldo Leal
1450 52 Beraldo Leal
1451 50 Beraldo Leal
Obtenha imagem de teste:
1452 50 Beraldo Leal
<pre>
1453 50 Beraldo Leal
mkdir /tmp/images
1454 50 Beraldo Leal
cd /tmp/images/
1455 50 Beraldo Leal
wget http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz
1456 50 Beraldo Leal
tar -zxvf ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz
1457 50 Beraldo Leal
</pre>
1458 50 Beraldo Leal
1459 50 Beraldo Leal
Suba as imagens, fazendo as devidas substituicoes:
1460 50 Beraldo Leal
1461 50 Beraldo Leal
<pre>
1462 50 Beraldo Leal
# cd /tmp/images/
1463 50 Beraldo Leal
# glance add name="tty-linux-kernel" disk_format=aki container_format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz 
1464 50 Beraldo Leal
# glance add name="tty-linux-ramdisk" disk_format=ari container_format=ari < ttylinux-uec-amd64-12.1_2.6.35-22_1-loader 
1465 50 Beraldo Leal
# glance add name="tty-linux" disk_format=ami container_format=ami kernel_id=[kernel_image_id] ramdisk_id=[kernel_ramdisk_image_id] < ttylinux-uec-amd64-12.1_2.6.35-22_1.img 
1466 50 Beraldo Leal
</pre>
1467 51 Beraldo Leal
1468 51 Beraldo Leal
Liste as imagens:
1469 51 Beraldo Leal
1470 51 Beraldo Leal
<pre>
1471 51 Beraldo Leal
# glance index
1472 51 Beraldo Leal
</pre>