OpenStack (2) -glance service deployment

Image Services (glance) enables users to discover, register and retrieve a virtual machine image. It provides a  REST  API, allowing you to query the virtual machine image metadata and retrieve the actual image. In various locations, from simple file system to OpenStack Object Storage Object storage systems such as virtual machine images you can store provided by the Image service.

1. Create a glance relevant data in the database, authorization;

mysql> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '123';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '123'
    -> ;
Query OK, 0 rows affected, 1 warning (0.00 sec)

2. Create a glance the user, password; (recognized as an admin user)

[root@sxb2 ~]# . admin-openrc
[root@sxb2 ~]# openstack user create --domain default --password-prompt glance
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 60205d4f43ba4e4f8eaa9921928a880d |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

3. Add glance to service the project to the admin role management;

[root@sxb2 ~]# openstack role add --project service --user glance admin

4. Create galnce service entity;

[root@sxb2 ~]# openstack service create --name glance --description "OpenStack Image" image

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | ab36d61aaad041d8ac7ece6d9fbbf6b1 |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+

5. Create a glance services API endpoint;

[root@sxb2 ~]# openstack endpoint create --region RegionOne image public http://192.168.88.10
[root@sxb2 ~]# openstack endpoint create --region RegionOne image internal http://192.168.88.
[root@sxb2 ~]# openstack endpoint create --region RegionOne image admin http://192.168.88.102

6. Installation software openstack-glance;

yum install openstack-glance

7. glance.api profile configuration;

[root@sxb2 ~]# vim /etc/glance/glance-api.conf

[database]
connection = mysql+pymysql://glance:123@controller/glance


[keystone_authtoken]
www_authenticate_uri  = http://192.168.88.102:5000
auth_url = http://192.168.88.102:5000
memcached_servers = 192.168.88.102:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = 123

[paste_deploy]
flavor = keystone

[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

8. Modify glance-registry.conf file;

[root@sxb2 ~]# vim /etc/glance/glance-registry.conf

[database]
connection = mysql+pymysql://glance:[email protected]/glance

[keystone_authtoken]
www_authenticate_uri = http://192.168.88.102:5000
auth_url = http://192.168.88.102:5000
memcached_servers = 192.168.88.102:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = 123

[paste_deploy]
flavor = keystone

9. glance initializing a database;

[root@sxb2 ~]# su -s /bin/sh -c "glance-manage db_sync" glance

10. Image Start service and configured to start at system boot;

[root@sxb2 ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
[root@sxb2 ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service

Here we are lmage done!; Next we come to the next test

1. We downloaded the test file; (make sure Run as administrator provinces)

[root@sxb2 ~]# . admin-openrc 
[root@sxb2 ~]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img

2. We downloaded the test file, uploaded to the format qcow2;

[root@sxb2 ~]# openstack image create "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                                      |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe                                                                                                                                                           |
| container_format | bare                                                                                                                                                                                       |
| created_at       | 2019-08-11T05:04:13Z                                                                                                                                                                       |
| disk_format      | qcow2                                                                                                                                                                                      |
| file             | /v2/images/d82b2e52-0f74-4d20-9b61-158c691a1760/file                                                                                                                                       |
| id               | d82b2e52-0f74-4d20-9b61-158c691a1760                                                                                                                                                       |
| min_disk         | 0                                                                                                                                                                                          |
| min_ram          | 0                                                                                                                                                                                          |
| name             | cirros                                                                                                                                                                                     |
| owner            | 0efc3e774118464eb39800063ad7a64b                                                                                                                                                           |
| properties       | os_hash_algo='sha512', os_hash_value='6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78', os_hidden='False' |
| protected        | False                                                                                                                                                                                      |
| schema           | /v2/schemas/image                                                                                                                                                                          |
| size             | 12716032                                                                                                                                                                                   |
| status           | active                                                                                                                                                                                     |
| tags             |                                                                                                                                                                                            |
| updated_at       | 2019-08-11T05:04:13Z                                                                                                                                                                       |
| virtual_size     | None                                                                                                                                                                                       |
| visibility       | public                                                                                                                                                                                     |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

2. Confirm upload images and authentication attributes;

[root@sxb2 ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| d82b2e52-0f74-4d20-9b61-158c691a1760 | cirros | active |
+--------------------------------------+--------+--------+

[root@sxb2 ~]# ls /var/lib/glance/images/
d82b2e52-0f74-4d20-9b61-158c691a1760

When we can see that this document, glance even if it is done, the next chapter we placement configuration

Guess you like

Origin www.cnblogs.com/loganSxb/p/11333103.html