[Kimchi-devel] [PATCH 2/2] Bug fix: Properly get the new guest name while creating or cloning a guest

Aline Manera alinefm at linux.vnet.ibm.com
Tue Nov 10 12:07:28 UTC 2015


When creating or cloning a guest, a fake entry is displayed in the
guest list view to represent the guest is being created.
After the API changes (from /vms to /plugins/kimchi/vms) the new guest
name was wrongly set to 'kimchi'. Fix it by adjusting the array index.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 src/wok/plugins/kimchi/ui/js/src/kimchi.guest_main.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wok/plugins/kimchi/ui/js/src/kimchi.guest_main.js b/src/wok/plugins/kimchi/ui/js/src/kimchi.guest_main.js
index a6e6fd1..eb563fb 100644
--- a/src/wok/plugins/kimchi/ui/js/src/kimchi.guest_main.js
+++ b/src/wok/plugins/kimchi/ui/js/src/kimchi.guest_main.js
@@ -249,7 +249,7 @@ kimchi.listVmsAuto = function() {
         kimchi.getTasksByFilter('status=running&target_uri='+encodeURIComponent('^/plugins/kimchi/vms/[^/]+$'), function(tasks) {
             for(var i=0;i<tasks.length;i++){
                 var guestUri = tasks[i].target_uri;
-                var guestName = guestUri.split('/')[2]
+                var guestName = guestUri.split('/')[4]
                 guests.push($.extend({}, kimchi.sampleGuestObject, {name: guestName, isCreating: true}));
                 if(kimchi.trackingTasks.indexOf(tasks[i].id)==-1)
                     kimchi.trackTask(tasks[i].id, null, function(err){
@@ -264,7 +264,7 @@ kimchi.listVmsAuto = function() {
         kimchi.getTasksByFilter('status=running&target_uri='+encodeURIComponent('^/plugins/kimchi/vms/.+/clone'), function(tasks) {
             for(var i=0;i<tasks.length;i++){
                 var guestUri = tasks[i].target_uri;
-                var guestName = guestUri.split('/')[2]
+                var guestName = guestUri.split('/')[4]
                 guests.push($.extend({}, kimchi.sampleGuestObject, {name: guestName, isCloning: true}));
                 if(kimchi.trackingTasks.indexOf(tasks[i].id)==-1)
                     kimchi.trackTask(tasks[i].id, null, function(err){
-- 
2.5.0




More information about the Kimchi-devel mailing list