[SOLVED] can reduce vcpu, but cannot increase

-13-

Member
Feb 23, 2018
4
0
6
23
Hi
have debian 9.3 host and debian 9.3 guest
PVE 5.1-40

want to manage vcpu quantity on guest
reduce numbers in web-gui - OK, changes apply in web-gui, and in guest
increase numbers in web-gui - no errors, changes apply in web-gui, but no changes in guest

in guest i've got message in /var/log/messages
kernel: [18975.683085] CPU4 has been hot-added
but no additional vcpu appeared

if i shutdown and start guest - all 5 vCPU works fine
what's whe problem?
 
or another working way posted at __askubuntu.com/a/764621

The script below will turn all CPU and RAM online for you.

Code:
#!/bin/bash
# Based on script by William Lam - __engineering.ucsb.edu/~duonglt/vmware/

# Bring CPUs online
for CPU_DIR in /sys/devices/system/cpu/cpu[0-9]*
do
    CPU=${CPU_DIR##*/}
    echo "Found cpu: '${CPU_DIR}' ..."
    CPU_STATE_FILE="${CPU_DIR}/online"
    if [ -f "${CPU_STATE_FILE}" ]; then
        if grep -qx 1 "${CPU_STATE_FILE}"; then
            echo -e "\t${CPU} already online"
        else
            echo -e "\t${CPU} is new cpu, onlining cpu ..."
            echo 1 > "${CPU_STATE_FILE}"
        fi
    else
        echo -e "\t${CPU} already configured prior to hot-add"
    fi
done

# Bring all new Memory online
for RAM in $(grep line /sys/devices/system/memory/*/state)
do
    echo "Found ram: ${RAM} ..."
    if [[ "${RAM}" == *":offline" ]]; then
        echo "Bringing online"
        echo $RAM | sed "s/:offline$//"|sed "s/^/echo online > /"|source /dev/stdin
    else
        echo "Already online"
    fi
done