[Kimchi-devel] [PATCH v3 4/4] storagevolume: Set target URI when creating Task

Crístian Viana vianac at linux.vnet.ibm.com
Thu Sep 4 20:54:24 UTC 2014


Commit f8f43b3 has exposed the field "target_uri" out of the Task structure.
The function "storagevolumes_create" creates Tasks to perform that operation
asynchronously but the corresponding "target_uri" isn't set.

Set the field "target_uri" when creating a storage volume according to
the format "/storagepools/<pool-name>/storagevolumes/<vol-name>".

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 src/kimchi/mockmodel.py            | 3 ++-
 src/kimchi/model/storagevolumes.py | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index a3f720f..908b0b7 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -505,7 +505,8 @@ class MockModel(object):
             raise InvalidOperation("KCHVOL0001E", {'name': name})
 
         params['pool'] = pool_name
-        taskid = self.add_task('', create_func, params)
+        targeturi = '/storagepools/%s/storagevolumes/%s' % (pool_name, name)
+        taskid = self.add_task(targeturi, create_func, params)
         return self.task_lookup(taskid)
 
     def _create_volume_with_capacity(self, cb, params):
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index a1c8c9a..6037953 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -79,7 +79,8 @@ class StorageVolumesModel(object):
             raise InvalidParameter('KCHVOL0001E', {'name': name})
 
         params['pool'] = pool_name
-        taskid = add_task('', create_func, self.objstore, params)
+        targeturi = '/storagepools/%s/storagevolumes/%s' % (pool_name, name)
+        taskid = add_task(targeturi, create_func, self.objstore, params)
         return self.task.lookup(taskid)
 
     def _create_volume_with_capacity(self, cb, params):
-- 
1.9.3




More information about the Kimchi-devel mailing list