
This patch fixes following problems: - Properly defines the parameters passed to clone functions handler; - Defines a json to check parameters; - Adds right parameter names in docs/API.md; - Also includes a new error message. Fixes https://github.com/kimchi-project/kimchi/issues/700 Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- API.json | 17 +++++++++++++++++ control/storagevolumes.py | 4 +++- docs/API.md | 4 ++-- i18n.py | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/API.json b/API.json index 2b64d07..98b8c3f 100644 --- a/API.json +++ b/API.json @@ -225,6 +225,23 @@ }, "additionalProperties": false }, + "storagevolume_clone": { + "type": "object", + "error": "KCHVOL0030E", + "properties": { + "new_pool": { + "description": "Storage pool where clone will be created", + "type": "string", + "error": "KCHPOOL0016E" + }, + "new_name": { + "description": "New name of the volume clone.", + "type": "string", + "error": "KCHVOL0013E" + } + }, + "additionalProperties": false + }, "vms_create": { "type": "object", "error": "KCHVM0016E", diff --git a/control/storagevolumes.py b/control/storagevolumes.py index f920dee..67980dd 100644 --- a/control/storagevolumes.py +++ b/control/storagevolumes.py @@ -47,7 +47,9 @@ class StorageVolume(Resource): self.uri_fmt = '/storagepools/%s/storagevolumes/%s' self.resize = self.generate_action_handler('resize', ['size']) self.wipe = self.generate_action_handler('wipe') - self.clone = self.generate_action_handler_task('clone') + self.clone = self.generate_action_handler_task('clone', + ['new_pool', + 'new_name']) @property def data(self): diff --git a/docs/API.md b/docs/API.md index 1c4ee50..3ff4eff 100644 --- a/docs/API.md +++ b/docs/API.md @@ -576,8 +576,8 @@ A interface represents available network interface on VM. The unit is bytes * wipe: Wipe a Storage Volume * clone: Clone a Storage Volume. - * pool: The name of the destination pool (optional). - * name: The new storage volume name (optional). + * new_pool: The name of the destination pool (optional). + * new_name: The new storage volume name (optional). ### Collection: Interfaces diff --git a/i18n.py b/i18n.py index cf67085..96729ef 100644 --- a/i18n.py +++ b/i18n.py @@ -247,6 +247,7 @@ messages = { "KCHVOL0027E": _("The storage volume %(vol)s is not under an upload process."), "KCHVOL0028E": _("The upload chunk data will exceed the storage volume size."), "KCHVOL0029E": _("Unable to upload chunk data to storage volume. Details: %(err)s."), + "KCHVOL0030E": _("Storage volume clone function expects only these optional parameters: 'new_pool' and 'new_name'"), "KCHIFACE0001E": _("Interface %(name)s does not exist"), -- 2.1.0