Ubuntu 22.04
Sponsored Link

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

 
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 5 --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                         | 5                                 |
| 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 |   20 |         0 |     4 | True      |
| 5  | gpu1.small | 8192 |   20 |         0 |     4 | True      |
+----+------------+------+------+-----------+-------+-----------+
[5] 任意の Openstack ユーザーで GPU インスタンスを作成して動作確認します。
ubuntu@dlp ~(keystone)$
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 1d42f5e1-1ff2-4f70-8c48-8c7f6eae0672 | public  | c192082c-f107-4eed-aafc-6e30b604e283 |
| 529ae54a-4bba-40a3-905d-2ca57557236a | private | e14c5e7d-41d0-4378-af0f-0993c4389593 |
+--------------------------------------+---------+--------------------------------------+

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     |
+--------------------------------------+----------------+---------+------------------------------------+------------+------------+
| 2932146c-3ab0-4b43-b288-e9771fee7c59 | Ubuntu-2204GPU | ACTIVE  | private=192.168.100.182            | Ubuntu2204 | gpu1.small |
| 530698ed-413e-4bda-b02e-8f6f60380bd1 | Ubuntu-2204    | SHUTOFF | private=10.0.0.222, 192.168.100.79 | Ubuntu2204 | m1.medium  |
+--------------------------------------+----------------+---------+------------------------------------+------------+------------+

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2023-10-05T09:21:50Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.221                           |
| floating_network_id | 1d42f5e1-1ff2-4f70-8c48-8c7f6eae0672 |
| id                  | 3217d6a9-f909-46d3-b06f-c3bb1a311238 |
| name                | 10.0.0.221                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | f30cd546632e484cb24414d83207694b     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2023-10-05T09:21:50Z                 |
+---------------------+--------------------------------------+

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

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

The authenticity of host '10.0.0.221 (10.0.0.221)' can't be established.
ED25519 key fingerprint is SHA256:RZ4Xwnd2jlSstMnZKarHrTYVz5MrU7ktIs1ecdFNiQA.
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.221' (ED25519) to the list of known hosts.
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-84-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)
関連コンテンツ