Bug 1211548 - memtune settings in running vm xml will disappear after restart libvirtd
Summary: memtune settings in running vm xml will disappear after restart libvirtd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-14 09:56 UTC by Luyao Huang
Modified: 2015-11-19 06:28 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.15-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:28:21 UTC
Target Upstream Version:


Attachments (Terms of Use)


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

Description Luyao Huang 2015-04-14 09:56:53 UTC
Description of problem:
memtune settings in xml will disappear after restart libvirtd

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 running vm:

# virsh list
 Id    Name                           State
----------------------------------------------------
 9     test4                          running

2. no memtune settings
# virsh memtune test4
hard_limit     : unlimited
soft_limit     : unlimited
swap_hard_limit: unlimited

3. set a big memtune value then recheck:

# virsh memtune test4 --hard-limit 9007199254740988

# virsh dumpxml test4
<domain type='kvm' id='9'>
  <name>test4</name>
  <uuid>b1e7936b-104b-430e-9211-d6c61b8df313</uuid>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <memtune>
    <hard_limit unit='KiB'>900719925</hard_limit>
  </memtune>

# virsh memtune test4
hard_limit     : 900719925
soft_limit     : unlimited
swap_hard_limit: unlimited

4. restart libvirtd and recheck:

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

# virsh memtune test4
hard_limit     : 900719925
soft_limit     : unlimited
swap_hard_limit: unlimited

# virsh dumpxml test4
<domain type='kvm' id='9'>
  <name>test4</name>
  <uuid>b1e7936b-104b-430e-9211-d6c61b8df313</uuid>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <vcpu placement='static'>5</vcpu>                     <------no memory tune


Actual results:
big memtune value settings will disappear after restart libvirtd,
this will influence migration

Expected results:
still exist

Additional info:

From Shanzhi Yu:

seem we need a virDomainSaveStatus after succeed set memory

qemuDomainSetMemoryParameters(virDomainPtr dom,
 
 #undef QEMU_SET_MEM_PARAMETER
 
+    if (flags & VIR_DOMAIN_AFFECT_LIVE &&
+        virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+        goto endjob;
+

Comment 1 Ján Tomko 2015-04-14 12:20:35 UTC
Fixed upstream by:
commit 1db6212331c6cd9cd0213f60c9ac73effd1fe3ad
Author:     Shanzhi Yu <shyu@redhat.com>
AuthorDate: 2015-04-14 18:24:41 +0800
Commit:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2015-04-14 13:50:08 +0200

    qemu: save domain status after set memory parameters
    
    After set memory parameters for running domain, save the change to live
    xml is needed otherwise it will disappear after restart libvirtd.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211548
    Signed-off-by: Shanzhi Yu <shyu@redhat.com>
    Signed-off-by: Ján Tomko <jtomko@redhat.com>

git describe: v1.2.14-146-g1db6212

Comment 3 Fangge Jin 2015-07-15 03:22:07 UTC
I can reproduce this bug on build libvirt-1.2.14-1.el7.x86_64.

Verify this bug on build libvirt-1.2.17-2.el7.x86_64

Verify steps:
1. prepare a running vm:
# virsh list
 Id    Name                           State
----------------------------------------------------
 19    rhel7-5                        running

2. no memtune settings
# virsh memtune rhel7-5 
hard_limit     : unlimited
soft_limit     : unlimited
swap_hard_limit: unlimited

3. set a big memtune value then recheck:

# virsh memtune rhel7-5 --hard-limit 9007199254740988 

# virsh memtune rhel7-5 
hard_limit     : 9007199254740988
soft_limit     : unlimited
swap_hard_limit: unlimited

# virsh dumpxml rhel7-5
<domain type='kvm' id='19'>
  <name>rhel7-5</name>
  <uuid>ab4696ee-6986-488f-81b8-8578759ae8e2</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <memtune>
    <hard_limit unit='KiB'>9007199254740988</hard_limit>
  </memtune>

4. restart libvirtd and recheck:

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

# virsh memtune rhel7-5 
hard_limit     : 9007199254740988
soft_limit     : unlimited
swap_hard_limit: unlimited

# virsh dumpxml rhel7-5|grep memtune -a5
<domain type='kvm' id='19'>
  <name>rhel7-5</name>
  <uuid>ab4696ee-6986-488f-81b8-8578759ae8e2</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <memtune>
    <hard_limit unit='KiB'>9007199254740988</hard_limit>
  </memtune>

Comment 5 errata-xmlrpc 2015-11-19 06:28:21 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.