Martin Polednik has uploaded a new change for review.

Change subject: faqemu hook: move memory limitation to config
......................................................................

faqemu hook: move memory limitation to config

Qemu supports more than 20 MB memory[1], removing the need for hardcoded
memory limit. This patch allows faqemu memory to be either unchanged,
or limited by the configuration file. Usage of > 20 MB memory is required
when running faqemu with system kernel/initramfs combo.

[1] https://code.launchpad.net/~rvb/maas-test/memory-limit/+merge/198101

Change-Id: I0ffeaf7926dac2a0db0bdfb21416919452718531
Signed-off-by: Martin Polednik <mpole...@redhat.com>
---
M lib/vdsm/config.py.in
M vdsm_hooks/faqemu/before_vm_start.py
2 files changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/28320/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 8eb1811..2f9eecc 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -183,6 +183,8 @@
         ('fake_kvm_architecture', 'x86_64',
             'Choose the target architecture of the fake KVM mode'),
 
+        ('fake_kvm_memory', '262144', None),
+
         ('xmlrpc_enable', 'true', 'Enable the xmlrpc server'),
 
         ('xmlrpc_http11', 'true',
diff --git a/vdsm_hooks/faqemu/before_vm_start.py 
b/vdsm_hooks/faqemu/before_vm_start.py
old mode 100755
new mode 100644
index 9539810..92a4a9e
--- a/vdsm_hooks/faqemu/before_vm_start.py
+++ b/vdsm_hooks/faqemu/before_vm_start.py
@@ -29,19 +29,15 @@
     graphics = domxml.getElementsByTagName("graphics")[0]
     graphics.removeAttribute("passwdValidTo")
 
-    for memtag in ("memory", "currentMemory"):
-        memvalue = domxml.getElementsByTagName(memtag)[0]
-        while memvalue.firstChild:
-            memvalue.removeChild(memvalue.firstChild)
+    memory = config.get('vars', 'fake_kvm_memory', None)
 
-        arch = config.get('vars', 'fake_kvm_architecture')
+    if memory:
+        for memtag in ("memory", "currentMemory"):
+            memvalue = domxml.getElementsByTagName(memtag)[0]
+            while memvalue.firstChild:
+                memvalue.removeChild(memvalue.firstChild)
 
-        if arch == 'x86_64':
-            memory = '20480'
-        elif arch == 'ppc64':
-            memory = '262144'
-
-        memvalue.appendChild(domxml.createTextNode(memory))
+            memvalue.appendChild(domxml.createTextNode(memory))
 
     for cputag in domxml.getElementsByTagName("cpu"):
         cputag.parentNode.removeChild(cputag)


-- 
To view, visit http://gerrit.ovirt.org/28320
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ffeaf7926dac2a0db0bdfb21416919452718531
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpole...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to