Increase ram or CPU cores from the API

Ulrar

Active Member
Feb 4, 2016
37
1
28
33
Hi,

I'm trying to finish a script to deploy and configure a VM from a template.
Right now it works pretty well, it clones the template, increase the disk size to whatever value I passed as an argument and grows the LVM partitions and then mounts the / to customize the configuration files in /etc.

I'm only missing parameters for the number of cores and the quantity of ram, I took a look at the API and I don't see any methods for that.
Is the only way to put the whole config again ? I'm using pvesh for this if that matters.

Thanks
 
Code:
pvesh set /nodes/NODE/qemu/VMID/config -OPTION VALUE

you can set one or more of the configuration options at a time.
 
Code:
pvesh set /nodes/NODE/qemu/VMID/config -OPTION VALUE

you can set one or more of the configuration options at a time.
Hi Fabian,
are there a switch to use hotplug for this?
If I do following:
Code:
pvesh set nodes/pve03/qemu/333/config -sockets 2
The additional socket was in pending state
Code:
pvesh get nodes/pve03/qemu/333/pending   
200 OK
[
  {
  "key" : "cores",
  "value" : 4
  },
...
  {
  "key" : "sockets",
  "pending" : 2,
  "value" : 1
  },
...
  {
  "key" : "hotplug",
  "value" : "disk,network,usb,memory,cpu"
  },
...
can't find an hint in man/doku.

Udo
 
it should hotplug automatically if possible (and enabled). IIRC, sockets are not hotpluggable..
 
it should hotplug automatically if possible (and enabled). IIRC, sockets are not hotpluggable..
Hi Fabian,
memory worked but cores not - the same happens from the gui... but I'm sure to test this from gui some days before.
Perhaps an bug in the latest version?
Code:
root@pve03:~# pvesh set nodes/pve03/qemu/333/config -cores 8
update VM 333: -cores 8
200 OK
#### gui shows pending cpu

root@pve03:~# pvesh set nodes/pve03/qemu/333/config -memory 1536
update VM 333: -memory 1536
try to unplug memory dimm dimm1
200 OK
Proxmox VE version:
Code:
proxmox-ve: 4.3-72 (running kernel: 4.4.24-1-pve)
pve-manager: 4.3-12 (running version: 4.3-12/6894c9d9)
pve-kernel-4.4.21-1-pve: 4.4.21-71
pve-kernel-4.4.24-1-pve: 4.4.24-72
pve-kernel-4.4.19-1-pve: 4.4.19-66
lvm2: 2.02.116-pve3
corosync-pve: 2.4.0-1
libqb0: 1.0-1
pve-cluster: 4.0-47
qemu-server: 4.0-96
pve-firmware: 1.1-10
libpve-common-perl: 4.0-83
libpve-access-control: 4.0-19
libpve-storage-perl: 4.0-68
pve-libspice-server1: 0.12.8-1
vncterm: 1.2-1
pve-docs: 4.3-17
pve-qemu-kvm: 2.7.0-8
pve-container: 1.0-85
pve-firewall: 2.0-31
pve-ha-manager: 1.0-38
ksm-control-daemon: 1.2-1
glusterfs-client: 3.5.2-2+deb8u2
lxc-pve: 2.0.6-1
lxcfs: 2.0.5-pve1
criu: 1.6.0-1
novnc-pve: 0.5-8
smartmontools: 6.5+svn4324-1~pve80
zfsutils: 0.6.5.8-pve13~bpo80
openvswitch-switch: 2.6.0-2
ceph: 0.94.9-1~bpo80+1
Udo
 
cpu hotplugging is done by setting the vcpus config option, not the cores one. with cores and sockets you can define a maximum number of cpus, and with vcpus the actual currently hot plugged count.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!