Bug 1460945 - virsh failed to create xen hvm guest with memory unit MB/GB
Summary: virsh failed to create xen hvm guest with memory unit MB/GB
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 26
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-13 08:37 UTC by Frank Liang
Modified: 2017-09-14 20:24 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-14 20:24:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
virsh dumpxml file (2.27 KB, text/plain)
2017-07-10 14:38 UTC, Frank Liang
no flags Details

Description Frank Liang 2017-06-13 08:37:46 UTC
Description of problem:

On Fedora26 xen host, 'virsh'  cannot create xen hvm guest with "MB" and "GB" unit. There is no problem to pass "KiB", "MiB" or "GiB" as memory unit to create guest.

Here is the doc link of configure file, it should support pass "MB" or "GB" as memory unit.

https://libvirt.org/formatdomain.html#elementsMemoryAllocation

Here is error messages:

[root@dell-per415-02 fedora26]# virsh create guest2_fedora26_alpha.xml
error: Failed to create domain from guest2_fedora26_alpha.xml
error: internal error: libxenlight failed to create new domain 'guest2_fedora26'

[root@dell-per415-02 libxl]# tail /var/log/libvirt/libxl/libxl-driver.log

2017-06-11 14:31:10.699+0000: xc: panic: xc_dom_boot.c:141: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
2017-06-11 14:31:10.699+0000: libxl: libxl_dom.c:653:libxl__build_dom: xc_dom_boot_mem_init failed: No such file or directory
2017-06-11 14:31:10.699+0000: libxl: libxl_create.c:1223:domcreate_rebuild_done: cannot (re-)build domain: -3

[root@dell-per415-02 fedora26]# grep 'memory' guest2_fedora26_alpha.xml
<memory unit='MB'>1000</memory>

Version-Release number of selected component (if applicable):
Fedora 26 latest xen version(xen-4.8.1-2.fc26.x86_64)

RHEL Version:
N/A

How reproducible:
100%

Steps to Reproduce:

1. Install Fedora 26 Alpha release and xen packages.
2. Upgrade xen to the latest version.
2. Boot into xen environment and create the hvm guest configuration.
3. Change memory unit to "MB".
4. Create guest via "virsh create xxxx.xml".

Actual results:

The guest failed to be created.

Expected results:
The guest should be able to be started normally.

Additional info:
Some packages information:

[root@dell-per415-02 fedora26]#   rpm -qa|egrep "xen-4|libvirt-3|kernel-4"
kernel-4.11.0-0.rc3.git0.2.fc26.x86_64
libvirt-3.2.1-1.fc26.x86_64
xen-4.8.1-2.fc26.x86_64

Verified it on RHEL7.3 kvm host, cannot reproduce such problem when passed "MB" to create kvm guest.
libvirt-2.0.0-10.el7.x86_64

Comment 1 Cole Robinson 2017-06-26 18:39:40 UTC
What is the XML after you did 'virsh edit'? Please provide the dumpxml after that

The 'units' parameter seems to be 'write only' at least in my testing, and should be converted to KiB the next time you read the XML. Is it possible your memory setting is too large for the host?

Comment 2 Frank Liang 2017-07-10 14:38:33 UTC
Created attachment 1295845 [details]
virsh dumpxml file

Comment 3 Frank Liang 2017-07-10 14:40:54 UTC
(In reply to Cole Robinson from comment #1)
> What is the XML after you did 'virsh edit'? Please provide the dumpxml after
> that
> 
> The 'units' parameter seems to be 'write only' at least in my testing, and
> should be converted to KiB the next time you read the XML. 
Yes. It converts the 'GiB' to "KiB" when I use 'virsh edit' or dumpxml to see the configuration.

>Is it possible
> your memory setting is too large for the host?
No. I just set 1 GB in my testing, and there is enough memory on the host.
As it is ok on KVM host, the configuration format should be correct and supported.

Comment 4 Cole Robinson 2017-07-10 15:05:12 UTC
Okay so this isn't related to the units= parameter specifically, just that for whatever reason a xen VM with 1GB is failing with:

2017-06-11 14:31:10.699+0000: xc: panic: xc_dom_boot.c:141: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory

The memory model of kvm vs xen is quite different so you can't necessarily expect that the same memory amount will be accepted by both. How much total memory does your machine have?

There's some debugging ideas here for a similar report on a xen list: https://lists.xenproject.org/archives/html/xen-users/2015-02/msg00028.html

Comment 5 Cole Robinson 2017-09-14 20:24:21 UTC
Closing since I presume this is just due to low VM memory situation as mentioned in Comment #4, please reopen if you think otherwise


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