Bug 1624336 - Improve error info when hotplug/coldplug memory device without 'maxMemory' defined
Summary: Improve error info when hotplug/coldplug memory device without 'maxMemory' de...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: John Ferlan
QA Contact: Jing Qi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-31 08:59 UTC by yafu
Modified: 2020-03-11 22:32 UTC (History)
5 users (show)

Fixed In Version: libvirt-5.0.0-1.el8
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2020-03-11 22:32:52 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description yafu 2018-08-31 08:59:52 UTC
description of problem:
Improve error info when hotpulg/coldplug memory device without 'maxMemory' defined

Version-Release number of selected component (if applicable):
libvirt-4.5.0-7.el7.x86_64
qemu-kvm-rhev-2.12.0-12.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Start a guest without 'maxMemory' defined:
#virsh dumpxml iommu1 | grep -i 'maxmemory'
no output

2.Prepare a memory device:
#cat mem.xml 
<memory model='dimm'>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

3.Hotplug the memory device to guest:
#virsh attach-device iommu1 mem.xml
error: Failed to attach device from mem.xml
error: unsupported configuration: Attaching memory device with size '524288' would exceed domain's maxMemory config

4.Coldplug the memory device to guest:
#virsh attach-device iommu1 mem.xml
error: Failed to attach device from mem.xml
error: unsupported configuration: Attaching memory device with size '524288' would exceed domain's maxMemory config

Actual results:


Expected results:
Should report error more clearly, such as: 
cannot use/hotplug a memory device when domain 'maxMemory' is not defined


Additional info:

Comment 2 John Ferlan 2018-12-07 17:28:36 UTC
Posted a couple of patches.  Details in the cover letter and the actual desired fix in patch 2. Patch 1 just augments the message to display the max_memory size that's too small.

https://www.redhat.com/archives/libvir-list/2018-December/msg00207.html

Comment 3 John Ferlan 2018-12-12 19:43:33 UTC
Patch pushed upstream:

commit 3972a25f1d4f9c75d73faaac9106fc16037de645
Author: John Ferlan <jferlan>
Date:   Fri Dec 7 09:46:48 2018 -0500

    conf: Add check/error for domain supports cold/hotplug
    
...
    
    Add a check during virDomainDefCompatibleDevice whether the
    domain supports cold/hotplug of a memory module even though
    this duplicates the qemuDomainDefValidateMemoryHotplug check.
    
    Without this check, the cold/hot plug would fail on the
    subsequent mem_memory check (since it's 0). Adding a check
    for max_memory > 0 would allow the subsequent hotplug check
    to fail, but would cause coldplug to fail with the somewhat
    opaque message "no free memory device slot available".
    
    Signed-off-by: John Ferlan <jferlan>
    ACKed-by: Michal Privoznik <mprivozn>

$ git describe 3972a25f1d4f9c75d73faaac9106fc16037de645
v4.10.0-53-g3972a25f1d
$

Comment 4 Jing Qi 2019-05-24 06:35:47 UTC
Verified with libvirt-daemon-5.0.0-7.module+el8+2887+effa3c42.x86_64 and qemu-kvm-3.1.0-20.module+el8+2888+cdc893a8.x86_64
mem.xml
<memory model='dimm'>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

Start domain avocado-vt-vm2 -

# virsh attach-device avocado-vt-vm2 ~/mem.xml 
error: Failed to attach device from /root/mem.xml
error: unsupported configuration: cannot use/hotplug a memory device when domain 'maxMemory' is not defined

Destroy domain -

# virsh attach-device avocado-vt-vm2 ~/mem.xml --config
error: Failed to attach device from /root/mem.xml
error: unsupported configuration: cannot use/hotplug a memory device when domain 'maxMemory' is not defined

Comment 6 Jing Qi 2019-07-05 05:33:27 UTC
Verified with libvirt-5.0.0-11.module+el8.0.1+3459+e357ef2f.x86_64 & qemu-kvm-3.1.0-27.module+el8.0.1+3253+c5371cb3.x86_64

1. A domain without maxMemory element and dd below xml to the <devices> part in the domain 

 <memory model='dimm'>
      <target>
        <size unit='KiB'>524288</size>
        <node>0</node>
      </target>
    </memory>

# virsh start r1
error: Failed to start domain r1
error: unsupported configuration: cannot use/hotplug a memory device when domain 'maxMemory' is not defined

2. Save above xml to m.xml and attach device

# virsh attach-device r1 ./m.xml 
error: Failed to attach device from ./m.xml
error: unsupported configuration: cannot use/hotplug a memory device when domain 'maxMemory' is not defined

# virsh attach-device r1 ./m.xml  --config
error: Failed to attach device from ./m.xml
error: unsupported configuration: cannot use/hotplug a memory device when domain 'maxMemory' is not defined

Comment 7 Jeff Nelson 2020-03-11 22:32:52 UTC
This was verified and shipped long ago. Closing the bug report.


Note You need to log in before you can comment on or make changes to this bug.