diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2018-01-24 16:12:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-01-24 16:12:18 +0000 |
commit | ccc7cf93bd769f2b9255ac59e93751535b463f2a (patch) | |
tree | 5680c0bdc218ffd14f538c0018ab6b7dd9c2aa2c | |
parent | c10c3a740626078f1e3212beea479ca90eca869a (diff) | |
parent | 6053ec68c8fe13ab154ed22f7cffd2e256d1e982 (diff) |
Merge "Check RS for virtualized OpenStack/Yardstick"
-rw-r--r-- | ansible/infra_deploy.yml | 18 | ||||
-rw-r--r-- | ansible/roles/infra_check_requirements/tasks/main.yml | 43 | ||||
-rw-r--r-- | ansible/roles/infra_check_requirements/vars/main.yml | 17 | ||||
-rw-r--r-- | etc/infra/infra_deploy.yaml.sample | 34 | ||||
-rwxr-xr-x | tools/virt_ci_rampup.sh | 21 |
5 files changed, 133 insertions, 0 deletions
diff --git a/ansible/infra_deploy.yml b/ansible/infra_deploy.yml new file mode 100644 index 000000000..10f53fbad --- /dev/null +++ b/ansible/infra_deploy.yml @@ -0,0 +1,18 @@ +# Copyright (c) 2018 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- hosts: jumphost + + roles: + - infra_check_requirements diff --git a/ansible/roles/infra_check_requirements/tasks/main.yml b/ansible/roles/infra_check_requirements/tasks/main.yml new file mode 100644 index 000000000..8d05bbdb7 --- /dev/null +++ b/ansible/roles/infra_check_requirements/tasks/main.yml @@ -0,0 +1,43 @@ +# Copyright (c) 2018 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: Include + include_vars: + file: "{{rs_file}}" + name: infra_deploy_vars + +- name: Store total CPU, RAM, Disk requested resources + set_fact: + vcpu_t: "{{item.vcpus|int + vcpu_t|int}}" + vram_t: "{{item.ram|int + vram_t|int}}" + disk_t: "{{item.disk|int + disk_t|int}}" + with_items: "{{infra_deploy_vars.nodes}}" + +- name: Fail if not enough RAM + fail: + msg: "Failed, not enough RAM, required: {{ vram_t }}, available {{ ansible_memory_mb.nocache.free }}" + when: ansible_memory_mb.nocache.free < vram_t|int + +- name: Fail if not enough CPU + fail: + msg: "Failed, not enough CPU, required: {{ vcpu_t }}, available {{ ansible_processor_vcpus }}" + when: ansible_processor_vcpus < vcpu_t|int + + +- name: Fail if not enough Disk space + set_fact: + disk_avail: "{% for mount in ansible_mounts if mount.mount == '/' %}{{ (mount.size_available/1024/1024)|int }}{% endfor %}" +- fail: + msg: "Failed, not enough disk space, required {{ disk_t }}, available: {{ disk_avail }}" + when: disk_avail|int < disk_t|int diff --git a/ansible/roles/infra_check_requirements/vars/main.yml b/ansible/roles/infra_check_requirements/vars/main.yml new file mode 100644 index 000000000..219c33875 --- /dev/null +++ b/ansible/roles/infra_check_requirements/vars/main.yml @@ -0,0 +1,17 @@ +# Copyright (c) 2018 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +vcpu_t: 0 +vram_t: 0 +disk_t: 0 diff --git a/etc/infra/infra_deploy.yaml.sample b/etc/infra/infra_deploy.yaml.sample new file mode 100644 index 000000000..fb162d35b --- /dev/null +++ b/etc/infra/infra_deploy.yaml.sample @@ -0,0 +1,34 @@ +nodes: + - name: Yardstick VM + hostname: yardstickvm + interfaces: + - network: management + ip: 192.168.1.10 + netmask: 255.255.255.0 + user: ubuntu + pasword: password + image: /tmp/image1.qcow + disk: 50000 + ram: 8192 + vcpus: 4 + + - name Controller_Compute VM + openstack_node: controller_compute + hostname: controller_compute + interfaces: + - network: management + ip: 192.168.1.20 + netmask: 255.255.255.0 + - network: traffic + ip: 192.20.1.20 + netmask: 255.255.255.0 + user: ubuntu + pasword: password + image: /tmp/image_2.qcow + disk: 40000 + ram: 32768 + vcpus: 4 + +networks: + - name: management + host_ip: 192.168.1.1 # not mandatory diff --git a/tools/virt_ci_rampup.sh b/tools/virt_ci_rampup.sh new file mode 100755 index 000000000..210e6ed40 --- /dev/null +++ b/tools/virt_ci_rampup.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Copyright (c) 2018 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ANSIBLE_SCRIPTS="${0%/*}/../ansible" + +cd ${ANSIBLE_SCRIPTS} &&\ +ansible-playbook \ + -e rs_file='../etc/infra/infra_deploy.yaml' \ + -i inventory.ini infra_deploy.yml |