Create a VM in ProxmoxVE on cluster, not on specific node

andrei_optiva

New Member
Jul 20, 2021
1
0
1
38
Hi all,

I am sure this question was asked multiple times but i was not able to find an updated answer.
We are using a 16 nodes PVE cluster. Plan is to integrate it with Jenkins and to create pipelines for new VM creation. How can we balance the VMs across all nodes? at the moment we can create VMs on a specific node only but we would like to create them on Cluster and to be balanced on all nodes in the cluster, like an automated round robin.
Details about Proxmox versions:
Code:
proxmox-ve: 6.4-1 (running kernel: 5.4.128-1-pve)
pve-manager: 6.4-13 (running version: 6.4-13/9f411e79)
pve-kernel-5.4: 6.4-5
pve-kernel-helper: 6.4-5
pve-kernel-5.4.128-1-pve: 5.4.128-1
pve-kernel-5.4.106-1-pve: 5.4.106-1
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.1.2-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: not correctly installed
ifupdown2: 3.0.0-1+pve4~bpo10
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.20-pve1
libproxmox-acme-perl: 1.1.0
libproxmox-backup-qemu0: 1.1.0-1
libpve-access-control: 6.4-3
libpve-apiclient-perl: 3.1-3
libpve-common-perl: 6.4-3
libpve-guest-common-perl: 3.1-5
libpve-http-server-perl: 3.2-3
libpve-network-perl: 0.6.0
libpve-storage-perl: 6.4-1
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.6-2
lxcfs: 4.0.6-pve1
novnc-pve: 1.1.0-1
proxmox-backup-client: 1.1.12-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.6-1
pve-cluster: 6.4-1
pve-container: 3.3-6
pve-docs: 6.4-2
pve-edk2-firmware: 2.20200531-1
pve-firewall: 4.1-4
pve-firmware: 3.2-4
pve-ha-manager: 3.1-1
pve-i18n: 2.3-1
pve-qemu-kvm: 5.2.0-6
pve-xtermjs: 4.7.0-3
qemu-server: 6.4-2
smartmontools: 7.2-pve2
spiceterm: 3.1-1
vncterm: 1.6-2
zfsutils-linux: 2.0.5-pve1~bpo10+1
Thank you!
Andrei
 
There is no built-in functionality for that AFAIK. You would need to first fetch the status of the cluster nodes (CPU, Mem, free space maybe) and decide where to create the VM. Depending on how you already interact with PVE you have different possibilities for that, e.g. API directly or pvesh.

For example:
Code:
pvesh get cluster/resources --type node --output-format json-pretty
[
   {
      "cpu" : 0.127997535879204,
      "disk" : 8355446784,
      "id" : "node/cephtest1",
      "level" : "",
      "maxcpu" : 4,
      "maxdisk" : 32232308736,
      "maxmem" : 8339136512,
      "mem" : 1930690560,
      "node" : "cephtest1",
      "status" : "online",
      "type" : "node",
      "uptime" : 27
   },
   {
      "cpu" : 0.0727078212136381,
      "disk" : 3887071232,
      "id" : "node/cephtest2",
      "level" : "",
      "maxcpu" : 4,
      "maxdisk" : 32237813760,
      "maxmem" : 8339136512,
      "mem" : 1795825664,
      "node" : "cephtest2",
      "status" : "online",
      "type" : "node",
      "uptime" : 25
   },
   {
      "cpu" : 0.0343129358761603,
      "disk" : 3885105152,
      "id" : "node/cephtest3",
      "level" : "",
      "maxcpu" : 4,
      "maxdisk" : 32238338048,
      "maxmem" : 8339136512,
      "mem" : 1741074432,
      "node" : "cephtest3",
      "status" : "online",
      "type" : "node",
      "uptime" : 26
   }
]
You get the CPU usage, total mem and used mem. If storage is also important, because you only have local storage, you can check that as well, if you add the type "storage" to the call: --type node,storage.

https://pve.proxmox.com/pve-docs/api-viewer/index.html#/cluster/resources
 
Has there been any updates to this matter?

It does not seem like so when I checked the latest documentation.

I am guessing this sort of feature is not on the roadmap of Proxmox VE any time soon. Right?