[PATCH 0/3] Add disks to LVM pool backend

From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> This patch series implements the backend changes to allow disks/partitions to be added to an existing LVM (logical) pool. The process, as discussed previously in kimchi mailing list, is to use 'vgextend' and 'virsh pool-refresh' commands to add the disks and then refresh the pool. It is also worth noticing that the existing data from the disks/partitions being added to the pool will be erased/lost. To test the patch: $ curl -u root -H 'Content-type: application/json' -H 'Accept: application/json' -X PUT localhost:8000/storagepools/<pool_name> -d '{"disks": ["/path/to/disk1", "/path/to/disk2"] }' Tip: to test the patch over and over with the same pool and disks without the need to destroy/create the pool: $ vgreduce <pool_name> disk1 disk2 $ virsh pool-refresh <pool_name> The above commands will restore the logical pool to its previous state, before adding disks 'disk1' and 'disk2' Daniel Henrique Barboza (3): Add disks to LVM pool: control and model changes Add disks to LVM pool: API changes Add disks to LVM pool: mockmodel changes docs/API.md | 5 ++++- src/kimchi/control/storagepools.py | 2 +- src/kimchi/mockmodel.py | 12 ++++++------ src/kimchi/model/storagepools.py | 35 +++++++++++++++++++++++++++-------- 4 files changed, 38 insertions(+), 16 deletions(-) -- 1.8.3.1

From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> Added a new update parameter to storagepool resource. Changed the logic in the model to accept any update parameter ('autostart' or 'disks'). 'disks' parameter will add disks/partitions to the target LVM pool. Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchi/control/storagepools.py | 2 +- src/kimchi/model/storagepools.py | 35 +++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/kimchi/control/storagepools.py b/src/kimchi/control/storagepools.py index ae5185c..af10acd 100644 --- a/src/kimchi/control/storagepools.py +++ b/src/kimchi/control/storagepools.py @@ -80,7 +80,7 @@ class StoragePools(Collection): class StoragePool(Resource): def __init__(self, model, ident): super(StoragePool, self).__init__(model, ident) - self.update_params = ["autostart"] + self.update_params = ["autostart", "disks"] self.uri_fmt = "/storagepools/%s" self.activate = self.generate_action_handler('activate') self.deactivate = self.generate_action_handler('deactivate') diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py index 233a8a7..89cb61f 100644 --- a/src/kimchi/model/storagepools.py +++ b/src/kimchi/model/storagepools.py @@ -28,7 +28,7 @@ from kimchi.exception import InvalidOperation, MissingParameter from kimchi.exception import NotFoundError, OperationFailed from kimchi.model.libvirtstoragepool import StoragePoolDef from kimchi.utils import add_task, kimchi_log - +from kimchi.utils import run_command ISO_POOL_NAME = u'kimchi_isos' POOL_STATE_MAP = {0: 'inactive', @@ -200,15 +200,34 @@ class StoragePoolModel(object): pass return res + def _update_lvm_disks(self, pool_name, disks): + vgextend_cmd = ["vgextend", pool_name] + vgextend_cmd += disks + output, error, returncode = run_command(vgextend_cmd) + if returncode != 0: + kimchi_log.error('Could not add disks to pool %s, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while adding disks to pool %s.', + pool_name) + pool_refresh_cmd = ["virsh", "pool-refresh", pool_name] + output, error, returncode = run_command(pool_refresh_cmd) + if returncode != 0: + kimchi_log.error('Could not refresh pool %s using libvirt, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while refreshing pool %s ' + 'using libvirt.', pool_name) + def update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") pool = self.get_storagepool(name, self.conn) - if autostart: - pool.setAutostart(1) - else: - pool.setAutostart(0) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + if params['autostart']: + pool.setAutostart(1) + else: + pool.setAutostart(0) + if 'disks' in params: + self._update_lvm_disks(name, params['disks']) ident = pool.name() return ident -- 1.8.3.1

From: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com>
Added a new update parameter to storagepool resource. Changed the logic in the model to accept any update parameter ('autostart' or 'disks'). 'disks' parameter will add disks/partitions to the target LVM pool. need to update API.json? Signed-off-by: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com> --- src/kimchi/control/storagepools.py | 2 +- src/kimchi/model/storagepools.py | 35 +++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/control/storagepools.py b/src/kimchi/control/storagepools.py index ae5185c..af10acd 100644 --- a/src/kimchi/control/storagepools.py +++ b/src/kimchi/control/storagepools.py @@ -80,7 +80,7 @@ class StoragePools(Collection): class StoragePool(Resource): def __init__(self, model, ident): super(StoragePool, self).__init__(model, ident) - self.update_params = ["autostart"] + self.update_params = ["autostart", "disks"] self.uri_fmt = "/storagepools/%s" self.activate = self.generate_action_handler('activate') self.deactivate = self.generate_action_handler('deactivate') diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py index 233a8a7..89cb61f 100644 --- a/src/kimchi/model/storagepools.py +++ b/src/kimchi/model/storagepools.py @@ -28,7 +28,7 @@ from kimchi.exception import InvalidOperation, MissingParameter from kimchi.exception import NotFoundError, OperationFailed from kimchi.model.libvirtstoragepool import StoragePoolDef from kimchi.utils import add_task, kimchi_log - +from kimchi.utils import run_command
ISO_POOL_NAME = u'kimchi_isos' POOL_STATE_MAP = {0: 'inactive', @@ -200,15 +200,34 @@ class StoragePoolModel(object): pass return res
+ def _update_lvm_disks(self, pool_name, disks): + vgextend_cmd = ["vgextend", pool_name] + vgextend_cmd += disks + output, error, returncode = run_command(vgextend_cmd) + if returncode != 0: + kimchi_log.error('Could not add disks to pool %s, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while adding disks to pool %s.', + pool_name) + pool_refresh_cmd = ["virsh", "pool-refresh", pool_name] src/kimchi/model/storagepools.py:
a minor comment below On 02/07/2014 08:53 PM, Daniel Barboza wrote: pool = self.get_storagepool(pool_name , self.conn) pool.refresh(0)
+ output, error, returncode = run_command(pool_refresh_cmd) + if returncode != 0: + kimchi_log.error('Could not refresh pool %s using libvirt, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while refreshing pool %s ' + 'using libvirt.', pool_name) + def update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") pool = self.get_storagepool(name, self.conn) - if autostart: - pool.setAutostart(1) - else: - pool.setAutostart(0) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + if params['autostart']: + pool.setAutostart(1) + else: + pool.setAutostart(0) do you need to check this pool is a logical pool here as you docs says.
* disks: Adds one or more disks to the pool (for 'logical' pool only)
+ if 'disks' in params: + self._update_lvm_disks(name, params['disks']) ident = pool.name() return ident
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center

On 02/10/2014 12:17 AM, Sheldon wrote:
a minor comment below
On 02/07/2014 08:53 PM, Daniel Barboza wrote:
From: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com>
Added a new update parameter to storagepool resource. Changed the logic in the model to accept any update parameter ('autostart' or 'disks'). 'disks' parameter will add disks/partitions to the target LVM pool. need to update API.json?
Good point. I've just checked the API.json and there is no entry for storagepool_update so it will need to add a new entry for that
Signed-off-by: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com> --- src/kimchi/control/storagepools.py | 2 +- src/kimchi/model/storagepools.py | 35 +++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/control/storagepools.py b/src/kimchi/control/storagepools.py index ae5185c..af10acd 100644 --- a/src/kimchi/control/storagepools.py +++ b/src/kimchi/control/storagepools.py @@ -80,7 +80,7 @@ class StoragePools(Collection): class StoragePool(Resource): def __init__(self, model, ident): super(StoragePool, self).__init__(model, ident) - self.update_params = ["autostart"] + self.update_params = ["autostart", "disks"] self.uri_fmt = "/storagepools/%s" self.activate = self.generate_action_handler('activate') self.deactivate = self.generate_action_handler('deactivate') diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py index 233a8a7..89cb61f 100644 --- a/src/kimchi/model/storagepools.py +++ b/src/kimchi/model/storagepools.py @@ -28,7 +28,7 @@ from kimchi.exception import InvalidOperation, MissingParameter from kimchi.exception import NotFoundError, OperationFailed from kimchi.model.libvirtstoragepool import StoragePoolDef from kimchi.utils import add_task, kimchi_log - +from kimchi.utils import run_command
ISO_POOL_NAME = u'kimchi_isos' POOL_STATE_MAP = {0: 'inactive', @@ -200,15 +200,34 @@ class StoragePoolModel(object): pass return res
+ def _update_lvm_disks(self, pool_name, disks): + vgextend_cmd = ["vgextend", pool_name] + vgextend_cmd += disks + output, error, returncode = run_command(vgextend_cmd) + if returncode != 0: + kimchi_log.error('Could not add disks to pool %s, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while adding disks to pool %s.', + pool_name) + pool_refresh_cmd = ["virsh", "pool-refresh", pool_name] src/kimchi/model/storagepools.py: pool = self.get_storagepool(pool_name , self.conn) pool.refresh(0) + output, error, returncode = run_command(pool_refresh_cmd) + if returncode != 0: + kimchi_log.error('Could not refresh pool %s using libvirt, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while refreshing pool %s ' + 'using libvirt.', pool_name) + def update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") pool = self.get_storagepool(name, self.conn) - if autostart: - pool.setAutostart(1) - else: - pool.setAutostart(0) + if 'autostart' in params:
+ if params['autostart'] not in [True, False]:
After updating the API.json you can remove the above verification as jsonschema will care about it
+ raise InvalidOperation("Autostart flag must be true or false") + if params['autostart']: + pool.setAutostart(1) + else: + pool.setAutostart(0) do you need to check this pool is a logical pool here as you docs says.
Good point. =)
* disks: Adds one or more disks to the pool (for 'logical' pool only)
+ if 'disks' in params: + self._update_lvm_disks(name, params['disks']) ident = pool.name() return ident

On 02/10/2014 12:17 AM, Sheldon wrote:
a minor comment below
From: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com>
Added a new update parameter to storagepool resource. Changed the logic in the model to accept any update parameter ('autostart' or 'disks'). 'disks' parameter will add disks/partitions to the target LVM pool. need to update API.json? Signed-off-by: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com> --- src/kimchi/control/storagepools.py | 2 +- src/kimchi/model/storagepools.py | 35 +++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/control/storagepools.py b/src/kimchi/control/storagepools.py index ae5185c..af10acd 100644 --- a/src/kimchi/control/storagepools.py +++ b/src/kimchi/control/storagepools.py @@ -80,7 +80,7 @@ class StoragePools(Collection): class StoragePool(Resource): def __init__(self, model, ident): super(StoragePool, self).__init__(model, ident) - self.update_params = ["autostart"] + self.update_params = ["autostart", "disks"] self.uri_fmt = "/storagepools/%s" self.activate = self.generate_action_handler('activate') self.deactivate = self.generate_action_handler('deactivate') diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py index 233a8a7..89cb61f 100644 --- a/src/kimchi/model/storagepools.py +++ b/src/kimchi/model/storagepools.py @@ -28,7 +28,7 @@ from kimchi.exception import InvalidOperation, MissingParameter from kimchi.exception import NotFoundError, OperationFailed from kimchi.model.libvirtstoragepool import StoragePoolDef from kimchi.utils import add_task, kimchi_log - +from kimchi.utils import run_command
ISO_POOL_NAME = u'kimchi_isos' POOL_STATE_MAP = {0: 'inactive', @@ -200,15 +200,34 @@ class StoragePoolModel(object): pass return res
+ def _update_lvm_disks(self, pool_name, disks): + vgextend_cmd = ["vgextend", pool_name] + vgextend_cmd += disks + output, error, returncode = run_command(vgextend_cmd) + if returncode != 0: + kimchi_log.error('Could not add disks to pool %s, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while adding disks to pool %s.', + pool_name) + pool_refresh_cmd = ["virsh", "pool-refresh", pool_name] src/kimchi/model/storagepools.py:
On 02/07/2014 08:53 PM, Daniel Barboza wrote: pool = self.get_storagepool(pool_name , self.conn) pool.refresh(0)
+ output, error, returncode = run_command(pool_refresh_cmd) + if returncode != 0: + kimchi_log.error('Could not refresh pool %s using libvirt, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while refreshing pool %s ' + 'using libvirt.', pool_name) + def update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") pool = self.get_storagepool(name, self.conn) - if autostart: - pool.setAutostart(1) - else: - pool.setAutostart(0) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + if params['autostart']: + pool.setAutostart(1) + else: + pool.setAutostart(0) do you need to check this pool is a logical pool here as you docs says.
* disks: Adds one or more disks to the pool (for 'logical' pool only)
Good catch Sheldon! I'll fix it in v2
+ if 'disks' in params: + self._update_lvm_disks(name, params['disks']) ident = pool.name() return ident

On 02/07/2014 10:53 AM, Daniel Barboza wrote:
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Added a new update parameter to storagepool resource. Changed the logic in the model to accept any update parameter ('autostart' or 'disks'). 'disks' parameter will add disks/partitions to the target LVM pool.
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchi/control/storagepools.py | 2 +- src/kimchi/model/storagepools.py | 35 +++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/control/storagepools.py b/src/kimchi/control/storagepools.py index ae5185c..af10acd 100644 --- a/src/kimchi/control/storagepools.py +++ b/src/kimchi/control/storagepools.py @@ -80,7 +80,7 @@ class StoragePools(Collection): class StoragePool(Resource): def __init__(self, model, ident): super(StoragePool, self).__init__(model, ident) - self.update_params = ["autostart"] + self.update_params = ["autostart", "disks"] self.uri_fmt = "/storagepools/%s" self.activate = self.generate_action_handler('activate') self.deactivate = self.generate_action_handler('deactivate') diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py index 233a8a7..89cb61f 100644 --- a/src/kimchi/model/storagepools.py +++ b/src/kimchi/model/storagepools.py @@ -28,7 +28,7 @@ from kimchi.exception import InvalidOperation, MissingParameter from kimchi.exception import NotFoundError, OperationFailed from kimchi.model.libvirtstoragepool import StoragePoolDef from kimchi.utils import add_task, kimchi_log - +from kimchi.utils import run_command
ISO_POOL_NAME = u'kimchi_isos' POOL_STATE_MAP = {0: 'inactive', @@ -200,15 +200,34 @@ class StoragePoolModel(object): pass return res
+ def _update_lvm_disks(self, pool_name, disks):
You need to verify the disks. Are all those exists in system? Remember that we can always use the REST API direclty
+ vgextend_cmd = ["vgextend", pool_name] + vgextend_cmd += disks + output, error, returncode = run_command(vgextend_cmd) + if returncode != 0: + kimchi_log.error('Could not add disks to pool %s, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while adding disks to pool %s.', + pool_name)
+ pool_refresh_cmd = ["virsh", "pool-refresh", pool_name] + output, error, returncode = run_command(pool_refresh_cmd) + if returncode != 0: + kimchi_log.error('Could not refresh pool %s using libvirt, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while refreshing pool %s ' + 'using libvirt.', pool_name)
pool = StoragePoolModel.get_storagepool(poll_name) pool.refresh(0)
+ def update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") pool = self.get_storagepool(name, self.conn) - if autostart: - pool.setAutostart(1) - else: - pool.setAutostart(0) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + if params['autostart']: + pool.setAutostart(1) + else: + pool.setAutostart(0) + if 'disks' in params: + self._update_lvm_disks(name, params['disks']) ident = pool.name() return ident

Thanks for the feedback, Aline! All changes/suggestions were made in v2. Stay tuned! On 02/10/2014 12:47 PM, Aline Manera wrote:
On 02/07/2014 10:53 AM, Daniel Barboza wrote:
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Added a new update parameter to storagepool resource. Changed the logic in the model to accept any update parameter ('autostart' or 'disks'). 'disks' parameter will add disks/partitions to the target LVM pool.
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchi/control/storagepools.py | 2 +- src/kimchi/model/storagepools.py | 35 +++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/control/storagepools.py b/src/kimchi/control/storagepools.py index ae5185c..af10acd 100644 --- a/src/kimchi/control/storagepools.py +++ b/src/kimchi/control/storagepools.py @@ -80,7 +80,7 @@ class StoragePools(Collection): class StoragePool(Resource): def __init__(self, model, ident): super(StoragePool, self).__init__(model, ident) - self.update_params = ["autostart"] + self.update_params = ["autostart", "disks"] self.uri_fmt = "/storagepools/%s" self.activate = self.generate_action_handler('activate') self.deactivate = self.generate_action_handler('deactivate') diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py index 233a8a7..89cb61f 100644 --- a/src/kimchi/model/storagepools.py +++ b/src/kimchi/model/storagepools.py @@ -28,7 +28,7 @@ from kimchi.exception import InvalidOperation, MissingParameter from kimchi.exception import NotFoundError, OperationFailed from kimchi.model.libvirtstoragepool import StoragePoolDef from kimchi.utils import add_task, kimchi_log - +from kimchi.utils import run_command
ISO_POOL_NAME = u'kimchi_isos' POOL_STATE_MAP = {0: 'inactive', @@ -200,15 +200,34 @@ class StoragePoolModel(object): pass return res
+ def _update_lvm_disks(self, pool_name, disks):
You need to verify the disks. Are all those exists in system? Remember that we can always use the REST API direclty
+ vgextend_cmd = ["vgextend", pool_name] + vgextend_cmd += disks + output, error, returncode = run_command(vgextend_cmd) + if returncode != 0: + kimchi_log.error('Could not add disks to pool %s, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while adding disks to pool %s.', + pool_name)
+ pool_refresh_cmd = ["virsh", "pool-refresh", pool_name] + output, error, returncode = run_command(pool_refresh_cmd) + if returncode != 0: + kimchi_log.error('Could not refresh pool %s using libvirt, ' + 'error: %s', pool_name, error) + raise OperationFailed('Error while refreshing pool %s ' + 'using libvirt.', pool_name)
pool = StoragePoolModel.get_storagepool(poll_name) pool.refresh(0)
+ def update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") pool = self.get_storagepool(name, self.conn) - if autostart: - pool.setAutostart(1) - else: - pool.setAutostart(0) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + if params['autostart']: + pool.setAutostart(1) + else: + pool.setAutostart(0) + if 'disks' in params: + self._update_lvm_disks(name, params['disks']) ident = pool.name() return ident

From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- docs/API.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/API.md b/docs/API.md index 580728c..48a293f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -319,7 +319,10 @@ A interface represents available network interface on VM. * path: export path of this storage pool(for 'netfs' pool) * **PUT**: Set whether the Storage Pool should be enabled automatically when the system boots - * autostart: Toggle the autostart flag of the VM + * autostart: Toggle the autostart flag of the VM. This flag sets whether + the Storage Pool should be enabled automatically when the + system boots + * disks: Adds one or more disks to the pool (for 'logical' pool only) * **DELETE**: Remove the Storage Pool * **POST**: *See Storage Pool Actions* -- 1.8.3.1

Just a minor comment below On 02/07/2014 08:53 PM, Daniel Barboza wrote:
From: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com> commit message? Signed-off-by: Daniel Henrique Barboza<danielhb@linux.vnet.ibm.com> --- docs/API.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/docs/API.md b/docs/API.md index 580728c..48a293f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -319,7 +319,10 @@ A interface represents available network interface on VM. * path: export path of this storage pool(for 'netfs' pool) * **PUT**: Set whether the Storage Pool should be enabled automatically when the system boots - * autostart: Toggle the autostart flag of the VM + * autostart: Toggle the autostart flag of the VM. This flag sets whether + the Storage Pool should be enabled automatically when the + system boots + * disks: Adds one or more disks to the pool (for 'logical' pool only) * **DELETE**: Remove the Storage Pool * **POST**: *See Storage Pool Actions*
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center

Missing commit message On 02/07/2014 10:53 AM, Daniel Barboza wrote:
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- docs/API.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/docs/API.md b/docs/API.md index 580728c..48a293f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -319,7 +319,10 @@ A interface represents available network interface on VM. * path: export path of this storage pool(for 'netfs' pool) * **PUT**: Set whether the Storage Pool should be enabled automatically when the system boots - * autostart: Toggle the autostart flag of the VM + * autostart: Toggle the autostart flag of the VM. This flag sets whether + the Storage Pool should be enabled automatically when the + system boots + * disks: Adds one or more disks to the pool (for 'logical' pool only) * **DELETE**: Remove the Storage Pool * **POST**: *See Storage Pool Actions*

From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchi/mockmodel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py index 4e276eb..5303bda 100644 --- a/src/kimchi/mockmodel.py +++ b/src/kimchi/mockmodel.py @@ -316,12 +316,12 @@ class MockModel(object): return storagepool.info def storagepool_update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") - storagepool = self._get_storagepool(name) - storagepool.info['autostart'] = autostart - ident = storagepool.name + pool = self._get_storagepool(name) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + pool.info['autostart'] = params['autostart'] + ident = pool.name return ident def storagepool_activate(self, name): -- 1.8.3.1

On 02/07/2014 10:53 AM, Daniel Barboza wrote:
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchi/mockmodel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py index 4e276eb..5303bda 100644 --- a/src/kimchi/mockmodel.py +++ b/src/kimchi/mockmodel.py @@ -316,12 +316,12 @@ class MockModel(object): return storagepool.info
def storagepool_update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") - storagepool = self._get_storagepool(name) - storagepool.info['autostart'] = autostart - ident = storagepool.name + pool = self._get_storagepool(name) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + pool.info['autostart'] = params['autostart'] + ident = pool.name
What about the 'disks' for logical pool?
return ident
def storagepool_activate(self, name):

On 02/10/2014 12:51 PM, Aline Manera wrote:
On 02/07/2014 10:53 AM, Daniel Barboza wrote:
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchi/mockmodel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py index 4e276eb..5303bda 100644 --- a/src/kimchi/mockmodel.py +++ b/src/kimchi/mockmodel.py @@ -316,12 +316,12 @@ class MockModel(object): return storagepool.info
def storagepool_update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") - storagepool = self._get_storagepool(name) - storagepool.info['autostart'] = autostart - ident = storagepool.name + pool = self._get_storagepool(name) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + pool.info['autostart'] = params['autostart'] + ident = pool.name
What about the 'disks' for logical pool?
I'm not sure what to do with the disks in the mock model. Sum a fixed amount in the capacity of the pool perhaps?
return ident
def storagepool_activate(self, name):

On 02/10/2014 01:15 PM, Daniel H Barboza wrote:
On 02/10/2014 12:51 PM, Aline Manera wrote:
On 02/07/2014 10:53 AM, Daniel Barboza wrote:
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchi/mockmodel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py index 4e276eb..5303bda 100644 --- a/src/kimchi/mockmodel.py +++ b/src/kimchi/mockmodel.py @@ -316,12 +316,12 @@ class MockModel(object): return storagepool.info
def storagepool_update(self, name, params): - autostart = params['autostart'] - if autostart not in [True, False]: - raise InvalidOperation("Autostart flag must be true or false") - storagepool = self._get_storagepool(name) - storagepool.info['autostart'] = autostart - ident = storagepool.name + pool = self._get_storagepool(name) + if 'autostart' in params: + if params['autostart'] not in [True, False]: + raise InvalidOperation("Autostart flag must be true or false") + pool.info['autostart'] = params['autostart'] + ident = pool.name
What about the 'disks' for logical pool?
I'm not sure what to do with the disks in the mock model. Sum a fixed amount in the capacity of the pool perhaps?
I am not sure how the logical pool is being added in mocmkmodel Need to check it in order to know what to update
return ident
def storagepool_activate(self, name):
participants (4)
-
Aline Manera
-
Daniel Barboza
-
Daniel H Barboza
-
Sheldon