[Kimchi-devel] [PATCH] [Kimchi 4/4] CPU Hot plug/unplug: ui changes

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Tue Nov 8 11:49:54 UTC 2016


From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>

This patch enables the CPU field for hotplug/unplug operations and
adds information text below CPU field about guest cpu
hotplug/unplug support if guest is running.

Changes in guests.dita were made to add information about the guest
support for this feature.

Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_edit_main.js | 12 +++++-------
 ui/pages/guest-edit.html.tmpl       |  1 +
 ui/pages/help/en_US/guests.dita     |  8 ++++++++
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 9669d08..558325a 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -981,16 +981,14 @@ 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-cores-textbox").prop("disabled", true);
+            $("#guest-edit-cores-hotplug-unsupported").removeClass('hidden');
             if (kimchi.capabilities.mem_hotplug_support) {
-                $("#form-guest-edit-general input").not("#guest-edit-memory-textbox").prop("disabled", true);
+                $("#guest-edit-memory-textbox").prop("disabled", false);
             } else {
-                $("#form-guest-edit-general input").prop("disabled", true);
+                $("#guest-edit-memory-hotplug-unsupported").removeClass('hidden');
             }
         }
-        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;
@@ -1071,7 +1069,7 @@ kimchi.guest_edit_main = function() {
                     // since it is disabled; for cpu_info, when guest is running, just skip it since no processing is required
                     if (kimchi.thisVMState === 'running' || kimchi.thisVMState === 'paused') {
                         if (key === 'cpu_info') {
-                            continue;
+                            data['cpu_info']['maxvcpus'] = org.cpu_info.maxvcpus;
                         }
                         if (key === 'memory') {
                             // Replace valueFromUI of max mem with one from original as otherwise the value is undefined
diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
index 7e0e3d3..f88dbf6 100644
--- a/ui/pages/guest-edit.html.tmpl
+++ b/ui/pages/guest-edit.html.tmpl
@@ -49,6 +49,7 @@
                     <div id="guest-processor">
                         <input id="guest-edit-cores-textbox" class="form-control" name="vcpus" type="number" min="1" />
                         <button id="guest-show-max-processor" class="btn btn-primary" type="button"><i class="fa fa-plus-circle"></i> <span class="cputext">$_("More")</span></button>
+                        <p id="guest-edit-cores-hotplug-unsupported" class="help-block hidden"><i class="fa fa-info-circle"></i> $_("Guest must support CPU hotplug. Check Help page for details.")</p>
                     </div>
                 </div>
                 <div id="guest-max-processor-panel" class="form-group">
diff --git a/ui/pages/help/en_US/guests.dita b/ui/pages/help/en_US/guests.dita
index 45cf7da..5c71694 100644
--- a/ui/pages/help/en_US/guests.dita
+++ b/ui/pages/help/en_US/guests.dita
@@ -77,6 +77,14 @@ create a template.</li>
 can be edited only while guest is stopped. Others will take effect
 in next boot.</shortdesc>
 <csbody>
+<ol><li><uicontrol>If guest is off: </uicontrol>CPU and Memory new values
+takes effect after next boot.</li>
+<li><uicontrol>If guest is running: </uicontrol>Guest must support
+hotplug/hotunplug of CPU and Memory devices, otherwise changes in these fields will not take effect. For Power systems, the guest must have:<ul>
+<li>Latest versions of packages <uicontrol>powerpc-utils, ppc64-diag</uicontrol> and <uicontrol>librtas</uicontrol>
+must be installed.</li>
+<li>Service <uicontrol>rtas_err</uicontrol> must be running.</li></ul>
+</li></ol>
 <dl><dlentry>
 <dt>General</dt>
 <dd>Displays information about your guest, including name, CPUs, memory,
-- 
2.7.4




More information about the Kimchi-devel mailing list