[elbe-devel] [PATCH v2 6/8] init libvirt.xml.mako: specify memsize from xml node initvm/mem

Torben Hohn torben.hohn at linutronix.de
Tue May 8 17:10:44 CEST 2018


ram allocated to initvm was hardcoded.

Obey value in xml file including default value.
Use size_to_int() and divide by 1024 as values are
specified in kiB.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/init/libvirt.xml.mako | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/elbepack/init/libvirt.xml.mako b/elbepack/init/libvirt.xml.mako
index 47dbbc89..064f38b9 100644
--- a/elbepack/init/libvirt.xml.mako
+++ b/elbepack/init/libvirt.xml.mako
@@ -13,13 +13,14 @@
 import uuid
 import multiprocessing
 import os
+from elbepack.filesystem import size_to_int
 
 # Generate UUID
 uid = uuid.uuid4()
 
 name = cfg['initvm_domain']
 cpus = multiprocessing.cpu_count()
-memory = 1048576
+memory = size_to_int(prj.text('mem', default=defs, key='mem')) / 1024
 
 imagetype = prj.text('img', defaults=defs, key='img')
 img = os.path.join(opt.directory, 'buildenv.img')
-- 
2.11.0




More information about the elbe-devel mailing list