
This patch apply necessary changes in: - documentation (API.md): adds cpu and memory in update parameter - data validation (API.json: validate given cpu and memory numbers - error message (i18n.py): this new feature uses the same messages from Templates update, but a minor change was necessary in cpu text. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- docs/API.md | 3 +++ src/kimchi/API.json | 12 ++++++++++++ src/kimchi/i18n.py | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/API.md b/docs/API.md index 143c70c..822e551 100644 --- a/docs/API.md +++ b/docs/API.md @@ -97,6 +97,9 @@ the following general conventions: * **DELETE**: Remove the Virtual Machine * **PUT**: update the parameters of existed VM * name: New name for this VM (only applied for shutoff VM) + * cpus: New number of virtual cpus for this VM (only applied for shutoff VM) + * memory: New amount of memory (MB) for this VM (only applied for shutoff + VM) * **POST**: *See Virtual Machine Actions* **Actions (POST):** diff --git a/src/kimchi/API.json b/src/kimchi/API.json index 5ca94e3..f95bddf 100644 --- a/src/kimchi/API.json +++ b/src/kimchi/API.json @@ -201,6 +201,18 @@ "type": "string", "minLength": 1, "error": "KCHVM0011E" + }, + "cpus": { + "description": "The new number of virtual CPUs for the VM", + "type": "integer", + "minimum": 1, + "error": "KCHTMPL0012E" + }, + "memory": { + "description": "The new amount (MB) of memory for the VM", + "type": "integer", + "minimum": 512, + "error": "KCHTMPL0013E" } } }, diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py index ae8d24e..341700c 100644 --- a/src/kimchi/i18n.py +++ b/src/kimchi/i18n.py @@ -80,6 +80,7 @@ messages = { "KCHVM0019E": _("Unable to start virtual machine %(name)s. Details: %(err)s"), "KCHVM0020E": _("Unable to power off virtual machine %(name)s. Details: %(err)s"), "KCHVM0021E": _("Unable to delete virtual machine %(name)s. Details: %(err)s"), + "KCHVM0022E": _("Unable to update virtual machine in running state. You must power it off before."), "KCHVMIF0001E": _("Interface %(iface)s does not exist in virtual machine %(name)s"), "KCHVMIF0002E": _("Network %(network)s specified for virtual machine %(name)s does not exist"), @@ -100,7 +101,7 @@ messages = { "KCHTMPL0009E": _("Template icon must be a path to the image"), "KCHTMPL0010E": _("Template distribution must be a string"), "KCHTMPL0011E": _("Template distribution version must be a string"), - "KCHTMPL0012E": _("The number of CPUs must be a integer"), + "KCHTMPL0012E": _("The number of CPUs must be an integer greater than 0"), "KCHTMPL0013E": _("Amount of memory (MB) must be an integer greater than 512"), "KCHTMPL0014E": _("Template CDROM must be a local or remote ISO file"), "KCHTMPL0015E": _("Invalid storage pool URI %(value)s specified for template"), -- 1.8.5.3