To query available RAM, disk space, and vCPUs on a compute node using OpenStack Placement APIs, you can make requests to the Placement API endpoints. Below are examples of requests you can use to retrieve this information:

1. **Available RAM**:

```http
GET /resource_providers?member_of=allocation_ratio HTTP/1.1
Host: placement.example.com
```

This request retrieves a list of resource providers along with their allocation ratios. You can parse the response to calculate available RAM based on the allocation ratios and total memory.

2. **Disk Space**:

```http
GET /resource_providers?member_of=inventories&resources=disk_gb HTTP/1.1
Host: placement.example.com
```

This request retrieves a list of resource providers along with their disk inventories. You can parse the response to calculate available disk space based on the disk inventory.

3. **vCPUs**:

```http
GET /resource_providers?member_of=inventories&resources=VCPU HTTP/1.1
Host: placement.example.com
```

This request retrieves a list of resource providers along with their vCPU inventories. You can parse the response to calculate available vCPUs based on the vCPU inventory.

Please note that these requests assume that the compute nodes are already known to the Placement service, and the necessary inventories and allocation ratios have been configured. Additionally, you may need to authenticate and authorize your requests depending on the OpenStack deployment's security configuration.

You can execute these HTTP requests using tools like `curl`, or by using an HTTP client library in your programming language of choice (e.g., Python's `requests` library).


A 2024-04-23 09:19, Gk Gk escreveu:

Hi,
 
Is there a way to find out the available ram, disk and vcpus on a compute node for vm creation using any placement APIs or any other way ?