From 1b01390bc01de489d5e9f77b111f105797c69bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Thu, 26 Jan 2012 15:02:59 +0100 Subject: [PATCH] doc/rapi.rst: Document ipolicy parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RenΓ© Nussbaumer <rn@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- doc/rapi.rst | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ lib/opcodes.py | 6 ++++-- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/doc/rapi.rst b/doc/rapi.rst index c80a30931..313364cae 100644 --- a/doc/rapi.rst +++ b/doc/rapi.rst @@ -166,6 +166,61 @@ likely to succeed or at least start executing. Force operation to continue even if it will cause the cluster to become inconsistent (e.g. because there are not enough master candidates). +Parameter details +----------------- + +Some parameters are not straight forward, so we describe them in details +here. + +.. _rapi-ipolicy: + +``ipolicy`` ++++++++++++ + +The instance policy specification is a dict with the following fields: + +.. pyassert:: + + constants.IPOLICY_ALL_KEYS == set([constants.ISPECS_MIN, + constants.ISPECS_MAX, + constants.ISPECS_STD, + constants.IPOLICY_DTS, + constants.IPOLICY_VCPU_RATIO]) + + +.. pyassert:: + + (set(constants.ISPECS_PARAMETER_TYPES.keys()) == + set([constants.ISPEC_MEM_SIZE, + constants.ISPEC_DISK_SIZE, + constants.ISPEC_DISK_COUNT, + constants.ISPEC_CPU_COUNT, + constants.ISPEC_NIC_COUNT])) + +.. |ispec-min| replace:: :pyeval:`constants.ISPECS_MIN` +.. |ispec-max| replace:: :pyeval:`constants.ISPECS_MAX` +.. |ispec-std| replace:: :pyeval:`constants.ISPECS_STD` + + +|ispec-min|, |ispec-max|, |ispec-std| + A sub- `dict` with the following fields, which sets the limit and standard + values of the instances: + + :pyeval:`constants.ISPEC_MEM_SIZE` + The size in MiB of the memory used + :pyeval:`constants.ISPEC_DISK_SIZE` + The size in MiB of the disk used + :pyeval:`constants.ISPEC_DISK_COUNT` + The numbers of disks used + :pyeval:`constants.ISPEC_CPU_COUNT` + The numbers of cpus used + :pyeval:`constants.ISPEC_NIC_COUNT` + The numbers of nics used +:pyeval:`constants.IPOLICY_DTS` + A `list` of disk templates allowed for instances using this policy +:pyeval:`constants.IPOLICY_VCPU_RATIO` + Maximum ratio of virtual to physical CPUs (`float`) + Usage examples -------------- diff --git a/lib/opcodes.py b/lib/opcodes.py index b928b8cdc..16cba8c70 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -803,7 +803,8 @@ class OpClusterSetParams(OpCode): "Whether to wipe disks before allocating them to instances"), ("nicparams", None, ht.TMaybeDict, "Cluster-wide NIC parameter defaults"), ("ndparams", None, ht.TMaybeDict, "Cluster-wide node parameter defaults"), - ("ipolicy", None, ht.TMaybeDict, "Cluster-wide instance policy specs"), + ("ipolicy", None, ht.TMaybeDict, + "Cluster-wide :ref:`instance policy <rapi-ipolicy>` specs"), ("drbd_helper", None, ht.TOr(ht.TString, ht.TNone), "DRBD helper program"), ("default_iallocator", None, ht.TOr(ht.TString, ht.TNone), "Default iallocator for cluster"), @@ -1438,7 +1439,8 @@ class OpGroupAdd(OpCode): _PDiskParams, _PHvState, _PDiskState, - ("ipolicy", None, ht.TMaybeDict, "Group-wide instance policy specs"), + ("ipolicy", None, ht.TMaybeDict, + "Group-wide :ref:`instance policy <rapi-ipolicy>` specs"), ] -- GitLab