Bug 1282335 - The default size unit of memory-backend-ram is different from "-m"
The default size unit of memory-backend-ram is different from "-m"
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
x86_64 Linux
unspecified Severity low
: rc
: ---
Assigned To: Markus Armbruster
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2015-11-16 02:28 EST by Yumei Huang
Modified: 2016-03-28 05:51 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-11-20 10:30:16 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Yumei Huang 2015-11-16 02:28:43 EST
Description of problem:
The default size unit of memory-backend-ram is Bytes, while the default size unit of "-m" is MB.

Version-Release number of selected component (if applicable):
kernel: 3.10.0-327.2.1.el7.x86_64
qemu-kvm:  qemu-kvm-rhev-2.3.0-31.el7_2.1

How reproducible:

Steps to Reproduce:
1. start a qemu-kvm process:
/usr/libexec/qemu-kvm  -smp 1 -m 1024,slots=4,maxmem=8G \
-object memory-backend-ram,id=mem1,size=1024  -numa node,nodeid=0,memdev=mem1 

Actual results:
Qemu-kvm process start failed, print:
qemu-kvm: total memory for NUMA nodes (0x400) should equal RAM size (0x40000000)

Expected results:
The default size unit of memory-backend-ram should be same as '-m'. Qemu process start succeed.

Additional info:
Comment 2 Markus Armbruster 2015-11-20 10:30:16 EST
We accept sizes in many places, but the interpretation of an
unsuffixed number varies.  HMP commands commonly interpret as
Mebibytes.  qemu-img interprets as bytes.  Command line commonly
interprets as bytes, but there are exceptions, and -m is one: it
interprets as Mebibytes for backward compatibility, see

The inconsistency is unfortunate, but it's clearly intentional, and it
cannot be fixed now, because it's ABI.  Closing NOTABUG.

I recommend to always use a suffix, like

$ /usr/libexec/qemu-kvm  -smp 1 -m 1024M,slots=4,maxmem=8G \
-object memory-backend-ram,id=mem1,size=1024M -numa node,nodeid=0,memdev=mem1

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