Difference between revisions of "Hotplug (qemu disk,nic,cpu,memory)"

From Proxmox VE
Jump to navigation Jump to search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Proxmox support hotplugging of qemu devices
+
Proxmox support hotplugging of Qemu devices:
  
- disks (hotplug/unplug)
+
- Disks (hotplug/unplug)
  
- nics (hotplug/unplug)
+
- NICs (hotplug/unplug)
  
- cpu (hotplug/unplug)
+
- CPU (hotplug/unplug)
  
- memory (hotplug/unplug)
+
- Memory (hotplug/unplug)
  
== Linux Guests notes ==
+
== Linux Guests Notes ==
  
==== kernel modules needed ====  
+
==== Kernel Modules Needed ====  
you need to have 2 modules loaded in your linux guest
+
You need to have 2 modules loaded in your Linux guest:
  
 
<pre>
 
<pre>
Line 19: Line 19:
 
</pre>
 
</pre>
  
==== cpu && memory hotplug ====  
+
==== CPU and Memory Hotplug ====  
  
you need a recent kernel > 3.10
+
You need a recent kernel (> 3.10) and a udev rules file, to auto-enable CPU or memory hotplugging.
 
 
and a udev rules, to auto enable cpus or memory hotplugged
 
 
 
you can add a file:
 
  
 +
You can add the file:
  
 
/lib/udev/rules.d/80-hotplug-cpu-mem.rules
 
/lib/udev/rules.d/80-hotplug-cpu-mem.rules
Line 34: Line 31:
 
</pre>
 
</pre>
  
for linux kernel >= 4.7,
+
For Linux kernel >= 4.7, you don't need the udev rule for memory hotplug; you only need to add this kernel parameter at boot:
  
you don't need the udev rule for memory hotplug, you only need to add this kernel parameter at boot:
+
memhp_default_state=online
  
 +
For Linux kernel >=5.15 (e.g. Ubuntu 22.04) you only need the UDEV rule for cpu hotplug:
  
memhp_default_state=online
+
/lib/udev/rules.d/80-hotplug-cpu.rules
 +
<pre>
 +
SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
 +
</pre>
  
== Windows Guests notes ==
+
== Windows Guests Notes ==
  
- Disk and nic hotplug is working out of the box for all windows versions >2003
+
- Disk and NIC hotplug work out of the box for all Windows versions >2003
- cpu && memory hotplug is working on > 2008 enterprise/datacenter, 2012 > standard
 
  
 +
- CPU and memory hotplug work on > 2008 enterprise/datacenter, 2012 > standard
  
 +
== Disk and NIC Hotplug/unplug ==
  
== Disk && Nic hotplug/unplug ==
+
Edit your VM configuration file:
 
 
edit your vm configuration file
 
  
 
<pre>
 
<pre>
 
/etc/pve/qemuserver/<VMID>.conf
 
/etc/pve/qemuserver/<VMID>.conf
 
</pre>
 
</pre>
and add
+
and add:
 
<pre>
 
<pre>
 
hotplug: network,disk,....
 
hotplug: network,disk,....
 
</pre>
 
</pre>
  
Note: Since proxmox 3.3, hotplug option is available in GUI.
+
Note: Since Proxmox 3.3, the hotplug option is available in the GUI.
 
 
 
 
  
Then add/remove your disk or nics as usual.
+
Then add/remove your disks or NICs as usual.
  
For disk unplug, verify that your disk is not mounted in your linux guest or disabled in windows disk management.
+
For disk unplug, verify that your disk is not mounted in your Linux guest or enabled in Windows Disk Management.
  
== CPU hotplug ==
+
== CPU Hotplug ==
  
# In the VM Options edit the "Hotplug" Value and activate "CPU Hotplug".
+
# In the VM Options, edit the "Hotplug" Value and activate "CPU Hotplug".
# In the Hardware Section of your VM specify the maximum number of Sockets/Cores.
+
# In the Hardware Section of your VM, specify the maximum number of Sockets/Cores.
# You can now use the "CPU Options" dialog to change the number of vCPUs while the machine is running.
+
# You can now use the "CPU Options" dialog to change the number of vCPUs, while the machine is running.
  
 
maxcpus = sockets * cores.
 
maxcpus = sockets * cores.
  
Note :
+
Note : Windows CPU hotplug has been working since qemu 2.6 and CPU hot unplug has been working since qemu 2.7.
windows cpu hotplug is working since qemu 2.6
 
cpu hot unplug is working since qemu 2.7
 
  
== Memory hotplug ==
+
== Memory Hotplug ==
  
 
Memory hotplug is available in proxmox 3.4.
 
Memory hotplug is available in proxmox 3.4.
  
You need to enable numa and hotplug to get it working
+
You need to enable NUMA and hotplug to get it working:
  
 
<pre>
 
<pre>
Line 91: Line 87:
 
</pre>
 
</pre>
  
Then you can use the memory GUI as usual.
+
Then you can use the memory GUI options as usual.
 
 
== Memory Hot-Unplug ==
 
  
- Memory unplug currently doesn't work in Windows (<=win10 currently)
+
== Memory Hot Unplug ==
  
- Memory unplug can't be unstable on Linux (<= kernel 4.10 currently)
+
- Memory unplug currently does not work on Windows (<=win10 currently)
  
for Linux memory unplug, you need to have movable zone enabled in the kernel config (not enabled by default on Debian/Ubuntu)
+
- Memory unplug can be unstable on Linux (<= kernel 4.10 currently)
  
CONFIG_MOVABLE_NODE=YES
+
For Linux memory unplug, you need to have movable zone enabled, in the kernel config (not enabled by default on Debian/Ubuntu):
  
and
+
CONFIG_MOVABLE_NODE=YES
  
"movable_node" boot kernel parameter enabled
+
and the "movable_node" boot kernel parameter enabled.
  
 
Here are some future kernel patches to improve unplug : http://www.spinics.net/lists/linux-mm/msg125359.html
 
Here are some future kernel patches to improve unplug : http://www.spinics.net/lists/linux-mm/msg125359.html
  
 
[[Category:HOWTO]] [[Category:Installation]]
 
[[Category:HOWTO]] [[Category:Installation]]

Latest revision as of 10:10, 20 October 2022

Proxmox support hotplugging of Qemu devices:

- Disks (hotplug/unplug)

- NICs (hotplug/unplug)

- CPU (hotplug/unplug)

- Memory (hotplug/unplug)

Linux Guests Notes

Kernel Modules Needed

You need to have 2 modules loaded in your Linux guest:

#modprobe acpiphp
#modprobe pci_hotplug

CPU and Memory Hotplug

You need a recent kernel (> 3.10) and a udev rules file, to auto-enable CPU or memory hotplugging.

You can add the file:

/lib/udev/rules.d/80-hotplug-cpu-mem.rules

SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
SUBSYSTEM=="memory", ACTION=="add", TEST=="state", ATTR{state}=="offline", ATTR{state}="online"

For Linux kernel >= 4.7, you don't need the udev rule for memory hotplug; you only need to add this kernel parameter at boot:

memhp_default_state=online

For Linux kernel >=5.15 (e.g. Ubuntu 22.04) you only need the UDEV rule for cpu hotplug:

/lib/udev/rules.d/80-hotplug-cpu.rules

SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"

Windows Guests Notes

- Disk and NIC hotplug work out of the box for all Windows versions >2003

- CPU and memory hotplug work on > 2008 enterprise/datacenter, 2012 > standard

Disk and NIC Hotplug/unplug

Edit your VM configuration file:

/etc/pve/qemuserver/<VMID>.conf

and add:

hotplug: network,disk,....
Note: Since Proxmox 3.3, the hotplug option is available in the GUI.

Then add/remove your disks or NICs as usual.

For disk unplug, verify that your disk is not mounted in your Linux guest or enabled in Windows Disk Management.

CPU Hotplug

  1. In the VM Options, edit the "Hotplug" Value and activate "CPU Hotplug".
  2. In the Hardware Section of your VM, specify the maximum number of Sockets/Cores.
  3. You can now use the "CPU Options" dialog to change the number of vCPUs, while the machine is running.

maxcpus = sockets * cores.

Note : Windows CPU hotplug has been working since qemu 2.6 and CPU hot unplug has been working since qemu 2.7.

Memory Hotplug

Memory hotplug is available in proxmox 3.4.

You need to enable NUMA and hotplug to get it working:

numa: 1
hotplug: memory,...

Then you can use the memory GUI options as usual.

Memory Hot Unplug

- Memory unplug currently does not work on Windows (<=win10 currently)

- Memory unplug can be unstable on Linux (<= kernel 4.10 currently)

For Linux memory unplug, you need to have movable zone enabled, in the kernel config (not enabled by default on Debian/Ubuntu):

CONFIG_MOVABLE_NODE=YES

and the "movable_node" boot kernel parameter enabled.

Here are some future kernel patches to improve unplug : http://www.spinics.net/lists/linux-mm/msg125359.html