Openstack平台命令操作和创建

目录

1.创建外部网络

2.openstack创建外部网络子网

3.openstack创建内部网络

4.openstack创建内部网络子网

5.openstack创建路由及端口添加

6.openstack创建安全组

7.glance上传镜像

8.nova创建云主机类型

9.nova创建云主机

10.openstack创建绑定浮动IP

11.openstack绑定浮动IP至云主机

12.cinder创建卷组

13.openstack添加卷至云主机


1.创建外部网络

1.在openstack私有云平台上,使用命令创建云主机外部网络ext,子网extsubnet,虚拟机网段为192.168.x.0/24(其中x是vlan号),网关为192.168.x.1网络使用vlan模式。

[root@controller ~]# neutron net-create --router:external=true --provider:network_type vlan --provider:physical_network provider --provider:segmentation_id 200 ext
#200表示vlan id号
 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
 Created a new network:
 +---------------------------+--------------------------------------+
 | Field                     | Value                                |
 +---------------------------+--------------------------------------+
 | admin_state_up            | True                                 |
 | availability_zone_hints   |                                      |
 | availability_zones        |                                      |
 | created_at                | 2021-05-11T17:18:54Z                 |
 | description               |                                      |
 | id                        | 55f9c4d0-a2ce-462c-95ab-c9179b1db930 |
 | ipv4_address_scope        |                                      |
 | ipv6_address_scope        |                                      |
 | is_default                | False                                |
 | mtu                       | 1500                                 |
 | name                      | ext                                  |
 | port_security_enabled     | True                                 |
 | project_id                | 6edc32da421e4c6694c8c071c27f3bd4     |
 | provider:network_type     | vlan                                 |
 | provider:physical_network | provider                             |
 | provider:segmentation_id  | 200                                  |
 | revision_number           | 5                                    |
 | router:external           | True                                 |
 | shared                    | False                                |
 | status                    | ACTIVE                               |
 | subnets                   |                                      |
 | tags                      |                                      |
 | tenant_id                 | 6edc32da421e4c6694c8c071c27f3bd4     |
 | updated_at                | 2021-05-11T17:18:54Z                 |
 +---------------------------+--------------------------------------+
 

2.openstack创建外部网络子网

[root@controller ~]# neutron subnet-create --name extsubnet --gateway 192.168.200.1 --enable-dhcp --ip-version 4 ext 192.168.200.0/24 
 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
 Created a new subnet:
 +-------------------+------------------------------------------------------+
 | Field             | Value                                                |
 +-------------------+------------------------------------------------------+
 | allocation_pools  | {"start": "192.168.200.2", "end": "192.168.200.254"} |
 | cidr              | 192.168.200.0/24                                     |
 | created_at        | 2021-05-11T17:19:21Z                                 |
 | description       |                                                      |
 | dns_nameservers   |                                                      |
 | enable_dhcp       | True                                                 |
 | gateway_ip        | 192.168.200.1                                        |
 | host_routes       |                                                      |
 | id                | 46627d5d-c3b2-45a3-bb1b-ad518a3303e8                 |
 | ip_version        | 4                                                    |
 | ipv6_address_mode |                                                      |
 | ipv6_ra_mode      |                                                      |
 | name              | extsubnet                                            |
 | network_id        | 55f9c4d0-a2ce-462c-95ab-c9179b1db930                 |
 | project_id        | 6edc32da421e4c6694c8c071c27f3bd4                     |
 | revision_number   | 0                                                    |
 | service_types     |                                                      |
 | subnetpool_id     |                                                      |
 | tags              |                                                      |
 | tenant_id         | 6edc32da421e4c6694c8c071c27f3bd4                     |
 | updated_at        | 2021-05-11T17:19:21Z                                 |
 +-------------------+------------------------------------------------------+

3.openstack创建内部网络

在openstack私有云平台上,通过使用命令创建云主机内网int,子网intsubnet,虚拟机子网 IP 网段为10.10.0.0/24,网关为10.10.x.1。

[root@controller ~]# neutron net-create int
 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
 Created a new network:
 +---------------------------+--------------------------------------+
 | Field                     | Value                                |
 +---------------------------+--------------------------------------+
 | admin_state_up            | True                                 |
 | availability_zone_hints   |                                      |
 | availability_zones        |                                      |
 | created_at                | 2021-05-11T17:19:43Z                 |
 | description               |                                      |
 | id                        | 31ad78b3-b5e3-41cb-adcb-0de351061ab1 |
 | ipv4_address_scope        |                                      |
 | ipv6_address_scope        |                                      |
 | is_default                | False                                |
 | mtu                       | 1450                                 |
 | name                      | int                                  |
 | port_security_enabled     | True                                 |
 | project_id                | 6edc32da421e4c6694c8c071c27f3bd4     |
 | provider:network_type     | vxlan                                |
 | provider:physical_network |                                      |
 | provider:segmentation_id  | 53                                   |
 | revision_number           | 2                                    |
 | router:external           | False                                |
 | shared                    | False                                |
 | status                    | ACTIVE                               |
 | subnets                   |                                      |
 | tags                      |                                      |
 | tenant_id                 | 6edc32da421e4c6694c8c071c27f3bd4     |
 | updated_at                | 2021-05-11T17:19:43Z                 |
 +---------------------------+--------------------------------------+

4.openstack创建内部网络子网

[root@controller ~]# neutron subnet-create --name intsubnet --gateway 10.10.0.1 --enable-dhcp --ip-version 4 int 10.10.0.0/24
 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
 Created a new subnet:
 +-------------------+----------------------------------------------+
 | Field             | Value                                        |
 +-------------------+----------------------------------------------+
 | allocation_pools  | {"start": "10.10.0.2", "end": "10.10.0.254"} |
 | cidr              | 10.10.0.0/24                                 |
 | created_at        | 2021-05-11T17:20:14Z                         |
 | description       |                                              |
 | dns_nameservers   |                                              |
 | enable_dhcp       | True                                         |
 | gateway_ip        | 10.10.0.1                                    |
 | host_routes       |                                              |
 | id                | 82072c0f-80ab-4f7d-be18-7acd34ccddf2         |
 | ip_version        | 4                                            |
 | ipv6_address_mode |                                              |
 | ipv6_ra_mode      |                                              |
 | name              | intsubnet                                    |
 | network_id        | 31ad78b3-b5e3-41cb-adcb-0de351061ab1         |
 | project_id        | 6edc32da421e4c6694c8c071c27f3bd4             |
 | revision_number   | 0                                            |
 | service_types     |                                              |
 | subnetpool_id     |                                              |
 | tags              |                                              |
 | tenant_id         | 6edc32da421e4c6694c8c071c27f3bd4             |
 | updated_at        | 2021-05-11T17:20:14Z                         |
 +-------------------+----------------------------------------------+

5.openstack创建路由及端口添加

添加名为 ext-router 的路由器,配置路由接口地址,完成内网子网和外部网络的连通

 [root@controller ~]# neutron router-create ext-router
 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
 Created a new router:
 +-------------------------+--------------------------------------+
 | Field                   | Value                                |
 +-------------------------+--------------------------------------+
 | admin_state_up          | True                                 |
 | availability_zone_hints |                                      |
 | availability_zones      |                                      |
 | created_at              | 2021-05-11T17:20:52Z                 |
 | description             |                                      |
 | distributed             | False                                |
 | external_gateway_info   |                                      |
 | flavor_id               |                                      |
 | ha                      | False                                |
 | id                      | 335bf3a2-7918-4aed-9613-d17a66528e8c |
 | name                    | ext-router                           |
 | project_id              | 6edc32da421e4c6694c8c071c27f3bd4     |
 | revision_number         | 1                                    |
 | routes                  |                                      |
 | status                  | ACTIVE                               |
 | tags                    |                                      |
 | tenant_id               | 6edc32da421e4c6694c8c071c27f3bd4     |
 | updated_at              | 2021-05-11T17:20:52Z                 |
 +-------------------------+--------------------------------------+

添加端口

#此处添加路由网关使用的外部网络ID

[root@controller ~]# neutron router-gateway-set ext-router 55f9c4d0-a2ce-462c-95ab-c9179b1db930
 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
 Set gateway for router ext-router


#此处添加路由接口使用的内部网络子网的ID ​

 [root@controller ~]# neutron router-interface-add ext-router 82072c0f-80ab-4f7d-be18-7acd34ccddf2  neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.  Added interface 075fa474-0b1d-427c-8891-00ef7fe38ed8 to router ext-router.

6.openstack创建安全组

 [root@controller ~]# openstack security group rule create --ingress --protocol icmp default
 +-------------------+--------------------------------------+
 | Field             | Value                                |
 +-------------------+--------------------------------------+
 | created_at        | 2021-05-11T19:42:46Z                 |
 | description       |                                      |
 | direction         | ingress                              |
 | ether_type        | IPv4                                 |
 | id                | 6cd11ead-177b-4f68-9f77-6cdd885f9d40 |
 | name              | None                                 |
 | port_range_max    | None                                 |
 | port_range_min    | None                                 |
 | project_id        | 6edc32da421e4c6694c8c071c27f3bd4     |
 | protocol          | icmp                                 |
 | remote_group_id   | None                                 |
 | remote_ip_prefix  | 0.0.0.0/0                            |
 | revision_number   | 0                                    |
 | security_group_id | 8d0e17a4-d214-46e9-81fb-4385670df7b8 |
 | updated_at        | 2021-05-11T19:42:46Z                 |
 +-------------------+--------------------------------------+
 [root@controller ~]# openstack security group rule create --ingress --protocol icmp default
 +-------------------+--------------------------------------+
 | Field             | Value                                |
 +-------------------+--------------------------------------+
 | created_at        | 2021-05-11T19:42:28Z                 |
 | description       |                                      |
 | direction         | egress                               |
 | ether_type        | IPv4                                 |
 | id                | c47d8f7e-770c-4f2e-90f4-2d604556d33f |
 | name              | None                                 |
 | port_range_max    | None                                 |
 | port_range_min    | None                                 |
 | project_id        | 6edc32da421e4c6694c8c071c27f3bd4     |
 | protocol          | icmp                                 |
 | remote_group_id   | None                                 |
 | remote_ip_prefix  | 0.0.0.0/0                            |
 | revision_number   | 0                                    |
 | security_group_id | 8d0e17a4-d214-46e9-81fb-4385670df7b8 |
 | updated_at        | 2021-05-11T19:42:28Z                 |
 +-------------------+--------------------------------------+
 ​
 [root@controller ~]# openstack security group rule create --ingress --protocol tcp --dst-port 1:65535 default
 +-------------------+--------------------------------------+
 | Field             | Value                                |
 +-------------------+--------------------------------------+
 | created_at        | 2021-05-11T19:52:50Z                 |
 | description       |                                      |
 | direction         | ingress                              |
 | ether_type        | IPv4                                 |
 | id                | 50cbf6c2-d8b7-423e-99db-2e0facc58f13 |
 | name              | None                                 |
 | port_range_max    | 65535                                |
 | port_range_min    | 1                                    |
 | project_id        | 6edc32da421e4c6694c8c071c27f3bd4     |
 | protocol          | tcp                                  |
 | remote_group_id   | None                                 |
 | remote_ip_prefix  | 0.0.0.0/0                            |
 | revision_number   | 0                                    |
 | security_group_id | 8d0e17a4-d214-46e9-81fb-4385670df7b8 |
 | updated_at        | 2021-05-11T19:52:50Z                 |
 +-------------------+--------------------------------------+
 [root@controller ~]# openstack security group rule create --egress --protocol tcp --dst-port 1:65535 default
 +-------------------+--------------------------------------+
 | Field             | Value                                |
 +-------------------+--------------------------------------+
 | created_at        | 2021-05-11T19:54:22Z                 |
 | description       |                                      |
 | direction         | egress                               |
 | ether_type        | IPv4                                 |
 | id                | af14cf9f-fb0c-45ae-94e1-a1ccce6b099a |
 | name              | None                                 |
 | port_range_max    | 65535                                |
 | port_range_min    | 1                                    |
 | project_id        | 6edc32da421e4c6694c8c071c27f3bd4     |
 | protocol          | tcp                                  |
 | remote_group_id   | None                                 |
 | remote_ip_prefix  | 0.0.0.0/0                            |
 | revision_number   | 0                                    |
 | security_group_id | 8d0e17a4-d214-46e9-81fb-4385670df7b8 |
 | updated_at        | 2021-05-11T19:54:22Z                 |
 +-------------------+--------------------------------------+
[root@controller ~]# openstack security group rule create --ingress --protocol udp --dst-port 1:65535 default
 +-------------------+--------------------------------------+
 | Field             | Value                                |
 +-------------------+--------------------------------------+
 | created_at        | 2021-05-11T19:55:16Z                 |
 | description       |                                      |
 | direction         | ingress                              |
 | ether_type        | IPv4                                 |
 | id                | 2194ded7-c0f9-4e86-a48d-74268f623ebe |
 | name              | None                                 |
 | port_range_max    | 65535                                |
 | port_range_min    | 1                                    |
 | project_id        | 6edc32da421e4c6694c8c071c27f3bd4     |
 | protocol          | udp                                  |
 | remote_group_id   | None                                 |
 | remote_ip_prefix  | 0.0.0.0/0                            |
 | revision_number   | 0                                    |
 | security_group_id | 8d0e17a4-d214-46e9-81fb-4385670df7b8 |
 | updated_at        | 2021-05-11T19:55:16Z                 |
 +-------------------+--------------------------------------+
 

7.glance上传镜像

上传CentOS_7.5_x86_64.qcow2文件到controller节点,并在openstack私有云平台上,使用glance相关命令上传镜像,镜像源为CentOS_7.5_x86_64.qcow2

 [root@controller ~]# glance image-create --name "centos" --disk-format qcow2 --container-format bare --progress < CentOS_7.5_x86_64_XD.qcow2 
 [=============================>] 100%
 +------------------+--------------------------------------+
 | Property         | Value                                |
 +------------------+--------------------------------------+
 | checksum         | 3d3e9c954351a4b6953fd156f0c29f5c     |
 | container_format | bare                                 |
 | created_at       | 2021-05-11T17:25:10Z                 |
 | disk_format      | qcow2                                |
 | id               | 582fb71d-591a-4afa-b753-a5ec55776802 |
 | min_disk         | 0                                    |
 | min_ram          | 0                                    |
 | name             | centos                               |
 | owner            | 6edc32da421e4c6694c8c071c27f3bd4     |
 | protected        | False                                |
 | size             | 510459904                            |
 | status           | active                               |
 | tags             | []                                   |
 | updated_at       | 2021-05-11T17:25:12Z                 |
 | virtual_size     | None                                 |
 | visibility       | shared                               |
 +------------------+--------------------------------------+

8.nova创建云主机类型

在openstack私有云平台上,使用命令创建名为 test、内存为 2048MB、硬盘为50GB、虚拟内核数量为2的云主机类型。

[root@controller ~]# nova flavor-create test 1999 2048 50 2
+------+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID   | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description |
+------+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1999 | test | 2048      | 50   | 0         |      | 2     | 1.0         | True      | -           |
+------+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+

9.nova创建云主机

[root@controller ~]# nova boot --flavor test --image 582fb71d-591a-4afa-b753-a5ec55776802 --nic net-id=31ad78b3-b5e3-41cb-adcb-0de351061ab1 VM1
+--------------------------------------+-----------------------------------------------+
| Property                             | Value                                         |
+--------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                        |
| OS-EXT-AZ:availability_zone          |                                               |
| OS-EXT-SRV-ATTR:host                 | -                                             |
| OS-EXT-SRV-ATTR:hostname             | vm1                                           |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                             |
| OS-EXT-SRV-ATTR:instance_name        |                                               |
| OS-EXT-SRV-ATTR:kernel_id            |                                               |
| OS-EXT-SRV-ATTR:launch_index         | 0                                             |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                               |
| OS-EXT-SRV-ATTR:reservation_id       | r-9qy1jss2                                    |
| OS-EXT-SRV-ATTR:root_device_name     | -                                             |
| OS-EXT-SRV-ATTR:user_data            | -                                             |
| OS-EXT-STS:power_state               | 0                                             |
| OS-EXT-STS:task_state                | scheduling                                    |
| OS-EXT-STS:vm_state                  | building                                      |
| OS-SRV-USG:launched_at               | -                                             |
| OS-SRV-USG:terminated_at             | -                                             |
| accessIPv4                           |                                               |
| accessIPv6                           |                                               |
| adminPass                            | y22qpvQQ6tfv                                  |
| config_drive                         |                                               |
| created                              | 2021-05-11T20:02:20Z                          |
| description                          | -                                             |
| flavor:disk                          | 50                                            |
| flavor:ephemeral                     | 0                                             |
| flavor:extra_specs                   | {}                                            |
| flavor:original_name                 | test                                          |
| flavor:ram                           | 2048                                          |
| flavor:swap                          | 0                                             |
| flavor:vcpus                         | 2                                             |
| hostId                               |                                               |
| host_status                          |                                               |
| id                                   | 0e0eeef7-945f-4de5-8ec3-d96e37e2ffbc          |
| image                                | centos (582fb71d-591a-4afa-b753-a5ec55776802) |
| key_name                             | -                                             |
| locked                               | False                                         |
| metadata                             | {}                                            |
| name                                 | VM1                                           |
| os-extended-volumes:volumes_attached | []                                            |
| progress                             | 0                                             |
| security_groups                      | default                                       |
| status                               | BUILD                                         |
| tags                                 | []                                            |
| tenant_id                            | 6edc32da421e4c6694c8c071c27f3bd4              |
| updated                              | 2021-05-11T20:02:20Z                          |
| user_id                              | afcc4fb7841a460ca65c86a8241a8c0b              |
+--------------------------------------+-----------------------------------------------+
[root@controller ~]# nova list
+--------------------------------------+------+--------+------------+-------------+-------------------+
| ID                                   | Name | Status | Task State | Power State | Networks          |
+--------------------------------------+------+--------+------------+-------------+-------------------+
| 0e0eeef7-945f-4de5-8ec3-d96e37e2ffbc | VM1  | ACTIVE | -          | Running     | pvm_int=10.10.0.3 |
+--------------------------------------+------+--------+------------+-------------+-------------------+

10.openstack创建绑定浮动IP

#通过外部网络创建浮动IP

[root@controller ~]# openstack floating ip create ext
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2021-05-11T20:10:09Z                 |
| description         |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 192.168.200.7                        |
| floating_network_id | 55f9c4d0-a2ce-462c-95ab-c9179b1db930 |
| id                  | 3411d93f-2761-49fe-942f-06df6a92693b |
| name                | 192.168.200.7                        |
| port_id             | None                                 |
| project_id          | 6edc32da421e4c6694c8c071c27f3bd4     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| updated_at          | 2021-05-11T20:10:09Z                 |
+---------------------+--------------------------------------+

[root@controller ~]# openstack floating ip list
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
| ID                                   | Floating IP Address | Fixed IP Address | Port | Floating Network                     | Project                          |
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
| 3411d93f-2761-49fe-942f-06df6a92693b | 192.168.200.7       | None             | None | 55f9c4d0-a2ce-462c-95ab-c9179b1db930 | 6edc32da421e4c6694c8c071c27f3bd4 |
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+

11.openstack绑定浮动IP至云主机

[root@controller ~]# openstack server add floating ip 0e0eeef7-945f-4de5-8ec3-d96e37e2ffbc 192.168.200.7

[root@controller ~]# nova show 0e0eeef7-945f-4de5-8ec3-d96e37e2ffbc
+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | nova                                                     |
| OS-EXT-SRV-ATTR:host                 | compute                                                  |
| OS-EXT-SRV-ATTR:hostname             | vm1                                                      |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | compute                                                  |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000001                                        |
| OS-EXT-SRV-ATTR:kernel_id            |                                                          |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                        |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                          |
| OS-EXT-SRV-ATTR:reservation_id       | r-9qy1jss2                                               |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                 |
| OS-EXT-SRV-ATTR:user_data            | -                                                        |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2021-05-11T20:04:44.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2021-05-11T20:02:20Z                                     |
| description                          | -                                                        |
| flavor:disk                          | 50                                                       |
| flavor:ephemeral                     | 0                                                        |
| flavor:extra_specs                   | {}                                                       |
| flavor:original_name                 | test                                                     |
| flavor:ram                           | 2048                                                     |
| flavor:swap                          | 0                                                        |
| flavor:vcpus                         | 2                                                        |
| hostId                               | e838000031557cc2bc4f0d82c4caea4727a08d3fe150052475372f0b |
| host_status                          | UP                                                       |
| id                                   | 0e0eeef7-945f-4de5-8ec3-d96e37e2ffbc                     |
| image                                | centos (582fb71d-591a-4afa-b753-a5ec55776802)            |
| key_name                             | -                                                        |
| locked                               | False                                                    |
| metadata                             | {}                                                       |
| name                                 | VM1                                                      |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| pvm_int network                      | 10.10.0.3, 192.168.200.7                                 |
| security_groups                      | default                                                  |
| status                               | ACTIVE                                                   |
| tags                                 | []                                                       |
| tenant_id                            | 6edc32da421e4c6694c8c071c27f3bd4                         |
| updated                              | 2021-05-11T20:04:44Z                                     |
| user_id                              | afcc4fb7841a460ca65c86a8241a8c0b                         |
+--------------------------------------+----------------------------------------------------------+

12.cinder创建卷组

 [root@controller ~]# cinder type-create lvm
 +--------------------------------------+------+-------------+-----------+
 | ID                                   | Name | Description | Is_Public |
 +--------------------------------------+------+-------------+-----------+
 | 8e80b969-b368-4bea-943a-e3d032e43afc | lvm  | -           | True      |
 +--------------------------------------+------+-------------+-----------+
 [root@controller ~]# cinder create --name block --volume-type lvm 10
 +--------------------------------+--------------------------------------+
 | Property                       | Value                                |
 +--------------------------------+--------------------------------------+
 | attachments                    | []                                   |
 | availability_zone              | nova                                 |
 | bootable                       | false                                |
 | consistencygroup_id            | None                                 |
 | created_at                     | 2021-05-11T20:20:30.000000           |
 | description                    | None                                 |
 | encrypted                      | False                                |
 | id                             | 912e1596-d745-49e1-a38a-c53613aa0b56 |
 | metadata                       | {}                                   |
 | migration_status               | None                                 |
 | multiattach                    | False                                |
 | name                           | block                                |
 | os-vol-host-attr:host          | None                                 |
 | os-vol-mig-status-attr:migstat | None                                 |
 | os-vol-mig-status-attr:name_id | None                                 |
 | os-vol-tenant-attr:tenant_id   | 6edc32da421e4c6694c8c071c27f3bd4     |
 | replication_status             | None                                 |
 | size                           | 10                                   |
 | snapshot_id                    | None                                 |
 | source_volid                   | None                                 |
 | status                         | creating                             |
 | updated_at                     | None                                 |
 | user_id                        | afcc4fb7841a460ca65c86a8241a8c0b     |
 | volume_type                    | lvm                                  |
 +--------------------------------+--------------------------------------+
 [root@controller ~]# cinder list
 +--------------------------------------+-----------+-------+------+-------------+----------+-------------+
 | ID                                   | Status    | Name  | Size | Volume Type | Bootable | Attached to |
 +--------------------------------------+-----------+-------+------+-------------+----------+-------------+
 | 912e1596-d745-49e1-a38a-c53613aa0b56 | available | block | 10   | lvm         | false    |             |
 +--------------------------------------+-----------+-------+------+-------------+----------+-------------+

13.openstack添加卷至云主机

[root@controller ~]# openstack server add volume VM1 912e1596-d745-49e1-a38a-c53613aa0b56
 [root@controller ~]# cinder show 912e1596-d745-49e1-a38a-c53613aa0b56
 +--------------------------------+------------------------------------------+
 | Property                       | Value                                    |
 +--------------------------------+------------------------------------------+
 | attached_servers               | ['0e0eeef7-945f-4de5-8ec3-d96e37e2ffbc'] |
 | attachment_ids                 | ['e13f0dfe-178d-4aac-9a14-a5881f09953c'] |
 | availability_zone              | nova                                     |
 | bootable                       | false                                    |
 | consistencygroup_id            | None                                     |
 | created_at                     | 2021-05-11T20:20:30.000000               |
 | description                    | None                                     |
 | encrypted                      | False                                    |
 | id                             | 912e1596-d745-49e1-a38a-c53613aa0b56     |
 | metadata                       | attached_mode : rw                       |
 | migration_status               | None                                     |
 | multiattach                    | False                                    |
 | name                           | block                                    |
 | os-vol-host-attr:host          | compute@lvm#LVM                          |
 | os-vol-mig-status-attr:migstat | None                                     |
 | os-vol-mig-status-attr:name_id | None                                     |
 | os-vol-tenant-attr:tenant_id   | 6edc32da421e4c6694c8c071c27f3bd4         |
 | replication_status             | None                                     |
 | size                           | 10                                       |
 | snapshot_id                    | None                                     |
 | source_volid                   | None                                     |
 | status                         | in-use                                   |
 | updated_at                     | 2021-05-11T20:29:05.000000               |
 | user_id                        | afcc4fb7841a460ca65c86a8241a8c0b         |
 | volume_type                    | lvm                                      |
 +--------------------------------+------------------------------------------+

运维就像是绿叶,没有绿叶的衬托,花儿始终是残缺的美!

没有Error就是最好的消息。

  • 11
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值