RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1216046 - guest which cold-plug too much memory device will disappear after restart libvirt
Summary: guest which cold-plug too much memory device will disappear after restart lib...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1220702
TreeView+ depends on / blocked
 
Reported: 2015-04-28 12:06 UTC by Luyao Huang
Modified: 2015-11-19 06:29 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.15-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1220702 (view as bug list)
Environment:
Last Closed: 2015-11-19 06:29:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2015-04-28 12:06:39 UTC
description of problem:
guest which cold-plug too much memory device will disappear after restart libvirt

Version-Release number of selected component (if applicable):
libvirt-1.2.14-1.el7.x86_64
qemu-kvm-rhev-2.2.0-8.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
prepare a inactive vm with maxmemory and numa settings:
  <maxMemory slots='16' unit='KiB'>2524288</maxMemory>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
...
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>
...

2.
attach some memory device utill xml error:
# virsh attach-device test3 memdevice.xml --config
Device attached successfully

# virsh attach-device test3 memdevice.xml --config
Device attached successfully

# virsh attach-device test3 memdevice.xml --config
Device attached successfully

# virsh attach-device test3 memdevice.xml --config
error: Failed to attach device from memdevice.xml
error: XML error: maximum memory size must be equal or greater than the actual memory size
 
3.
check the xml:
...
  <maxMemory slots='16' unit='KiB'>2524288</maxMemory>
  <memory unit='KiB'>3024000</memory>   <--- greater than maxmemory
  <currentMemory unit='KiB'>1024000</currentMemory>
...

4.
restart libvirtd and check the vm:

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

5.
# virsh edit test3
error: failed to get domain 'test3'
error: Domain not found: no domain with matching name 'test3'


Actual results:
guest which cold-plug too much memory device will disappear after restart libvirt

Expected results:
guest should not disappear

infomation:

Comment 1 Peter Krempa 2015-04-29 07:58:43 UTC
This and a few other corner case checks were added by commits:

commit a83b2e253f0750c7053e2bf0f4510d6e1de73264
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 28 17:33:54 2015 +0200

    qemu: Validate available slot count for memory devices
    
    While qemu would reject the configuration we can check whether it makes
    sense to plug the device upfront.

commit 6705d828fc44fabf9f24c73a649089f068b00f35
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 28 17:15:43 2015 +0200

    qemu: command: Validate that memory devices slot ID is in range
    
    slot id, if specified, has to be less than the slots count.

commit 406944e476729ce740da126d767b073e23c1af4d
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 28 16:23:05 2015 +0200

    qemu: conf: Reject memory device if it would exceed configured max size
    
    If the added memory device would exceed the maximum memory size, reject
    it.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1216046

v1.2.15-rc1-22-ga83b2e2

Comment 2 Luyao Huang 2015-04-30 08:51:34 UTC
Hi Peter,

I have found another guest disappear because memory vs current memory (and test with upstream libvirt, this issue still exist), would you please help to check out if need open a another bug to track it? thanks in advance for your help.

1. prepare a vm with memory deivce like this:

# virsh dumpxml test3

  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1536000</memory>
  <currentMemory unit='KiB'>1536000</currentMemory>
...
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>
...
    <memory model='dimm'>
      <target>
        <size unit='KiB'>512000</size>
        <node>0</node>
      </target>
    </memory>

2. cold-unplug the memory deivce:
# virsh detach-device test3 memdevice.xml --config
Device detached successfully

# virsh dumpxml test3
  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1536000</currentMemory>


3. restart libvirtd and vm will disappear

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh edit test3
error: failed to get domain 'test3'
error: Domain not found: no domain with matching name 'test3'


And ask another question about the display of initial memory and memory.

I test memory device with qemu-2.3.0, I found the current memory is not correct if we hot-plug a memory device:

1. prepare a running vm with maxmemory and numa settings: 

  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
...
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>

2. hot-plug a memory device
# virsh attach-device test3 memdevice.xml
Device attached successfully

3. check the current memory and memory ballon:

# virsh dumpxml test3
...
  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1536000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>


# virsh dommemstat test3
actual 1536000
swap_in 0
swap_out 0
major_fault 370
minor_fault 393570
unused 1375984
available 1506908
rss 260156


# virsh qemu-monitor-command test3 --hmp info balloon
balloon: actual=1500

and check in guest the actual memory is 1471M. And from libvirt.org current memory is The actual allocation of memory for the guest. So this value(current memory) should not be 1536000 after hot-plug memory deivce?

Comment 4 Luyao Huang 2015-05-12 09:02:42 UTC
After talking with peter via IRC, open a new bug 1220702 to track the issue in comment 2.

Comment 5 Luyao Huang 2015-07-21 08:36:59 UTC
Verify this bug with libvirt-1.2.17-2.el7.x86_64:

1.

# virsh dumpxml rhel7.0 |grep -A3 maxMemory
  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <vcpu placement='static'>4</vcpu>

2.

# virsh attach-device rhel7.0 memdevice.xml --config
Device attached successfully

# virsh attach-device rhel7.0 memdevice.xml --config
Device attached successfully

# virsh attach-device rhel7.0 memdevice.xml --config
error: Failed to attach device from memdevice.xml
error: unsupported configuration: Attaching memory device with size '524288' would exceed domain's maxMemory config

3. recheck the xml :

# virsh dumpxml rhel7.0 |grep -A3 maxMemory
  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>2072576</memory>
  <currentMemory unit='KiB'>2072576</currentMemory>



4. edit xml change the slot:

# virsh dumpxml rhel7.0 |grep -A3 maxMemory
  <maxMemory slots='1' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <vcpu placement='static'>4</vcpu>

# virsh attach-device rhel7.0 memdevice.xml --config
Device attached successfully

# virsh attach-device rhel7.0 memdevice.xml --config
error: Failed to attach device from memdevice.xml
error: unsupported configuration: no free memory device slot available

5. start a guest with a memory device which slot is out of range:

# virsh dumpxml rhel7.0
  <maxMemory slots='1' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1286144</memory>
  <currentMemory unit='KiB'>1286144</currentMemory>
...
    <memory model='dimm'>
      <target>
        <size unit='KiB'>262144</size>
        <node>0</node>
      </target>
      <address type='dimm' slot='2' base='0x0'/>
    </memory>

# virsh start rhel7.0
error: Failed to start domain rhel7.0
error: unsupported configuration: memory device slot '2' exceeds slots count '1'

Comment 7 errata-xmlrpc 2015-11-19 06:29:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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