OpenStack Pike Volet 2
OpenStack Pike Volet 2
2017/09/03
Volet 2
2
[root@dlp ~]#
source ~/keystonerc
[root@dlp ~(keystone)]#
echo "source ~/keystonerc " >> ~/.bash_profile
[2] Create Projects.
# create service project
[root@dlp ~(keystone)]#
openstack project create --domain default --description "Service Project" service
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Service Project |
2
3
| domain_id | default |
| enabled | True |
| id | c9ab6e9feb4d444c8f637fcfe7a67305 |
| is_domain | False |
| name | service |
| parent_id | default |
+-------------+----------------------------------+
# confirm settings
[root@dlp ~(keystone)]#
openstack project list
+----------------------------------+---------+
| ID | Name |
+----------------------------------+---------+
| 09158bee8c6441519bf3a3743d936566 | admin |
| c9ab6e9feb4d444c8f637fcfe7a67305 | service |
+----------------------------------+---------+
3
4
[root@dlp ~(keystone)]#
openstack user create --domain default --project service --password servicepassword glance
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| default_project_id | c9ab6e9feb4d444c8f637fcfe7a67305 |
| domain_id | default |
| enabled | True |
| id | 40ba972965df476298070661ab6fd89b |
| name | glance |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack role add --project service --user glance admin
# add service entry for glance
[root@dlp ~(keystone)]#
openstack service create --name glance --description "OpenStack Image service" image
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image service |
| enabled | True |
| id | 67eeb34ddaac4ab884e6a13d779ac159 |
| name | glance |
| type | image |
4
5
+-------------+----------------------------------+
[root@dlp ~(keystone)]#
export controller=10.0.0.30
# add endpoint for glance (public)
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne image public http://$controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | bcd18d118e65418ca50a344f9dbc61c3 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 67eeb34ddaac4ab884e6a13d779ac159 |
| service_name | glance |
| service_type | image |
| url | http://10.0.0.30:9292 |
+--------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne image internal http://$controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 549d8e551bd64ef4891d08c6f0d13118 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 67eeb34ddaac4ab884e6a13d779ac159 |
| service_name | glance |
| service_type | image |
| url | http://10.0.0.30:9292 |
+--------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne image admin http://$controller:9292
+--------------+----------------------------------+
| Field | Value |
5
6
+--------------+----------------------------------+
| enabled | True |
| id | 2972421c017b447d9af6bf150e7530f2 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 67eeb34ddaac4ab884e6a13d779ac159 |
| service_name | glance |
| service_type | image |
| url | http://10.0.0.30:9292 |
+--------------+----------------------------------+
[2] Add a User and Database on MariaDB for Glance.
[root@dlp ~(keystone)]#
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.1.20-MariaDB MariaDB Server
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
create database glance;
Bye
[3] Install Glance.
# install from Pike, EPEL
[root@dlp ~(keystone)]#
6
7
[root@dlp ~(keystone)]#
vi /etc/glance/glance-api.conf
# create new
[DEFAULT]
bind_host = 0.0.0.0
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[database]
# MariaDB connection info
connection = mysql+pymysql://glance:[email protected]/glance
[paste_deploy]
flavor = keystone
[root@dlp ~(keystone)]#
mv /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.org
[root@dlp ~(keystone)]#
vi /etc/glance/glance-registry.conf
# create new
[DEFAULT]
bind_host = 0.0.0.0
[database]
# MariaDB connection info
connection = mysql+pymysql://glance:[email protected]/glance
7
8
[keystone_authtoken]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = servicepassword
[paste_deploy]
flavor = keystone
[root@dlp ~(keystone)]#
chmod 640 /etc/glance/glance-api.conf /etc/glance/glance-registry.conf
[root@dlp ~(keystone)]#
chown root:glance /etc/glance/glance-api.conf /etc/glance/glance-registry.conf
[root@dlp ~(keystone)]#
su -s /bin/bash glance -c "glance-manage db_sync"
[root@dlp ~(keystone)]#
systemctl start openstack-glance-api openstack-glance-registry
[root@dlp ~(keystone)]#
systemctl enable openstack-glance-api openstack-glance-registry
success
[root@dlp ~(keystone)]#
firewall-cmd --reload
success
8
9
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | bac19d4ee3533cb79fcd6d9905a5ef02 |
| container_format | bare |
| created_at | 2017-09-04T05:38:19Z |
| disk_format | qcow2 |
| file | /v2/images/68132026-60aa-4afe-8976-398b0482cfd6/file |
| id | 68132026-60aa-4afe-8976-398b0482cfd6 |
9
10
| min_disk | 0 |
| min_ram | 0 |
| name | CentOS7 |
| owner | 09158bee8c6441519bf3a3743d936566 |
| protected | False |
| schema | /v2/schemas/image |
| size | 1378942976 |
| status | active |
| tags | |
| updated_at | 2017-09-04T05:38:25Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
+--------------------------------------+---------+--------+
| ID | Name | Status |
+--------------------------------------+---------+--------+
| 68132026-60aa-4afe-8976-398b0482cfd6 | CentOS7 | active |
+--------------------------------------+---------+--------+
[4] By the way, if you got an image from internet, it's OK to simply add it like follows.
[root@dlp ~(keystone)]#
wget http://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-
amd64-disk1.img -P /var/kvm/images
[root@dlp ~(keystone)]#
openstack image create "Ubuntu1604" --file /var/kvm/images/ubuntu-16.04-server-cloudimg-
amd64-disk1.img --disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | fc5ad26274fcc42cfa32d97308613432 |
| container_format | bare |
| created_at | 2017-02-24T01:44:21Z |
| disk_format | qcow2 |
| file | /v2/images/3113fc28-fa1f-4221-909e-a4fc5bdb8d6a/file |
| id | 3113fc28-fa1f-4221-909e-a4fc5bdb8d6a |
| min_disk | 0 |
| min_ram | 0 |
| name | Ubuntu1604 |
| owner | 3424019a88f34894b22058d6e15a8d35 |
| protected | False |
| schema | /v2/schemas/image |
| size | 324141056 |
| status | active |
| tags | |
| updated_at | 2017-02-24T01:44:23Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
10
11
[root@dlp ~(keystone)]#
openstack user create --domain default --project service --password servicepassword nova
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| default_project_id | c9ab6e9feb4d444c8f637fcfe7a67305 |
| domain_id | default |
| enabled | True |
| id | 4cda5314e8a347b0825e7143f98c9213 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack role add --project service --user nova admin
# add placement user (set in service project)
[root@dlp ~(keystone)]#
openstack user create --domain default --project service --password servicepassword placement
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| default_project_id | c9ab6e9feb4d444c8f637fcfe7a67305 |
| domain_id | default |
| enabled | True |
| id | 9a0f7fe7234749d18dd920bd02ae9aff |
| name | placement |
11
12
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack role add --project service --user placement admin
# add service entry for nova
[root@dlp ~(keystone)]#
openstack service create --name nova --description "OpenStack Compute service" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute service |
| enabled | True |
| id | b29ba1c32f124b5f815537ec1af15108 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack service create --name placement --description "OpenStack Compute Placement
service" placement
+-------------+-------------------------------------+
| Field | Value |
+-------------+-------------------------------------+
| description | OpenStack Compute Placement service |
| enabled | True |
| id | d9b2c2dfb45d45eb926a7d48f8995c7b |
| name | placement |
| type | placement |
+-------------+-------------------------------------+
[root@dlp ~(keystone)]#
export controller=10.0.0.30
# add endpoint for nova (public)
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne compute public
http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
12
13
| Field | Value |
+--------------+------------------------------------------+
| enabled | True |
| id | 388f2a27465e4541b7ee7068412a72d6 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b29ba1c32f124b5f815537ec1af15108 |
| service_name | nova |
| service_type | compute |
| url | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne compute internal
http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field | Value |
+--------------+------------------------------------------+
| enabled | True |
| id | 8f1b1ceb8df84113812eda157e9b3622 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b29ba1c32f124b5f815537ec1af15108 |
| service_name | nova |
| service_type | compute |
| url | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne compute admin
http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field | Value |
+--------------+------------------------------------------+
| enabled | True |
| id | f1a6a36bf1314586be033596b06bdd18 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b29ba1c32f124b5f815537ec1af15108 |
| service_name | nova |
| service_type | compute |
| url | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+
13
14
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne placement public http://$controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 7bbc5b631aa149ce902839ced72cec0c |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d9b2c2dfb45d45eb926a7d48f8995c7b |
| service_name | placement |
| service_type | placement |
| url | http://10.0.0.30:8778 |
+--------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne placement internal http://$controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | f78911008831478f92d1366e9f80e342 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d9b2c2dfb45d45eb926a7d48f8995c7b |
| service_name | placement |
| service_type | placement |
| url | http://10.0.0.30:8778 |
+--------------+----------------------------------+
[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne placement admin http://$controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | c6e6719ba03842c1ab6fbacc66e27980 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d9b2c2dfb45d45eb926a7d48f8995c7b |
14
15
| service_name | placement |
| service_type | placement |
| url | http://10.0.0.30:8778 |
+--------------+----------------------------------+
[2] Add a User and Database on MariaDB for Nova.
[root@dlp ~(keystone)]#
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.1.20-MariaDB MariaDB Server
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
create database nova;
15
16
Bye
16