CentOS Stream 9
Sponsored Link

OpenStack Bobcat : Compute ノードを追加する (GPU)2023/10/25

 
GPU を搭載した Compute ノードを追加して、仮想マシンインスタンスで GPU が利用できるように設定します。
当例では以下のような環境を例に、新たに GPU を搭載した [node02.srv.world] を Compute ノードとして追加します。
------------+--------------------------+--------------------------+------------
            |                          |                          |
        eth0|10.0.0.30             eth0|10.0.0.50             eth0|10.0.0.51
+-----------+-----------+  +-----------+-----------+  +-----------+-----------+
|   [ dlp.srv.world ]   |  | [ network.srv.world ] |  |  [ node01.srv.world ] |
|     (Control Node)    |  |     (Network Node)    |  |     (Compute Node)    |
|                       |  |                       |  |                       |
|  MariaDB    RabbitMQ  |  |      Open vSwitch     |  |        Libvirt        |
|  Memcached  Nginx     |  |     Neutron Server    |  |      Nova Compute     |
|  Keystone   httpd     |  |      OVN-Northd       |  |      Open vSwitch     |
|  Glance     Nova API  |  |         Nginx         |  |   OVN Metadata Agent  |
|                       |  |                       |  |     OVN-Controller    |
+-----------------------+  +-----------------------+  +-----------------------+

------------+------------
            |
        eth0|10.0.0.52
+-----------+-----------+
|  [ node02.srv.world ] |
|  (Compute Node (GPU)) |
|                       |
|        Libvirt        |
|      Nova Compute     |
|      Open vSwitch     |
|   OVN Metadata Agent  |
|     OVN-Controller    |
+-----------------------+

[1]
[2]
[3] 追加した Nova-Compute に、GPU パススルー用の設定をします。
[root@node02 ~]#
lspci -nn | grep -i nvidia

02:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK104 [GeForce GTX 680] [10de:1180] (rev a1)
02:00.1 Audio device [0403]: NVIDIA Corporation GK104 HDMI Audio Controller [10de:0e0a] (rev a1)

[root@node02 ~]#
vi /etc/nova/nova.conf
# 最終行に追記
# パススルーしたいデバイスの [vendor_id], [product_id] を追記
[pci]
passthrough_whitelist = { "vendor_id": "10de", "product_id": "1180" }

[root@node02 ~]#
systemctl restart openstack-nova-compute
[4] Control ノードで Nova の設定を変更します。
[root@dlp ~(keystone)]#
vi /etc/nova/nova.conf
# 最終行に追記
# 対象の Compute ノードでパススルー設定したデバイスの [vendor_id], [product_id] を追記
# [name] は任意の名称
[pci]
alias: { "vendor_id":"10de", "product_id":"1180", "device_type":"type-PCI", "name":"GTX-680" }

[filter_scheduler]
enabled_filters = PciPassthroughFilter

[root@dlp ~(keystone)]#
systemctl restart openstack-nova-api openstack-nova-scheduler
# GPU 用の [flavor] 作成

[root@dlp ~(keystone)]#
openstack flavor create --id 6 --vcpus 4 --ram 8192 --disk 20 --property "pci_passthrough:alias"="GTX-680:1" gpu1.small

+----------------------------+-----------------------------------+
| Field                      | Value                             |
+----------------------------+-----------------------------------+
| OS-FLV-DISABLED:disabled   | False                             |
| OS-FLV-EXT-DATA:ephemeral  | 0                                 |
| description                | None                              |
| disk                       | 20                                |
| id                         | 6                                 |
| name                       | gpu1.small                        |
| os-flavor-access:is_public | True                              |
| properties                 | pci_passthrough:alias='GTX-680:1' |
| ram                        | 8192                              |
| rxtx_factor                | 1.0                               |
| swap                       | 0                                 |
| vcpus                      | 4                                 |
+----------------------------+-----------------------------------+

[root@dlp ~(keystone)]#
openstack flavor list

+----+------------+------+------+-----------+-------+-----------+
| ID | Name       |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+------------+------+------+-----------+-------+-----------+
| 1  | m1.small   | 2048 |   10 |         0 |     1 | True      |
| 2  | m1.medium  | 4096 |   10 |         0 |     2 | True      |
| 3  | m1.large   | 8192 |   10 |         0 |     4 | True      |
| 4  | m2.large   | 8192 |   10 |        10 |     4 | True      |
| 5  | m3.large   | 8192 |   50 |         0 |     4 | True      |
| 6  | gpu1.small | 8192 |   20 |         0 |     4 | True      |
+----+------------+------+------+-----------+-------+-----------+
[5] 任意の Openstack ユーザーで GPU インスタンスを作成して動作確認します。
[cent@dlp ~(keystone)]$
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 1245127b-0e5c-49c1-8638-de9d51c34949 | private | 88416326-c3b5-4e6f-bf53-71a77c213721 |
| 44e70c99-2e15-429b-9dcc-cccaac557c0c | public  | fac5715e-35f6-4007-9e8f-edffb2629eeb |
+--------------------------------------+---------+--------------------------------------+

[cent@dlp ~(keystone)]$
netID=$(openstack network list | grep private | awk '{ print $2 }')

[cent@dlp ~(keystone)]$
openstack server create --flavor gpu1.small --image CentOS-Stream9 --security-group secgroup01 --nic net-id=$netID --key-name mykey CentOS-St9GPU
[cent@dlp ~(keystone)]$
openstack server list

+--------------------------------------+---------------+---------+------------------------------------+----------------+------------+
| ID                                   | Name          | Status  | Networks                           | Image          | Flavor     |
+--------------------------------------+---------------+---------+------------------------------------+----------------+------------+
| a15014f7-d000-48fc-8987-dc7fa99f63d7 | CentOS-St9GPU | ACTIVE  | private=192.168.100.41             | CentOS-Stream9 | gpu1.small |
| 78b8c394-be14-4312-84e8-06eeebbd74f3 | CentOS-St9    | SHUTOFF | private=10.0.0.208, 192.168.100.63 | CentOS-Stream9 | m1.medium  |
+--------------------------------------+---------------+---------+------------------------------------+----------------+------------+

[cent@dlp ~(keystone)]$
openstack floating ip create public

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2023-10-25T03:54:38Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.253                           |
| floating_network_id | 44e70c99-2e15-429b-9dcc-cccaac557c0c |
| id                  | b20bd2c2-e3fa-4669-a14a-d9d8bb58c36a |
| name                | 10.0.0.253                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | f4598dfd3b8a47149234b6892d18d5a4     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2023-10-25T03:54:38Z                 |
+---------------------+--------------------------------------+

[cent@dlp ~(keystone)]$
openstack server add floating ip CentOS-St9GPU 10.0.0.253

[cent@dlp ~(keystone)]$
ssh centos@10.0.0.253

The authenticity of host '10.0.0.253 (10.0.0.253)' can't be established.
ED25519 key fingerprint is SHA256:wo9rJxuBZAp+Ggao1frIEumoJ98NSR+A4XtiojyoN/w.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.0.0.253' (ED25519) to the list of known hosts.
[centos@centos-st9gpu ~]$
[centos@centos-st9gpu ~]$
lspci | grep -i nvidia

00:05.0 VGA compatible controller: NVIDIA Corporation GK104 [GeForce GTX 680] (rev a1)
関連コンテンツ