[Kimchi-devel] [PATCH 2/3] [WOK] Update Kimchi to use Tasks from Wok.

pvital at linux.vnet.ibm.com pvital at linux.vnet.ibm.com
Mon Sep 21 14:00:19 UTC 2015


From: Paulo Vital <pvital at linux.vnet.ibm.com>

Update Kimchi model and UI files to import and use the Tasks collection and
Task resource from Wok structure.

Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
 plugins/kimchi/model/debugreports.py   | 2 +-
 plugins/kimchi/model/host.py           | 2 +-
 plugins/kimchi/model/storagevolumes.py | 2 +-
 plugins/kimchi/model/vms.py            | 2 +-
 plugins/kimchi/model/vmsnapshots.py    | 2 +-
 plugins/kimchi/ui/js/src/kimchi.api.js | 4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/plugins/kimchi/model/debugreports.py b/plugins/kimchi/model/debugreports.py
index bee10b6..48e6b26 100644
--- a/plugins/kimchi/model/debugreports.py
+++ b/plugins/kimchi/model/debugreports.py
@@ -29,9 +29,9 @@ from wok.exception import InvalidParameter, NotFoundError, OperationFailed
 from wok.exception import WokException
 from wok.utils import add_task, wok_log
 from wok.utils import run_command
+from wok.model.tasks import TaskModel

 from .. import config
-from tasks import TaskModel


 class DebugReportsModel(object):
diff --git a/plugins/kimchi/model/host.py b/plugins/kimchi/model/host.py
index 8c891a1..75d4de0 100644
--- a/plugins/kimchi/model/host.py
+++ b/plugins/kimchi/model/host.py
@@ -30,6 +30,7 @@ from wok.exception import InvalidOperation, InvalidParameter
 from wok.exception import NotFoundError, OperationFailed
 from wok.utils import add_task, wok_log
 from wok.xmlutils.utils import xpath_get_text
+from wok.model.tasks import TaskModel

 import hostdev
 from .. import disks
@@ -37,7 +38,6 @@ from .. import netinfo
 from ..repositories import Repositories
 from ..swupdate import SoftwareUpdate
 from config import CapabilitiesModel
-from tasks import TaskModel
 from vms import DOM_STATE_MAP


diff --git a/plugins/kimchi/model/storagevolumes.py b/plugins/kimchi/model/storagevolumes.py
index 920333c..99b17d3 100644
--- a/plugins/kimchi/model/storagevolumes.py
+++ b/plugins/kimchi/model/storagevolumes.py
@@ -32,12 +32,12 @@ from wok.exception import MissingParameter, NotFoundError, OperationFailed
 from wok.utils import add_task, get_next_clone_name, get_unique_file_name
 from wok.utils import wok_log
 from wok.xmlutils.utils import xpath_get_text
+from wok.model.tasks import TaskModel

 from ..config import READONLY_POOL_TYPE
 from ..isoinfo import IsoImage
 from diskutils import get_disk_used_by, set_disk_used_by
 from storagepools import StoragePoolModel
-from tasks import TaskModel


 VOLUME_TYPE_MAP = {0: 'file',
diff --git a/plugins/kimchi/model/vms.py b/plugins/kimchi/model/vms.py
index f446e80..f37b5d6 100644
--- a/plugins/kimchi/model/vms.py
+++ b/plugins/kimchi/model/vms.py
@@ -36,6 +36,7 @@ from wok.utils import add_task, convert_data_size, get_next_clone_name
 from wok.utils import import_class, run_setfacl_set_attr, wok_log
 from wok.xmlutils.utils import xpath_get_text, xml_item_update
 from wok.xmlutils.utils import dictize
+from wok.model.tasks import TaskModel

 from .. import model
 from .. import vnc
@@ -45,7 +46,6 @@ from ..screenshot import VMScreenshot
 from ..utils import template_name_from_uri
 from ..xmlutils.cpu import get_cpu_xml, get_numa_xml
 from config import CapabilitiesModel
-from tasks import TaskModel
 from templates import TemplateModel
 from utils import get_vm_name
 from utils import get_metadata_node
diff --git a/plugins/kimchi/model/vmsnapshots.py b/plugins/kimchi/model/vmsnapshots.py
index 6abf726..fff1908 100644
--- a/plugins/kimchi/model/vmsnapshots.py
+++ b/plugins/kimchi/model/vmsnapshots.py
@@ -26,8 +26,8 @@ from lxml.builder import E
 from wok.exception import InvalidOperation, NotFoundError, OperationFailed
 from wok.utils import add_task
 from wok.xmlutils.utils import xpath_get_text
+from wok.model.tasks import TaskModel

-from tasks import TaskModel
 from vms import DOM_STATE_MAP, VMModel
 from vmstorages import VMStorageModel, VMStoragesModel

diff --git a/plugins/kimchi/ui/js/src/kimchi.api.js b/plugins/kimchi/ui/js/src/kimchi.api.js
index 0ec3747..fde803a 100644
--- a/plugins/kimchi/ui/js/src/kimchi.api.js
+++ b/plugins/kimchi/ui/js/src/kimchi.api.js
@@ -525,7 +525,7 @@ var kimchi = {

     getTask : function(taskId, suc, err) {
         wok.requestJSON({
-            url : 'plugins/kimchi/tasks/' + encodeURIComponent(taskId),
+            url : 'tasks/' + encodeURIComponent(taskId),
             type : 'GET',
             contentType : 'application/json',
             dataType : 'json',
@@ -536,7 +536,7 @@ var kimchi = {

     getTasksByFilter : function(filter, suc, err, sync) {
         wok.requestJSON({
-            url : 'plugins/kimchi/tasks?' + filter,
+            url : 'tasks?' + filter,
             type : 'GET',
             contentType : 'application/json',
             dataType : 'json',
--
2.4.3




More information about the Kimchi-devel mailing list