Ubuntu 24.04
Sponsored Link

OpenStack Caracal : Compute ノードを追加する (GPU)2024/05/21

 

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  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |                       |  |      Open vSwitch     |
|  Neutron Server       |  |                       |  |                       |
|  Neutron Metadata     |  |                       |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

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

[1]

追加する Compute ノードに こちらの [1] を参考にして GPU パススルーの設定を適用しておきます

[2]

追加する ノードを こちらを参考にして Openstack クラスターに Compute ノードとして追加しておきます

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

81:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA104 [GeForce RTX 3060] [10de:2487] (rev a1)
81:00.1 Audio device [0403]: NVIDIA Corporation GA104 High Definition Audio Controller [10de:228b] (rev a1)

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

root@node02:~#
systemctl restart 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":"2487", "device_type":"type-PCI", "name":"RTX-3060" }

[filter_scheduler]
enabled_filters = PciPassthroughFilter

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

root@dlp ~(keystone)#
openstack flavor create --id 5 --vcpus 4 --ram 8192 --disk 20 --property "pci_passthrough:alias"="RTX-3060:1" gpu1.small

+----------------------------+------------------------------------+
| Field                      | Value                              |
+----------------------------+------------------------------------+
| OS-FLV-DISABLED:disabled   | False                              |
| OS-FLV-EXT-DATA:ephemeral  | 0                                  |
| description                | None                               |
| disk                       | 20                                 |
| id                         | 5                                  |
| name                       | gpu1.small                         |
| os-flavor-access:is_public | True                               |
| properties                 | pci_passthrough:alias='RTX-3060: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.tiny    | 2048 |   10 |         0 |     1 | True      |
| 2  | m1.small   | 4096 |   10 |         0 |     2 | True      |
| 3  | m1.medium  | 8192 |   10 |         0 |     4 | True      |
| 4  | m2.medium  | 8192 |   10 |        10 |     4 | True      |
| 5  | gpu1.small | 8192 |   20 |         0 |     4 | True      |
+----+------------+------+------+-----------+-------+-----------+
[5] 任意の Openstack ユーザーで GPU インスタンスを作成して動作確認します。
ubuntu@dlp ~(keystone)$
openstack network list

+---------------------------------+---------+----------------------------------+
| ID                              | Name    | Subnets                          |
+---------------------------------+---------+----------------------------------+
| 5e99fe3a-c28a-47b3-ae5f-        | public  | 5f767674-473e-402c-ba60-         |
| 504fa513709b                    |         | cc6d6b9e5513                     |
| 78a330d7-074f-491d-a820-        | private | 5ac5f7dc-c275-48a1-aaac-         |
| 2b5e87f5602f                    |         | 745dd2f61ea7                     |
+---------------------------------+---------+----------------------------------+

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

ubuntu@dlp ~(keystone)$
openstack server create --flavor gpu1.small --image Ubuntu2404 --security-group secgroup01 --nic net-id=$netID --key-name mykey Ubuntu-2404GPU
ubuntu@dlp ~(keystone)$
openstack server list

+-------------+-------------+---------+--------------+------------+------------+
| ID          | Name        | Status  | Networks     | Image      | Flavor     |
+-------------+-------------+---------+--------------+------------+------------+
| 0217da81-   | Ubuntu-     | ACTIVE  | private=192. | Ubuntu2404 | gpu1.small |
| 0411-4bcf-  | 2404GPU     |         | 168.100.46   |            |            |
| b646-       |             |         |              |            |            |
| 2bb35b37a66 |             |         |              |            |            |
| 6           |             |         |              |            |            |
| 7fbc24c1-   | Ubuntu-2404 | SHUTOFF | private=10.0 | Ubuntu2404 | m1.small   |
| c0d1-43d6-  |             |         | .0.208, 192. |            |            |
| 87aa-       |             |         | 168.100.130  |            |            |
| 68df83597b5 |             |         |              |            |            |
| 7           |             |         |              |            |            |
+-------------+-------------+---------+--------------+------------+------------+

ubuntu@dlp ~(keystone)$
openstack floating ip create public

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2024-05-21T08:19:24Z                 |
| description         |                                      |
| dns_domain          | None                                 |
| dns_name            | None                                 |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.224                           |
| floating_network_id | 5e99fe3a-c28a-47b3-ae5f-504fa513709b |
| id                  | 279aaa49-a7dc-4919-a82e-86505ddbfe12 |
| name                | 10.0.0.224                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | 18ede7365bdc430093e8fd4a90f77369     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2024-05-21T08:19:24Z                 |
+---------------------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack server add floating ip Ubuntu-2404GPU 10.0.0.224

ubuntu@dlp ~(keystone)$
ssh ubuntu@10.0.0.224

The authenticity of host '10.0.0.224 (10.0.0.224)' can't be established.
ED25519 key fingerprint is SHA256:mX/ZrNCojy+4xAyKdj13bGUrGTRqms/l/MhrIjrGrj4.
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.224' (ED25519) to the list of known hosts.
Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-31-generic x86_64)

.....
.....

ubuntu@ubuntu-2404gpu:~$
ubuntu@ubuntu-2404gpu:~$
lspci | grep -i nvidia

00:05.0 VGA compatible controller: NVIDIA Corporation GA104 [GeForce RTX 3060] (rev a1)
関連コンテンツ