Ubuntu 22.04
Sponsored Link

OpenStack Caracal : Add Compute Nodes (GPU)2024/04/09

 
Add GPU attached Compute Nodes to use GPU on virtual machine instances.
On this example, add [node02.srv.world] like follows.
------------+--------------------------+--------------------------+------------
            |                          |                          |
        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] On the new Node with GPU, Configure additional settings for Nova-Compute.
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
# add to last line
# add [vendor_id], [product_id] of passthrough device
[pci]
passthrough_whitelist = { "vendor_id": "10de", "product_id": "2487" }

root@node02:~#
systemctl restart nova-compute
[4] On Control Node, Change Nova settings.
root@dlp ~(keystone)#
vi /etc/nova/nova.conf
# add to last line
# add [vendor_id], [product_id] that are the same one on compute node
# for the [name], set any name you like
[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
# create [flavor] for GPU instance

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] Verify settings to create a GPU instance with any Openstack user.
ubuntu@dlp ~(keystone)$
openstack network list

+---------------------------------+---------+----------------------------------+
| ID                              | Name    | Subnets                          |
+---------------------------------+---------+----------------------------------+
| 24288203-5512-40c5-8bcb-        | public  | 0b39a7b6-3b03-4704-ba32-         |
| aed6dffc2bc1                    |         | 89e5894bad2c                     |
| b28ad879-8bbf-40fe-b2fb-        | private | 42dd9fb5-a0f2-4556-b896-         |
| af772cf88a8a                    |         | 6257cb5119f6                     |
+---------------------------------+---------+----------------------------------+

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     |
+-------------+-------------+---------+--------------+------------+------------+
| a30b6a48-   | Ubuntu-     | ACTIVE  | private=192. | Ubuntu2204 | gpu1.small |
| 8b7c-428a-  | 2204GPU     |         | 168.100.229  |            |            |
| b652-       |             |         |              |            |            |
| 6c3bdf330ae |             |         |              |            |            |
| 9           |             |         |              |            |            |
| e7feb65c-   | Ubuntu-2204 | SHUTOFF | private=10.0 | Ubuntu2204 | m1.small   |
| 1482-48a9-  |             |         | .0.250, 192. |            |            |
| 9d45-       |             |         | 168.100.188  |            |            |
| e74196a5ea9 |             |         |              |            |            |
| 2           |             |         |              |            |            |
+-------------+-------------+---------+--------------+------------+------------+

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2024-04-09T05:11:23Z                 |
| description         |                                      |
| dns_domain          | None                                 |
| dns_name            | None                                 |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.237                           |
| floating_network_id | 24288203-5512-40c5-8bcb-aed6dffc2bc1 |
| id                  | 90a54b31-a191-4988-afe7-7be7719922b1 |
| name                | 10.0.0.237                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | 2bcdd2fecf1d4a8c8faf87f1232cf365     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2024-04-09T05:11:23Z                 |
+---------------------+--------------------------------------+

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

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

The authenticity of host '10.0.0.237 (10.0.0.237)' can't be established.
ED25519 key fingerprint is SHA256:3jurTu5EcAET+hbboq+TCSuL6W1W16UoJjCOseC/Ymg.
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.237' (ED25519) to the list of known hosts.
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-101-generic x86_64)

.....
.....

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

00:05.0 VGA compatible controller: NVIDIA Corporation GA104 [GeForce RTX 3060] (rev a1)
Matched Content