Subject: [alpine-devel] Xen: first experiments

From: Leonardo <[email-masked]>
Date: Fri, 28 Sep 2012 11:08:18 +0200

Hi,

I've just started to play with alpine-xen-2.4.5-x86_64 iso + libvirt,
and I've hit the first issues.

So far I've followed http://wiki.alpinelinux.org/wiki/Xen_LiveCD, setup
my local storage, installed and started libvirt.

When creating a new domain via libvirt, it reports this error:

xc: detail: Failed allocation for dom 2: 2048 extents of order 0
xc: error: Could not allocate memory for HVM guest. (16 = Device or
resource busy): Internal error

Googling around I've found this:

"Sufficient memory was not reserved for fully virtualized guests when
creating new guests. Memory listed as available by the xm info command
could not be fully allocated to the guest. When attempting create a
fully virtualized guest with more than or equal to the maximum available
memory value, the following error message would appear: 
Error: (1, 'Internal error', 'Could not allocate memory for HVM guest.\n (16 = Device or resource busy)')
This issue has been resolved by improving the memory balloon driver to
correctly allocate memory for fully virtualized guests and fully
virtualized guests using the Intel VT-d extensions for PCI passthrough.
(BZ#512041)"

(from http://www.centos.org/docs/5/html/5.5/Technical_Notes/xen.html
)

This is what "xl info" reports:

kvbn1:~# xl info
host                   : kvbn1
release                : 3.3.8-grsec
version                : #4-Alpine SMP Tue Jul 17 13:08:00 UTC 2012
machine                : x86_64
nr_cpus                : 8
nr_nodes               : 2
cores_per_socket       : 4
threads_per_core       : 1
cpu_mhz                : 2128
hw_caps                :
bfebfbff:28100800:00000000:00003b40:009ce3bd:00000000:00000001:00000000
virt_caps              : hvm hvm_directio
total_memory           : 8179
free_memory            : 909
free_cpus              : 0
xen_major              : 4
xen_minor              : 1
xen_extra              : .2
xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32
hvm-3.0-x86_32p hvm-3.0-x86_64 
xen_scheduler          : credit
xen_pagesize           : 4096
platform_params        : virt_start=0xffff800000000000
xen_changeset          : unavailable
xen_commandline        : 
cc_compiler            : gcc version 4.6.3 (Alpine 4.6.3-r0) 
cc_compile_by          : buildozer
cc_compile_domain      : alpinelinux.org
cc_compile_date        : Fri Jun 22 14:59:04 UTC 2012
xend_config_format     : 4

I'd like also to try creating a domain without libvirt, and I tried
following this http://wiki.xen.org/wiki/Xen_Beginners_Guide. However I
cannot find on Alpine a xen-tools package to run "xen-create-image", for
creating a config file to feed to "xl" in order to create a domain.

I'm pretty new to Xen, so if anyone can give me a suggestion it will be
very much appreciated.

Thank you

- leonardo

---

From: Roger Pau Monne <[email-masked]>
Date: Fri, 28 Sep 2012 10:31:56 +0100

Leonardo wrote:

Hello!

Thanks for trying Xen with Alpine!

> my local storage, installed and started libvirt.

So I assume you are running it from RAM? If you are interested in this
kind of setup, I would recommend that you create a new ISO/USB with the
dom0_mem command line option [1], something like dom0_mem=512M or maybe
dom0_mem=1024M, since you seem to have quite a lot of memory. This will
prevent errors from the ballon driver, which as far as I know can be a
little slow and I'm not sure if it plays well with ramfs.

Could you also paste the output from `free -m` and `df -h`?

Anyway, I would recommend making sure that everything works with xl, and
then try to use libvirt (I've never used it, so I'm not sure of how well
it works).

> creating a config file to feed to "xl" in order to create a domain.

xen-create-image is a Debian tool, which is not present in Alpine. If
you wish, you can try creating a Alpine Linux DomU [2] or a Debian DomU
with NetInstall [3].

> I'm pretty new to Xen, so if anyone can give me a suggestion it will be

[1] http://xenbits.xen.org/docs/unstable/misc/xen-command-line.html
[2] http://wiki.alpinelinux.org/wiki/Create_Alpine_Linux_PV_DomU
[3] http://wiki.gbweb.net/tiki-index.php?page=Installing+a+new+Xen+DomU

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Leonardo <[email-masked]>
Date: Fri, 28 Sep 2012 13:10:59 +0200

> little slow and I'm not sure if it plays well with ramfs.

I've added "dom0_mem=512M,max:512M" and this fixed the problem.

> Could you also paste the output from `free -m` and `df -h`?

# free -m
             total         used         free       shared      buffers
Mem:           425          252          172            0            3
-/+ buffers:                249          175
Swap:            0            0            0

# df -h
Filesystem                Size      Used Available Use% Mounted on
mdev                      1.0M         0      1.0M   0% /dev
shm                     212.8M         0    212.8M   0% /dev/shm
/dev/usbdisk              3.7G    105.9M      3.6G   3% /media/usb
tmpfs                   212.8M    115.5M     97.3M  54% /
tmpfs                   212.8M    176.0K    212.6M   0% /run
rc-svcdir                 1.0M     72.0K    952.0K   7% /lib/rc/init.d
cgroup_root              10.0M         0     10.0M   0% /sys/fs/cgroup
/dev/loop0               46.1M     46.1M         0 100% /.modloop
/dev/sda2                68.1G      1.4G     63.4G   2% /var

> then try to use libvirt (I've never used it, so I'm not sure of how well

Yeah. That's why I want to use "xl". And I'm also interested in fixing
libvirt.

> you wish, you can try creating a Alpine Linux DomU [2] or a Debian DomU

Sorry, I've missed the wiki doc about AL PV DomU.

Thank you!

- leonardo

---

From: Roger Pau Monné <[email-masked]>
Date: Fri, 28 Sep 2012 12:39:21 +0100

> I've added "dom0_mem=512M,max:512M" and this fixed the problem.

If you set the "max" to the same value there's no need to use it, just use
dom0_mem=512M. Sorry if the reply is mangled, I'm on my mobile phone now.

> Yeah. That's why I want to use "xl". And I'm also interested in fixing

If you want to fix libvirt I wold recommend using edge with Xen 4.2, that
introduced libxl API changes. I don't know if someone already ported
libvirt to that version, but the 4.2 API is going to be the stable one, so
there won't be a need to change libvirt for every Xen release.

> > > Error: (1, 'Internal error', 'Could not allocate memory for HVM
guest.\n (16 = Device or resource busy)')