diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-05-04 12:55:52 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-06-14 07:15:12 +0000 |
commit | 55d5d9245c615436921167e24c5e49a59c53f590 (patch) | |
tree | d48a1dc63f077163147839d453cc5717c4728367 /yardstick/common | |
parent | a3399d07b83ce0e50d9c0144d00a7ba83a73390f (diff) |
Add "volumes" parameter in Kubernetes context
This new parameter, "volumes", will allow the user to automatically create
new volumes. Example of Kubernetes context definition:
context:
type: Kubernetes
servers:
host:
image: ...
commands: ...
volumes:
- name: volume1 # mandatory
<volume type definition> # mandatory
The volume type and the definition must be one of the supported ones in
Kubernetes [1].
[1] https://kubernetes.io/docs/concepts/storage/volumes/#types-of-volumes
JIRA: YARDSTICK-1152
Change-Id: I44a91c605f047de4f286407e28fb5aa2e921b00a
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/common')
-rw-r--r-- | yardstick/common/exceptions.py | 4 | ||||
-rw-r--r-- | yardstick/common/kubernetes_utils.py | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py index 966b15cf8..5f362b356 100644 --- a/yardstick/common/exceptions.py +++ b/yardstick/common/exceptions.py @@ -195,6 +195,10 @@ class WaitTimeout(YardstickException): message = 'Wait timeout while waiting for condition' +class KubernetesTemplateInvalidVolumeType(YardstickException): + message = 'No valid "volume" types present in %(volume)s' + + class ScenarioCreateNetworkError(YardstickException): message = 'Create Neutron Network Scenario failed' diff --git a/yardstick/common/kubernetes_utils.py b/yardstick/common/kubernetes_utils.py index d60c9b23a..ee8e8edcd 100644 --- a/yardstick/common/kubernetes_utils.py +++ b/yardstick/common/kubernetes_utils.py @@ -199,3 +199,9 @@ def get_pod_list(namespace='default'): # pragma: no cover def get_pod_by_name(name): # pragma: no cover pod_list = get_pod_list() return next((n for n in pod_list.items if n.metadata.name.startswith(name)), None) + + +def get_volume_types(): + """Return the "volume" types supported by the current API""" + return [vtype for vtype in client.V1Volume.attribute_map.values() + if vtype != 'name'] |