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 ?
On Tue, 2024-04-23 at 17:49 +0530, Gk Gk wrote:
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 ?
yes in placement those resouces are reported as inventoies on the resouces providers corresponidng to the compute nodes each compute node has a resouce provider with the same uuid and name (the name of the rp is the hypervior_hostname of the comptue node) https://docs.openstack.org/api-ref/placement/#list-resource-provider-invento... each resouce provider has a usage api so you see the totall amount and the current usage via placement. https://docs.openstack.org/api-ref/placement/#list-resource-provider-usages you can also get this info from nova usign the hyperviors api https://docs.openstack.org/api-ref/compute/#list-hypervisors-details athough placement is prefered we ahve removed some of the resouce information from the hyperiors api in wallaby https://specs.openstack.org/openstack/nova-specs/specs/wallaby/implemented/m...
Hello Gk, hope this email finds you well Yes, theres a lot of ways, depends on what are you using. But, in general, here are some common methods: A - Placement APIs if you are using a cloud platform like Openstack B - Hypervisor APIs, if you are using KVM, VMWare C - Command Line Tools, in Linux systems with libvirt installed, you can use commands like 'virsh nodeinfo' D - Monitoring tools: You can use monitoring tools like Prometheus, Grafana, or Nagios to monitor resource usage on compute nodes in real-time E - Cloud Management Platforms: If you're using a cloud management platform like OpenStack, VMware vSphere, or Microsoft Azure, these platforms often provide built-in interfaces or APIs for querying available resources and creating VMs. The specific method you choose will depend on your environment, the tools and platforms you're using, and your specific requirements for VM creation and resource allocation. Thanks, have a nice week. 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 ?
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 ?
participants (3)
-
Gk Gk
-
smooney@redhat.com
-
tor@linvx.com.br