From Fedora Project Wiki

Description

How to test

  1. edit the guest <memory> section
    # virsh edit <guest-name>
    <memory>1048576</memory>
    <currentMemory>524288</currentMemory>
    # virsh start <guest-name>
     
  2. set guest memory using non-integer
    # virsh setmem <guest-name,id,uuid> abc
  3. set guest memory larger than max memory
    # virsh setmem <guest-name,id,uuid>1248576
  4. reduce guest memory
    # virsh setmem <guest-name,id,uuid> 655360
  5. reboot guest then check the memory
    # virsh shutdown <guest-name>
    # virsh start <guest-name>
    # virsh dumpxml <guest-name>
    login guest
    guest> cat /proc/meminfo | grep -i memtotal

Expected Results

  1. Step#1: guest started successfully
  2. Step#2: error: Invalid value of 0 for memory size
  3. Step#3: error: Requested memory size 1248576 kb is larger than maximum of 1048576 kb
  4. Step#4: return nothing
  5. Step#5: the memory of guest is approximate to 655360