[PATCH V3] [Wok 0/3] Issue #158: Move AsyncTask information to memory
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
V3:
- Changes in how create AsyncTask
V2:
- moved all tasks_queue infrastructure to wok.asynctask
- modified some user messages.
V1:
this patch-set moves AsyncTask information from objectstore to memory and it
is dependency to solve Issue #122.
Paulo Vital (3):
Issue #158: Move AsyncTask information to memory
Issue #158: Update model/tasks.py with AsyncTasks in memory.
Issue #158: Add AsyncTasks testcases
src/wok/asynctask.py | 49 +++++++++++--------
src/wok/i18n.py | 3 +-
src/wok/model/tasks.py | 22 +++++----
src/wok/objectstore.py | 6 ---
src/wok/utils.py | 19 --------
tests/test_tasks.py | 124 +++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 167 insertions(+), 56 deletions(-)
create mode 100644 tests/test_tasks.py
--
2.7.4
8 years, 4 months
[PATCH] [Kimchi] Update usage of add_task() method.
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
After move AsyncTask to memory, the call to add a new task has changed.
This patch updates all add_task() calls to address the new way.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
mockmodel.py | 5 +++--
model/storagepools.py | 5 +++--
model/storagevolumes.py | 7 ++++---
model/vmhostdevs.py | 12 ++++++------
model/vms.py | 12 ++++++------
model/vmsnapshots.py | 4 ++--
tests/test_model.py | 15 +++++++--------
tests/test_rest.py | 11 ++++-------
8 files changed, 35 insertions(+), 36 deletions(-)
diff --git a/mockmodel.py b/mockmodel.py
index cd06ee3..eed2e7f 100644
--- a/mockmodel.py
+++ b/mockmodel.py
@@ -28,9 +28,10 @@ from collections import defaultdict
from lxml import objectify
from lxml.builder import E
+from wok.asynctask import add_task
from wok.exception import NotFoundError, OperationFailed
from wok.objectstore import ObjectStore
-from wok.utils import add_task, convert_data_size
+from wok.utils import convert_data_size
from wok.xmlutils.utils import xml_item_update
from wok.plugins.kimchi import imageinfo
@@ -418,7 +419,7 @@ class MockModel(Model):
params = {'vm_name': vm_name, 'name': name}
taskid = add_task(u'/plugins/kimchi/vms/%s/snapshots/%s' %
(vm_name, name), self._vmsnapshots_create_task,
- self.objstore, params)
+ params)
return self.task_lookup(taskid)
def _vmsnapshots_create_task(self, cb, params):
diff --git a/model/storagepools.py b/model/storagepools.py
index a2dbaec..95e3858 100644
--- a/model/storagepools.py
+++ b/model/storagepools.py
@@ -21,9 +21,10 @@ import libvirt
import lxml.etree as ET
from lxml.builder import E
+from wok.asynctask import add_task
from wok.exception import InvalidOperation, MissingParameter
from wok.exception import NotFoundError, OperationFailed
-from wok.utils import add_task, run_command, wok_log
+from wok.utils import run_command, wok_log
from wok.xmlutils.utils import xpath_get_text
from wok.plugins.kimchi.config import config, get_kimchi_version, kimchiPaths
@@ -253,7 +254,7 @@ class StoragePoolsModel(object):
params['path'] = self.scanner.scan_dir_prepare(params['name'])
scan_params['pool_path'] = params['path']
task_id = add_task('/plugins/kimchi/storagepools/%s' % ISO_POOL_NAME,
- self.scanner.start_scan, self.objstore, scan_params)
+ self.scanner.start_scan, scan_params)
# Record scanning-task/storagepool mapping for future querying
try:
with self.objstore as session:
diff --git a/model/storagevolumes.py b/model/storagevolumes.py
index 7b2272b..958af3e 100644
--- a/model/storagevolumes.py
+++ b/model/storagevolumes.py
@@ -28,9 +28,10 @@ import time
import urllib2
from lxml.builder import E
+from wok.asynctask import add_task
from wok.exception import InvalidOperation, InvalidParameter, IsoFormatError
from wok.exception import MissingParameter, NotFoundError, OperationFailed
-from wok.utils import add_task, get_unique_file_name
+from wok.utils import get_unique_file_name
from wok.utils import probe_file_permission_as_user, wok_log
from wok.xmlutils.utils import xpath_get_text
from wok.model.tasks import TaskModel
@@ -124,7 +125,7 @@ class StorageVolumesModel(object):
params['pool'] = pool_name
targeturi = '/plugins/kimchi/storagepools/%s/storagevolumes/%s' \
% (pool_name, name)
- taskid = add_task(targeturi, create_func, self.objstore, params)
+ taskid = add_task(targeturi, create_func, params)
return self.task.lookup(taskid)
def _create_volume_with_capacity(self, cb, params):
@@ -442,7 +443,7 @@ class StorageVolumeModel(object):
'new_name': new_name}
target_uri = u'/plugins/kimchi/storagepools/%s/storagevolumes/%s/clone'
taskid = add_task(target_uri % (pool, new_name), self._clone_task,
- self.objstore, params)
+ params)
return self.task.lookup(taskid)
def _clone_task(self, cb, params):
diff --git a/model/vmhostdevs.py b/model/vmhostdevs.py
index ef39de3..c92decd 100644
--- a/model/vmhostdevs.py
+++ b/model/vmhostdevs.py
@@ -26,12 +26,13 @@ from lxml import etree, objectify
from lxml.builder import E, ElementMaker
from operator import itemgetter
+from wok.asynctask import add_task
from wok.exception import InvalidOperation, InvalidParameter, NotFoundError
from wok.exception import OperationFailed
from wok.message import WokMessage
from wok.model.tasks import TaskModel
from wok.rollbackcontext import RollbackContext
-from wok.utils import add_task, run_command, wok_log
+from wok.utils import run_command, wok_log
from wok.plugins.kimchi.model.config import CapabilitiesModel
from wok.plugins.kimchi.model.host import DeviceModel, DevicesModel
@@ -94,7 +95,7 @@ class VMHostDevsModel(object):
if dev_info['device_type'] == 'pci':
taskid = add_task(u'/plugins/kimchi/vms/%s/hostdevs/' %
VMModel.get_vm(vmid, self.conn).name(),
- self._attach_pci_device, self.objstore,
+ self._attach_pci_device,
{'vmid': vmid, 'dev_info': dev_info,
'lock': threading.RLock()})
return self.task.lookup(taskid)
@@ -113,8 +114,8 @@ class VMHostDevsModel(object):
taskid = add_task(u'/plugins/kimchi/vms/%s/hostdevs/' %
VMModel.get_vm(vmid, self.conn).name(),
'_attach_%s_device' % dev_info['device_type'],
- self.objstore, {'vmid': vmid, 'dev_info': dev_info,
- 'lock': threading.RLock()})
+ {'vmid': vmid, 'dev_info': dev_info,
+ 'lock': threading.RLock()})
return self.task.lookup(taskid)
@@ -604,8 +605,7 @@ class VMHostDevModel(object):
'lock': threading.RLock()}
task_uri = u'/plugins/kimchi/vms/%s/hostdevs/%s' % \
(VMModel.get_vm(vmid, self.conn).name(), dev_name)
- taskid = add_task(task_uri, self._detach_device, self.objstore,
- task_params)
+ taskid = add_task(task_uri, self._detach_device, task_params)
return self.task.lookup(taskid)
def _event_devices(self, conn, dom, alias, opaque):
diff --git a/model/vms.py b/model/vms.py
index 3380278..518378f 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -34,12 +34,13 @@ from lxml import etree, objectify
from lxml.builder import E
from xml.etree import ElementTree
+from wok.asynctask import add_task
from wok.config import config
from wok.exception import InvalidOperation, InvalidParameter
from wok.exception import NotFoundError, OperationFailed
from wok.model.tasks import TaskModel
from wok.rollbackcontext import RollbackContext
-from wok.utils import add_task, convert_data_size
+from wok.utils import convert_data_size
from wok.utils import import_class, run_setfacl_set_attr, run_command, wok_log
from wok.xmlutils.utils import dictize, xpath_get_text, xml_item_insert
from wok.xmlutils.utils import xml_item_remove, xml_item_update
@@ -145,7 +146,7 @@ class VMsModel(object):
"title": params.get("title", ""),
"description": params.get("description", "")}
taskid = add_task(u'/plugins/kimchi/vms/%s' % name, self._create_task,
- self.objstore, data)
+ data)
return self.task.lookup(taskid)
@@ -350,8 +351,8 @@ class VMModel(object):
# create a task with the actual clone function
taskid = add_task(u'/plugins/kimchi/vms/%s/clone' % new_name,
- self._clone_task, self.objstore,
- {'name': name, 'new_name': new_name})
+ self._clone_task, {'name': name,
+ 'new_name': new_name})
return self.task.lookup(taskid)
@@ -1899,8 +1900,7 @@ class VMModel(object):
'remote_host': remote_host,
'user': user}
task_id = add_task('/plugins/kimchi/vms/%s/migrate' % name,
- self._migrate_task,
- self.objstore, params)
+ self._migrate_task, params)
return self.task.lookup(task_id)
diff --git a/model/vmsnapshots.py b/model/vmsnapshots.py
index 6f2483c..520623e 100644
--- a/model/vmsnapshots.py
+++ b/model/vmsnapshots.py
@@ -23,8 +23,8 @@ import time
from lxml import objectify
from lxml.builder import E
+from wok.asynctask import add_task
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
@@ -75,7 +75,7 @@ class VMSnapshotsModel(object):
task_params = {'vm_name': vm_name, 'name': name}
taskid = add_task(u'/plugins/kimchi/vms/%s/snapshots/%s' % (vm_name,
- name), self._create_task, self.objstore, task_params)
+ name), self._create_task, task_params)
return self.task.lookup(taskid)
def _create_task(self, cb, params):
diff --git a/tests/test_model.py b/tests/test_model.py
index e77d4fd..0a5d343 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -36,12 +36,13 @@ from mock import call, mock_open, patch
import tests.utils as utils
import wok.objectstore
+from wok.asynctask import add_task
from wok.basemodel import Singleton
from wok.config import config
from wok.exception import InvalidOperation
from wok.exception import InvalidParameter, NotFoundError, OperationFailed
from wok.rollbackcontext import RollbackContext
-from wok.utils import add_task, convert_data_size, get_task_id
+from wok.utils import convert_data_size, get_task_id
from wok.xmlutils.utils import xpath_get_text
from wok.plugins.gingerbase import netinfo
@@ -1401,15 +1402,14 @@ class ModelTests(unittest.TestCase):
inst = model.Model('test:///default',
objstore_loc=self.tmp_store)
- taskid = add_task('', quick_op, inst.objstore, 'Hello')
+ taskid = add_task('', quick_op, 'Hello')
inst.task_wait(taskid)
self.assertEquals(get_task_id(), taskid)
self.assertEquals('finished', inst.task_lookup(taskid)['status'])
self.assertEquals('Hello', inst.task_lookup(taskid)['message'])
- taskid = add_task('', long_op, inst.objstore,
- {'delay': 3, 'result': False,
- 'message': 'It was not meant to be'})
+ taskid = add_task('', long_op, {'delay': 3, 'result': False,
+ 'message': 'It was not meant to be'})
self.assertEquals(get_task_id(), taskid)
self.assertEquals('running', inst.task_lookup(taskid)['status'])
self.assertEquals('OK', inst.task_lookup(taskid)['message'])
@@ -1417,14 +1417,13 @@ class ModelTests(unittest.TestCase):
self.assertEquals('failed', inst.task_lookup(taskid)['status'])
self.assertEquals('It was not meant to be',
inst.task_lookup(taskid)['message'])
- taskid = add_task('', abnormal_op, inst.objstore, {})
+ taskid = add_task('', abnormal_op, {})
inst.task_wait(taskid)
self.assertEquals('Exception raised',
inst.task_lookup(taskid)['message'])
self.assertEquals('failed', inst.task_lookup(taskid)['status'])
- taskid = add_task('', continuous_ops, inst.objstore,
- {'result': True})
+ taskid = add_task('', continuous_ops, {'result': True})
self.assertEquals('running', inst.task_lookup(taskid)['status'])
inst.task_wait(taskid, timeout=10)
self.assertEquals('finished', inst.task_lookup(taskid)['status'])
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 80596c2..483e5ff 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -30,8 +30,8 @@ from functools import partial
from tests.utils import get_free_port, patch_auth, request
from tests.utils import run_server, wait_task
+from wok.asynctask import add_task
from wok.rollbackcontext import RollbackContext
-from wok.utils import add_task
from wok.plugins.kimchi import mockmodel
from wok.plugins.kimchi.osinfo import get_template_default
@@ -1305,12 +1305,9 @@ class RestTests(unittest.TestCase):
)
def test_tasks(self):
- id1 = add_task('/plugins/kimchi/tasks/1', self._async_op,
- model.objstore)
- id2 = add_task('/plugins/kimchi/tasks/2', self._except_op,
- model.objstore)
- id3 = add_task('/plugins/kimchi/tasks/3', self._intermid_op,
- model.objstore)
+ id1 = add_task('/plugins/kimchi/tasks/1', self._async_op)
+ id2 = add_task('/plugins/kimchi/tasks/2', self._except_op)
+ id3 = add_task('/plugins/kimchi/tasks/3', self._intermid_op)
target_uri = urllib2.quote('^/plugins/kimchi/tasks/*', safe="")
filter_data = 'status=running&target_uri=%s' % target_uri
--
2.7.4
8 years, 4 months
[PATCH] [Wok 0/3] Multiple UI patches for DataTables redesigned panels
by sguimaraes943@gmail.com
From: Samuel Guimarães <sguimaraes943(a)gmail.com>
This patchtset contains some updates that are required for the new redesigned panels in Ginger
Samuel Guimarães (3):
Minor change in Wok Drop-Downs to fix text alignment with different icons and locales
Fixed minor issue with sortable icons on Datatables.net CSS and with default DOM in JS
Added IP Address sorting plugin for Datatables.net
configure.ac | 2 +
ui/css/datatables.bootstrap.css | 9 ++
ui/css/src/datatables.bootstrap.scss | 8 ++
ui/css/src/modules/_buttons.scss | 9 ++
ui/css/src/modules/_menu-flat.scss | 44 +++++++--
ui/css/wok.css | 102 ++++++++++++++++++--
ui/js/src/wok.datatables.js | 2 +-
ui/libs/datatables/js/Makefile.am | 2 +
ui/libs/datatables/js/plugins/Makefile.am | 19 ++++
ui/libs/datatables/js/plugins/ip-address/LICENSE | 20 ++++
.../datatables/js/plugins/ip-address/Makefile.am | 21 +++++
.../datatables/js/plugins/ip-address/ip-address.js | 103 +++++++++++++++++++++
ui/pages/wok-ui.html.tmpl | 1 +
13 files changed, 327 insertions(+), 15 deletions(-)
create mode 100644 ui/libs/datatables/js/plugins/Makefile.am
create mode 100644 ui/libs/datatables/js/plugins/ip-address/LICENSE
create mode 100644 ui/libs/datatables/js/plugins/ip-address/Makefile.am
create mode 100644 ui/libs/datatables/js/plugins/ip-address/ip-address.js
--
2.5.5
8 years, 4 months
[PATCH V2] [Wok 0/3] Issue #158: Move AsyncTask information to memory
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
V2:
- moved all tasks_queue infrastructure to wok.asynctask
- modified some user messages.
V1:
this patch-set moves AsyncTask information from objectstore to memory and it
is dependency to solve Issue #122.
Paulo Vital (3):
Issue #158: Move AsyncTask information to memory
Issue #158: Update model/tasks.py with AsyncTasks in memory.
Issue #158: Add AsyncTasks testcases
src/wok/asynctask.py | 58 +++++++++++++++--------
src/wok/i18n.py | 3 +-
src/wok/model/tasks.py | 22 +++++----
src/wok/objectstore.py | 6 ---
src/wok/utils.py | 19 --------
tests/test_tasks.py | 124 +++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 177 insertions(+), 55 deletions(-)
create mode 100644 tests/test_tasks.py
--
2.7.4
8 years, 4 months
[PATCH] [Kimchi] Check if VM is off before detaching multifn PCI
by Jose Ricardo Ziviani
- this commit fix a bug when detaching multifunction pci devices
because hotplug/coldplug need a different approach with
libvirt upstream.
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
model/vmhostdevs.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/model/vmhostdevs.py b/model/vmhostdevs.py
index ef39de3..e2299e2 100644
--- a/model/vmhostdevs.py
+++ b/model/vmhostdevs.py
@@ -686,6 +686,9 @@ class VMHostDevModel(object):
return devices
def _hotunplug_multifunction_pci(self, dom, hostdev, dev_name):
+ if DOM_STATE_MAP[dom.info()[0]] == "shutoff":
+ return False
+
domain, bus, slot, _ = dev_name.split('_')[1:]
# get all devices attached to the guest in the same domain+bus+slot
# that the one we are going to detach because they must be detached
--
2.7.4
8 years, 4 months
[PATCH] [Kimchi] Github #986: create '/data/virtviewerfiles' dir automatically
by dhbarboza82@gmail.com
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
This patch makes the '/data/virtviewerfiles' dir behave the
same as '/data/screenshots', being created automatically at
Kimchi startup if it doesn't exists.
Signed-off-by: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
---
root.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/root.py b/root.py
index a88f97d..90680b4 100644
--- a/root.py
+++ b/root.py
@@ -37,7 +37,8 @@ class Kimchi(WokRoot):
make_dirs = [
os.path.dirname(os.path.abspath(config.get_object_store())),
os.path.abspath(config.get_distros_store()),
- os.path.abspath(config.get_screenshot_path())
+ os.path.abspath(config.get_screenshot_path()),
+ os.path.abspath(config.get_virtviewerfiles_path())
]
for directory in make_dirs:
if not os.path.isdir(directory):
--
2.5.5
8 years, 4 months
[PATCH] [Kimchi] Revert "Fix frontend vcpu hotplug"
by Jose Ricardo Ziviani
This reverts commit 7cc96b592191b521effac1a6bb98a2b4dbf29474, this
commit must be available only in HostOS repository for now.
---
ui/js/src/kimchi.guest_edit_main.js | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 9b6eab6..dcaafb8 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -815,13 +815,12 @@ kimchi.guest_edit_main = function() {
for (var key in data) {
valueFromUI = data[key];
if (valueFromUI instanceof Object) {
- // Compare if Objects of original and data are identical.
- // Handle special case when key is memory and guest is
- // running as valueFromUI will return a null for max mem
- // since it is disabled.
+ // Compare if Objects of original and data are identical
+ // Handle special case when key is memory and guest is running as valueFromUI will return a null for max mem
+ // 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') {
- data['cpu_info']['maxvcpus'] = org.cpu_info.maxvcpus;
+ continue;
}
if (key === 'memory') {
// Replace valueFromUI of max mem with one from original as otherwise the value is undefined
--
2.7.4
8 years, 4 months
[PATCH] [Wok 0/3] Issue #158: Move AsyncTask information to memory
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
this patch-set moves AsyncTask information from objectstore to memory and it
is dependency to solve Issue #122.
Paulo Vital (3):
Issue #158: Move AsyncTask information to memory
Issue #158: Update model/tasks.py with AsyncTasks in memory.
Issue #158: Add AsyncTasks testcases
src/wok/asynctask.py | 25 ++-------
src/wok/i18n.py | 3 +-
src/wok/model/tasks.py | 22 ++++----
src/wok/objectstore.py | 6 ---
src/wok/utils.py | 31 ++++++++---
tests/test_tasks.py | 136 +++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 178 insertions(+), 45 deletions(-)
create mode 100644 tests/test_tasks.py
--
2.7.4
8 years, 4 months
[RFC] Issue# 979 Create UI to change boot order
by Socorro Stoppler
Per discussion w/Samuel, here is what the proposed UI looks like. A
menu item - 'Change boot order' - in Actions for each guest will be
added to invoke this.
Dragging the entries will cause the order to change.
Thoughts?
Thanks!
-Socorro
8 years, 4 months
[RFC] Should not be allowed to remove "default" storagepool and network
by Ramon Medeiros
Propose: avoid to delete default network and storage pool:
files affected:
Create a error message at i18n.py
Check at delete() method on model to verify
Doubt:
Where is defined the default pool and network? I did not see it in
kimchi.conf
Should i create a entry to deal it?
--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn(a)br.ibm.com
8 years, 4 months