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 1161461 - forbid to set memory to ZERO
Summary: forbid to set memory to ZERO
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:
TreeView+ depends on / blocked
 
Reported: 2014-11-07 07:58 UTC by Jincheng Miao
Modified: 2015-11-19 05:55 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.14-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:55:19 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 Jincheng Miao 2014-11-07 07:58:11 UTC
Description of problem:
forbid to set memory to ZERO in order to avoid some strange error message.

version:
libvirt-1.2.8-5.el7.x86_64
qemu-kvm-1.5.3-77.el7.x86_64

How reproducible:
100%

Step to reproduce:
1. set memory to zero
# virsh edit r7
...
  <memory unit='KiB'>0</memory>
  <currentMemory unit='KiB'>0</currentMemory>
  <vcpu placement='static'>6</vcpu>
...

2. start guest
# virsh start r7
error: Failed to start domain r7
error: internal error: unable to execute QEMU command 'balloon': Parameter 'target' expects a size

3. if there is a auto placement vcpu
  <memory unit='KiB'>0</memory>
  <currentMemory unit='KiB'>0</currentMemory>
  <vcpu placement='static'>6</vcpu>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

# virsh start r7
error: Failed to start domain r7
error: invalid argument: Failed to parse bitmap ''

Expect result:
memory value should not be set to ZERO, that is meanless.
libvirtd should forbid this.

Comment 3 Peter Krempa 2015-03-16 14:38:27 UTC
Fixed upstream as a part of:

commit 4bca6192f20802773012d935145811fb4ba4a4d4
Author: Peter Krempa <pkrempa>
Date:   Wed Mar 4 11:04:27 2015 +0100

    conf: Make specifying <memory> optional
    
    Now that the size of guest's memory can be inferred from the NUMA
    configuration (if present) make it optional to specify <memory>
    explicitly.
    
    To make sure that memory is specified add a check that some form of
    memory size was specified. One side effect of this change is that it is
    no longer possible to specify 0KiB as memory size for the VM, but I
    don't think it would be any useful to do so. (I can imagine embedded
    systems without memory, just registers, but that's far from what libvirt
    is usually doing).
    
    Forbidding 0 memory for guests also fixes a few corner cases where 0 was
    not interpreted correctly and caused failures. (Arguments for numad when
    using automatic placement, size of the balloon). This fixes problems
    described in https://bugzilla.redhat.com/show_bug.cgi?id=1161461
    
    Test case changes are added to verify that the schema change and code
    behave correctly.

Comment 6 Luyao Huang 2015-07-07 08:30:31 UTC
Verify this bug with libvirt-1.2.17-1.el7.x86_64:

1. edit a guest and set memory is 0:

  <memory unit='KiB'>0</memory>
  <currentMemory unit='KiB'>11111110</currentMemory>


# virsh edit test4
error: XML error: Memory size must be specified via <memory> or in the <numa> configuration
Failed. Try again? [y,n,i,f,?]: 

2. edit a guest and set current memory is 0:

  <memory unit='KiB'>10240000</memory>
  <currentMemory unit='KiB'>0</currentMemory>

# virsh edit test4
Domain test4 XML configuration edited.

# virsh dumpxml test4

  <memory unit='KiB'>10240000</memory>
  <currentMemory unit='KiB'>10240000</currentMemory>


3. edit a guest and set memory is 0 and with numa settings:

  <memory unit='KiB'>0</memory>
  <currentMemory unit='KiB'>0</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>

# virsh edit test4
Domain test4 XML configuration edited.

# virsh dumpxml test4
...
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <vcpu placement='auto'>4</vcpu>
...
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>
...

Comment 8 errata-xmlrpc 2015-11-19 05:55:19 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.