管理裸金属节点

管理裸金属节点

OpenStack计算服务的裸金属驱动通过通用API或其他工具如编排服务(Heat)来管理物理硬件的供应。该驱动常用于单租户云环境,如高性能计算集群,或用于部署OpenStack自身。

要使用裸金属驱动,必须创建一个网卡并添加到裸金属节点。在此之后即可从裸金属镜像启动一个实例。

可以列出和删除裸金属节点。删除节点时,所有关联的网卡都会被移除。可以列出、移除所有关联到一个裸金属节点的网卡。

命令

下列命令用于管理裸金属节点。

baremetal-interface-add
为裸金属节点添加网卡。
baremetal-interface-list
列出绑定到裸金属节点的网卡。
baremetal-interface-remove
从裸金属节点移除一个网卡。
baremetal-node-create
创建裸金属节点。
baremetal-node-delete
移除一个裸金属节点及其关联的所有网卡。
baremetal-node-list
列出可用的裸金属节点。
baremetal-node-show
显示裸金属节点的信息。

创建裸金属节点

创建裸金属节点时,PM地址,用户名和密码必须和硬件BIOS/IPMI配置一致。

$ nova baremetal-node-create --pm_address PM_ADDRESS --pm_user PM_USERNAME \
  --pm_password PM_PASSWORD $(hostname -f) 1 512 10 aa:bb:cc:dd:ee:ff

以下示例中展示了创建一个裸金属节点的命令和结果,裸金属节点的PM地址为``1.2.3.4``, 用户名为 ipmi, 密码为 ipmi.

$ nova baremetal-node-create --pm_address 1.2.3.4 --pm_user ipmi \
  --pm_password ipmi $(hostname -f) 1 512 10 aa:bb:cc:dd:ee:ff
+------------------+-------------------+
| Property         | Value             |
+------------------+-------------------+
| instance_uuid    | None              |
| pm_address       | 1.2.3.4           |
| interfaces       | []                |
| prov_vlan_id     | None              |
| cpus             | 1                 |
| memory_mb        | 512               |
| prov_mac_address | aa:bb:cc:dd:ee:ff |
| service_host     | ubuntu            |
| local_gb         | 10                |
| id               | 1                 |
| pm_user          | ipmi              |
| terminal_port    | None              |
+------------------+-------------------+

添加一个网卡到节点

节点的每个网卡都要指定MAC地址创建接口。

$ nova baremetal-interface-add 1 aa:bb:cc:dd:ee:ff
+-------------+-------------------+
| Property    | Value             |
+-------------+-------------------+
| datapath_id | 0                 |
| id          | 1                 |
| port_no     | 0                 |
| address     | aa:bb:cc:dd:ee:ff |
+-------------+-------------------+

从裸金属镜像启动一个实例。

裸金属实例是直接创建在物理机上的实例,下层没有虚拟化层。Nova通过IPMI保留了电源控制。在某些情形下,Nova也通过Neutron和OpenFlow保留网络控制。

 $ openstack server create --image my-baremetal-image --flavor \
   my-baremetal-flavor test
 +-----------------------------+--------------------------------------+
 | Property                    | Value                                |
 +-----------------------------+--------------------------------------+
 | status                      | BUILD                                |
 | id                          | cc302a8f-cd81-484b-89a8-b75eb3911b1b |
 +-----------------------------+--------------------------------------+

... wait for instance to become active ...

注解

Set the --availability-zone parameter to specify which zone or node to use to start the server. Separate the zone from the host name with a comma. For example:

$ openstack server create --availability-zone zone:HOST,NODE

host is optional for the --availability-zone parameter. You can simply specify zone:,node, still including the comma.

列出裸金属节点和接口

使用:command:`nova baremetal-node-list`列出裸金属节点和接口。节点被使用时,其状态包含运行在其上的实例的UUID:

$ nova baremetal-node-list
+----+--------+------+-----------+---------+-------------------+------+------------+-------------+-------------+---------------+
| ID | Host   | CPUs | Memory_MB | Disk_GB | MAC Address       | VLAN | PM Address | PM Username | PM Password | Terminal Port |
+----+--------+------+-----------+---------+-------------------+------+------------+-------------+-------------+---------------+
| 1  | ubuntu | 1    | 512       | 10      | aa:bb:cc:dd:ee:ff | None | 1.2.3.4    | ipmi        |             | None          |
+----+--------+------+-----------+---------+-------------------+------+------------+-------------+-------------+---------------+

显示裸金属节点的详细信息

使用 nova baremetal-node-show 查看裸金属节点的详细信息:

$ nova baremetal-node-show 1
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| instance_uuid    | cc302a8f-cd81-484b-89a8-b75eb3911b1b |
| pm_address       | 1.2.3.4                              |
| interfaces       | [{u'datapath_id': u'0', u'id': 1,    |
|                  | u'port_no': 0,                       |
|                  | u'address': u'aa:bb:cc:dd:ee:ff'}]   |
| prov_vlan_id     | None                                 |
| cpus             | 1                                    |
| memory_mb        | 512                                  |
| prov_mac_address | aa:bb:cc:dd:ee:ff                    |
| service_host     | ubuntu                               |
| local_gb         | 10                                   |
| id               | 1                                    |
| pm_user          | ipmi                                 |
| terminal_port    | None                                 |
+------------------+--------------------------------------+
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.