On 29-01-2016 14:54, Paulo Ricardo Paz Vital wrote:
On 01/27/2016 07:14 PM, Lucio Correia wrote:
> - Update defalut values for maxvcpus and cpus
> - Rename check_topology() to check_cpu_info() to also verify cpus
> and maxvcpus and use it for simplification of all CPU parameter
> validations
> - Unduplicate and move _get_host_maxcpu() to CPUInfoModel as
> get_host_max_vcpus()
> - Update docs and APIs with maxvcpus attribute
>
> Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
> ---
> API.json | 12 ++++++++++
> control/templates.py | 3 ++-
> docs/API.md | 24 +++++++++++++++----
> i18n.py | 10 ++++----
> model/cpuinfo.py | 59 ++++++++++++++++++++++++++++++++-------------
> model/templates.py | 67 ++++++++++++++++++++++++++++------------------------
> model/vms.py | 25 +-------------------
> vmtemplate.py | 6 ++++-
> 8 files changed, 125 insertions(+), 81 deletions(-)
>
> diff --git a/API.json b/API.json
> index 2b64d07..4876cc0 100644
> --- a/API.json
> +++ b/API.json
> @@ -454,6 +454,12 @@
> "minimum": 1,
> "error": "KCHTMPL0012E"
> },
> + "maxvcpus": {
> + "description": "The maximum number of virtual
CPUs that can be assigned to the VMs created from the template",
> + "type": "integer",
> + "minimum": 1,
> + "error": "KCHTMPL0012E"
> + },
> "memory": {
> "description": "Memory (MB) for the
template",
> "type": "integer",
> @@ -637,6 +643,12 @@
> "minimum": 1,
> "error": "KCHTMPL0012E"
> },
> + "maxvcpus": {
> + "description": "The maximum number of virtual
CPUs that can be assigned to the VMs created from the template",
> + "type": "integer",
> + "minimum": 1,
> + "error": "KCHTMPL0012E"
> + },
> "memory": {
> "description": "Memory (MB) for the
template",
> "type": "integer",
> diff --git a/control/templates.py b/control/templates.py
> index 4cd70c2..fcc298e 100644
> --- a/control/templates.py
> +++ b/control/templates.py
> @@ -1,7 +1,7 @@
> #
> # Project Kimchi
> #
> -# Copyright IBM, Corp. 2013-2015
> +# Copyright IBM, Corp. 2013-2016
> #
> # This library is free software; you can redistribute it and/or
> # modify it under the terms of the GNU Lesser General Public
> @@ -47,6 +47,7 @@ class Template(Resource):
> 'os_distro': self.info['os_distro'],
> 'os_version': self.info['os_version'],
> 'cpus': self.info['cpus'],
> + 'maxvcpus': self.info.get('maxvcpus'),
> 'memory': self.info['memory'],
> 'cdrom': self.info.get('cdrom', None),
> 'disks': self.info['disks'],
> diff --git a/docs/API.md b/docs/API.md
> index 5122a0c..4790d08 100644
> --- a/docs/API.md
> +++ b/docs/API.md
> @@ -276,8 +276,11 @@ Represents a snapshot of the Virtual Machine's primary
monitor.
> * os_distro *(optional)*: The operating system distribution
> * os_version *(optional)*: The version of the operating system distribution
> * cpus *(optional)*: The number of CPUs assigned to the VM.
> - Default is 1, unlees specifying a cpu topology. In that case, cpus
> - will default to a product of the topology values (see cpu_info).
> + Default is 1, unless a CPU topology is specified. In that case, cpus
> + will default to maxvcpus value.
> + * maxvcpus *(optional)*: The maximum number of CPUs that can be assigned to
In API.json you said that maxvcpu is "The maximum number of virtual CPUs
that can be assigned to the VMs..." and here looks like you missed the
*virtual* word. Is it correct?
I tried to follow what was already in docs and UI. UI does not mention
"virtual". I believe that's because in the context of guest,
"virtual"
is implicit.
See that I have not changed first line (* cpus...) and it does not
mention "virtual".
We may want to do a patch to review and fix all occurrences and avoid
confusion.
--
Lucio Correia
Software Engineer
IBM LTC Brazil