Bug 1122455

Summary: libvirt should refuse to start domain with unsupported/useless min-guarantee element in qemu driver
Product: Red Hat Enterprise Linux 7 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: dyuan, honzhang, mzhan, rbalakri, s.kieske, sowang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.8-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:41:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hu Jianwei 2014-07-23 10:03:16 UTC
Description of problem:
libvirt should refuse to start domain with unsupported/useless min-guarantee element in qemu driver

Version-Release number of selected component (if applicable):
libvirt-1.1.1-29.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
[root@localhost ~]# virsh dumpxml r7 | grep min_guarantee -b1
179-  <memtune>
191:    <min_guarantee unit='KiB'>1048576</min_guarantee>
245-  </memtune>
[root@localhost ~]# virsh start r7
Domain r7 started

[root@localhost ~]# virsh dumpxml r7 | grep min_guarantee -b1
187-  <memtune>
199:    <min_guarantee unit='KiB'>1048576</min_guarantee>
253-  </memtune>
[root@localhost ~]#

Actual results:
As shown above steps, Domain with a unsupported/useless min-guarantee element can start, and edited it into domain xml successfully.

Expected results:
The min-guarantee is used by esx and vmx drivers, so for qemu driver, libvirt should report an error when starting domain or ignoring this element using virsh edit.

Just like below other features, libvirt should have same behaviors.

[root@localhost ~]# virsh dumpxml r7 | grep timer
    <timer name='platform'/>
[root@localhost ~]# virsh start r7
error: Failed to start domain r7
error: unsupported configuration: unsupported timer type (name) 'platform'

[root@localhost ~]# virsh edit r7
Domain r7 XML configuration edited.

[root@localhost ~]# virsh dumpxml r7 | grep uml
      <target type='uml' port='0'/>
[root@localhost ~]# virsh dumpxml r7 | grep uml -b1
1659-    <console type='pty'>
1684:      <target type='uml' port='0'/>
1720-    </console>
[root@localhost ~]# virsh start r7
error: Failed to start domain r7
error: unsupported configuration: unsupported console target type uml

[root@localhost ~]# virsh memtune r7 --min-guarantee 1000
error: Unable to change memory parameters
error: argument unsupported: parameter 'min_guarantee' not supported

Comment 3 Erik Skultety 2014-08-25 06:50:53 UTC
Fixed upstream:

commit 36a0993a15ca43298073f96081176c612cbff515
Author: Erik Skultety <eskultet>
Date:   Wed Aug 13 10:07:46 2014 +0200

qemu: min_guarantee: Parameter 'min_guarantee' not supported
    
The 'min_guarantee' is used by VMware ESX and OpenVZ drivers,
with qemu however, libvirt should report error when starting a domain,
because this element is not used.
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1122455

v1.2.7-210-g36a0993

Comment 5 Martin Sivák 2014-09-04 15:14:27 UTC
Guys, the parameter is not useless. If you consider the xml to be consumed only by the hypervisor then this might make sense. But the xml is used by other tools as well.

Hypervisor agnostic parameter defining minimum guaranteed memory for a VM is seriously needed.

Even if it is not enforced by the driver itself, it can be used as a hint to tools that dynamically compute and update the memory balloon of running VMs. oVirt/RHEV uses it exactly for this.

The enforcing in qemu would be a nice bonus, but is not necessary and won't change the semantics or behaviour when/if it appears.

There are some values that should be available for tools cooperating with libvirt. Those values should stay at the same place even if the used driver does not enforce them by itself. The guaranteed memory is one of them. The presence of enforcing does not change the semantics nor the behaviour of a domain. It also does not make sense to have a "hypervisor unifying API" when it forces the users to store the same value (guaranteed memory) in different place (metadata section) for some hypervisors only (qemu).

Btw I also believe you are introducing a regression to the API (and the XML is part of an API to start a VM) by changing this between RHEL 7.0 and 7.1. And the adoption or upstream support for this value is irrelevant here. If it worked in 7.0 then it must be supported during the whole RHEL 7 lifetime. Two packages that are part of RHEL 7 (and also RHEV) depend on this behaviour - vdsm and mom.

Comment 6 Song Wang 2014-11-19 08:45:20 UTC
[root@localhost ~]# rpm -q libvirt
libvirt-1.2.8-7.el7.x86_64

Scenarios1:
[root@localhost ~]# virsh dumpxml aa |grep min_guarantee -b1
180-  <memtune>
192:    <min_guarantee unit='KiB'>1048576</min_guarantee>
246-  </memtune>


[root@localhost ~]# virsh start aa
error: Failed to start domain aa
error: unsupported configuration: Parameter 'min_guarantee' not supported by QEMU.

Scenarios2:
[root@localhost ~]# virsh memtune aa --min-guarantee 1000
error: Unable to change memory parameters
error: argument unsupported: parameter 'min_guarantee' not supported


[root@localhost ~]# virsh dumpxml aa |grep uml
      <target type='uml' port='0'/>
[root@localhost ~]# virsh start aa
error: Failed to start domain aa
error: unsupported configuration: unsupported console target type uml


the bug is fixed .Change the state to VERIFIED.

Comment 7 Song Wang 2014-11-21 08:25:04 UTC
Additonal test:

1.on host7.1
[root@localhost mnt]# rpm -q libvirt
libvirt-1.2.8-7.el7.x86_64

[root@localhost mnt]# virsh dumpxml aa |grep min_guarantee -b1
180-  <memtune>
192:    <min_guarantee unit='KiB'>1048576</min_guarantee>
246-  </memtune>

[root@localhost mnt]# virsh start aa
error: Failed to start domain aa
error: unsupported configuration: Parameter 'min_guarantee' not supported by QEMU.

2.on host6.6
[root@ibm-x3850x5-08 ~]# rpm -q libvirt
libvirt-0.10.2-46.el6.x86_64

[root@ibm-x3850x5-08 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 11    test                           running

[root@ibm-x3850x5-08 ~]# virsh dumpxml test
<domain type='kvm' id='11'>
  <name>test</name>
  <uuid>4b95171a-967b-7156-8143-af7d8a6878c6</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <memtune>
    <hard_limit unit='KiB'>1048576</hard_limit>
    <soft_limit unit='KiB'>1048576</soft_limit>
    <min_guarantee unit='KiB'>1048576</min_guarantee>  <---unsupported in rhel7.1            
  </memtune>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.5.0'>hvm</type>
    <boot dev='hd'/>
  </os>
.......


then , do the migration from 6.6 to 7.1

[root@ibm-x3850x5-08 ~]# virsh migrate --live test qemu+ssh://10.66.4.190/system --verbose
The authenticity of host '10.66.4.190 (10.66.4.190)' can't be established.
RSA key fingerprint is 9a:f2:f7:64:4f:074:13:a2:fa:c0:96:41:64:ac:1c.
Are you sure you want to continue connecting (yes/no)? yes
root.4.190's password:
Migration: [100 %]

It migrates successfully.

3.on host7.1
[root@localhost mnt]# virsh list
 Id    Name                           State
----------------------------------------------------
 10    test                           running

[root@localhost mnt]# virsh dumpxml test
<domain type='kvm' id='10'>
  <name>test</name>
  <uuid>4b95171a-967b-7156-8143-af7d8a6878c6</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <memtune>
    <hard_limit unit='KiB'>1048576</hard_limit>
    <soft_limit unit='KiB'>1048576</soft_limit>
  </memtune>
........

xml doesn't show the min_guarantee.


As shows, min-guarantee is used by esx and vmx drivers,not supported in RHEL7.1,but supported in RHEL6.6.

Actually,it migrates successfully when I do migration from 6.6 to 7.1,but doesn't show unsupported "min_guarantee" in xml on target machine.

The problem is  that libvirt  has the ability to deal with the error automatically  or it should show error messages with the configuration when doing the migration ?

For the bug ,the problem is sovled.But I think libvirt should refuse the migration because of unsupported function.

Comment 8 Song Wang 2014-11-21 08:52:23 UTC
(In reply to Song Wang from comment #7)
> Additonal test:
> 
> 1.on host7.1
> [root@localhost mnt]# rpm -q libvirt
> libvirt-1.2.8-7.el7.x86_64
> 
> [root@localhost mnt]# virsh dumpxml aa |grep min_guarantee -b1
> 180-  <memtune>
> 192:    <min_guarantee unit='KiB'>1048576</min_guarantee>
> 246-  </memtune>
> 
> [root@localhost mnt]# virsh start aa
> error: Failed to start domain aa
> error: unsupported configuration: Parameter 'min_guarantee' not supported by
> QEMU.
> 
> 2.on host6.6
> [root@ibm-x3850x5-08 ~]# rpm -q libvirt
> libvirt-0.10.2-46.el6.x86_64
> 
> [root@ibm-x3850x5-08 ~]# virsh list --all
>  Id    Name                           State
> ----------------------------------------------------
>  11    test                           running
> 
> [root@ibm-x3850x5-08 ~]# virsh dumpxml test
> <domain type='kvm' id='11'>
>   <name>test</name>
>   <uuid>4b95171a-967b-7156-8143-af7d8a6878c6</uuid>
>   <memory unit='KiB'>1048576</memory>
>   <currentMemory unit='KiB'>1048576</currentMemory>
>   <memtune>
>     <hard_limit unit='KiB'>1048576</hard_limit>
>     <soft_limit unit='KiB'>1048576</soft_limit>
>     <min_guarantee unit='KiB'>1048576</min_guarantee>  <---unsupported in
> rhel7.1            
>   </memtune>
>   <vcpu placement='static'>4</vcpu>
>   <os>
>     <type arch='x86_64' machine='rhel6.5.0'>hvm</type>
>     <boot dev='hd'/>
>   </os>
> .......
> 
> 
> then , do the migration from 6.6 to 7.1
> 
> [root@ibm-x3850x5-08 ~]# virsh migrate --live test
> qemu+ssh://10.66.4.190/system --verbose
> The authenticity of host '10.66.4.190 (10.66.4.190)' can't be established.
> RSA key fingerprint is 9a:f2:f7:64:4f:074:13:a2:fa:c0:96:41:64:ac:1c.
> Are you sure you want to continue connecting (yes/no)? yes
> root.4.190's password:
> Migration: [100 %]
> 
> It migrates successfully.
> 
> 3.on host7.1
> [root@localhost mnt]# virsh list
>  Id    Name                           State
> ----------------------------------------------------
>  10    test                           running
> 
> [root@localhost mnt]# virsh dumpxml test
> <domain type='kvm' id='10'>
>   <name>test</name>
>   <uuid>4b95171a-967b-7156-8143-af7d8a6878c6</uuid>
>   <memory unit='KiB'>1048576</memory>
>   <currentMemory unit='KiB'>1048576</currentMemory>
>   <memtune>
>     <hard_limit unit='KiB'>1048576</hard_limit>
>     <soft_limit unit='KiB'>1048576</soft_limit>
>   </memtune>
> ........
> 
> xml doesn't show the min_guarantee.
> 
> 
> As shows, min-guarantee is used by esx and vmx drivers,not supported in
> RHEL7.1,but supported in RHEL6.6.

No, min_guarantee was never supported. Even 6.6 did not support it.
However, the old libvirt did not report any error, it just completely
ignored that setting.

> Actually,it migrates successfully when I do migration from 6.6 to 7.1,but
> doesn't show unsupported "min_guarantee" in xml on target machine.
> 
> The problem is  that libvirt  has the ability to deal with the error
> automatically  or it should show error messages with the configuration when
> doing the migration ?
> 
> For the bug ,the problem is sovled.But I think libvirt should refuse the
> migration because of unsupported function.

Oh, I'm surprised the machine migrates without any error being reported.
That's very good. I think the current behavior is exactly what we want.


I have mailed  jiri to ask about the issue.As shows ,that is reply. 
It is expected results.

Comment 10 errata-xmlrpc 2015-03-05 07:41:33 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/RHSA-2015-0323.html