【OpenStack】菜鸟学OpenStack之部署Train(14)

时间:2024-10-13 09:43:32

菜鸟学OpenStack之部署Train(14)

  • 创建虚拟机实例测试
    • 创建虚拟网络
      • Provider Network
      • 创建public network
    • 创建类型模板(Flavor)
    • 创建密钥对(Key Pair)
    • 创建安全组规则(Security Group)
    • 创建虚拟机实例
    • 创建块存储
    • 遇到的问题
    • 参考资料

创建虚拟机实例测试

为了真正学习OpenStack,我们在之前搭建好的OpenStack云环境中创建虚拟机实例,对其功能进行测试,同时也学习如何使用OpenStack。
以下操作均在控制节点上执行,并从5个部分进行测试。

创建虚拟网络

在创建虚拟机实例之前,需要一个合适的网络架构

Provider Network

Provider Network 是由 OpenStack 管理员创建的,直接对应于数据中心的已有物理网络的一个网段。这种网络有三个和物理网络有关属性:

  • provider:network_type (网络类型,包括 vxlan, gre, vlan, flat, local)
  • provider:segmentation_id (网段 ID, 比如 VLAN 的 802.1q tag, GRE 网络的 Tunnel ID, VXLAN 网络的 VNI)
  • provider:physical_network (物理网络的逻辑名称,比如 physnet1, ph-eth1, etc)

这种网络是可以在多个租户之间共享的。这种网络通过计算和网络节点上指定的 bridge 直接接入物理网络,所以默认的情况下它们是可以路由的,因此也不需要接入Neutron Virtual Router,也不需要使用L3 agent。使用这种网络,必须预先在各计算和网络节点上配置指定的网桥

虽然可以创建 GRE 和 VXLAN 类型的 Provider network, 但是**(个人认为)Provider network 只对 Flat 和 VLAN 类型的网络才有意义**,因为Provider network的一个重要属性是provider:physical_network,而这个参数对其他网络类型没有有意义。

创建 provider network:

  • local 类型的:neutron net-create NAME --provider:network_type local
  • flat 类型的:neutron net-create NAME --provider:network_type flat --provider:physical_network PHYS_NET_NAME
  • vlan 类型的:neutron net-create NAME --provider:network_type vlan --provider:physical_network PHYS_NET_NAME --provider:segmentation_id VID
  • gre 类型的:neutron net-create NAME --provider:network_type gre --provider:segmentation_id TUNNEL_ID
  • vxlan 类型的:neutron net-create NAME --provider:network_type vxlan --provider:segmentation_id TUNNEL_ID

Public Provider Network为虚拟机实例提供了基于Layer 2(桥接和交换网络信息)的虚拟网络,虚拟网络中的DHCP为虚拟机实例提供了IP地址。
admin或其他特权用户必须创建此网络,因为它直接连接到物理网络基础结构。
下面是Public Provider Network的全局视图
Public Provider Networks全局视图
下面是Public Provider Network的网络连接图
Public Provider Network网络连接图

创建public network

  1. 在控制节点上,导入admin的用户凭据
[root@controller openstack]# source 
  • 1
  1. 创建网络
[root@controller openstack]# openstack network create --share --external --provider-physical-network provider --provider-network-type flat provider
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field                     | Value                                                                                                                                                   |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up            | UP                                                                                                                                                      |
| availability_zone_hints   |                                                                                                                                                         |
| availability_zones        |                                                                                                                                                         |
| created_at                | 2021-01-11T07:08:16Z                                                                                                                                    |
| description               |                                                                                                                                                         |
| dns_domain                | None                                                                                                                                                    |
| id                        | ffead491-c5be-416a-8a47-14a8dfec8d54                                                                                                                    |
| ipv4_address_scope        | None                                                                                                                                                    |
| ipv6_address_scope        | None                                                                                                                                                    |
| is_default                | None                                                                                                                                                    |
| is_vlan_transparent       | None                                                                                                                                                    |
| location                  | cloud='', project.domain_id=, project.domain_name='Default', ='ad9bee2960ab4ba39ebbe9ee0fbba3b7', ='admin', region_name='', zone= |
| mtu                       | 1500                                                                                                                                                    |
| name                      | provider                                                                                                                                                |
| port_security_enabled     | True                                                                                                                                                    |
| project_id                | ad9bee2960ab4ba39ebbe9ee0fbba3b7                                                                                                                        |
| provider:network_type     | flat                                                                                                                                                    |
| provider:physical_network | provider                                                                                                                                                |
| provider:segmentation_id  | None                                                                                                                                                    |
| qos_policy_id             | None                                                                                                                                                    |
| revision_number           | 1                                                                                                                                                       |
| router:external           | External                                                                                                                                                |
| segments                  | None                                                                                                                                                    |
| shared                    | True                                                                                                                                                    |
| status                    | ACTIVE                                                                                                                                                  |
| subnets                   |                                                                                                                                                         |
| tags                      |                                                                                                                                                         |
| updated_at                | 2021-01-11T07:08:16Z                                                                                                                                    |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

参数解释:
–share 允许所有project使用该虚拟网络
–external 将虚拟网络定义为外部,如果想创建一个内部网络,则可以使用–internal。默认值为internal
–provider-physical-network provider 指明物理网络的提供者,provider 与下面neutron的配置文件对应,其中provider是标签,可以更改为其他,但是2个地方必须要统一
配置文件/etc/neutron/plugins/ml2/ml2_conf.ini中的参数
[ml2_type_flat]
flat_networks = provider
配置文件/etc/neutron/plugins/ml2/linuxbridge_agent.ini中的参数
[linux_bridge]
physical_interface_mappings = provider:ens35
–provider-network-type flat 指明这里创建的网络是flat类型,即实例连接到此网络时和物理网络是在同一个网段,无vlan等功能。
最后输入的provider指定网络的名称

  1. 创建子网192.168.0.0/24,网关192.168.0.254,DHCP服务器在192.168.0.101~192.168.0.200地址段内给虚拟机实例分配IP地址
[root@controller openstack]# openstack subnet create --network provider --allocation-pool start=192.168.0.101,end=192.      168.0.200 --dns-nameserver 223.5.5.5 --gateway 192.168.0.254 --subnet-range 192.168.0.0/24 provider
+-------------------+-------------------------------------------------------------------------------------------------      --------------------------------------------------------+
| Field             | Value                                                                                                                                                         |
+-------------------+-------------------------------------------------------------------------------------------------      --------------------------------------------------------+
| allocation_pools  | 192.168.0.101-192.168.0.200                                                                                                                                   |
| cidr              | 192.168.0.0/24                                                                                                                                                |
| created_at        | 2021-01-11T07:21:41Z                                                                                                                                          |
| description       |                                                                                                                                                               |
| dns_nameservers   | 223.5.5.5                                                                                                                                                     |
| enable_dhcp       | True                                                                                                                                                          |
| gateway_ip        | 192.168.0.254                                                                                                                                                 |
| host_routes       |                                                                                                                                                               |
| id                | 569c6309-33e1-4aaa-bdf3-cf011188f8ed                                                                                                                          |
| ip_version        | 4                                                                                                                                                             |
| ipv6_address_mode | None                                                                                                                                                          |
| ipv6_ra_mode      | None                                                                                                                                                          |
| location          | cloud='', project.domain_id=, project.domain_name='Default', ='ad9bee2960ab4ba39ebbe9e      e0fbba3b7', ='admin', region_name='', zone= |
| name              | provider                                                                                                                                                      |
| network_id        | ffead491-c5be-416a-8a47-14a8dfec8d54                                                                                                                          |
| prefix_length     | None                                                                                                                                                          |
| project_id        | ad9bee2960ab4ba39ebbe9ee0fbba3b7                                                                                                                              |
| revision_number   | 0                                                                                                                                                             |
| segment_id        | None                                                                                                                                                          |
| service_types     |                                                                                                                                                               |
| subnetpool_id     | None                                                                                                                                                          |
| tags              |                                                                                                                                                               |
| updated_at        | 2021-01-11T07:21:41Z                                                                                                                                          |
+-------------------+-------------------------------------------------------------------------------------------------      --------------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

参数解释:
–network provider 指定父网络
–allocation-pool start=192.168.0.101,end=192.168.0.200 指定子网的起始地址和终止地址
–dns-nameserver 223.5.5.5 指定DNS服务器地址
–gateway 192.168.0.254 指定网关地址
–subnet-range 192.168.0.0/24 指定子网的网段
最后的provider 指定子网的名称

  1. 查看创建的网络和子网
[root@controller openstack]# openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID                                   | Name     | Subnets                              |
+--------------------------------------+----------+--------------------------------------+
| ffead491-c5be-416a-8a47-14a8dfec8d54 | provider | 569c6309-33e1-4aaa-bdf3-cf011188f8ed |
+--------------------------------------+----------+--------------------------------------+
[root@controller openstack]# openstack subnet list
+--------------------------------------+----------+--------------------------------------+----------------+
| ID                                   | Name     | Network                              | Subnet         |
+--------------------------------------+----------+--------------------------------------+----------------+
| 569c6309-33e1-4aaa-bdf3-cf011188f8ed | provider | ffead491-c5be-416a-8a47-14a8dfec8d54 | 192.168.0.0/24 |
+--------------------------------------+----------+--------------------------------------+----------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

创建类型模板(Flavor)

Flavor:类型模板,虚机硬件模板被称为类型模板,包括RAM和硬盘大小,CPU核数等。

  1. 创建一台1核cpu 128M硬盘的类型模板与CirrOS映像一起使用进行测试
[root@controller openstack]# openstack flavor create --id 0 --vcpus 1 --ram 128 --disk 1 
+----------------------------+---------+
| Field                      | Value   |
+----------------------------+---------+
| OS-FLV-DISABLED:disabled   | False   |
| OS-FLV-EXT-DATA:ephemeral  | 0       |
| disk                       | 1       |
| id                         | 0       |
| name                       |  |
| os-flavor-access:is_public | True    |
| properties                 |         |
| ram                        | 128     |
| rxtx_factor                | 1.0     |
| swap                       |         |
| vcpus                      | 1       |
+----------------------------+---------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  1. 查看创建的类型模板
[root@controller openstack]# openstack flavor list
+----+---------+-----+------+-----------+-------+-----------+
| ID | Name    | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+---------+-----+------+-----------+-------+-----------+
| 0  |  | 128 |    1 |         0 |     1 | True      |
+----+---------+-----+------+-----------+-------+-----------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

创建密钥对(Key Pair)

大部分OpenStack云镜像都支持公钥认证而不是传统的密码认证,因此在创建虚拟机实例之前,必须为Nova计算服务添加一个公钥,而私钥在文档开始时的配置基础环境中已经生成,所以可以直接添加。

[root@controller openstack]# source 
[root@controller openstack]# ssh-keygen -q -N ""
Enter file in which to save the key (/root/.ssh/id_rsa):
[root@controller openstack]# openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
+-------------+-------------------------------------------------+
| Field       | Value                                           |
+-------------+-------------------------------------------------+
| fingerprint | d1:a3:d0:d5:40:46:19:57:da:09:ca:19:2f:fc:87:3f |
| name        | mykey                                           |
| user_id     | 6c23d5d4a0754dd5938d48652fb67f1d                |
+-------------+-------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

查看创建的密钥对

[root@controller openstack]# openstack keypair list
+-------+-------------------------------------------------+
| Name  | Fingerprint                                     |
+-------+-------------------------------------------------+
| mykey | d1:a3:d0:d5:40:46:19:57:da:09:ca:19:2f:fc:87:3f |
+-------+-------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

创建安全组规则(Security Group)

在OpenStack环境中包含一个默认的Security Group,默认所有的虚拟机实例都可以使用它,但是默认的Security Group规则是拒绝一切访问,对于CirrOS之类的Linux镜像,建议至少允许ICMP(ping)和ssh两项功能。

  1. 对默认的Security Group添加ICMP协议(ping命令)
[root@controller openstack]# openstack security group rule create --proto icmp default
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field             | Value                                                                                                                                                  |
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at        | 2021-01-11T07:55:24Z                                                                                                                                   |
| description       |                                                                                                                                                        |
| direction         | ingress                                                                                                                                                |
| ether_type        | IPv4                                                                                                                                                   |
| id                | 40fb37b6-d958-44d4-9dae-90eafb392cfa                                                                                                                   |
| location          | cloud='', project.domain_id=, project.domain_name='Default', ='82435bbf568b4eddb33b79024ae8bd22', ='demo', region_name='', zone= |
| name              | None                                                                                                                                                   |
| port_range_max    | None                                                                                                                                                   |
| port_range_min    | None                                                                                                                                                   |
| project_id        | 82435bbf568b4eddb33b79024ae8bd22                                                                                                                       |
| protocol          | icmp                                                                                                                                                   |
| remote_group_id   | None                                                                                                                                                   |
| remote_ip_prefix  | 0.0.0.0/0                                                                                                                                              |
| revision_number   | 0                                                                                                                                                      |
| security_group_id | 79ee9f23-f186-4127-8c49-26d78b12107b                                                                                                                   |
| tags              | []                                                                                                                                                     |
| updated_at        | 2021-01-11T07:55:24Z                                                                                                                                   |
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  1. 对默认的Security Group添加SSH访问
[root@controller openstack]# openstack security group rule create --proto tcp --dst-port 22 default
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field             | Value                                                                                                                                                  |
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at        | 2021-01-11T07:56:24Z                                                                                                                                   |
| description       |                                                                                                                                                        |
| direction         | ingress                                                                                                                                                |
| ether_type        | IPv4                                                                                                                                                   |
| id                | 9531febb-3fcf-438d-b86e-a44fda474e6a                                                                                                                   |
| location          | cloud='', project.domain_id=, project.domain_name='Default', ='82435bbf568b4eddb33b79024ae8bd22', ='demo', region_name='', zone= |
| name              | None                                                                                                                                                   |
| port_range_max    | 22                                                                                                                                                     |
| port_range_min    | 22                                                                                                                                                     |
| project_id        | 82435bbf568b4eddb33b79024ae8bd22                                                                                                                       |
| protocol          | tcp                                                                                                                                                    |
| remote_group_id   | None                                                                                                                                                   |
| remote_ip_prefix  | 0.0.0.0/0                                                                                                                                              |
| revision_number   | 0                                                                                                                                                      |
| security_group_id | 79ee9f23-f186-4127-8c49-26d78b12107b                                                                                                                   |
| tags              | []                                                                                                                                                     |
| updated_at        | 2021-01-11T07:56:24Z                                                                                                                                   |
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  1. 查看安全组
[root@controller openstack]# openstack security group list
+--------------------------------------+---------+------------------------+----------------------------------+------+
| ID                                   | Name    | Description            | Project                          | Tags |
+--------------------------------------+---------+------------------------+----------------------------------+------+
| 79ee9f23-f186-4127-8c49-26d78b12107b | default | Default security group | 82435bbf568b4eddb33b79024ae8bd22 | []   |
+--------------------------------------+---------+------------------------+----------------------------------+------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 查看安全组规则
[root@controller openstack]# openstack security group rule list
+--------------------------------------+-------------+-----------+-----------+------------+--------------------------------------+--------------------------------------+
| ID                                   | IP Protocol | Ethertype | IP Range  | Port Range | Remote Security Group                | Security Group                       |
+--------------------------------------+-------------+-----------+-----------+------------+--------------------------------------+--------------------------------------+
| 1622558a-1662-493e-aa43-aca42504bf63 | None        | IPv4      | 0.0.0.0/0 |            | None                                 | 79ee9f23-f186-4127-8c49-26d78b12107b |
| 40fb37b6-d958-44d4-9dae-90eafb392cfa | icmp        | IPv4      | 0.0.0.0/0 |            | None                                 | 79ee9f23-f186-4127-8c49-26d78b12107b |
| 88ae36a5-2116-4668-b395-82582bdce05e | None        | IPv4      | 0.0.0.0/0 |            | 79ee9f23-f186-4127-8c49-26d78b12107b | 79ee9f23-f186-4127-8c49-26d78b12107b |
| 89b5554b-ed1d-4b28-b5c0-9879fa720155 | None        | IPv6      | ::/0      |            | 79ee9f23-f186-4127-8c49-26d78b12107b | 79ee9f23-f186-4127-8c49-26d78b12107b |
| 9531febb-3fcf-438d-b86e-a44fda474e6a | tcp         | IPv4      | 0.0.0.0/0 | 22:22      | None                                 | 79ee9f23-f186-4127-8c49-26d78b12107b |
| a71e95a3-bac2-4322-b9ed-eaf2507d46d6 | None        | IPv6      | ::/0      |            | None                                 | 79ee9f23-f186-4127-8c49-26d78b12107b |
+--------------------------------------+-------------+-----------+-----------+------------+--------------------------------------+--------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

创建虚拟机实例

在创建虚拟机实例之前,首先需要确定Flavor(主机类型)、Image Name(镜像名称)、Neutron(网络)、Security Group(安全组)、Key Pair和Instance Name(虚拟机实例名称)。

  1. 在控制节点上加载demo用户的环境变量
[root@controller openstack]# source 
  • 1
  1. 列出可用的Flavor
[root@controller openstack]# openstack flavor list
+----+---------+-----+------+-----------+-------+-----------+
| ID | Name    | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+---------+-----+------+-----------+-------+-----------+
| 0  |  | 128 |    1 |         0 |     1 | True      |
+----+---------+-----+------+-----------+-------+-----------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 列出有效的Image
[root@controller openstack]# openstack image list
+--------------------------------------+--------------+--------+
| ID                                   | Name         | Status |
+--------------------------------------+--------------+--------+
| 0aa979dd-7483-439f-ac14-de65cb597224 | cirros-0.3.4 | active |
| 0b7761c6-de9d-43b8-bc3b-fd646af2ae55 | cirros-0.4.0 | active |
+--------------------------------------+--------------+--------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  1. 列出可用的Network
[root@controller openstack]# openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID                                   | Name     | Subnets                              |
+--------------------------------------+----------+--------------------------------------+
| ffead491-c5be-416a-8a47-14a8dfec8d54 | provider | 569c6309-33e1-4aaa-bdf3-cf011188f8ed |
+--------------------------------------+----------+--------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 列出有效的Security Group
[root@controller openstack]# openstack security group list
+--------------------------------------+---------+------------------------+----------------------------------+------+
| ID                                   | Name    | Description            | Project                          | Tags |
+--------------------------------------+---------+------------------------+----------------------------------+------+
| 79ee9f23-f186-4127-8c49-26d78b12107b | default | Default security group | 82435bbf568b4eddb33b79024ae8bd22 | []   |
+--------------------------------------+---------+------------------------+----------------------------------+------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 创建实例
[root@controller openstack]# openstack server create --flavor  --image cirros-0.3.4 --nic net-id=ffead491-c5be-416a-8a47-14a8dfec8d54 --security-group default --key-name mykey provider-vm1
+-----------------------------+-----------------------------------------------------+
| Field                       | Value                                               |
+-----------------------------+-----------------------------------------------------+
| OS-DCF:diskConfig           | MANUAL                                              |
| OS-EXT-AZ:availability_zone |                                                     |
| OS-EXT-STS:power_state      | NOSTATE                                             |
| OS-EXT-STS:task_state       | scheduling                                          |
| OS-EXT-STS:vm_state         | building                                            |
| OS-SRV-USG:launched_at      | None                                                |
| OS-SRV-USG:terminated_at    | None                                                |
| accessIPv4                  |                                                     |
| accessIPv6                  |                                                     |
| addresses                   |                                                     |
| adminPass                   | qxEgBLWimr5N                                        |
| config_drive                |                                                     |
| created                     | 2021-01-11T08:07:24Z                                |
| flavor                      |  (0)                                         |
| hostId                      |                                                     |
| id                          | 5d8b418f-fdfc-4689-84c5-1a9265bfa3dd                |
| image                       | cirros-0.3.4 (0aa979dd-7483-439f-ac14-de65cb597224) |
| key_name                    | mykey                                               |
| name                        | provider-vm1                                        |
| progress                    | 0                                                   |
| project_id                  | 82435bbf568b4eddb33b79024ae8bd22                    |
| properties                  |                                                     |
| security_groups             | name='79ee9f23-f186-4127-8c49-26d78b12107b'         |
| status                      | BUILD                                               |
| updated                     | 2021-01-11T08:07:25Z                                |
| user_id                     | 6c23d5d4a0754dd5938d48652fb67f1d                    |
| volumes_attached            |                                                     |
+-----------------------------+-----------------------------------------------------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

查看创建的实例:

[root@controller openstack]# openstack server list
+--------------------------------------+--------------+--------+----------+--------------+---------+
| ID                                   | Name         | Status | Networks | Image        | Flavor  |
+--------------------------------------+--------------+--------+----------+--------------+---------+
| 5d8b418f-fdfc-4689-84c5-1a9265bfa3dd | provider-vm1 | BUILD  |          | cirros-0.3.4 |  |
+--------------------------------------+--------------+--------+----------+--------------+---------+
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 使用虚拟控制台访问实例
[root@controller openstack]# openstack console url show provider-vm1
  • 1

创建块存储

遇到的问题

  1. Device brqffead491-c5 cannot be used as it has no MAC address
    2021-01-11 15:21:47.823 1076 ERROR .ip_lib [req-6d7bdabe-ce7c-45bc-8637-6a7d21f8cab3 - - - - -] Device brqffead491-c5 cannot be used as it has no MAC address
  2. 使用使用虚拟控制台访问实例命令时出现:oslo_messaging.
    Unexpected API Error. Please report this at /nova/ and attach the Nova API log if possible.
    <class ‘oslo_messaging.’> (HTTP 500) (Request-ID: req-d9ffcfec-d979-4ea3-8046-ff2e468df8eb)
  3. oslo_messaging.: Timed out waiting for a reply to message ID b3648db7b94348f39b4c6de6657e1c63
    oslo_messaging.: Timed out waiting for a reply to message ID b3648db7b94348f39b4c6de6657e1c63
  4. Agent healthcheck: found 1 dead agents out of 5
    Linux bridge agent 2021-01-11 08:07:32 computer02
    2021-01-11 16:27:30.286 2303 WARNING .agents_db [req-9076e345-41c2-4471-8919-6c84bff7589b - - - - -] Agent healthcheck: found 1 dead agents out of 5:
    Type Last heartbeat host
  5. Unable to establish connection to http://controller:8778/resource_providers
    2021-01-11 14:04:38.184 1344 ERROR .resource_tracker [req-b30f7558-b3a3-425e-af0a-7b67b2395aaa - - - - -] Skipping removal of allocations for deleted instances: Unable to establish connection to http://controller:8778/resource_providers/c3f627bf-4a3b-4105-9f81-c3c3b0e8923f/allocations: HTTPConnectionPool(host=‘controller’, port=8778): Max retries exceeded with url: /resource_providers/c3f627bf-4a3b-4105-9f81-c3c3b0e8923f/allocations (Caused by NewConnectionError(‘< object at 0x7f4edc418eb8>: Failed to establish a new connection: [Errno 111] ECONNREFUSED’,)): : Unable to establish connection to http://controller:8778/resource_providers/c3f627bf-4a3b-4105-9f81-c3c3b0e8923f/allocations: HTTPConnectionPool(host=‘controller’, port=8778): Max retries exceeded with url: /resource_providers/c3f627bf-4a3b-4105-9f81-c3c3b0e8923f/allocations (Caused by NewConnectionError(‘< object at 0x7f4edc418eb8>: Failed to establish a new connection: [Errno 111] ECONNREFUSED’,))

上面出现的问题的原因时由于第二个计算节点computer02没有起来。
[root@controller openstack]# openstack compute service list
±—±---------------±-----------±---------±--------±------±---------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
±—±---------------±-----------±---------±--------±------±---------------------------+
| 1 | nova-scheduler | controller | internal | enabled | up | 2021-01-11T08:59:01.000000 |
| 5 | nova-conductor | controller | internal | enabled | up | 2021-01-11T08:59:04.000000 |
| 10 | nova-compute | computer01 | nova | enabled | up | 2021-01-11T08:59:10.000000 |
| 11 | nova-compute | computer02 | nova | enabled | down | 2021-01-11T08:07:36.000000 |
| 1 | nova-scheduler | controller | internal | enabled | up | 2021-01-11T08:59:01.000000 |
| 5 | nova-conductor | controller | internal | enabled | up | 2021-01-11T08:59:04.000000 |
| 10 | nova-compute | computer01 | nova | enabled | up | 2021-01-11T08:59:10.000000 |
| 11 | nova-compute | computer02 | nova | enabled | down | 2021-01-11T08:07:36.000000 |
±—±---------------±-----------±---------±--------±------±---------------------------+
当重启该节点后,功能正常。

参考资料

  1. Neutron网络虚拟化
  2. Public provider network