[Kimchi-devel] [PATCH v2][Kimchi 2/2] Issue #838: UI - Blocks maxmemory input field

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Wed Mar 23 20:17:21 UTC 2016


This patch block UI memory and max memory inputs to avoid problems with
max memory tag and memory hotplug in distros that do not support this
feature.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_edit_main.js | 11 ++++++++++-
 ui/pages/guest-edit.html.tmpl       |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 9054eec..19d9e7d 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -679,8 +679,17 @@ kimchi.guest_edit_main = function() {
             wok.window.open('plugins/kimchi/guest-storage-add.html', 'extendCreateStorage');
         });
         if ((kimchi.thisVMState === "running") || (kimchi.thisVMState === "paused")) {
-            $("#form-guest-edit-general input").not("#guest-edit-memory-textbox").prop("disabled", true);
+            if (kimchi.capabilities.mem_hotplug_support) {
+                $("#form-guest-edit-general input").not("#guest-edit-memory-textbox").prop("disabled", true);
+            } else {
+                $("#form-guest-edit-general input").prop("disabled", true);
+            }
         }
+        if (! kimchi.capabilities.mem_hotplug_support) {
+            $("#guest-edit-max-memory-textbox").prop("disabled", true);
+            $("#guest-edit-memory-hotplug-unsupported").removeClass('hidden');
+        }
+
         $('#guest-show-max-memory').on('click', function(e) {
             e.preventDefault;
             $('#guest-max-memory-panel').slideToggle();
diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
index 2a8cfbe..05d0b14 100644
--- a/ui/pages/guest-edit.html.tmpl
+++ b/ui/pages/guest-edit.html.tmpl
@@ -65,6 +65,7 @@
                 <div id="guest-max-memory-panel" class="form-group">
                     <label for="guest-edit-max-memory-textbox">$_("Max Memory (MB)")</label>
                     <input id="guest-edit-max-memory-textbox" class="form-control" name="max-memory" type="number" min="1024" step="1024" />
+                    <p id="guest-edit-memory-hotplug-unsupported" class="help-block hidden"><i class="fa fa-info-circle"></i> $_("Host does not support memory hotplug")</p>
                 </div>
                 <div class="form-group">
                     <label for="guest-edit-icon-textbox">$_("Icon")</label>
-- 
2.1.0




More information about the Kimchi-devel mailing list