Debian 12 bookworm
Sponsored Link

OpenStack Zed : Compute ノードを追加する (GPU)2023/06/29

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

03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK104 [GeForce GTX 770] [10de:1184] (rev a1)
03: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": "1184" }

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":"1184", "device_type":"type-PCI", "name":"GTX-770" }

[filter_scheduler]
enabled_filters = PciPassthroughFilter

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

root@dlp ~(keystone)#
openstack flavor create --id 6 --vcpus 6 --ram 8192 --disk 20 --property "pci_passthrough:alias"="GTX-770: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-770:1' |
| ram                        | 8192                              |
| rxtx_factor                | 1.0                               |
| swap                       |                                   |
| 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 |   20 |         0 |     4 | True      |
| 6  | gpu1.small | 8192 |   20 |         0 |     4 | True      |
+----+------------+------+------+-----------+-------+-----------+
[5] 任意の Openstack ユーザーで GPU インスタンスを作成して動作確認します。
debian@dlp ~(keystone)$
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| ae5fdb1f-efb9-412b-9053-b81106c90336 | private | b3234f3f-b3e3-41d2-b3a4-ca3d4ec55d24 |
| b9b8536b-0696-4a5b-af05-602587435c0a | public  | 0129c597-e411-450e-a4f9-b387c68eddb3 |
+--------------------------------------+---------+--------------------------------------+

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

debian@dlp ~(keystone)$
openstack server create --flavor gpu1.small --image Debian12 --security-group secgroup01 --nic net-id=$netID --key-name mykey Debian-12GPU
debian@dlp ~(keystone)$
openstack server list

+--------------------------------------+--------------+---------+------------------------------------+----------+------------+
| ID                                   | Name         | Status  | Networks                           | Image    | Flavor     |
+--------------------------------------+--------------+---------+------------------------------------+----------+------------+
| d675a48c-3451-440a-8255-2c98e4749485 | Debian-12GPU | ACTIVE  | private=192.168.100.253            | Debian12 | gpu1.small |
| c3a4a792-a7ac-41bd-8c93-7fd162016f22 | Debian-12    | SHUTOFF | private=10.0.0.241, 192.168.100.66 | Debian12 | m1.medium  |
+--------------------------------------+--------------+---------+------------------------------------+----------+------------+

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2023-06-28T23:48:33Z                 |
| description         |                                      |
| dns_domain          | None                                 |
| dns_name            | None                                 |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.210                           |
| floating_network_id | b9b8536b-0696-4a5b-af05-602587435c0a |
| id                  | 5c95ebe2-0619-4624-9f63-320d1238c54b |
| name                | 10.0.0.210                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | 1c2f5dc8c4f9494fbaaa4217c8e3585a     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2023-06-28T23:48:33Z                 |
+---------------------+--------------------------------------+

debian@dlp ~(keystone)$
openstack server add floating ip Debian-12GPU 10.0.0.210

debian@dlp ~(keystone)$
ssh debian@10.0.0.210

The authenticity of host '10.0.0.210 (10.0.0.210)' can't be established.
ED25519 key fingerprint is SHA256:bHQFXsoEvEOhLq0aB2GbVbqf7Xjz5wCy/AxAQqLmAv0.
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.210' (ED25519) to the list of known hosts.
Linux debian-12gpu 6.1.0-9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@debian-12gpu:~$
debian@debian-12gpu:~$
lspci | grep -i nvidia

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