aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml1
-rw-r--r--deploy/opera_adapter.py126
-rw-r--r--plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.sh3
-rw-r--r--plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml2
-rw-r--r--plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml88
-rw-r--r--plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml2
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh9
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/tasks/main.yml2
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml13
9 files changed, 101 insertions, 145 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
index 1d4ec9ef..874fcfb5 100644
--- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
+++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
@@ -123,6 +123,7 @@
- hosts:
- ceph_adm
+ - ceph-mon
remote_user: root
roles:
- os-stor4nfv
diff --git a/deploy/opera_adapter.py b/deploy/opera_adapter.py
deleted file mode 100644
index fbf1b662..00000000
--- a/deploy/opera_adapter.py
+++ /dev/null
@@ -1,126 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import os
-import sys
-import yaml
-import re
-import subprocess
-import traceback
-
-
-def load_file(file):
- with open(file) as fd:
- try:
- return yaml.safe_load(fd)
- except:
- traceback.print_exc()
- return None
-
-
-def dump_file(data, file):
- with open(file, 'w') as fd:
- try:
- return yaml.dump(data, fd, default_flow_style=False)
- except:
- traceback.print_exc()
- return None
-
-
-def sync_openo_config(openo_config, dha, network):
- """sync opera/conf/open-o.yml according to DHA and Network file"""
- deploy_opts = dha.get('deploy_options')
- openo_net = network.get('openo_net')
- if deploy_opts['orchestrator']['type'] != 'open-o':
- print("orchestrator is not openo")
- sys.exit(1)
-
- openo_config['openo_version'] = deploy_opts['orchestrator']['version']
- openo_config['vnf_type'] = deploy_opts['vnf']['type']
- openo_config['openo_net']['openo_ip'] = openo_net['openo_ip']
-
-
-def sync_admin_openrc(network, admin_openrc_file):
- ssh_opts = "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
- vip = network['public_vip']['ip']
- cmd = 'sshpass -p"root" ssh %s root@%s "cat /opt/admin-openrc.sh"' \
- % (ssh_opts, vip)
- ssh = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
- if ssh.stdout is None:
- print("fetch openrc fail")
- sys.exit(1)
-
- rcdata = ssh.stdout.readlines()
- with open(admin_openrc_file, 'w') as fd:
- ip = re.compile("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}")
- for i in rcdata:
- if 'OS_AUTH_URL' in i:
- i = re.sub(ip, vip, i)
- fd.write(i)
-
- fd.write('export OS_REGION_NAME=RegionOne')
-
-
-if __name__ == "__main__":
- if len(sys.argv) != 3:
- print("parameter wrong%d %s" % (len(sys.argv), sys.argv))
- sys.exit(1)
-
- _, dha_file, network_file = sys.argv
- compass_dir = os.getenv('COMPASS_DIR')
-
- if not compass_dir:
- print("env var COMPASS_DIR doesn't exist")
- sys.exit(1)
-
- if not os.path.exists(dha_file):
- print("DHA file doesn't exist")
- sys.exit(1)
- if not os.path.exists(network_file):
- print("NETWORK file doesn't exist")
- sys.exit(1)
-
- dha = load_file(dha_file)
- network = load_file(network_file)
-
- if not dha:
- print('format error in DHA: %s' % dha_file)
- sys.exit(1)
- if not network:
- print('format error in NETWORK: %s' % network_file)
- sys.exit(1)
-
- work_dir = os.path.join(compass_dir, 'work')
- opera_dir = os.path.join(work_dir, 'opera')
- conf_dir = os.path.join(opera_dir, 'conf')
- openo_config_file = os.path.join(conf_dir, 'open-o.yml')
- admin_openrc_file = os.path.join(conf_dir, 'admin-openrc.sh')
-
- p1 = subprocess.Popen(
- "git clone https://gerrit.opnfv.org/gerrit/opera",
- cwd=work_dir, shell=True)
- p1.communicate()
-
- if not os.path.exists(openo_config_file):
- print('file opera/conf/open-o.yml not found')
- sys.exit(1)
- if not os.path.exists(admin_openrc_file):
- print('file opera/conf/admin-openrc.sh not found')
- sys.exit(1)
-
- openo_config = load_file(openo_config_file)
- sync_openo_config(openo_config, dha, network)
- dump_file(openo_config, openo_config_file)
- sync_admin_openrc(network, admin_openrc_file)
-
- p2 = subprocess.Popen("./opera_launch.sh", cwd=opera_dir, shell=True)
- p2.communicate()
- if p2.returncode != 0:
- print('./opera_launch.sh fail')
- sys.exit(1)
diff --git a/plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.sh b/plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.sh
index 7d497598..a081c0bd 100644
--- a/plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.sh
+++ b/plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.sh
@@ -23,3 +23,6 @@ sed -i 's/^opensds_auth_strategy.*/opensds_auth_strategy: noauth/g' group_vars/a
# opensds_endpoint
sed -i 's/^opensds_endpoint.*/opensds_endpoint: http:\/\/'"$1"':50040/g' group_vars/common.yml
+
+# etcd_host
+sed -i 's/^etcd_host.*/etcd_host: '"$2"'/g' group_vars/osdsdb.yml
diff --git a/plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml b/plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml
index 2d0f05cc..fd9756a4 100644
--- a/plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml
+++ b/plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml
@@ -63,7 +63,7 @@
remote_user: root
shell: |
cd /opt;
- ./os_configure_vars.sh {{ public_vip.ip }}
+ ./os_configure_vars.sh {{ public_vip.ip }} {{ internal_vip.ip }}
- name: run playbook
remote_user: root
diff --git a/plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml b/plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml
index c549566a..d14c0c68 100644
--- a/plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml
+++ b/plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml
@@ -11,17 +11,16 @@
- name: ensure opensds.conf exists
stat:
path: /etc/opensds/opensds.conf
- ignore_errors: "true"
register: opensds_exists
+ when:
+ - inventory_hostname in groups['ceph_adm']
- name: configure ceph.yaml, opensds.conf
remote_user: root
shell: |
cd /root/gopath/src/github.com/os-stor4nfv/stor4nfv/ci/ansible
cp group_vars/ceph/ceph.yaml /etc/opensds/driver/
-
sed -i 's/^ enabled_backends.*/ enabled_backends: ceph/g' /etc/opensds/opensds.conf
-
sudo cat >> /etc/opensds/opensds.conf << OPENSDS_GLOABL_CONFIG_DOC
[ceph]
@@ -31,36 +30,96 @@
config_path = /etc/opensds/driver/ceph.yaml
OPENSDS_GLOABL_CONFIG_DOC
when:
- - opensds_exists.stat.exists
+ - inventory_hostname in groups['ceph_adm']
+
+- name: modify osdsdock endpoint
+ remote_user: root
+ shell:
+ _raw_params: |
+ function _modify_osdsdock_endpoint {
+ local ip_addr=(lxc-info -n $(lxc-ls --line | grep ceph-mon) -iH)|grep "10.1"
+ if [ ! -z "${ip_addr}" ]; then
+ sed -i 's/^50050.*/api_endpoint = $ip_addr:50050/g' /etc/opensds/opensds.conf
+ fi
+ }
+ _modify_osdsdock_endpoint
+ args:
+ executable: /bin/bash
+ become: true
+ when:
+ - inventory_hostname in groups['ceph_adm']
- name: copy ceph.conf from ceph-mon container
remote_user: root
shell: |
- mkdir -p /etc/ceph
+ mkdir -p /etc/ceph;
cp /proc/$(lxc-info -n $(lxc-ls --line | grep ceph-mon) -p -H)/root/etc/ceph/ceph.conf \
/etc/ceph/ceph.conf
when:
- - opensds_exists.stat.exists
+ - inventory_hostname in groups['ceph_adm']
+
+- name: copy osdsdock executable to ceph-mon container
+ remote_user: root
+ shell: |
+ cd /opt;
+ tar -C opensds-hotpot-linux-amd64 -c . | lxc-attach -n \
+ $(lxc-ls --line | grep ceph-mon) -- /bin/sh -c "tar -C /opt/ -vx; chmod 1777 /opt;"
+ when:
+ - inventory_hostname in groups['ceph_adm']
+
+- name: copy opensds conf files to ceph-mon container
+ remote_user: root
+ shell: |
+ cd /etc;
+ tar -C opensds -c . | lxc-attach -n \
+ $(lxc-ls --line | grep ceph-mon) -- /bin/sh -c "tar -C /tmp/ -vx; chmod 1777 /tmp;"
+ when:
+ - inventory_hostname in groups['ceph_adm']
+
+- name: ensure opensds driver exists
+ stat:
+ path: /tmp/driver
+ register: opensds_driver_exists
+ when:
+ - inventory_hostname in groups['ceph-mon']
+
+- name: copy opensds conf
+ remote_user: root
+ shell: |
+ mkdir -p /etc/opensds;
+ cp /tmp/opensds.conf /etc/opensds;
+ cp /tmp/policy.json /etc/opensds;
+ cp -r /tmp/driver /etc/opensds;
+ when:
+ - inventory_hostname in groups['ceph-mon']
+
+- name: create ceph pool
+ remote_user: root
+ shell: |
+ ceph osd pool create rbd 24 && ceph osd pool set rbd size 1
+ when:
+ - inventory_hostname in groups['ceph-mon']
- name: ensure osdsdock exists
stat:
- path: /opt/opensds-hotpot-linux-amd64/bin/osdsdock
- ignore_errors: "true"
- register: osdsdock_exists
+ path: /opt/bin/osdsdock
+ register: opensds_exists
+ when:
+ - inventory_hostname in groups['ceph-mon']
- name: start osdsdock daemon
remote_user: root
shell: |
- /opt/opensds-hotpot-linux-amd64/bin/osdsdock -daemon
- ignore_errors: "true"
+ cd /opt && ./bin/osdsdock -daemon
when:
- - osdsdock_exists.stat.exists
+ - inventory_hostname in groups['ceph-mon']
- name: ensure osdsctl exists
stat:
path: /opt/opensds-hotpot-linux-amd64/bin/osdsctl
- ignore_errors: "true"
register: osdsctl_exists
+ when:
+ - inventory_hostname in groups['ceph_adm']
- name: run cinder-compatible-api, create opensds default profile
remote_user: root
@@ -73,6 +132,5 @@
cp /opt/opensds-hotpot-linux-amd64/bin/osdsctl /usr/local/bin;
export OPENSDS_AUTH_STRATEGY=noauth;
osdsctl profile create '{"name": "default", "description": "default policy"}'
- ignore_errors: "true"
when:
- - osdsctl_exists.stat.exists
+ - inventory_hostname in groups['ceph_adm']
diff --git a/plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml b/plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml
index 57bae793..05ada67a 100644
--- a/plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml
+++ b/plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml
@@ -8,5 +8,7 @@
# #############################################################################
---
- include: opensds.yml
+ when:
+ - inventory_hostname in groups['ceph_adm']
- include: post-install.yml
diff --git a/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh
index 112d9c84..89432135 100644
--- a/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh
+++ b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh
@@ -49,3 +49,12 @@ sed -i 's/^opensds_auth_strategy.*/opensds_auth_strategy: noauth/g' group_vars/a
sed -i '/check_ansible_version/a \ ignore_errors: yes\' roles/common/tasks/main.yml
sed -i '/- dashboard-installer/s/^/#/g' site.yml
+
+# comment csi create pods in Stor4nfv
+sed -i '/kubectl create/s/^/#/g' roles/nbp-installer/scenarios/csi.yml
+
+sed -i 's/^opensds_endpoint.*/opensds_endpoint: http:\/\/'"$1"':50040/g' group_vars/common.yml
+
+sed -i '/and service_ceph_osd_status.rc == 0/s/^/#/g' roles/osdsdock/scenarios/ceph.yml
+sed -i '/and service_ceph_osd_status.rc == 0/a \ when: service_ceph_mon_status.rc == 0\' \
+ roles/osdsdock/scenarios/ceph.yml
diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml
index 7bc8ec06..dbaa8d6b 100644
--- a/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml
+++ b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml
@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
# #############################################################################
---
-- include: stor4nfv
+- include: stor4nfv.yml
when:
- ansible_distribution == 'Ubuntu'
- stor4nfv is defined and stor4nfv == "Enable"
diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml
index 017f377e..501d3baa 100644
--- a/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml
+++ b/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml
@@ -48,13 +48,22 @@
ignore_errors: "true"
register: osdsctl_exists
-- name: create opensds default profile
+- name: ensure opensds csi directory exists
+ stat:
+ path: /opt/opensds-sushi-linux-{{ imgarch }}
+ ignore_errors: "true"
+ register: csi_dir_exists
+
+- name: create opensds default profile, create csi pods
remote_user: root
shell: |
cp /opt/opensds-hotpot-linux-{{ imgarch }}/bin/osdsctl /usr/local/bin;
export OPENSDS_ENDPOINT=http://{{ public_vip.ip }}:50040;
export OPENSDS_AUTH_STRATEGY=noauth;
- osdsctl profile create '{"name": "default", "description": "default policy"}'
+ osdsctl profile create '{"name": "default", "description": "default policy"}';
+ cd /opt/opensds-sushi-linux-{{ imgarch }};
+ kubectl create -f csi/deploy/kubernetes
ignore_errors: "true"
when:
- osdsctl_exists.stat.exists is defined and osdsctl_exists.stat.exists
+ - csi_dir_exists.stat.exists is defined and csi_dir_exists.stat.exists