Ubuntu 22.04
Sponsored Link

OpenStack Antelope : Compute ノードを追加する (GPU)2023/03/27

 
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 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 nova-api nova-scheduler
# GPU 用の [flavor] 作成

root@dlp ~(keystone)#
openstack flavor create --id 4 --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                         | 4                                 |
| name                       | gpu1.small                        |
| os-flavor-access:is_public | True                              |
| properties                 | pci_passthrough:alias='GTX-680: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 |   20 |        10 |     4 | True      |
| 4  | gpu1.small | 8192 |   20 |         0 |     4 | True      |
+----+------------+------+------+-----------+-------+-----------+
[5] 任意の Openstack ユーザーで GPU インスタンスを作成して動作確認します。
ubuntu@dlp ~(keystone)$
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 5352e6c0-47b3-4df2-84f4-ca048f141e1d | public  | ca5539a8-0291-4684-9fb3-0f448efacebf |
| ce6e88bc-107a-446b-b2ab-255bab7269fe | private | feb337ec-215e-406e-8871-196fed2c4207 |
+--------------------------------------+---------+--------------------------------------+

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

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

+--------------------------------------+----------------+---------+-------------------------------------+------------+------------+
| ID                                   | Name           | Status  | Networks                            | Image      | Flavor     |
+--------------------------------------+----------------+---------+-------------------------------------+------------+------------+
| 1a3f3521-42e4-4628-a73d-606916ce40c1 | Ubuntu-2204GPU | ACTIVE  | private=192.168.100.119             | Ubuntu2204 | gpu1.small |
| 11987eec-fb38-4de1-a386-3d1d6001bbd3 | Ubuntu-2204    | SHUTOFF | private=10.0.0.252, 192.168.100.100 | Ubuntu2204 | m1.medium  |
+--------------------------------------+----------------+---------+-------------------------------------+------------+------------+

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2023-03-27T04:04:56Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.244                           |
| floating_network_id | 5352e6c0-47b3-4df2-84f4-ca048f141e1d |
| id                  | d3315a3f-dba5-45fd-9160-3908a505b752 |
| name                | 10.0.0.244                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | e294bd7c00314facacdb46c36fb54ee9     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2023-03-27T04:04:56Z                 |
+---------------------+--------------------------------------+

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

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

The authenticity of host '10.0.0.244 (10.0.0.244)' can't be established.
ED25519 key fingerprint is SHA256:7eWknomqH6PO2pVaiEIuK6jcatrxM1on6fhFayq54FI.
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.244' (ED25519) to the list of known hosts.
Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-67-generic x86_64)

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

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