OpenStack Yoga版安装笔记(六)glance练习

1、glance架构

Glance api处理来自用户端(OpenStackClient等)的请求,如果是读写镜像元数据,则对glance db进行读写操作,因为镜像元数据都保存在glance db里面;如果是存取镜像本身,则对后端存储进行操作,因为镜像保存在后端存储里。同时,用户端、glance servcie都需要到keystone进行身份认证。

需要注意的是,验证后的授权不在keystone这里处理,而是交给被访问的service处理。比如user访问glance service,具体能读写哪些镜像以及镜像元数据,根据该user的role,由glance service进行授权。

2、glance安装过程

首先,在controller node上的MariaDB中创建glance DB,用于存储镜像的元数据;然后,通过OpenStackClient操作之前创建的keystone DB,创建glance user(即“glance” image service的身份凭证),创建命名为glance的image service,并设置Image service api endpoint;最后,安装glance API软件包,并编辑配置文件,配置必要的连接信息,如glance DB(存储镜像元数据)、keystone的认证信息以及后端存储(存储镜像)等。

在本次安装中,glance数据库、keystone数据库、keystone以及glance都部署在控制节点上。实际上,根据需求,这些组件可以分别安装在不同的服务器上。

3、glance练习1

3.1 keystone DB

root@controller:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 35
Server version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
6 rows in set (0.002 sec)

MariaDB [(none)]> USE keystone;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [keystone]> SHOW TABLES;
(略)
MariaDB [keystone]> select * from local_user;
+----+----------------------------------+----------------------------------+-----------+-------------------+----------------+
| id | user_id                          | domain_id                        | name      | failed_auth_count | failed_auth_at |
+----+----------------------------------+----------------------------------+-----------+-------------------+----------------+
|  1 | 2947c213547147979dce3c8f8b85697f | default                          | admin     |                 0 | NULL           |
|  2 | 9382b59561c04dd1abf0a4cb7a8252ec | default                          | myuser    |                 0 | NULL           |
|  4 | 981d061282aa43afba72df6ff637f41c | f2a209f9e83040c9a619ca05c41e952b | testuser1 |                 0 | NULL           |
|  5 | b7849907a23b4604a3e3940f4034326b | default                          | glance    |                 0 | NULL           |
+----+----------------------------------+----------------------------------+-----------+-------------------+----------------+
4 rows in set (0.000 sec)
MariaDB [keystone]> SELECT * FROM service;
+----------------------------------+----------+---------+------------------------------------------------------+
| id                               | type     | enabled | extra                                                |
+----------------------------------+----------+---------+------------------------------------------------------+
| 75fe01049ec648b69e48d200971bf601 | identity |       1 | {"name": "keystone"}                                 |
| d6a3dadf92e542289c5ebd37e3553cdd | image    |       1 | {"name": "glance", "description": "OpenStack Image"} |
+----------------------------------+----------+---------+------------------------------------------------------+
2 rows in set (0.000 sec)
MariaDB [keystone]> SELECT * from endpoint;
+----------------------------------+--------------------+-----------+----------------------------------+----------------------------+-------+---------+-----------+
| id                               | legacy_endpoint_id | interface | service_id                       | url                        | extra | enabled | region_id |
+----------------------------------+--------------------+-----------+----------------------------------+----------------------------+-------+---------+-----------+
| 56d1454571064cb3ad3c749d18fb57e6 | NULL               | admin     | d6a3dadf92e542289c5ebd37e3553cdd | http://controller:9292     | {}    |       1 | RegionOne |
| a82bd043e133464fa863fba98b400460 | NULL               | admin     | 75fe01049ec648b69e48d200971bf601 | http://controller:5000/v3/ | {}    |       1 | RegionOne |
| ac109817862344c4854b783d642be412 | NULL               | internal  | 75fe01049ec648b69e48d200971bf601 | http://controller:5000/v3/ | {}    |       1 | RegionOne |
| ae98462c8f4346f3991d693232a108d3 | NULL               | internal  | d6a3dadf92e542289c5ebd37e3553cdd | http://controller:9292     | {}    |       1 | RegionOne |
| e047382ce61740bf9dc4219c97eff2f8 | NULL               | public    | d6a3dadf92e542289c5ebd37e3553cdd | http://controller:9292     | {}    |       1 | RegionOne |
| eaf4ddaab1b74aa59403f9fbf5fc4ac1 | NULL               | public    | 75fe01049ec648b69e48d200971bf601 | http://controller:5000/v3/ | {}    |       1 | RegionOne |
+----------------------------------+--------------------+-----------+----------------------------------+----------------------------+-------+---------+-----------+
6 rows in set (0.000 sec)

MariaDB [keystone]> 

3.2 glance DB

MariaDB [(none)]> use glance;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [glance]> show tables;
+----------------------------------+
| Tables_in_glance                 |
+----------------------------------+
| alembic_version                  |
| image_locations                  |
| image_members                    |
| image_properties                 |
| image_tags                       |
| images                           |
| metadef_namespace_resource_types |
| metadef_namespaces               |
| metadef_objects                  |
| metadef_properties               |
| metadef_resource_types           |
| metadef_tags                     |
| task_info                        |
| tasks                            |
+----------------------------------+
14 rows in set (0.000 sec)

MariaDB [glance]> select * from images;
+--------------------------------------+--------+----------+--------+---------------------+---------------------+------------+---------+-------------+------------------+----------------------------------+----------------------------------+----------+---------+-----------+--------------+------------+-----------+--------------+----------------------------------------------------------------------------------------------------------------------------------+
| id                                   | name   | size     | status | created_at          | updated_at          | deleted_at | deleted | disk_format | container_format | checksum                         | owner                            | min_disk | min_ram | protected | virtual_size | visibility | os_hidden | os_hash_algo | os_hash_value                                                                                                                    |
+--------------------------------------+--------+----------+--------+---------------------+---------------------+------------+---------+-------------+------------------+----------------------------------+----------------------------------+----------+---------+-----------+--------------+------------+-----------+--------------+----------------------------------------------------------------------------------------------------------------------------------+
| 429decdd-9230-49c0-b735-70364c226eb5 | cirros | 12716032 | active | 2024-07-06 13:54:01 | 2024-07-06 13:54:02 | NULL       |       0 | qcow2       | bare             | 443b7623e27ecf03dc9e01ee93f67afe | ee65b6c3961747b988ab8bd1cc19fb93 |        0 |       0 |         0 |     46137344 | public     |         0 | sha512       | 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78 |
+--------------------------------------+--------+----------+--------+---------------------+---------------------+------------+---------+-------------+------------------+----------------------------------+----------------------------------+----------+---------+-----------+--------------+------------+-----------+--------------+----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

MariaDB [glance]> select * from image_properties;
Empty set (0.000 sec)

MariaDB [glance]> 

3.3 后端存储

本次安装为了简化操作,将镜像上传并存储在托管镜像服务的控制节点上的一个目录中。默认情况下,这个目录是/var/lib/glance/images/

检查该目录:

root@controller:~# ls -l /var/lib/glance/images/
total 12420
-rw-r----- 1 glance glance 12716032 Jul  6 13:54 429decdd-9230-49c0-b735-70364c226eb5
root@controller:~# 

文件名和glance DB的select * from images;中的id一致。

3.4 OpenStackClient操作(用户端操作)

用户端可以通过访问glance api,完成对后端存储、glance DB、keystoneDB的信息进行操作。

------keystone DB:

ubcode@osclient ~(admin/amdin)$ openstack user list
+----------------------------------+-----------+
| ID                               | Name      |
+----------------------------------+-----------+
| 2947c213547147979dce3c8f8b85697f | admin     |
| 9382b59561c04dd1abf0a4cb7a8252ec | myuser    |
| 981d061282aa43afba72df6ff637f41c | testuser1 |
| b7849907a23b4604a3e3940f4034326b | glance    |
+----------------------------------+-----------+
ubcode@osclient ~(admin/amdin)$ openstack service list
+----------------------------------+----------+----------+
| ID                               | Name     | Type     |
+----------------------------------+----------+----------+
| 75fe01049ec648b69e48d200971bf601 | keystone | identity |
| d6a3dadf92e542289c5ebd37e3553cdd | glance   | image    |
+----------------------------------+----------+----------+
ubcode@osclient ~(admin/amdin)$ openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                        |
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| 56d1454571064cb3ad3c749d18fb57e6 | RegionOne | glance       | image        | True    | admin     | http://controller:9292     |
| a82bd043e133464fa863fba98b400460 | RegionOne | keystone     | identity     | True    | admin     | http://controller:5000/v3/ |
| ac109817862344c4854b783d642be412 | RegionOne | keystone     | identity     | True    | internal  | http://controller:5000/v3/ |
| ae98462c8f4346f3991d693232a108d3 | RegionOne | glance       | image        | True    | internal  | http://controller:9292     |
| e047382ce61740bf9dc4219c97eff2f8 | RegionOne | glance       | image        | True    | public    | http://controller:9292     |
| eaf4ddaab1b74aa59403f9fbf5fc4ac1 | RegionOne | keystone     | identity     | True    | public    | http://controller:5000/v3/ |
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
ubcode@osclient ~(admin/amdin)$ 

------glance DB:

ubcode@osclient ~(admin/amdin)$ openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 429decdd-9230-49c0-b735-70364c226eb5 | cirros | active |
+--------------------------------------+--------+--------+
ubcode@osclient ~(admin/amdin)$ openstack image show cirros
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                                      |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe                                                                                                                                                           |
| container_format | bare                                                                                                                                                                                       |
| created_at       | 2024-07-06T13:54:01Z                                                                                                                                                                       |
| disk_format      | qcow2                                                                                                                                                                                      |
| file             | /v2/images/429decdd-9230-49c0-b735-70364c226eb5/file                                                                                                                                       |
| id               | 429decdd-9230-49c0-b735-70364c226eb5                                                                                                                                                       |
| min_disk         | 0                                                                                                                                                                                          |
| min_ram          | 0                                                                                                                                                                                          |
| name             | cirros                                                                                                                                                                                     |
| owner            | ee65b6c3961747b988ab8bd1cc19fb93                                                                                                                                                           |
| 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       | 2024-07-06T13:54:02Z                                                                                                                                                                       |
| virtual_size     | 46137344                                                                                                                                                                                   |
| visibility       | public                                                                                                                                                                                     |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

4、glance练习2——glanc独立安装

为了方便查看OpenStack各组件之间的交互情况,将glance服务独立安装。

4.1 网络拓扑

4.2 新增一台虚机image1

根据之前的介绍,新增一台虚机(4G内存/2CPU,可根据实际情况调整),用于安装glance。虚机hostname设置为image1,配置ip地址为10.0.20.16/24。

该虚机信息如下:

------网络配置:

ubcode@image1:~$ cat /etc/netplan/00-installer-config.yaml 
cat: /etc/netplan/00-installer-config.yaml: Permission denied
ubcode@image1:~$ sudo cat /etc/netplan/00-installer-config.yaml 
[sudo] password for ubcode: 
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens32:
      addresses:
      - 10.0.20.16/24
      nameservers:
        addresses:
        - 10.0.20.2
        search: []
      routes:
      - to: default
        via: 10.0.20.2
  version: 2

------hosts文件:

ubcode@image1:~$ cat /etc/hosts
127.0.0.1 localhost
# 127.0.1.1 image1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


10.0.20.11 controller
10.0.20.12 compute1
10.0.20.16 image1 

------NTP配置:

ubcode@image1:~$ cat /etc/chrony/chrony.conf 
...
# pool ntp.ubuntu.com        iburst maxsources 4
# pool 0.ubuntu.pool.ntp.org iburst maxsources 1
# pool 1.ubuntu.pool.ntp.org iburst maxsources 1
# pool 2.ubuntu.pool.ntp.org iburst maxsources 2

server controller iburst

controller(10.0.20.11)虚机和osclient(10.0.20.100)虚机hosts文件增加image1信息:

root@controller:~# cat /etc/hosts
127.0.0.1 localhost
# 127.0.1.1 os-1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

10.0.20.11 controller
10.0.20.12 compute1

10.0.20.16 image1  <---新增

4.3 controller node虚机恢复快照

快照转到“keyston安装完成”:

 (快照名称后来修改过)

4.4 Install and configure (Ubuntu)

4.4.1 controller node(hostname: controller)

1、创建glance DB

root@controller:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| keystone           |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.002 sec)

MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
    ->   IDENTIFIED BY 'openstack';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
    ->   IDENTIFIED BY 'openstack';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]>
MariaDB [(none)]> quit
Bye
root@controller:~# 

4.4.2 OpenStackClient(hostname: osclient)

在OpenStackClient(10.0.20.100),创建glance user、“glance” image service以及endpoint,注意endpoint指向了image node 1 (hostname: image1)。

ubcode@osclient:~$ . admin-openrc
ubcode@osclient ~(admin/amdin)$ openstack user create --domain default --password-prompt glance
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 2eb252b5fc2743e995141d9529569e2d |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
ubcode@osclient ~(admin/amdin)$ openstack role add --project service --user glance admin
ubcode@osclient ~(admin/amdin)$ openstack service create --name glance \
>   --description "OpenStack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | f378aa833518466c9ce2c9ef85e82ace |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
ubcode@osclient ~(admin/amdin)$ openstack endpoint create --region RegionOne \
>   image public http://image1:9292    
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | c37250b6bd2d471f92427483d31fd5c7 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | f378aa833518466c9ce2c9ef85e82ace |
| service_name | glance                           |
| service_type | image                            |
| url          | http://image1:9292               |
+--------------+----------------------------------+
ubcode@osclient ~(admin/amdin)$ openstack endpoint create --region RegionOne \
>   image internal http://image1:9292    
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7d17e6182d8640a7a6637f4f460a5c08 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | f378aa833518466c9ce2c9ef85e82ace |
| service_name | glance                           |
| service_type | image                            |
| url          | http://image1:9292               |
+--------------+----------------------------------+
ubcode@osclient ~(admin/amdin)$ openstack endpoint create --region RegionOne \
>   image admin http://image1:9292    
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | f210d94217e54d2781192170bdf26877 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | f378aa833518466c9ce2c9ef85e82ace |
| service_name | glance                           |
| service_type | image                            |
| url          | http://image1:9292               |
+--------------+----------------------------------+

4.4.3 image node 1(hostname: image1)

1、安装glance软件包

ubcode@image1:~$ apt install glance

2、配置glance-api.conf

ubcode@image1:~$ sudo vi /etc/glance/glance-api.conf

[database]
# connection = sqlite:var/lib/glance/glance.sqlite
connection = mysql+pymysql://glance:openstack@controller/glance
backend = sqlalchemy

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

[paste_deploy]
flavor = keystone

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

3、初始化glance数据库,重启glance-api

ubcode@image1:~$ sudo passwd root
New password: 
Retype new password: 
passwd: password updated successfully
ubcode@image1:~$ su
Password: 
root@image1:/home/ubcode#  su -s /bin/sh -c "glance-manage db_sync" glance
2024-07-07 08:18:13.472 6118 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
2024-07-07 08:18:13.472 6118 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
2024-07-07 08:18:13.482 6118 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
2024-07-07 08:18:13.482 6118 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> liberty, liberty initial
INFO  [alembic.runtime.migration] Running upgrade liberty -> mitaka01, add index on created_at and updated_at columns of 'images' table
INFO  [alembic.runtime.migration] Running upgrade mitaka01 -> mitaka02, update metadef os_nova_server
INFO  [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_expand01, add visibility to images
INFO  [alembic.runtime.migration] Running upgrade ocata_expand01 -> pike_expand01, empty expand for symmetry with pike_contract01
INFO  [alembic.runtime.migration] Running upgrade pike_expand01 -> queens_expand01
INFO  [alembic.runtime.migration] Running upgrade queens_expand01 -> rocky_expand01, add os_hidden column to images table
INFO  [alembic.runtime.migration] Running upgrade rocky_expand01 -> rocky_expand02, add os_hash_algo and os_hash_value columns to images table
INFO  [alembic.runtime.migration] Running upgrade rocky_expand02 -> train_expand01, empty expand for symmetry with train_contract01
INFO  [alembic.runtime.migration] Running upgrade train_expand01 -> ussuri_expand01, empty expand for symmetry with ussuri_expand01
INFO  [alembic.runtime.migration] Running upgrade ussuri_expand01 -> wallaby_expand01, add image_id, request_id, user columns to tasks table"
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Upgraded database to: wallaby_expand01, current revision(s): wallaby_expand01
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Database migration is up to date. No migration needed.
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_contract01, remove is_public from images
INFO  [alembic.runtime.migration] Running upgrade ocata_contract01 -> pike_contract01, drop glare artifacts tables
INFO  [alembic.runtime.migration] Running upgrade pike_contract01 -> queens_contract01
INFO  [alembic.runtime.migration] Running upgrade queens_contract01 -> rocky_contract01
INFO  [alembic.runtime.migration] Running upgrade rocky_contract01 -> rocky_contract02
INFO  [alembic.runtime.migration] Running upgrade rocky_contract02 -> train_contract01
INFO  [alembic.runtime.migration] Running upgrade train_contract01 -> ussuri_contract01
INFO  [alembic.runtime.migration] Running upgrade ussuri_contract01 -> wallaby_contract01
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Upgraded database to: wallaby_contract01, current revision(s): wallaby_contract01
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Database is synced successfully.
root@image1:/home/ubcode# 

root@image1:/home/ubcode# service glance-api restart

ubcode@image1:~$ glance-manage --version
24.2.1

4.4.4 image node 1(Verify operation)

ubcode@image1:~$ wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
ubcode@image1:~$ sudo vi admin-openrc
ubcode@image1:~$ cat admin-openrc 
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
export PS1='\u@\h \W(admin/amdin)\$ '
ubcode@image1:~$ 
ubcode@image1 ~(admin/amdin)$ ls
admin-openrc  cirros-0.4.0-x86_64-disk.img
ubcode@image1 ~(admin/amdin)$ glance image-create --name "cirros" \
>   --file cirros-0.4.0-x86_64-disk.img \
>   --disk-format qcow2 --container-format bare \
>   --visibility=public
+------------------+----------------------------------------------------------------------------------+
| Property         | Value                                                                            |
+------------------+----------------------------------------------------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe                                                 |
| container_format | bare                                                                             |
| created_at       | 2024-07-07T08:26:02Z                                                             |
| disk_format      | qcow2                                                                            |
| id               | 9f0e6328-3e96-41e1-b282-d577b6749a09                                             |
| min_disk         | 0                                                                                |
| min_ram          | 0                                                                                |
| name             | cirros                                                                           |
| os_hash_algo     | sha512                                                                           |
| os_hash_value    | 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e |
|                  | 2161b5b5186106570c17a9e58b64dd39390617cd5a350f78                                 |
| os_hidden        | False                                                                            |
| owner            | ee65b6c3961747b988ab8bd1cc19fb93                                                 |
| protected        | False                                                                            |
| size             | 12716032                                                                         |
| status           | active                                                                           |
| tags             | []                                                                               |
| updated_at       | 2024-07-07T08:26:02Z                                                             |
| virtual_size     | 46137344                                                                         |
| visibility       | public                                                                           |
+------------------+----------------------------------------------------------------------------------+
ubcode@image1 ~(admin/amdin)$ glance image-list
+--------------------------------------+--------+
| ID                                   | Name   |
+--------------------------------------+--------+
| 9f0e6328-3e96-41e1-b282-d577b6749a09 | cirros |
+--------------------------------------+--------+
ubcode@image1 ~(admin/amdin)$ openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 9f0e6328-3e96-41e1-b282-d577b6749a09 | cirros | active |
+--------------------------------------+--------+--------+

root@image1:/var/lib/glance/images# ls
9f0e6328-3e96-41e1-b282-d577b6749a09

4.5 Wireshark抓包

4.5.1 抓包目的

查看OpenStack各组件之间的交互情况。

4.5.2 抓包方式

1、在win11上运行wireshark,抓取VMware Network Adapter VMnet8的流量:

 2、在osclient上,执行:openstack image list

ubcode@osclient:~$ . admin-openrc 
ubcode@osclient ~(admin/amdin)$ openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 9f0e6328-3e96-41e1-b282-d577b6749a09 | cirros | active |
+--------------------------------------+--------+--------+
ubcode@osclient ~(admin/amdin)$ 

3、停止抓包,进行分析

4.6 Wireshark抓包分析

4.6.1 抓包结果

过滤无关数据包,filter: http or tcp.port -- 11211 or tcp.port ==3306

抓包显示了OpenStackClient、keystone、glance、glance DB之间的交互情况。

  • OpenStackClient --> keystone,认证user admin身份,取得user admin的token。
  • OpenStackClient --> glance,请求image list
  • glance --> MEMCACHE,验证user admin的token
  • glance --> keystone,认证uer glance身份,取得user glance的token
  • glance --> MEMCACHE,存储admin token
  • glance --> Marria DB,MySQL/login,查询glance DB,取得image元数据
  • glance --> OpenStackClient,返回查询结果

4.6.2 抓包的流量图

 4.6.3 典型数据包

1/ user admin认证

OpenStackClient--->keystone,认证admin user scope to project admin:

Frame 262: 284 bytes on wire (2272 bits), 284 bytes captured (2272 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: VMware_ff:20:81 (00:0c:29:ff:20:81), Dst: controller (00:0c:29:a8:e0:3c)
Internet Protocol Version 4, Src: 10.0.20.100 (10.0.20.100), Dst: controller (10.0.20.11)
Transmission Control Protocol, Src Port: 57938, Dst Port: 5000, Seq: 501, Ack: 534, Len: 218
[2 Reassembled TCP Segments (501 bytes): #261(283), #262(218)]
Hypertext Transfer Protocol
    POST /v3/auth/tokens HTTP/1.1\r\n
    Host: controller:5000\r\n
    User-Agent: openstacksdk/0.61.0 keystoneauth1/4.4.0 python-requests/2.25.1 CPython/3.10.12\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept: application/json\r\n
    Connection: keep-alive\r\n
    Content-Type: application/json\r\n
    Content-Length: 218\r\n
    \r\n
    [Full request URI: http://controller:5000/v3/auth/tokens]
    [HTTP request 2/2]
    [Prev request in frame: 257]
    [Response in frame: 266]
    File Data: 218 bytes
JavaScript Object Notation: application/json
    JSON raw form:
        {
            "auth": {
                "identity": {
                    "methods": [
                        "password"
                    ],
                    "password": {
                        "user": {
                            "password": "openstack",
                            "name": "admin",
                            "domain": {
                                "name": "Default"
                            }
                        }
                    }
                },
                "scope": {
                    "project": {
                        "name": "admin",
                        "domain": {
                            "name": "Default"
                        }
                    }
                }
            }
        }
    Object

认证成功,取得token(X-Subject-Token)

Frame 266: 858 bytes on wire (6864 bits), 858 bytes captured (6864 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: controller (00:0c:29:a8:e0:3c), Dst: VMware_ff:20:81 (00:0c:29:ff:20:81)
Internet Protocol Version 4, Src: controller (10.0.20.11), Dst: 10.0.20.100 (10.0.20.100)
Transmission Control Protocol, Src Port: 5000, Dst Port: 57938, Seq: 1982, Ack: 719, Len: 792
[2 Reassembled TCP Segments (2240 bytes): #265(1448), #266(792)]
Hypertext Transfer Protocol
    HTTP/1.1 201 CREATED\r\n
    Date: Thu, 11 Jul 2024 21:58:26 GMT\r\n
    Server: Apache/2.4.52 (Ubuntu)\r\n
    Content-Length: 1750\r\n
    X-Subject-Token: gAAAAABmkFWFJBbsCv5MsBqeIGj9Fc426FeFSZTyQsjlgM4lC6I6crQcE3x-ygbUSoDUoMzjTh06W5STx4YChIbkhHCe_5OuuKOx8ZAp1pxs9M_yMLD6PtuYK7TDPwlPNfjdHOKWNvrA6BHc3Xg-mjdvnsi_Z2tKdw_A3AQUYN3uAub3zaxK418\r\n
    Vary: X-Auth-Token\r\n
    x-openstack-request-id: req-d1c97182-1225-48de-a8cd-b657907a6d50\r\n
    Keep-Alive: timeout=5, max=99\r\n
    Connection: Keep-Alive\r\n
    Content-Type: application/json\r\n
    \r\n
    [HTTP response 2/2]
    [Time since request: 3.077388000 seconds]
    [Prev request in frame: 257]
    [Prev response in frame: 259]
    [Request in frame: 262]
    [Request URI: http://controller:5000/v3/auth/tokens]
    File Data: 1750 bytes
JavaScript Object Notation: application/json
    JSON raw form:
        {
            "token": {
                "methods": [
                    "password"
                ],
                "user": {
                    "domain": {
                        "id": "default",
                        "name": "Default"
                    },
                    "id": "2947c213547147979dce3c8f8b85697f",
                    "name": "admin",
                    "password_expires_at": null
                },
                "audit_ids": [
                    "-gVm2yInSBWpjE6RI9Q78A"
                ],
                "expires_at": "2024-07-11T22:58:29.000000Z",
                "issued_at": "2024-07-11T21:58:29.000000Z",
                "project": {
                    "domain": {
                        "id": "default",
                        "name": "Default"
                    },
                    "id": "ee65b6c3961747b988ab8bd1cc19fb93",
                    "name": "admin"
                },
                "is_domain": false,
                "roles": [
                    {
                        "id": "17552c9a365d4944a50fd8ac271791c6",
                        "name": "member"
                    },
                    {
                        "id": "e434c66b7af647158bcaa77686ca6e93",
                        "name": "admin"
                    },
                    {
                        "id": "be23525c20c44f05b3ba071455522fcb",
                        "name": "reader"
                    }
                ],
                "catalog": [
                    {
                        "endpoints": [
                            {
                                "id": "7d17e6182d8640a7a6637f4f460a5c08",
                                "interface": "internal",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            },
                            {
                                "id": "c37250b6bd2d471f92427483d31fd5c7",
                                "interface": "public",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            },
                            {
                                "id": "f210d94217e54d2781192170bdf26877",
                                "interface": "admin",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            }
                        ],
                        "id": "f378aa833518466c9ce2c9ef85e82ace",
                        "type": "image",
                        "name": "glance"
                    },
                    {
                        "endpoints": [
                            {
                                "id": "a82bd043e133464fa863fba98b400460",
                                "interface": "admin",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            },
                            {
                                "id": "ac109817862344c4854b783d642be412",
                                "interface": "internal",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            },
                            {
                                "id": "eaf4ddaab1b74aa59403f9fbf5fc4ac1",
                                "interface": "public",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            }
                        ],
                        "id": "75fe01049ec648b69e48d200971bf601",
                        "type": "identity",
                        "name": "keystone"
                    }
                ]
            }
        }
    Object
2/ 查询image list

OpenStackClient ---> glance,查询image list,注意携带了之前获得的token(X-Auth-Token):

Frame 277: 485 bytes on wire (3880 bits), 485 bytes captured (3880 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: VMware_ff:20:81 (00:0c:29:ff:20:81), Dst: image1 (00:0c:29:cc:19:7d)
Internet Protocol Version 4, Src: 10.0.20.100 (10.0.20.100), Dst: image1 (10.0.20.16)
Transmission Control Protocol, Src Port: 32788, Dst Port: 9292, Seq: 212, Ack: 1172, Len: 419
Hypertext Transfer Protocol
    GET /v2/images HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): GET /v2/images HTTP/1.1\r\n]
        Request Method: GET
        Request URI: /v2/images
        Request Version: HTTP/1.1
    Host: image1:9292\r\n
    User-Agent: openstacksdk/0.61.0 keystoneauth1/4.4.0 python-requests/2.25.1 CPython/3.10.12\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept: application/json\r\n
    Connection: keep-alive\r\n
    X-Auth-Token: gAAAAABmkFWFJBbsCv5MsBqeIGj9Fc426FeFSZTyQsjlgM4lC6I6crQcE3x-ygbUSoDUoMzjTh06W5STx4YChIbkhHCe_5OuuKOx8ZAp1pxs9M_yMLD6PtuYK7TDPwlPNfjdHOKWNvrA6BHc3Xg-mjdvnsi_Z2tKdw_A3AQUYN3uAub3zaxK418\r\n
    \r\n
    [Full request URI: http://image1:9292/v2/images]
    [HTTP request 2/2]
    [Prev request in frame: 273]
    [Response in frame: 362]
3/ MEMCACHE验证token

glance ---> MEMCACHE,验证token:

Frame 281: 143 bytes on wire (1144 bits), 143 bytes captured (1144 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: image1 (00:0c:29:cc:19:7d), Dst: controller (00:0c:29:a8:e0:3c)
Internet Protocol Version 4, Src: image1 (10.0.20.16), Dst: controller (10.0.20.11)
Transmission Control Protocol, Src Port: 59524, Dst Port: 11211, Seq: 1, Ack: 1, Len: 77
Memcache Protocol
    Command: get
    Key: tokens/773e2dee2fb1030e539ea2f4cbee331eb398d4f8145ca001c733c4b3f63ca862

MEMCACHE---> glance,MEMCACHE回复验证请求:

Frame 282: 66 bytes on wire (528 bits), 66 bytes captured (528 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: controller (00:0c:29:a8:e0:3c), Dst: image1 (00:0c:29:cc:19:7d)
Internet Protocol Version 4, Src: controller (10.0.20.11), Dst: image1 (10.0.20.16)
Transmission Control Protocol, Src Port: 11211, Dst Port: 59524, Seq: 1, Ack: 78, Len: 0
    Source Port: 11211
    Destination Port: 59524
    [Stream index: 3]
    [Conversation completeness: Incomplete, DATA (15)]
    [TCP Segment Len: 0]
    Sequence Number: 1    (relative sequence number)
    Sequence Number (raw): 981702265
    [Next Sequence Number: 1    (relative sequence number)]
    Acknowledgment Number: 78    (relative ack number)
    Acknowledgment number (raw): 2808812894
    1000 .... = Header Length: 32 bytes (8)
    Flags: 0x010 (ACK)
    Window: 509
    [Calculated window size: 65152]
    [Window size scaling factor: 128]
    Checksum: 0x13d8 [unverified]
    [Checksum Status: Unverified]
    Urgent Pointer: 0
    Options: (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
        TCP Option - No-Operation (NOP)
        TCP Option - No-Operation (NOP)
        TCP Option - Timestamps: TSval 2111276189, TSecr 3515395769
    [Timestamps]
        [Time since first frame in this TCP stream: 0.000488000 seconds]
        [Time since previous frame in this TCP stream: 0.000127000 seconds]
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 281] <-------回复验证请求
        [The RTT to ACK the segment was: 0.000127000 seconds]
        [iRTT: 0.000232000 seconds]
4/ user glance认证

glance ---> keystone,user glance scope to project service,认证身份:

Frame 294: 287 bytes on wire (2296 bits), 287 bytes captured (2296 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: image1 (00:0c:29:cc:19:7d), Dst: controller (00:0c:29:a8:e0:3c)
Internet Protocol Version 4, Src: image1 (10.0.20.16), Dst: controller (10.0.20.11)
Transmission Control Protocol, Src Port: 35368, Dst Port: 5000, Seq: 559, Ack: 601, Len: 221
[2 Reassembled TCP Segments (534 bytes): #293(313), #294(221)]
Hypertext Transfer Protocol
    POST /v3/auth/tokens HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): POST /v3/auth/tokens HTTP/1.1\r\n]
        Request Method: POST
        Request URI: /v3/auth/tokens
        Request Version: HTTP/1.1
    Host: controller:5000\r\n
    User-Agent: glance/24.2.1 keystonemiddleware.auth_token/9.4.0 keystoneauth1/4.4.0 python-requests/2.25.1 CPython/3.10.12\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept: application/json\r\n
    Connection: keep-alive\r\n
    Content-Type: application/json\r\n
    Content-Length: 221\r\n
    \r\n
    [Full request URI: http://controller:5000/v3/auth/tokens]
    [HTTP request 2/3]
    [Prev request in frame: 288]
    [Response in frame: 304]
    [Next request in frame: 306]
    File Data: 221 bytes
JavaScript Object Notation: application/json
    JSON raw form:
        {
            "auth": {
                "identity": {
                    "methods": [
                        "password"
                    ],
                    "password": {
                        "user": {
                            "password": "openstack",
                            "name": "glance",
                            "domain": {
                                "name": "Default"
                            }
                        }
                    }
                },
                "scope": {
                    "project": {
                        "name": "service",
                        "domain": {
                            "name": "Default"
                        }
                    }
                }
            }
        }
    Object

keystone ---> glance,认证成功,发放glance的token(X-Subject-Token):

Frame 304: 861 bytes on wire (6888 bits), 861 bytes captured (6888 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: controller (00:0c:29:a8:e0:3c), Dst: image1 (00:0c:29:cc:19:7d)
Internet Protocol Version 4, Src: controller (10.0.20.11), Dst: image1 (10.0.20.16)
Transmission Control Protocol, Src Port: 5000, Dst Port: 35368, Seq: 2049, Ack: 780, Len: 795
[2 Reassembled TCP Segments (2243 bytes): #303(1448), #304(795)]
Hypertext Transfer Protocol
    HTTP/1.1 201 CREATED\r\n
        [Expert Info (Chat/Sequence): HTTP/1.1 201 CREATED\r\n]
        Response Version: HTTP/1.1
        Status Code: 201
        [Status Code Description: Created]
        Response Phrase: CREATED
    Date: Thu, 11 Jul 2024 21:58:32 GMT\r\n
    Server: Apache/2.4.52 (Ubuntu)\r\n
    Content-Length: 1753\r\n
    X-Subject-Token: gAAAAABmkFWLEgmaDAIh3GTU4gl2BQm2dgjcP7vCi7j6Z3h3rrjAL_c37havjhwmUxFXoxsZdKDWpzMuxjcL7UGBmoZeRHPxsnYeETpA_qz3OYhhZBV5LZM0gbZey_dCmWCJnI8dWyIXA3Iyd9wLxKX6vIYLYD9TZkTyNUuHsasmVrluTNp9i6s\r\n
    Vary: X-Auth-Token\r\n
    x-openstack-request-id: req-da6fa8c4-ce65-4dbe-b10b-f997d0858666\r\n
    Keep-Alive: timeout=5, max=99\r\n
    Connection: Keep-Alive\r\n
    Content-Type: application/json\r\n
    \r\n
    [HTTP response 2/3]
    [Time since request: 3.104488000 seconds]
    [Prev request in frame: 288]
    [Prev response in frame: 291]
    [Request in frame: 294]
    [Next request in frame: 306]
    [Next response in frame: 309]
    [Request URI: http://controller:5000/v3/auth/tokens]
    File Data: 1753 bytes
JavaScript Object Notation: application/json
    JSON raw form:
        {
            "token": {
                "methods": [
                    "password"
                ],
                "user": {
                    "domain": {
                        "id": "default",
                        "name": "Default"
                    },
                    "id": "2eb252b5fc2743e995141d9529569e2d",
                    "name": "glance",
                    "password_expires_at": null
                },
                "audit_ids": [
                    "JX1DnLlpRlS_8qqim-V36w"
                ],
                "expires_at": "2024-07-11T22:58:35.000000Z",
                "issued_at": "2024-07-11T21:58:35.000000Z",
                "project": {
                    "domain": {
                        "id": "default",
                        "name": "Default"
                    },
                    "id": "fe9220b4131041e4b551b42b64a8f9ca",
                    "name": "service"
                },
                "is_domain": false,
                "roles": [
                    {
                        "id": "17552c9a365d4944a50fd8ac271791c6",
                        "name": "member"
                    },
                    {
                        "id": "e434c66b7af647158bcaa77686ca6e93",
                        "name": "admin"
                    },
                    {
                        "id": "be23525c20c44f05b3ba071455522fcb",
                        "name": "reader"
                    }
                ],
                "catalog": [
                    {
                        "endpoints": [
                            {
                                "id": "7d17e6182d8640a7a6637f4f460a5c08",
                                "interface": "internal",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            },
                            {
                                "id": "c37250b6bd2d471f92427483d31fd5c7",
                                "interface": "public",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            },
                            {
                                "id": "f210d94217e54d2781192170bdf26877",
                                "interface": "admin",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            }
                        ],
                        "id": "f378aa833518466c9ce2c9ef85e82ace",
                        "type": "image",
                        "name": "glance"
                    },
                    {
                        "endpoints": [
                            {
                                "id": "a82bd043e133464fa863fba98b400460",
                                "interface": "admin",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            },
                            {
                                "id": "ac109817862344c4854b783d642be412",
                                "interface": "internal",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            },
                            {
                                "id": "eaf4ddaab1b74aa59403f9fbf5fc4ac1",
                                "interface": "public",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            }
                        ],
                        "id": "75fe01049ec648b69e48d200971bf601",
                        "type": "identity",
                        "name": "keystone"
                    }
                ]
            }
        }
    Object
5/ glance验证admin的token

glance ---> keystone,glance认证自己的身份获得token(X-Auth-Token)后,继续验证admin user scope to project admin的token(X-Subject-Token):

Frame 306: 675 bytes on wire (5400 bits), 675 bytes captured (5400 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: image1 (00:0c:29:cc:19:7d), Dst: controller (00:0c:29:a8:e0:3c)
Internet Protocol Version 4, Src: image1 (10.0.20.16), Dst: controller (10.0.20.11)
Transmission Control Protocol, Src Port: 35368, Dst Port: 5000, Seq: 780, Ack: 2844, Len: 609
Hypertext Transfer Protocol
    GET /v3/auth/tokens HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): GET /v3/auth/tokens HTTP/1.1\r\n]
        Request Method: GET
        Request URI: /v3/auth/tokens
        Request Version: HTTP/1.1
    Host: controller:5000\r\n
    User-Agent: python-keystoneclient\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept: application/json\r\n
    Connection: keep-alive\r\n
    X-Subject-Token: gAAAAABmkFWFJBbsCv5MsBqeIGj9Fc426FeFSZTyQsjlgM4lC6I6crQcE3x-ygbUSoDUoMzjTh06W5STx4YChIbkhHCe_5OuuKOx8ZAp1pxs9M_yMLD6PtuYK7TDPwlPNfjdHOKWNvrA6BHc3Xg-mjdvnsi_Z2tKdw_A3AQUYN3uAub3zaxK418\r\n
    OpenStack-Identity-Access-Rules: 1\r\n
    X-Auth-Token: gAAAAABmkFWLEgmaDAIh3GTU4gl2BQm2dgjcP7vCi7j6Z3h3rrjAL_c37havjhwmUxFXoxsZdKDWpzMuxjcL7UGBmoZeRHPxsnYeETpA_qz3OYhhZBV5LZM0gbZey_dCmWCJnI8dWyIXA3Iyd9wLxKX6vIYLYD9TZkTyNUuHsasmVrluTNp9i6s\r\n
    \r\n
    [Full request URI: http://controller:5000/v3/auth/tokens]
    [HTTP request 3/3]
    [Prev request in frame: 294]
    [Response in frame: 309]

keystone ---> glance,告知user admin scope to project admin的token没问题,并返回相关的服务目录和endpoint:

Frame 309: 853 bytes on wire (6824 bits), 853 bytes captured (6824 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: controller (00:0c:29:a8:e0:3c), Dst: image1 (00:0c:29:cc:19:7d)
Internet Protocol Version 4, Src: controller (10.0.20.11), Dst: image1 (10.0.20.16)
Transmission Control Protocol, Src Port: 5000, Dst Port: 35368, Seq: 4292, Ack: 1389, Len: 787
[2 Reassembled TCP Segments (2235 bytes): #308(1448), #309(787)]
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
        [Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n]
        Response Version: HTTP/1.1
        Status Code: 200
        [Status Code Description: OK]
        Response Phrase: OK
    Date: Thu, 11 Jul 2024 21:58:35 GMT\r\n
    Server: Apache/2.4.52 (Ubuntu)\r\n
    Content-Length: 1750\r\n
    X-Subject-Token: gAAAAABmkFWFJBbsCv5MsBqeIGj9Fc426FeFSZTyQsjlgM4lC6I6crQcE3x-ygbUSoDUoMzjTh06W5STx4YChIbkhHCe_5OuuKOx8ZAp1pxs9M_yMLD6PtuYK7TDPwlPNfjdHOKWNvrA6BHc3Xg-mjdvnsi_Z2tKdw_A3AQUYN3uAub3zaxK418\r\n
    Vary: X-Auth-Token\r\n
    x-openstack-request-id: req-1e89695f-0ef0-4703-88b5-0396bc0ea1c9\r\n
    Keep-Alive: timeout=5, max=98\r\n
    Connection: Keep-Alive\r\n
    Content-Type: application/json\r\n
    \r\n
    [HTTP response 3/3]
    [Time since request: 2.943232000 seconds]
    [Prev request in frame: 294]
    [Prev response in frame: 304]
    [Request in frame: 306]
    [Request URI: http://controller:5000/v3/auth/tokens]
    File Data: 1750 bytes
JavaScript Object Notation: application/json
    JSON raw form:
        {
            "token": {
                "methods": [
                    "password"
                ],
                "user": {
                    "domain": {
                        "id": "default",
                        "name": "Default"
                    },
                    "id": "2947c213547147979dce3c8f8b85697f",
                    "name": "admin",
                    "password_expires_at": null
                },
                "audit_ids": [
                    "-gVm2yInSBWpjE6RI9Q78A"
                ],
                "expires_at": "2024-07-11T22:58:29.000000Z",
                "issued_at": "2024-07-11T21:58:29.000000Z",
                "project": {
                    "domain": {
                        "id": "default",
                        "name": "Default"
                    },
                    "id": "ee65b6c3961747b988ab8bd1cc19fb93",
                    "name": "admin"
                },
                "is_domain": false,
                "roles": [
                    {
                        "id": "17552c9a365d4944a50fd8ac271791c6",
                        "name": "member"
                    },
                    {
                        "id": "e434c66b7af647158bcaa77686ca6e93",
                        "name": "admin"
                    },
                    {
                        "id": "be23525c20c44f05b3ba071455522fcb",
                        "name": "reader"
                    }
                ],
                "catalog": [
                    {
                        "endpoints": [
                            {
                                "id": "7d17e6182d8640a7a6637f4f460a5c08",
                                "interface": "internal",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            },
                            {
                                "id": "c37250b6bd2d471f92427483d31fd5c7",
                                "interface": "public",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            },
                            {
                                "id": "f210d94217e54d2781192170bdf26877",
                                "interface": "admin",
                                "region_id": "RegionOne",
                                "url": "http://image1:9292",
                                "region": "RegionOne"
                            }
                        ],
                        "id": "f378aa833518466c9ce2c9ef85e82ace",
                        "type": "image",
                        "name": "glance"
                    },
                    {
                        "endpoints": [
                            {
                                "id": "a82bd043e133464fa863fba98b400460",
                                "interface": "admin",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            },
                            {
                                "id": "ac109817862344c4854b783d642be412",
                                "interface": "internal",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            },
                            {
                                "id": "eaf4ddaab1b74aa59403f9fbf5fc4ac1",
                                "interface": "public",
                                "region_id": "RegionOne",
                                "url": "http://controller:5000/v3/",
                                "region": "RegionOne"
                            }
                        ],
                        "id": "75fe01049ec648b69e48d200971bf601",
                        "type": "identity",
                        "name": "keystone"
                    }
                ]
            }
        }
    Object
6/ MEMCACHE储存token

glance ---> MEMCACHE,储存token:

Frame 312: 677 bytes on wire (5416 bits), 677 bytes captured (5416 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: image1 (00:0c:29:cc:19:7d), Dst: controller (00:0c:29:a8:e0:3c)
Internet Protocol Version 4, Src: image1 (10.0.20.16), Dst: controller (10.0.20.11)
Transmission Control Protocol, Src Port: 59524, Dst Port: 11211, Seq: 1526, Ack: 6, Len: 611
[2 Reassembled TCP Segments (2059 bytes): #311(1448), #312(611)]
Memcache Protocol
    Command: set
    Key: tokens/773e2dee2fb1030e539ea2f4cbee331eb398d4f8145ca001c733c4b3f63ca862
    Flags: 0
    Expiration: 300
    Value length: 1968
    Value [truncated]: {"token": {"methods": ["password"], "user": {"domain": {"id": "default", "name": "Default"}, "id": "2947c213547147979dce3c8f8b85697f", "name": "admin", "password_expires_at": null}, "audit_ids": ["-gVm2yInSBWpjE6RI9Q78A"

MEMCACHE成功储存:

Frame 314: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: controller (00:0c:29:a8:e0:3c), Dst: image1 (00:0c:29:cc:19:7d)
Internet Protocol Version 4, Src: controller (10.0.20.11), Dst: image1 (10.0.20.16)
Transmission Control Protocol, Src Port: 11211, Dst Port: 59524, Seq: 6, Ack: 2137, Len: 8
Memcache Protocol
    Response: STORED
7/ glance连接数据库,SQL查询

(只展示login信息,其他SQL查询信息略)

Frame 321: 212 bytes on wire (1696 bits), 212 bytes captured (1696 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: image1 (00:0c:29:cc:19:7d), Dst: controller (00:0c:29:a8:e0:3c)
Internet Protocol Version 4, Src: image1 (10.0.20.16), Dst: controller (10.0.20.11)
Transmission Control Protocol, Src Port: 46382, Dst Port: 3306, Seq: 1, Ack: 111, Len: 146
MySQL Protocol
    Packet Length: 142
    Packet Number: 1
    Login Request
        Client Capabilities: 0xa20f
        Extended Client Capabilities: 0x003a
        MAX Packet: 16777215
        Charset: utf8 COLLATE utf8_general_ci (33)
        Unused: 0000000000000000000000000000000000000000000000
        Username: glance
        Password: 4d1590709f0fb6fdce405042311a3773f737dd5a
        Schema: glance
        Client Auth Plugin: mysql_native_password
        Connection Attributes
8/ glance将查询结果返回给OpenStackClient:
Frame 362: 1117 bytes on wire (8936 bits), 1117 bytes captured (8936 bits) on interface \Device\NPF_{3CF2B347-CE40-406F-B67A-13F210B29B37}, id 0
Ethernet II, Src: image1 (00:0c:29:cc:19:7d), Dst: VMware_ff:20:81 (00:0c:29:ff:20:81)
Internet Protocol Version 4, Src: image1 (10.0.20.16), Dst: 10.0.20.100 (10.0.20.100)
Transmission Control Protocol, Src Port: 9292, Dst Port: 32788, Seq: 1172, Ack: 631, Len: 1051
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
        [Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n]
        Response Version: HTTP/1.1
        Status Code: 200
        [Status Code Description: OK]
        Response Phrase: OK
    Content-Length: 852\r\n
    Content-Type: application/json\r\n
    X-Openstack-Request-Id: req-3fd463a0-2fae-4d96-b668-ecd6c402861c\r\n
    Date: Thu, 11 Jul 2024 21:58:38 GMT\r\n
    Connection: keep-alive\r\n
    \r\n
    [HTTP response 2/2]
    [Time since request: 8.837414000 seconds]
    [Prev request in frame: 273]
    [Prev response in frame: 275]
    [Request in frame: 277]
    [Request URI: http://image1:9292/v2/images]
    File Data: 852 bytes
JavaScript Object Notation: application/json
    JSON raw form:
        {
            "images": [
                {
                    "name": "cirros",
                    "disk_format": "qcow2",
                    "container_format": "bare",
                    "visibility": "public",
                    "size": 12716032,
                    "virtual_size": 46137344,
                    "status": "active",
                    "checksum": "443b7623e27ecf03dc9e01ee93f67afe",
                    "protected": false,
                    "min_ram": 0,
                    "min_disk": 0,
                    "owner": "ee65b6c3961747b988ab8bd1cc19fb93",
                    "os_hidden": false,
                    "os_hash_algo": "sha512",
                    "os_hash_value": "6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78",
                    "id": "9f0e6328-3e96-41e1-b282-d577b6749a09",
                    "created_at": "2024-07-07T08:26:02Z",
                    "updated_at": "2024-07-07T08:26:02Z",
                    "tags": [],
                    "self": "/v2/images/9f0e6328-3e96-41e1-b282-d577b6749a09",
                    "file": "/v2/images/9f0e6328-3e96-41e1-b282-d577b6749a09/file",
                    "schema": "/v2/schemas/image"
                }
            ],
            "first": "/v2/images",
            "schema": "/v2/schemas/images"
        }
    Object

5、关闭虚机,拍摄快照

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/798474.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Ubuntu系统上安装Apache和WordPress

** 第一步跟新系统包 ** 首先跟新系统包 sudo apt update sudo apt upgrade第二步下载安装apache sudo apt install apache2 ##查看apache的状态是否启动成功 sudo systemctl status apache2 ##查看服务器的ip地址 sudo ip a通过ip地址进行访问apache页面 第三步下载安装…

vue3+vite从零架构:写组件、构建、打包并上传个人前端组件库至私有npm仓库最终在自己项目中下载并使用(超详细的流程,小编已实现)

目录 第一章 前言 第二章 准备工作 第三章 封装组件 3.1 文件结构 3.2 编写组件代码 第四章 项目打包 第五章 发布到npm 5.1 npm准备工作 5.2 发布npm包 ​编辑 第六章 从npm安装使用 第一章 前言 在我们很多开发过程中&#xff0c;不管是使用vue还是react&#x…

github相关命令

如果我们要从 GitHub 上拉取一个项目到本地&#xff0c;进行修改并上传回去&#xff0c;通常需要以下步骤&#xff1a; 1. 克隆远程仓库到本地 使用 git clone 命令将 GitHub 上的项目克隆到本地&#xff1a; (网址示例如下所示&#xff09; git clone https://github.com/你的…

DP- 使用最小花费爬楼梯 DAY19

使用最小花费爬楼梯 给你一个整数数组 cost &#xff0c;其中 cost[i] 是从楼梯第i个台阶向上爬需要支付的费用。一旦你支付此费用&#xff0c;即可选择向上爬一个或者两个台阶。 你可以选择从下标为 0 或下标为 1 的台阶开始爬楼梯。请你计算并返回达到楼梯顶部的最低花费。 …

STM32对flash中程序的加密保护

2024.7.14 今天学习了很多关于STM32对于程序的保护措施&#xff0c;原先一直不理解为什么DF CAR需要做加密&#xff0c;他的加密流程我也不是很知道&#xff0c;后面发现他是在控制任务初始化的时候&#xff0c;加了一个判断flash中某个区域的数值的程序&#xff0c;如果判断失…

易懂的吉文斯(Givens)变换(一)

文章目录 二阶Givens旋转矩阵作用于向量作用于矩阵更一般的情况 二阶Givens旋转矩阵 在QR分解中&#xff0c;Givens旋转是一种用于将矩阵变成上三角形的技术。 别的教程里面往往会直接给出一个n*n阶的通用Givens矩阵形式&#xff0c;但是这样太过抽象难懂了&#xff0c;而且难…

ceph 部署

端口号 NFS 2049 rpcbind 111 NFS 目录越深&#xff0c;写入性能越差 操作简单&#xff0c; 一.前言&#xff1a;存储知识 1、存储基础 单机存储设备 【1】DAS&#xff08;直接附加存储&#xff0c;是直接接到计算机的主板总线上去的存储&#xff09; IDE、SATA、SCSI、SAS…

记录些Redis题集(2)

Redis 的多路IO复用 多路I/O复用是一种同时监听多个文件描述符&#xff08;如Socket&#xff09;的状态变化&#xff0c;并能在某个文件描述符就绪时执行相应操作的技术。在Redis中&#xff0c;多路I/O复用技术主要用于处理客户端的连接请求和读写操作&#xff0c;以实现高并发…

《后端程序员 · Nacos 配置优先级动态刷新》

&#x1f4e2; 大家好&#xff0c;我是 【战神刘玉栋】&#xff0c;有10多年的研发经验&#xff0c;致力于前后端技术栈的知识沉淀和传播。 &#x1f497; &#x1f33b; CSDN入驻不久&#xff0c;希望大家多多支持&#xff0c;后续会继续提升文章质量&#xff0c;绝不滥竽充数…

J025_斗地主游戏案例开发(简版)

一、需求描述 完成斗地主游戏的案例开发。 业务&#xff1a;总共有54张牌&#xff1b; 点数&#xff1a;3、4、5、6、7、8、9、10、J、Q、K、A、2 花色&#xff1a;黑桃、红桃、方片、梅花 大小王&#xff1a;大王、小王 点数分别要组合4种花色&#xff0c;大小王各一张。…

mysql不初始化升级

1、下载mysql&#xff0c;下载地址&#xff1a;MySQL :: Download MySQL Community Server 2、解压下载好的mysql&#xff0c;修改配置文件的datadir指定目录为当前数据存储的目录 3、通过管理员cmd进入新版本mysql的bin目录&#xff0c; 然后执行命令安装mysql服务&#xff…

性能测试(2)

jmeter参数化 loadrunner Jmeter IP欺骗&#xff0c;也称为IP欺诈&#xff0c;是指通过伪装、篡改IP地址的方式&#xff0c;进行网络攻击或欺骗行为。这种行为可能会导致网络安全问题&#xff0c;包括身份盗窃、数据泄露、DDoS攻击等。为了保护自己的网络安全&#xff0c;用户…

「C++系列」一篇文章讲透【运算符】

文章目录 一、运算符1. 算术运算符2. 关系运算符3. 逻辑运算符4. 位运算符5. 赋值运算符6. 条件运算符&#xff08;三元运算符&#xff09;7. 成员访问运算符8. 指针和地址运算符9. 类型转换运算符10. 其他运算符 二、其他特殊运算符1. 成员访问运算符2. 指针和地址运算符3. 类…

C语言 ——— 模拟实现strcpy函数

目录 strcpy函数功能介绍 strcpy函数的模拟实现 strcpy函数功能介绍 学习并使用strcpy函数-CSDN博客 strcpy函数的模拟实现 代码演示&#xff1a; #include<stdio.h> #include<assert.h> char* my_strcpy(char* destination, const char* source) {assert(des…

OpenCV下的单目标定,双目标定与立体校正(calibrateCamera, stereoCalibrate and stereoRectify)

OpenCV下的单目标定&#xff0c;双目标定与立体校正(calibrateCamera, stereoCalibrate and stereoRectify) 文章目录 1. 杂话2. 单目标定2.1 先看代码2.2 一点解释2.3 calibrateCamera参数 3. 双目标定3.1 先看代码3.2 stereoCalibrate参数 4. 立体校正4.1 先看代码4.2 一点解…

Spring Security 授权

基于request的授权 HttpSecurity 权限配置 Beanpublic SecurityFilterChain filterChain(HttpSecurity http) throws Exception {http.authorizeHttpRequests(authorize -> {authorize// 放行请求:针对含有 admin 权限的用户放行 /user/get 接口.requestMatchers("/us…

训练营第十一天 | 150. 逆波兰表达式求值

150. 逆波兰表达式求值 做题思路 遇到操作符&#xff0c;出栈&#xff0c;从栈口取出俩元素&#xff1b;遇到数字&#xff0c;入栈 栈的应用场景&#xff1a;相邻元素的消除 逆波兰表达式&#xff1a;即后缀表达式 来自二叉树的后序遍历&#xff1a;左右中 代码细节 class …

有限元中弱形式的一些数学基础

有限元方法在求解PED时&#xff0c;一般先将控制方程转化为等效的若积分形式&#xff0c;本文试图总结一下这一过程的一些数学基础&#xff0c;本文主要从工程的角度出发和理解&#xff0c;不探讨严谨的数学证明过程。 PDE强形式 强形式是PDE及其边界条件的原始形式。求解强…

Java巅峰之路---基础篇---综合练习(面向对象)

目录 文字版格斗游戏 基础版 souf输出语句 进阶版 键盘录入的说明 复杂对象数组练习 需求&#xff1a; 添加和遍历 删除和遍历 修改和遍历 文字版格斗游戏 基础版 格斗游戏&#xff0c;每个游戏角色的姓名&#xff0c;血量&#xff0c;都不相同&#xff0c;在选定人…

[BJDCTF2020]Mark loves cat

黑盒直接扫 dirsearch -u http://bba9a212-64d3-4a16-88b4-3605fe3ef749.node5.buuoj.cn:81/ -w /home/kali/Desktop/dirsearch/db/dicc.txt我们用GitHack拿一下源码 没有的去下载一下&#xff0c;开源代码 cd GitHackpython GitHack.py http://bba9a212-64d3-4a16-88b4-3605…