目录
[2. Glance服务](#2. Glance服务)
[(1) 概述](#(1) 概述)
[3. nova服务](#3. nova服务)
[6. Swift服务](#6. Swift服务)
1.Keystone 服务
(1)加载配置文件并创建用户

[root@controller ~]# source admin-openrc
[root@controller ~]# openstack user create --password mypassword123 --email alice@example.com alice
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| email | alice@example.com |
| enabled | True |
| id | 5bfcf128e85f4add97d855d38bbcbc0a |
| name | alice |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@controller ~]#


(2)创建项目
[root@controller ~]# openstack project create acme
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | |
| domain_id | default |
| enabled | True |
| id | bd5b9ab1e93549c69784071473a4feb5 |
| is_domain | False |
| name | acme |
| options | {} |
| parent_id | default |
| tags | [] |
+-------------+----------------------------------+
[root@controller ~]#

(3)创建角色
[root@controller ~]# openstack role create compute-user
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | None |
| domain_id | None |
| id | 2f26a60e82044b3f95316bdb4703188e |
| name | compute-user |
| options | {} |
+-------------+----------------------------------+
[root@controller ~]#
(4)绑定用户、项目、角色三者
[root@controller ~]# openstack role add --user alice --project acme compute-user
(5)查看用户列表
[root@controller ~]# openstack user list
+----------------------------------+-----------+
| ID | Name |
+----------------------------------+-----------+
| cd33d7cd74804b0981d641c071f88be5 | admin |
| b62dcbf194e94c648c19005689ee8d5e | demo |
| e7d1e630352445e08d6c5d8054a30e1a | glance |
| ace3a83884a54fc1bf96d9442ea104ed | nova |
| 60705916046f49d4b5747f1d6388eadc | placement |
| 36f26d729638451a97076fe2e4b7406e | neutron |
| 9278a09e3aee4f2cb998b24b11da980d | cinder |
| 6f269a3fb40e4873ba25b42ed02472ca | swift |
| 5bfcf128e85f4add97d855d38bbcbc0a | alice |
+----------------------------------+-----------+

TypeScript
[root@controller ~]# openstack user show alice
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| email | alice@example.com |
| enabled | True |
| id | 5bfcf128e85f4add97d855d38bbcbc0a |
| name | alice |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
(6)查看项目列表
TypeScript
[root@controller ~]# openstack project list
+----------------------------------+--------------+
| ID | Name |
+----------------------------------+--------------+
| 1cd4050cd679424e860f6e29617edccd | service |
| 832c5b8b5bc94f5facaeb2f4f72c7684 | demo |
| a4c8a29a9f0441468090542493e32c50 | admin |
| b56f2620b6d041b39037ef922afa97e5 | test-project |
| bd5b9ab1e93549c69784071473a4feb5 | acme |
+----------------------------------+--------------+

TypeScript
[root@controller ~]# openstack project show acme
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | |
| domain_id | default |
| enabled | True |
| id | bd5b9ab1e93549c69784071473a4feb5 |
| is_domain | False |
| name | acme |
| options | {} |
| parent_id | default |
| tags | [] |
+-------------+----------------------------------+
(7)查看角色列表
TypeScript
[root@controller ~]# openstack role list
+----------------------------------+--------------+
| ID | Name |
+----------------------------------+--------------+
| 18404e53621b480984a5a84b16027c5f | admin |
| 2f26a60e82044b3f95316bdb4703188e | compute-user |
| ca73e312f2c54ab0974aa7ed758e66b6 | reader |
| f2ea11e1782948bb99a92dcb2612d9eb | member |
| f3d0221787764521baad7994113daffb | user |
+----------------------------------+--------------+

TypeScript
[root@controller ~]# openstack role show compute-user
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | None |
| domain_id | None |
| id | 2f26a60e82044b3f95316bdb4703188e |
| name | compute-user |
| options | {} |
+-------------+----------------------------------+
(8)端点信息查询
TypeScript
[root@controller ~]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+-----------------------------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-----------------------------------------------+
| 013e183bedd44f8aa011529773b6827d | RegionOne | swift | object-store | True | admin | http://controller:8080/v1 |
| 0a88154e6c704ddf84ce324fe381ac1c | RegionOne | neutron | network | True | admin | http://controller:9696 |
| 12b51f28159241f0af4602eb6130da6e | RegionOne | neutron | network | True | internal | http://controller:9696 |
| 1c7e2b393d364b12b4002044f1935e8b | RegionOne | cinderv2 | volumev2 | True | internal | http://controller:8776/v2/%(project_id)s |
| 2317046d5e444f3fa294462bdbe4e218 | RegionOne | keystone | identity | True | public | http://controller:5000/v3/ |
| 2baa8b29a3a1444a9a86238715155f73 | RegionOne | cinderv3 | volumev3 | True | admin | http://controller:8776/v3/%(project_id)s |
| 35bcfeaefc08462a84dc6d4e701dee75 | RegionOne | cinderv2 | volumev2 | True | admin | http://controller:8776/v2/%(project_id)s |
| 395ac2fb0f4c469b8b225731fb887983 | RegionOne | placement | placement | True | admin | http://controller:8778 |
| 48e46690bd8d4472a30995360ae0aa5c | RegionOne | placement | placement | True | public | http://controller:8778 |
| 4f9aa398e6334482b30cdd4de8e251b2 | RegionOne | keystone | identity | True | admin | http://controller:5000/v3/ |
| 521887821c6b42e598b47fbd42389aba | RegionOne | cinderv3 | volumev3 | True | public | http://controller:8776/v3/%(project_id)s |
| 63553955e1e542aab8f695ef5deb0768 | RegionOne | neutron | network | True | public | http://controller:9696 |
| 78ee9882105e42c3bafe55e9cbfa0820 | RegionOne | nova | compute | True | internal | http://controller:8774/v2.1 |
| 7ecb6720eba64942b89bf66f232df5a6 | RegionOne | glance | image | True | admin | http://controller:9292 |
| 8d7d8498d89a4973b67ffcc6a14eda66 | RegionOne | keystone | identity | True | internal | http://controller:5000/v3/ |
| a540ac6246a44d5ca9fa67d0d584ad1c | RegionOne | swift | object-store | True | public | http://controller:8080/v1/AUTH_%(project_id)s |
| bb7726f2576e4d24a20b801644d9b591 | RegionOne | swift | object-store | True | internal | http://controller:8080/v1/AUTH_%(project_id)s |
| bec5996417234f7d88dc94c27a8b4bce | RegionOne | cinderv2 | volumev2 | True | public | http://controller:8776/v2/%(project_id)s |
| c7163d4f1ef741b08eed31a40000d41f | RegionOne | nova | compute | True | public | http://controller:8774/v2.1 |
| cab09a47293f4e888032ab6e995b3bf4 | RegionOne | glance | image | True | public | http://controller:9292 |
| e069ae7c555d4c419a964d9088fbce9b | RegionOne | placement | placement | True | internal | http://controller:8778 |
| e68dc236b29146708937a41d50a6262a | RegionOne | cinderv3 | volumev3 | True | internal | http://controller:8776/v3/%(project_id)s |
| efa24ec525704690b53deb6c506c7604 | RegionOne | nova | compute | True | admin | http://controller:8774/v2.1 |
| f2af436f41bb445eaea23a3d6fef03fc | RegionOne | glance | image | True | internal | http://controller:9292 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-----------------------------------------------+



2. Glance 服务
(1) 概述
(2)创建镜像
TypeScript
[root@controller ~]# cd /opt/images
[root@controller images]# openstack image create --disk-format qcow2 --container-format bare --public --file cirros-0.5.1-x86_64-disk.img cirros
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | 1d3062cd89af34e419f7100277f38b2b |
| container_format | bare |
| created_at | 2026-12-01T17:01:53Z |
| disk_format | qcow2 |
| file | /v2/images/726499d5-a757-4e0a-86cf-9f132fe661a9/file |
| id | 726499d5-a757-4e0a-86cf-9f132fe661a9 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | a4c8a29a9f0441468090542493e32c50 |
| properties | os_hash_algo='sha512', os_hash_value='553d220ed58cfee7dafe003c446a9f197ab5edf8ffc09396c74187cf83873c877e7ae041cb80f3b91489acf687183adcd689b53b38e3ddd22e627e7f98a09c46', os_hidden='False' |
| protected | False |
| schema | /v2/schemas/image |
| size | 16338944 |
| status | active |
| tags | |
| updated_at | 2026-12-01T17:01:53Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@controller images]#



javascript
[root@controller images]# openstack image list
+--------------------------------------+-----------+--------+
| ID | Name | Status |
+--------------------------------------+-----------+--------+
| 538ed75b-3386-4263-a313-6a169f0f46ea | centos7.9 | active |
| 726499d5-a757-4e0a-86cf-9f132fe661a9 | cirros | active |
| 68fde1ed-d9c6-486c-a126-797d2e3e5bb8 | cirros | active |
+--------------------------------------+-----------+--------+
(3)查看镜像
javascript
[root@controller images]# openstack image show 68fde1ed-d9c6-486c-a126-797d2e3e5bb8
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | 1d3062cd89af34e419f7100277f38b2b |
| container_format | bare |
| created_at | 2026-11-17T16:11:37Z |
| disk_format | qcow2 |
| file | /v2/images/68fde1ed-d9c6-486c-a126-797d2e3e5bb8/file |
| id | 68fde1ed-d9c6-486c-a126-797d2e3e5bb8 |
| min_disk | 1 |
| min_ram | 0 |
| name | cirros |
| owner | a4c8a29a9f0441468090542493e32c50 |
| properties | os_hash_algo='sha512', os_hash_value='553d220ed58cfee7dafe003c446a9f197ab5edf8ffc09396c74187cf83873c877e7ae041cb80f3b91489acf687183adcd689b53b38e3ddd22e627e7f98a09c46', os_hidden='False' |
| protected | False |
| schema | /v2/schemas/image |
| size | 16338944 |
| status | active |
| tags | |
| updated_at | 2026-11-17T16:18:56Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

更新镜像信息
javascript
[root@controller images]# openstack image set --min-disk=1 68fde1ed-d9c6-486c-a126-797d2e3e5bb8
(4)删除镜像
javascript
[root@controller images]# openstack image delete 68fde1ed-d9c6-486c-a126-797d2e3e5bb8
[root@controller images]# openstack image list
+--------------------------------------+-----------+--------+
| ID | Name | Status |
+--------------------------------------+-----------+--------+
| 538ed75b-3386-4263-a313-6a169f0f46ea | centos7.9 | active |
| 726499d5-a757-4e0a-86cf-9f132fe661a9 | cirros | active |
+--------------------------------------+-----------+--------+
3. nova 服务
(1)概述
(2)创建安全组
javascript
[root@controller images]# openstack security group create test --description 'test the nova command about the rules'
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at | 2026-12-01T17:12:15Z |
| description | test the nova command about the rules |
| id | ec74cc46-a6d9-49b5-b32f-8afbb6b18723 |
| location | cloud='', project.domain_id=, project.domain_name='demo', project.id='a4c8a29a9f0441468090542493e32c50', project.name='admin', region_name='', zone= |
| name | test |
| project_id | a4c8a29a9f0441468090542493e32c50 |
| revision_number | 1 |
| rules | created_at='2026-12-01T17:12:15Z', direction='egress', ethertype='IPv6', id='3439ce0a-9d42-4268-b465-1ae40c36becb', updated_at='2026-12-01T17:12:15Z' |
| | created_at='2026-12-01T17:12:15Z', direction='egress', ethertype='IPv4', id='b40fa7e3-84e1-49ca-b252-4244009fa5a6', updated_at='2026-12-01T17:12:15Z' |
| tags | [] |
| updated_at | 2026-12-01T17:12:15Z |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+


(3)创建实例类型
javascript
[root@controller images]# openstack flavor create --id 6 --ram 2048 --vcpus 2 --disk 20 test
+----------------------------+-------+
| Field | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 20 |
| id | 6 |
| name | test |
| os-flavor-access:is_public | True |
| properties | |
| ram | 2048 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 2 |
+----------------------------+-------+

查看实例类型列表
javascript
[root@controller images]# openstack flavor list
+--------------------------------------+--------+------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+--------+------+------+-----------+-------+-----------+
| 6 | test | 2048 | 20 | 0 | 2 | True |
| 7b5b4f85-464c-4279-8d9a-b87fd814cd2f | centos | 512 | 10 | 0 | 1 | True |
+--------------------------------------+--------+------+------+-----------+-------+-----------+
查看实例服务列表信息
javascript
[root@controller images]# openstack server list
+--------------------------------------+--------+---------+----------------------------------+-------+--------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+--------+---------+----------------------------------+-------+--------+
| 1cde6b57-341c-4dc6-8eac-7b6d6d9dd3a2 | centos | SHUTOFF | int=172.16.1.135, 192.168.200.97 | | centos |
+--------------------------------------+--------+---------+----------------------------------+-------+--------+

查看实例详细信息
javascript
[root@controller images]# openstack server show centos
+-------------------------------------+----------------------------------------------------------+
| Field | Value |
+-------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig | AUTO |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | controller |
| OS-EXT-SRV-ATTR:hypervisor_hostname | controller |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-EXT-STS:power_state | Shutdown |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | stopped |
| OS-SRV-USG:launched_at | 2026-11-10T16:45:38.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | int=172.16.1.135, 192.168.200.97 |
| config_drive | |
| created | 2026-11-10T16:44:57Z |
| flavor | centos (7b5b4f85-464c-4279-8d9a-b87fd814cd2f) |
| hostId | e3c8a521747ab91486ba91cb451ce469f6d89913f0253180de13ae85 |
| id | 1cde6b57-341c-4dc6-8eac-7b6d6d9dd3a2 |
| image | |
| key_name | None |
| name | centos |
| project_id | a4c8a29a9f0441468090542493e32c50 |
| properties | |
| security_groups | name='default' |
| status | SHUTOFF |
| updated | 2026-11-17T15:56:59Z |
| user_id | cd33d7cd74804b0981d641c071f88be5 |
| volumes_attached | id='9cf53b01-42f9-411c-8b4b-c580101275ee' |
+-------------------------------------+----------------------------------------------------------+


4.网络服务
(1)概述
Neutron网络目的是灵活地划分物理网络,在多租户环境下提供给每个租户独立的网络环境。它是可以被用户创建的对象,如果要和物理环境下的概念映射的话,这个对象相当于一个巨大的交换机,可以拥有无限多个动态可创建和销毁的虚拟端口。
(2)查看网络与网络代理
javascript
[root@controller ~]# openstack network agent list
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| 8ef436dc-d545-4c40-8a9c-df4e505af7d4 | DHCP agent | controller | nova | :-) | UP | neutron-dhcp-agent |
| 9d93754f-2e6e-4f32-bb05-518b0da1aea8 | Metadata agent | controller | None | :-) | UP | neutron-metadata-agent |
| c86c1bec-57eb-45cc-b483-1c39510ba80d | L3 agent | controller | nova | :-) | UP | neutron-l3-agent |
| d2bae27e-5df7-4445-9880-8b8197a8a28c | Linux bridge agent | controller | None | :-) | UP | neutron-linuxbridge-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+

TypeScript
[root@controller ~]# openstack network list
+--------------------------------------+--------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+--------+--------------------------------------+
| 2b15895b-60c5-48a2-900f-e350023b4f85 | public | 981fa386-0637-4f09-a3dd-61cbe84f4fc7 |
| 99601faa-a065-457e-8469-2ca1b6485e1e | int | 9e602647-70cd-453a-9d06-71cbd65448cd |
+--------------------------------------+--------+--------------------------------------+
[root@controller ~]#

TypeScript
[root@controller ~]# openstack subnet list
+--------------------------------------+------------+--------------------------------------+------------------+
| ID | Name | Network | Subnet |
+--------------------------------------+------------+--------------------------------------+------------------+
| 981fa386-0637-4f09-a3dd-61cbe84f4fc7 | public_sub | 2b15895b-60c5-48a2-900f-e350023b4f85 | 192.168.200.0/24 |
| 9e602647-70cd-453a-9d06-71cbd65448cd | int_sub | 99601faa-a065-457e-8469-2ca1b6485e1e | 172.16.1.0/24 |
+--------------------------------------+------------+--------------------------------------+------------------+

TypeScript
[root@controller ~]# openstack network show public
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2026-11-10T16:39:07Z |
| description | |
| dns_domain | None |
| id | 2b15895b-60c5-48a2-900f-e350023b4f85 |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | False |
| is_vlan_transparent | None |
| location | cloud='', project.domain_id=, project.domain_name='demo', project.id='a4c8a29a9f0441468090542493e32c50', project.name='admin', region_name='', zone= |
| mtu | 1500 |
| name | public |
| port_security_enabled | True |
| project_id | a4c8a29a9f0441468090542493e32c50 |
| provider:network_type | flat |
| provider:physical_network | provider |
| provider:segmentation_id | None |
| qos_policy_id | None |
| revision_number | 2 |
| router:external | External |
| segments | None |
| shared | False |
| status | ACTIVE |
| subnets | 981fa386-0637-4f09-a3dd-61cbe84f4fc7 |
| tags | |
| updated_at | 2026-11-10T16:39:08Z |
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@controller ~]#


bash
[root@controller ~]# openstack network agent show 8ef436dc-d545-4c40-8a9c-df4e505af7d4
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| agent_type | DHCP agent |
| alive | :-) |
| availability_zone | nova |
| binary | neutron-dhcp-agent |
| configuration | {u'subnets': 2, u'dhcp_lease_duration': 86400, u'dhcp_driver': u'neutron.agent.linux.dhcp.Dnsmasq', u'ports': 6, u'log_agent_heartbeats': False, u'networks': 2} |
| created_at | 2025-06-05 19:26:45 |
| description | None |
| ha_state | None |
| host | controller |
| id | 8ef436dc-d545-4c40-8a9c-df4e505af7d4 |
| last_heartbeat_at | 2026-12-03 18:47:55 |
| location | cloud='', project.domain_id=, project.domain_name='demo', project.id='a4c8a29a9f0441468090542493e32c50', project.name='admin', region_name='', zone='nova' |
| name | None |
| resources_synced | None |
| started_at | 2026-11-17 15:56:26 |
| topic | dhcp_agent |
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+


5.块存储服务
(1)创建云硬盘
TypeScript
[root@controller ~]# openstack volume create --size 2 extend-demo
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2026-12-03T18:52:17.000000 |
| description | None |
| encrypted | False |
| id | 0c2ef91c-7812-4258-8203-e2d26d745544 |
| migration_status | None |
| multiattach | False |
| name | extend-demo |
| properties | |
| replication_status | None |
| size | 2 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | __DEFAULT__ |
| updated_at | None |
| user_id | cd33d7cd74804b0981d641c071f88be5 |
+---------------------+--------------------------------------+
[root@controller ~]#


(2)查看卷列表
bash
[root@controller ~]# openstack volume list
+--------------------------------------+-------------+-----------+------+---------------------------------+
| ID | Name | Status | Size | Attached to |
+--------------------------------------+-------------+-----------+------+---------------------------------+
| 0c2ef91c-7812-4258-8203-e2d26d745544 | extend-demo | available | 2 | |
| 9cf53b01-42f9-411c-8b4b-c580101275ee | | in-use | 10 | Attached to centos on /dev/vda |
+--------------------------------------+-------------+-----------+------+---------------------------------+


(3)创建云硬盘卷类型
bash
[root@controller ~]# openstack volume type create lvm
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| description | None |
| id | 1f7f0541-1f80-4391-8892-a20d16823db5 |
| is_public | True |
| name | lvm |
+-------------+--------------------------------------+
[root@controller ~]#


(4)查看卷类型列表
bash
[root@controller ~]# openstack volume type list
+--------------------------------------+-------------+-----------+
| ID | Name | Is Public |
+--------------------------------------+-------------+-----------+
| 1f7f0541-1f80-4391-8892-a20d16823db5 | lvm | True |
| f083a578-aae2-4963-a620-193336ce0957 | __DEFAULT__ | True |
+--------------------------------------+-------------+-----------+


(5)创建带标识云硬盘
bash
[root@controller ~]# openstack volume create --size 1 --type lvm type_test_demo
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2026-12-03T18:59:50.000000 |
| description | None |
| encrypted | False |
| id | 859ed17a-9800-467f-ad55-a1c18f8db65c |
| migration_status | None |
| multiattach | False |
| name | type_test_demo |
| properties | |
| replication_status | None |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | lvm |
| updated_at | None |
| user_id | cd33d7cd74804b0981d641c071f88be5 |
+---------------------+--------------------------------------+


(6)查看卷创建结果&删除卷
bash
[root@controller ~]# openstack volume show type_test_demo
+--------------------------------+--------------------------------------+
| Field | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2026-12-03T18:59:50.000000 |
| description | None |
| encrypted | False |
| id | 859ed17a-9800-467f-ad55-a1c18f8db65c |
| migration_status | None |
| multiattach | False |
| name | type_test_demo |
| os-vol-host-attr:host | controller@lvm#LVM |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | a4c8a29a9f0441468090542493e32c50 |
| properties | |
| replication_status | None |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | available |
| type | lvm |
| updated_at | 2026-12-03T18:59:51.000000 |
| user_id | cd33d7cd74804b0981d641c071f88be5 |
+--------------------------------+--------------------------------------+
[root@controller ~]#

bash
[root@controller ~]# openstack volume delete type_test_demo
[root@controller ~]#

6. Swift 服务
(1)概述


(2)创建容器&查看容器列表
bash
、
[root@controller ~]# swift post test
[root@controller ~]# swift list
test

(3)给容器中上传文件
bash
[root@controller ~]# swift upload test /etc/hosts
etc/hosts
[root@controller ~]# swift list
test
(4)file目录中新建三个文件并上传至容器
bash
[root@controller ~]# mkdir file
[root@controller ~]# pwd
/root
[root@controller ~]# ls
admin-openrc CentOS-7-x86_64-DVD-2009.iso file variable.sh
anaconda-ks.cfg demo-openrc openstack-train.tar.gz
[root@controller ~]# cd file
[root@controller file]# touch one.txt
[root@controller file]# touch two.doc
[root@controller file]# touch three.jpg
[root@controller file]# ls
one.txt three.jpg two.doc
[root@controller file]# cd ..
[root@controller ~]# swift upload test file/
file/two.doc
file/one.txt
file/three.jpg

(5)从容器中下载&删除文件
bash
[root@controller ~]# swift download test file/three.jpg
file/three.jpg [auth 0.301s, headers 0.502s, total 0.503s, 0.000 MB/s]
[root@controller ~]# swift delete test file/three.jpg
file/three.jpg
[root@controller ~]# ls /root/file
one.txt three.jpg two.doc

(6)查看容器服务状态
bash
[root@controller ~]# swift stat
Account: AUTH_a4c8a29a9f0441468090542493e32c50
Containers: 1
Objects: 4
Bytes: 210
Containers in policy "policy-0": 1
Objects in policy "policy-0": 4
Bytes in policy "policy-0": 210
X-Account-Project-Domain-Id: a16450fc87ea4b12b35e6d95829e719b
X-Openstack-Request-Id: tx8e9811dfffc94103a5e09-006b11b285
X-Timestamp: 1796320916.29555
X-Trans-Id: tx8e9811dfffc94103a5e09-006b11b285
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes
[root@controller ~]# swift stat
Account: AUTH_a4c8a29a9f0441468090542493e32c50
Containers: 1
Objects: 3
Bytes: 210
Containers in policy "policy-0": 1
Objects in policy "policy-0": 3
Bytes in policy "policy-0": 210
X-Account-Project-Domain-Id: a16450fc87ea4b12b35e6d95829e719b
X-Openstack-Request-Id: txcbc5ad53cfa8401f997c2-006b11b2db
X-Timestamp: 1796320916.29555
X-Trans-Id: txcbc5ad53cfa8401f997c2-006b11b2db
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes


















