启动实例

本节创建必要的虚拟网络以支持启动实例。网络选项 1 包括一个提供程序(外部)网络,其中一个实例使用它。网络选项 2 包括一个使用网络的提供程序网络,以及一个使用该实例的自助服务(专用)网络。

本节中的说明使用控制器节点上的命令行接口 (CLI) 工具。但是,您可以按照安装工具的任何主机上的说明操作。

有关 CLI 工具的详细信息,请参阅派克的 OpenStackClient 文档、皇后区OpenStackClient文档或洛基的OpenStackClient 文档

若要使用仪表板,请参阅派克的仪表板用户文档、皇后区的仪表板用户文档Rocky 的仪表板用户文档

镜像操作

[root@controller ~]# openstack image list

[root@controller ~]# openstack image set --property hw_disk_bus=ide --property hw_vif_model=e1000 f6c85ee5-318b-4973-b01f-89c697d70275
[root@controller ~]# openstack image set --property hw_disk_bus=ide --property hw_vif_model=e1000 IMAGE_ID
[root@controller ~]# openstack image set --property hw_disk_bus=ide --property hw_vif_model=e1000 807815ff-450f-4be2-85ee-87841928451f

创建虚拟网络

为配置中子时选择的网络选项创建虚拟网络。如果选择选项 1,请仅创建提供程序网络。如果选择选项 2,请创建提供程序和自助服务网络。

为环境创建适当的网络后,可以继续准备环境以启动实例。

self-service 网络

如果选择网络选项 2,还可以创建通过 NAT 连接到物理网络基础结构的自助服务(专用)网络。此网络包括向实例提供 IP 地址的 DHCP 服务器。此网络上的实例可以自动访问外部网络(如 Internet)。但是,从外部网络(如 Internet)访问此网络上的实例需要浮动IP 地址

或其他非特权用户可以创建此网络,因为它仅提供与项目中实例的连接。demo demo

警告

您必须在自助服务网络之前创建提供程序网络。

注意

以下说明和图表使用示例 IP 地址范围。您必须根据您的特定环境调整它们。

Networking Option 2: Self-service networks - Overview

网络选项 2:自助服务网络 - 概述

Networking Option 2: Self-service networks - Connectivity

网络选项 2:自助服务网络 - 连接

创建自助服务网络

  1. 在控制器节点上,源凭据以访问仅用户 CLI 命令:demo

    $ . demo-openrc
  2. 创建网络:

    $ . admin-openrc
    $ 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                | 2020-12-14T05:24:32Z                                                                                                                                    |
    | description               |                                                                                                                                                         |
    | dns_domain                | None                                                                                                                                                    |
    | id                        | fa580241-39d4-42c8-9ff4-10234f12fee2                                                                                                                    |
    | ipv4_address_scope        | None                                                                                                                                                    |
    | ipv6_address_scope        | None                                                                                                                                                    |
    | is_default                | False                                                                                                                                                   |
    | is_vlan_transparent       | None                                                                                                                                                    |
    | location                  | cloud='', project.domain_id=, project.domain_name='Default', project.id='e8e39bd39c3f426ea753111acc4e6358', project.name='admin', region_name='', zone= |
    | mtu                       | 1500                                                                                                                                                    |
    | name                      | provider                                                                                                                                                |
    | port_security_enabled     | True                                                                                                                                                    |
    | project_id                | e8e39bd39c3f426ea753111acc4e6358                                                                                                                        |
    | 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                | 2020-12-14T05:24:32Z                                                                                                                                    |
    +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
    
    $ . demo-openrc
    $ openstack network create selfservice
    +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Field                     | Value                                                                                                                                                  |
    +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
    | admin_state_up            | UP                                                                                                                                                     |
    | availability_zone_hints   |                                                                                                                                                        |
    | availability_zones        |                                                                                                                                                        |
    | created_at                | 2020-12-14T05:13:13Z                                                                                                                                   |
    | description               |                                                                                                                                                        |
    | dns_domain                | None                                                                                                                                                   |
    | id                        | ***                                                                                                                   |
    | ipv4_address_scope        | None                                                                                                                                                   |
    | ipv6_address_scope        | None                                                                                                                                                   |
    | is_default                | False                                                                                                                                                  |
    | is_vlan_transparent       | None                                                                                                                                                   |
    | location                  | cloud='', project.domain_id=, project.domain_name='Default', project.id='68e7fcd6afa146d58de8ec94e1f5ece8', project.name='demo', region_name='', zone= |
    | mtu                       | 1450                                                                                                                                                   |
    | name                      | self                                                                                                                                           |
    | port_security_enabled     | True                                                                                                                                                   |
    | project_id                | 68e7fcd6afa146d58de8ec94e1f5ece8                                                                                                                       |
    | provider:network_type     | None                                                                                                                                                   |
    | provider:physical_network | None                                                                                                                                                   |
    | provider:segmentation_id  | None                                                                                                                                                   |
    | qos_policy_id             | None                                                                                                                                                   |
    | revision_number           | 1                                                                                                                                                      |
    | router:external           | Internal                                                                                                                                               |
    | segments                  | None                                                                                                                                                   |
    | shared                    | False                                                                                                                                                  |
    | status                    | ACTIVE                                                                                                                                                 |
    | subnets                   |                                                                                                                                                        |
    | tags                      |                                                                                                                                                        |
    | updated_at                | 2020-12-14T05:13:13Z                                                                                                                                   |
    +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+

    非特权用户通常不能为此命令提供其他参数。该服务使用以下文件中的信息自动选择参数:

    ml2_conf.ini:

    [ml2]
    tenant_network_types = vxlan
    
    [ml2_type_vxlan]
    vni_ranges = 1:1000
  3. 在网络上创建子网:

    $ openstack subnet create --network selfservice \
     --dns-nameserver DNS_RESOLVER --gateway SELFSERVICE_NETWORK_GATEWAY \
     --subnet-range SELFSERVICE_NETWORK_CIDR selfservice

    替换为 DNS 解析器的 IP 地址。在大多数情况下,您可以使用主机上文件中的一个。DNS_RESOLVER``/etc/resolv.conf

    替换为要在自助服务网络(通常为".1"IP 地址)使用的网关。SELFSERVICE_NETWORK_GATEWAY

    替换为要在自助服务网络上使用的子网。您可以使用任意值,尽管我们建议使用RFC 1918 中的网络SELFSERVICE_NETWORK_CIDR

    例子

    自助服务网络使用 172.16.1.0/24,网关为 172.16.1.1。DHCP 服务器为每个实例分配一个 IP 地址,从 172.16.1.2 到 172.16.1.254。所有实例都使用 8.8.4.4 作为 DNS 解析程序。

    $ openstack subnet create --network selfservice --dns-nameserver 8.8.8.8 --gateway 172.16.3.1 --subnet-range 172.16.3.0/24 selfservice
    

创建路由器

自助服务网络使用通常执行双向 NAT 的虚拟路由器连接到提供程序网络。每个路由器在至少一个自助服务网络上包含一个接口,在提供程序网络上包含一个网关。

提供程序网络必须包含使自助路由器能够使用它连接到外部网络(如 Internet)的选项。或其他特权用户必须在网络创建过程中包含此选项,或稍后添加此选项。在这种情况下,在创建网络时使用 参数设置了该选项。router:external admin router:external --external provider

  1. 在控制器节点上,源凭据以访问仅用户 CLI 命令:demo

    $ . demo-openrc
  2. 创建路由器:

    $ openstack router create router
    +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Field                   | Value                                                                                                                                                  |
    +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
    | admin_state_up          | UP                                                                                                                                                     |
    | availability_zone_hints |                                                                                                                                                        |
    | availability_zones      |                                                                                                                                                        |
    | created_at              | 2020-12-14T05:19:05Z                                                                                                                                   |
    | description             |                                                                                                                                                        |
    | external_gateway_info   | null                                                                                                                                                   |
    | flavor_id               | None                                                                                                                                                   |
    | id                      | 2485e3e3-998f-42fb-a1f9-d9865615c39a                                                                                                                   |
    | location                | cloud='', project.domain_id=, project.domain_name='Default', project.id='68e7fcd6afa146d58de8ec94e1f5ece8', project.name='demo', region_name='', zone= |
    | name                    | router                                                                                                                                                 |
    | project_id              | 68e7fcd6afa146d58de8ec94e1f5ece8                                                                                                                       |
    | revision_number         | 1                                                                                                                                                      |
    | routes                  |                                                                                                                                                        |
    | status                  | ACTIVE                                                                                                                                                 |
    | tags                    |                                                                                                                                                        |
    | updated_at              | 2020-12-14T05:19:05Z                                                                                                                                   |
    +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  3. 将自助服务网络子网添加为路由器上的接口:

    $ openstack router add subnet router selfservice
  4. 在路由器上的提供程序网络上设置网关:

    $ openstack router set router --external-gateway provider

验证操作

我们建议您在继续操作之前验证操作并修复任何问题。以下步骤使用网络和子网创建示例中的 IP 地址范围。

  1. 在控制器节点上,源凭据以访问仅管理员 CLI 命令:admin

    $ . admin-openrc
  2. 列出网络命名空间。您应该看到一个命名空间和两个命名空间。qrouter qdhcp

    $ ip netns
    qrouter-2485e3e3-998f-42fb-a1f9-d9865615c39a (id: 3)
    qdhcp-4503a7f2-84ac-481e-b315-235b93ca6be1 (id: 2)
    qdhcp-385ed999-a394-440c-86bb-0eda8a630908 (id: 1)
    qdhcp-55b7b582-6740-4139-9ba3-6e02d59fdab4 (id: 0)
  3. 列出路由器上的端口以确定提供程序网络上的网关 IP 地址:

    $ openstack port list --router router
    +--------------------------------------+------+-------------------+---------------------------------------------------------------------------+--------+
    | ID                                   | Name | MAC Address       | Fixed IP Addresses                                                        | Status |
    +--------------------------------------+------+-------------------+---------------------------------------------------------------------------+--------+
    | 22dd8103-7c23-4009-a060-f65d437ab1fc |      | fa:16:3e:d9:5c:93 | ip_address='172.16.3.1', subnet_id='0445460c-3bd3-470d-aa78-89aafa5c643c' | ACTIVE |
    | 955f2c28-423a-477d-9fbd-9d6f3ed290b9 |      | fa:16:3e:e7:1d:06 |                                                                           | ACTIVE |
    +--------------------------------------+------+-------------------+---------------------------------------------------------------------------+--------+
  4. 从控制器节点或物理提供商网络上的任何主机ping出此 IP 地址:

    $ ping -c 4 203.0.113.102
    
    PING 203.0.113.102 (203.0.113.102) 56(84) bytes of data.
    64 bytes from 203.0.113.102: icmp_req=1 ttl=64 time=0.619 ms
    64 bytes from 203.0.113.102: icmp_req=2 ttl=64 time=0.189 ms
    64 bytes from 203.0.113.102: icmp_req=3 ttl=64 time=0.165 ms
    64 bytes from 203.0.113.102: icmp_req=4 ttl=64 time=0.216 ms
    
    --- 203.0.113.102 ping statistics ---
    rtt min/avg/max/mdev = 0.165/0.297/0.619/0.187 ms

返回启动实例 - 创建虚拟网络

创造 m1.nano flavor

最小的默认风格每个实例消耗 512 MB 内存。对于计算节点内存少于 4 GB 的环境,我们建议创建每个实例只需要 64 MB 的 flavor 。仅将这种味道与 CirrOS 图像一起用于测试目的。m1.nano

$ openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano
+----------------------------+---------+
| Field                      | Value   |
+----------------------------+---------+
| OS-FLV-DISABLED:disabled   | False   |
| OS-FLV-EXT-DATA:ephemeral  | 0       |
| disk                       | 1       |
| id                         | 0       |
| name                       | m1.nano |
| os-flavor-access:is_public | True    |
| properties                 |         |
| ram                        | 64      |
| rxtx_factor                | 1.0     |
| swap                       |         |
| vcpus                      | 1       |
+----------------------------+---------+

生成密钥对

大多数云映像都支持公钥身份验证,而不是传统的密码身份验证。在启动实例之前,必须向计算服务添加公钥。

  1. 源项目凭据:demo

    $ . demo-openrc
  2. 生成密钥对并添加公钥:

    $ ssh-keygen -q -N ""
    $ openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
    +-------------+-------------------------------------------------+
    | Field       | Value                                           |
    +-------------+-------------------------------------------------+
    | fingerprint | b5:56:2e:37:67:a1:c5:a1:76:04:06:1e:8b:49:75:92 |
    | name        | mykey                                           |
    | user_id     | 1968700544b745f0b43422bdf18d7596                |
    +-------------+-------------------------------------------------+

注意

或者,您可以跳过该命令并使用现有的公钥。ssh-keygen

  1. 验证添加密钥对:

    $ openstack keypair list
    +-------+-------------------------------------------------+
    | Name  | Fingerprint                                     |
    +-------+-------------------------------------------------+
    | mykey | b5:56:2e:37:67:a1:c5:a1:76:04:06:1e:8b:49:75:92 |
    +-------+-------------------------------------------------+

添加安全组规则

默认情况下,安全组应用于所有实例,并包括拒绝远程访问实例的防火墙规则。对于 Linux 映像(如 CirrOS),我们建议至少允许 ICMP(ping)和安全外壳 (SSH)。default

  • 向安全组添加规则:default

    • 允许ICMP (ping):
    $ openstack security group rule create --proto icmp default
    
  • 允许安全外壳 (SSH) 访问:

    $ openstack security group rule create --proto tcp --dst-port 22 default
    

启动实例

如果选择网络选项 1,则只能在提供商网络上启动实例。如果选择了网络选项 2,可以在提供程序网络和自助服务网络上启动实例。

在自助服务网络上启动实例

确定实例选项

若要启动实例,必须至少指定风格、映像名称、网络、安全组、密钥和实例名称。

  1. 在控制器节点上,源凭据以访问仅用户 CLI 命令:demo

    $ . demo-openrc
  2. 风格指定虚拟资源分配配置文件,其中包括处理器、内存和存储。

    列出可用的口味:

    $ openstack flavor list
    
    +----+---------+-----+------+-----------+-------+-----------+
    | ID | Name    | RAM | Disk | Ephemeral | VCPUs | Is Public |
    +----+---------+-----+------+-----------+-------+-----------+
    | 0  | m1.nano |  64 |    1 |         0 |     1 | True      |
    +----+---------+-----+------+-----------+-------+-----------+

    注意

    还可以按 ID 引用 flavor。

  3. 列出可用图像:

    $ openstack image list
    +--------------------------------------+------------+--------+
    | ID                                   | Name       | Status |
    +--------------------------------------+------------+--------+
    | 19073eea-c2f0-47b5-9a55-f084815f1c0f | cirros     | active |
    | 807815ff-450f-4be2-85ee-87841928451f | cirros_x64 | active |
    +--------------------------------------+------------+--------+

    此实例使用映像。cirros

  4. 列出可用的网络:

    $ openstack network list
    +--------------------------------------+-------------+--------------------------------------+
    | ID                                   | Name        | Subnets                              |
    +--------------------------------------+-------------+--------------------------------------+
    | 385ed999-a394-440c-86bb-0eda8a630908 | vlan 30     | 73d920dd-6f4d-4420-b3ff-80e3c8ce22a7 |
    | 4503a7f2-84ac-481e-b315-235b93ca6be1 | selfservice | 0445460c-3bd3-470d-aa78-89aafa5c643c |
    | 55b7b582-6740-4139-9ba3-6e02d59fdab4 | vlan 6      | f177b8a9-7222-4040-8440-483ba02de9d1 |
    | fa580241-39d4-42c8-9ff4-10234f12fee2 | provider    |                                      |
    +--------------------------------------+-------------+--------------------------------------+

    此实例使用自助服务网络。但是,您必须使用 ID 而不是名称引用此网络。selfservice

  5. 列出可用的安全组:

    $ openstack security group list
    

    此实例使用安全组。default

  6. 启动实例:

    替换为网络的 ID。SELFSERVICE_NET_ID selfservice

    $ openstack server create --flavor m1.nano --image cirros \
    >   --nic net-id=4503a7f2-84ac-481e-b315-235b93ca6be1 --security-group default \
    >   --key-name mykey selfservice-instance
    +-----------------------------+-----------------------------------------------+
    | 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                   | XLfARTntXs5m                                  |
    | config_drive                |                                               |
    | created                     | 2020-12-14T05:39:53Z                          |
    | flavor                      | m1.nano (0)                                   |
    | hostId                      |                                               |
    | id                          | 7b790e2e-1369-4704-b0fb-20b64efec72a          |
    | image                       | cirros (19073eea-c2f0-47b5-9a55-f084815f1c0f) |
    | key_name                    | mykey                                         |
    | name                        | selfservice-instance                          |
    | progress                    | 0                                             |
    | project_id                  | 68e7fcd6afa146d58de8ec94e1f5ece8              |
    | properties                  |                                               |
    | security_groups             | name='77e21e9e-8787-4b26-9858-ecc0d27e857b'   |
    | status                      | BUILD                                         |
    | updated                     | 2020-12-14T05:39:53Z                          |
    | user_id                     | 1968700544b745f0b43422bdf18d7596              |
    | volumes_attached            |                                               |
    +-----------------------------+-----------------------------------------------+
  7. 检查实例的状态:

    $ openstack server list
    +--------------------------------------+----------------------+--------+-------------------------+--------+---------+
    | ID                                   | Name                 | Status | Networks                | Image  | Flavor  |
    +--------------------------------------+----------------------+--------+-------------------------+--------+---------+
    | 7b790e2e-1369-4704-b0fb-20b64efec72a | selfservice-instance | ACTIVE | selfservice=172.16.3.83 | cirros | m1.nano |
    +--------------------------------------+----------------------+--------+-------------------------+--------+---------+

    状态从生成过程成功完成到更改。BUILD ACTIVE

使用虚拟控制台访问实例

  1. 获取实例的虚拟网络计算 (VNC)会话 URL,然后从 Web 浏览器访问它:

    $ openstack console url show selfservice-instance
    
    +-------+---------------------------------------------------------------------------------+
    | Field | Value                                                                           |
    +-------+---------------------------------------------------------------------------------+
    | type  | novnc                                                                           |
    | url   | http://controller:6080/vnc_auto.html?token=5eeccb47-525c-4918-ac2a-3ad1e9f1f493 |
    +-------+---------------------------------------------------------------------------------+

    注意

    如果您的 Web 浏览器在无法解析主机名的主机上运行,则可以使用控制器节点上管理界面的 IP 地址进行替换。controller controller

    CirrOS 映像包括常规用户名/密码身份验证,并在登录提示符下提供这些凭据。登录到 CirrOS 后,我们建议您使用 验证网络连接。ping

  2. 验证对自助服务网络网关的访问:

    $ ping -c 4 172.16.1.1
    
    PING 172.16.1.1 (172.16.1.1) 56(84) bytes of data.
    64 bytes from 172.16.1.1: icmp_req=1 ttl=64 time=0.357 ms
    64 bytes from 172.16.1.1: icmp_req=2 ttl=64 time=0.473 ms
    64 bytes from 172.16.1.1: icmp_req=3 ttl=64 time=0.504 ms
    64 bytes from 172.16.1.1: icmp_req=4 ttl=64 time=0.470 ms
    
    --- 172.16.1.1 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 2998ms
    rtt min/avg/max/mdev = 0.357/0.451/0.504/0.055 ms
  3. 验证访问互联网:

    $ ping -c 4 openstack.org
    
    PING openstack.org (174.143.194.225) 56(84) bytes of data.
    64 bytes from 174.143.194.225: icmp_req=1 ttl=53 time=17.4 ms
    64 bytes from 174.143.194.225: icmp_req=2 ttl=53 time=17.5 ms
    64 bytes from 174.143.194.225: icmp_req=3 ttl=53 time=17.7 ms
    64 bytes from 174.143.194.225: icmp_req=4 ttl=53 time=17.5 ms
    
    --- openstack.org ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3003ms
    rtt min/avg/max/mdev = 17.431/17.575/17.734/0.143 ms

远程访问实例

  1. 在提供商虚拟网络上创建浮动 IP 地址:

    $ openstack floating ip create provider
    
    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | created_at          | 2017-01-20T17:29:16Z                 |
    | description         |                                      |
    | fixed_ip_address    | None                                 |
    | floating_ip_address | 203.0.113.104                        |
    | floating_network_id | b5b6993c-ddf9-40e7-91d0-86806a42edb8 |
    | headers             |                                      |
    | id                  | 88b4d06a-d794-4406-affd-6ffa2bcf1e2a |
    | port_id             | None                                 |
    | project_id          | ed0b60bf607743088218b0a533d5943f     |
    | revision_number     | 1                                    |
    | router_id           | None                                 |
    | status              | DOWN                                 |
    | updated_at          | 2017-01-20T17:29:16Z                 |
    +---------------------+--------------------------------------+
  2. 将浮动 IP 地址与实例关联:

    $ openstack server add floating ip selfservice-instance 203.0.113.104

    注意

    此命令不提供输出。

  3. 检查浮动 IP 地址的状态:

    $ openstack server list
    
    +--------------------------------------+----------------------+--------+---------------------------------------+
    | ID                                   | Name                 | Status | Networks                              |
    +--------------------------------------+----------------------+--------+---------------------------------------+
    | 113c5892-e58e-4093-88c7-e33f502eaaa4 | selfservice-instance | ACTIVE | selfservice=172.16.1.3, 203.0.113.104 |
    | 181c52ba-aebc-4c32-a97d-2e8e82e4eaaf | provider-instance    | ACTIVE | provider=203.0.113.103                |
    +--------------------------------------+----------------------+--------+---------------------------------------+
  4. 通过控制器节点或提供程序物理网络上的任何主机的浮动 IP 地址验证与实例的连接:

    $ ping -c 4 203.0.113.104
    
    PING 203.0.113.104 (203.0.113.104) 56(84) bytes of data.
    64 bytes from 203.0.113.104: icmp_req=1 ttl=63 time=3.18 ms
    64 bytes from 203.0.113.104: icmp_req=2 ttl=63 time=0.981 ms
    64 bytes from 203.0.113.104: icmp_req=3 ttl=63 time=1.06 ms
    64 bytes from 203.0.113.104: icmp_req=4 ttl=63 time=0.929 ms
    
    --- 203.0.113.104 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3002ms
    rtt min/avg/max/mdev = 0.929/1.539/3.183/0.951 ms
  5. 使用 SSH 从控制器节点或提供程序物理网络上的任何主机访问您的实例:

    $ ssh cirros@203.0.113.104
    
    The authenticity of host '203.0.113.104 (203.0.113.104)' can't be established.
    RSA key fingerprint is ed:05:e9:e7:52:a0:ff:83:68:94:c7:d1:f2:f8:e2:e9.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '203.0.113.104' (RSA) to the list of known hosts.

如果您的实例未按预期启动或似乎工作,请参阅 Pike 的疑难计算文档、皇后区疑难解答计算文档或 Rocky的疑难解答计算文档,了解更多信息或使用许多其他选项之一寻求帮助。我们希望您的第一个安装工作!

返回启动实例

块存储

创建卷

  1. 作为非管理项目,源式凭据以执行以下步骤:demo

    $ . demo-openrc
  2. 创建 1 GB 卷:

    $ openstack volume create --size 1 volume1
    
    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | attachments         | []                                   |
    | availability_zone   | nova                                 |
    | bootable            | false                                |
    | consistencygroup_id | None                                 |
    | created_at          | 2016-03-08T14:30:48.391027           |
    | description         | None                                 |
    | encrypted           | False                                |
    | id                  | a1e8be72-a395-4a6f-8e07-856a57c39524 |
    | multiattach         | False                                |
    | name                | volume1                              |
    | properties          |                                      |
    | replication_status  | disabled                             |
    | size                | 1                                    |
    | snapshot_id         | None                                 |
    | source_volid        | None                                 |
    | status              | creating                             |
    | type                | None                                 |
    | updated_at          | None                                 |
    | user_id             | 684286a9079845359882afc3aa5011fb     |
    +---------------------+--------------------------------------+
  3. 短时间后,卷状态应从 更改为 :creating``available

    $ openstack volume list
    
    +--------------------------------------+--------------+-----------+------+-------------+
    | ID                                   | Display Name | Status    | Size | Attached to |
    +--------------------------------------+--------------+-----------+------+-------------+
    | a1e8be72-a395-4a6f-8e07-856a57c39524 | volume1      | available |    1 |             |
    +--------------------------------------+--------------+-----------+------+-------------+

将卷附加到实例

  1. 将卷附加到实例:

    $ openstack server add volume INSTANCE_NAME VOLUME_NAME

    替换为实例的名称和要附加到实例的卷的名称。INSTANCE_NAME``VOLUME_NAME

    例子

    将卷附加到实例:volume1``provider-instance

    $ openstack server add volume provider-instance volume1

    注意

    此命令不提供输出。

  2. 列表卷:

    $ openstack volume list
    
    +--------------------------------------+--------------+--------+------+--------------------------------------------+
    | ID                                   | Display Name | Status | Size | Attached to                                |
    +--------------------------------------+--------------+--------+------+--------------------------------------------+
    | a1e8be72-a395-4a6f-8e07-856a57c39524 | volume1      | in-use |    1 | Attached to provider-instance on /dev/vdb  |
    +--------------------------------------+--------------+--------+------+--------------------------------------------+
  3. 使用 SSH 访问实例并使用 命令验证卷作为块存储设备是否存在:fdisk``/dev/vdb

    $ sudo fdisk -l
    
    Disk /dev/vda: 1073 MB, 1073741824 bytes
    255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *       16065     2088449     1036192+  83  Linux
    
    Disk /dev/vdb: 1073 MB, 1073741824 bytes
    16 heads, 63 sectors/track, 2080 cylinders, total 2097152 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    Disk /dev/vdb doesn't contain a valid partition table

    注意

    您必须在设备上创建文件系统并装入它才能使用卷。

有关如何管理卷的详细信息,请参阅派克的 python-openstack 客户文档、皇后区的 python-openstack客户文档或 Rocky 的python-openstack 客户文档

返回启动实例

编排

如果您的环境包含业务流程服务,您可以创建启动实例的堆栈。

有关详细信息,请参阅派克的编排安装指南、皇后区的编排安装指南或洛基的业务流程安装指南

共享文件系统

如果您的环境包含共享文件系统服务,您可以创建共享并在实例中装入共享。

有关详细信息,请参阅派克的共享文件系统安装指南、皇后区的共享文件系统安装指南Rocky 的共享文件系统安装指南