Bug 1416627 - [Xen][libvirt] Can't allocate low memory for guest when creating xen vm with virsh command.
Summary: [Xen][libvirt] Can't allocate low memory for guest when creating xen vm with ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-26 05:37 UTC by Lin Liu
Modified: 2017-04-07 08:38 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-04-07 08:38:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
guest_create_failed.log (2.90 KB, text/plain)
2017-01-26 05:37 UTC, Lin Liu
no flags Details

Description Lin Liu 2017-01-26 05:37:03 UTC
Created attachment 1244596 [details]
guest_create_failed.log

Description of problem:
Using virsh command to create xen guest, only guest with 1G(1048576Mb) memory can be created, guests with other size memory cannot be created with error message: "xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory". Using xl to create the same configuration guest is OK.

Version-Release number of selected component (if applicable):
kernel-4.9.0-0.rc6.git2.1.fc26.x86_64
libvirt-3.0.0-1.fc26.x86_64
xen-4.8.0-2.fc26.x86_64

How reproducible: Always

Steps to Reproduce:
1. Boot Fedora Rawhide system xen hypervisor with "dom0_mem=1024M,max:1024M" in kernel command:
[root@dhcp-10-249 ~]# cat /etc/grub2.cfg | grep 1024
        multiboot        /xen-4.8.0.gz dom0_mem=1024M,max:1024M placeholder   ${xen_rm_opts}
The total memory is enough to balloon to guests:
[root@dhcp-10-249 ~]# cat /proc/meminfo
MemTotal:         911280 kB
MemFree:           11708 kB
MemAvailable:     705572 kB

2. Create a guest with command "virsh create xen-hvm-guest.xml" with below configure file:
[root@dhcp-10-249 ~]# cat xen-hvm-guest.xml
<domain type='xen'>
<name>rhel-hvm</name>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='xenfv'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<source file='/home/RHEL-Server-6.9-64-hvm.raw'/>
<target dev='xvda' bus='xen'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
<interface type='bridge'>
<mac address='00:16:3e:83f:81'/>
<source bridge='xenbr0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
<video>
<model type='cirrus' vram='4096' heads='1'/>
</video>
</devices>
</domain>

3. Guest is created successfully and then destroy it.
4. Change the memory to other size for example 1048575 as below:
[root@dhcp-10-249 ~]# cat xen-hvm-guest.xml  | grep -i memory
<memory unit='KiB'>1048575</memory>
<currentMemory unit='KiB'>1048575</currentMemory>
5. Create the guest again.

Actual results:
Cannot create guest with error message:
[root@dhcp-10-249 ~]# virsh create xen-hvm-guest.xml
error: Failed to create domain from xen-hvm-guest.xml
error: internal error: libxenlight failed to create new domain 'rhel-hvm'

Expected results:
The guest should be created successfully since there is enough memory and the same configuration guest can be created by xl command.

Additional information:
In the log file /var/log/libvirt/libxl/libxl-driver.log it reports that: xc: panic: xc_dom_boot.c:141: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
Attach the full log file as guest_create_failed.log, also attach the log file when creating 1G(1048576Mb) memory guest successfully as virsh_guest.log.

Comment 1 Fedora End Of Life 2017-02-28 11:03:42 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 2 Frank Liang 2017-04-07 08:38:35 UTC
On Fedora-26-20170320.n.0 build, this bug is not reproducible. I can create guest domain with different memory setting, eg 524288,1048576,8388608. So close it.

[root@dhcp-3-6 media]# virsh dominfo test_hvm4
Id:             23
Name:           test_hvm4
UUID:           dabcd635-edc0-4f85-abaa-68602104a3d2
OS Type:        hvm
State:          running
CPU(s):         32
CPU time:       231.6s
Max memory:     8388608 KiB
Used memory:    8376332 KiB
Persistent:     no
Autostart:      disable
Managed save:   no
[root@dhcp-2-248 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          7979        672       7307          2         62        212
-/+ buffers/cache:        397       7582
Swap:         1199          0       1199

[root@dhcp-3-6 media]# cat test_hvm4.cfg 
<domain type='xen' id='1'>
<name>test_hvm4</name>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>8388608</currentMemory>
<vcpu placement='static'>32</vcpu>
<os>
<type arch='x86_64' machine='xenfv'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
<boot dev='network'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>preserve</on_crash>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<source file='/media/guest_hvm4.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='/media/test.img'/>
<target dev='xvdb' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:3b:f1:1c:59'/>
<source bridge='xenbr0'/>
<model type='e1000'/>
</interface>
<controller type='ide' index='0'/>
<serial type='pty'>
<source path='/dev/pts/3'/>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' listen='10.66.3.6' port='5900' autoport='yes' keymap='en-us'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
</video>
</devices>
</domain>


Packages information:
kernel-4.11.0-0.rc1.git0.1.fc26.x86_64
libvirt-3.1.0-1.fc26.x86_64
xen-4.8.0-8.fc26.x86_64


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