From c21e199a328c1d52232c213d2b243016cca46812 Mon Sep 17 00:00:00 2001 From: Narinder Gupta Date: Mon, 1 May 2017 14:32:51 -0500 Subject: added support for install from git repository. please modify default_deployment_config.yaml to install from release repo for ocata,master etc. Also user can define their own URL and more information can be obtained at jujucharms.com Change-Id: I4943dbf68c6d980b2a2da65417b16631df768b48 Signed-off-by: Narinder Gupta --- ci/03-maasdeploy.sh | 6 +- ci/config_tpl/juju2/bundle_tpl/cinder.yaml | 3 + ci/config_tpl/juju2/bundle_tpl/glance.yaml | 3 + ci/config_tpl/juju2/bundle_tpl/keystone.yaml | 5 +- ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml | 3 + .../juju2/bundle_tpl/neutron-gateway.yaml | 3 + ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml | 3 + .../juju2/bundle_tpl/nova-cloud-controller.yaml | 3 + ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml | 3 + .../juju2/bundle_tpl/openstack-dashboard.yaml | 3 + ci/default_deployment_config.yaml | 7 +- ci/deploy.sh | 11 ++- ci/k8.sh | 2 +- ci/openstack.sh | 110 +++++++++------------ juju/joid-configure-openstack | 2 +- 15 files changed, 94 insertions(+), 73 deletions(-) diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 43e95857..f66d0cbd 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -12,7 +12,7 @@ fi #install the packages needed sudo apt-add-repository ppa:juju/stable -y sudo apt-add-repository ppa:maas/stable -y -sudo apt-add-repository cloud-archive:newton -y +sudo apt-add-repository cloud-archive:ocata -y sudo apt-get update -y #sudo apt-get dist-upgrade -y sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin juju \ @@ -404,7 +404,7 @@ addnodes(){ fi sudo virt-install --connect qemu:///system --name bootstrap --ram 4098 --cpu host --vcpus 2 --video \ - cirrus --arch x86_64 --disk size=20,format=qcow2,bus=virtio,io=native,pool=default \ + cirrus --arch x86_64 --disk size=20,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \ $netw --boot network,hd,menu=off --noautoconsole \ --vnc --print-xml | tee bootstrap @@ -437,7 +437,7 @@ addnodes(){ NODE_NAME=`cat labconfig.json | jq ".lab.racks[].nodes[$units].name" | cut -d \" -f 2 ` sudo virt-install --connect qemu:///system --name $NODE_NAME --ram 8192 --cpu host --vcpus 4 \ - --disk size=120,format=qcow2,bus=virtio,io=native,pool=default \ + --disk size=120,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \ $netw $netw --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee $NODE_NAME nodemac=`grep "mac address" $NODE_NAME | head -1 | cut -d '"' -f 2` diff --git a/ci/config_tpl/juju2/bundle_tpl/cinder.yaml b/ci/config_tpl/juju2/bundle_tpl/cinder.yaml index 8b26e25e..cce12e01 100644 --- a/ci/config_tpl/juju2/bundle_tpl/cinder.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/cinder.yaml @@ -18,6 +18,9 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} region: {{ os.region }} block-device: None glance-api-version: 2 diff --git a/ci/config_tpl/juju2/bundle_tpl/glance.yaml b/ci/config_tpl/juju2/bundle_tpl/glance.yaml index 3329ea40..be80bb39 100644 --- a/ci/config_tpl/juju2/bundle_tpl/glance.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/glance.yaml @@ -14,6 +14,9 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} region: {{ os.region }} {% if os.beta.public_api %} use-internal-endpoints: true diff --git a/ci/config_tpl/juju2/bundle_tpl/keystone.yaml b/ci/config_tpl/juju2/bundle_tpl/keystone.yaml index 4f81dc5f..0d21f649 100644 --- a/ci/config_tpl/juju2/bundle_tpl/keystone.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/keystone.yaml @@ -14,10 +14,13 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} region: {{ os.region }} admin-role: {{ os.admin.role }} keystone-admin-role: {{ os.admin.role }} - preferred-api-version: 2 + preferred-api-version: 3 {% if os.network.ipv6 %} prefer-ipv6: {{ os.network.ipv6 }} {% endif %} diff --git a/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml b/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml index 0febddd1..620cc02e 100644 --- a/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml @@ -14,6 +14,9 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} region: {{ os.region }} neutron-security-groups: true {% if os.beta.public_api %} diff --git a/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml b/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml index f0416a73..d1159bb5 100644 --- a/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml @@ -12,6 +12,9 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} {% if os.api.worker_multiplier %} worker-multiplier: {{ os.api.worker_multiplier }} {% endif %} diff --git a/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml b/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml index 1dd2210d..65ecdd73 100644 --- a/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml @@ -12,6 +12,9 @@ {% endif %} {% else %} options: +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} {% if opnfv.spaces_dict.data is defined %} os-data-network: {{ opnfv.spaces_dict.data.cidr }} {% endif %} diff --git a/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml b/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml index b5fdb103..8373b2bb 100644 --- a/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml @@ -14,6 +14,9 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} region: {{ os.region }} console-access-protocol: novnc neutron-external-network: ext-net diff --git a/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml b/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml index 29a5f405..66d53852 100644 --- a/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml @@ -11,6 +11,9 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} enable-live-migration: true enable-resize: true migration-auth-type: ssh diff --git a/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml b/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml index bf0ac99d..cba9b794 100644 --- a/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml +++ b/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml @@ -15,6 +15,9 @@ {% endif %} options: openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}" +{% if os.git_repo.origin_git %} + openstack-origin-git: "{{ os.git_repo.branch }}" +{% endif %} secret: admin webroot: / {% if os.network.ipv6 %} diff --git a/ci/default_deployment_config.yaml b/ci/default_deployment_config.yaml index 2e97b863..0285ebcc 100644 --- a/ci/default_deployment_config.yaml +++ b/ci/default_deployment_config.yaml @@ -1,7 +1,10 @@ ubuntu: release: xenial os: - release: newton + release: ocata + git_repo: + origin_git: False + branch: ocata hyperconverged: True ha: mode: ha @@ -30,7 +33,7 @@ os: cpu_pin: False cpu_pin_set: all service: - congress: True + congress: False promise: True bindings: True openbaton: False diff --git a/ci/deploy.sh b/ci/deploy.sh index e1ec7a69..b0df68b6 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -7,9 +7,9 @@ set -ex opnfvsdn=nosdn opnfvtype=nonha -openstack=newton +openstack=ocata opnfvlab=default -opnfvrel=d +opnfvrel=e opnfvfeature=none opnfvdistro=xenial opnfvarch=amd64 @@ -88,7 +88,7 @@ createresource() { if [[ -z "$node_id" ]]; then sudo virt-install --connect qemu:///system --name $node \ --ram 8192 --cpu host --vcpus 4 \ - --disk size=120,format=qcow2,bus=virtio,io=native,pool=default \ + --disk size=120,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \ --network bridge=virbr0,model=virtio \ --network bridge=virbr0,model=virtio \ --boot network,hd,menu=off \ @@ -136,6 +136,11 @@ deploy() { echo " MAAS not deployed please deploy MAAS first." fi fi +#create json file which is missing in case of new deployment after maas and git tree cloned freshly. + + python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < labconfig.yaml > labconfig.json + python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < deployconfig.yaml > deployconfig.json + else if [ ! -f ./environments.yaml ] && [ -e ~/.juju/environments.yaml ]; then cp ~/.juju/environments.yaml ./environments.yaml diff --git a/ci/k8.sh b/ci/k8.sh index cb7dd497..5e0f4a49 100755 --- a/ci/k8.sh +++ b/ci/k8.sh @@ -6,7 +6,7 @@ mkdir -p ~/.kube || true juju scp kubernetes-master/0:config ~/.kube/config || true if [ ! -f /snap/kubectl/current/kubectl ]; then - sudo apt-get install snapd + sudo apt-get install snapd -y sudo snap install kubectl --classic fi diff --git a/ci/openstack.sh b/ci/openstack.sh index 80355dfa..24d068f9 100755 --- a/ci/openstack.sh +++ b/ci/openstack.sh @@ -92,41 +92,25 @@ create_openrc() { adminPasswd=$(juju config keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null) fi - configOpenrc admin $adminPasswd admin http://$keystoneIp:5000/v2.0 RegionOne > ~/joid_config/admin-openrc + configOpenrc admin $adminPasswd admin http://$keystoneIp:5000/v3 RegionOne > ~/joid_config/admin-openrc + chmod 0600 ~/joid_config/admin-openrc } configOpenrc() { -if [ "$API_FQDN" != "None" ]; then - cat <<-EOF - export SERVICE_ENDPOINT=$4 - unset SERVICE_TOKEN - unset SERVICE_ENDPOINT - export OS_USERNAME=$1 - export OS_PASSWORD=$2 - export OS_TENANT_NAME=$3 - export OS_AUTH_URL=$4 - export OS_REGION_NAME=$5 - export OS_ENDPOINT_TYPE='internalURL' - export CINDER_ENDPOINT_TYPE='internalURL' - export GLANCE_ENDPOINT_TYPE='internalURL' - export KEYSTONE_ENDPOINT_TYPE='internalURL' - export NEUTRON_ENDPOINT_TYPE='internalURL' - export NOVA_ENDPOINT_TYPE='internalURL' -EOF -else - cat <<-EOF - export SERVICE_ENDPOINT=$4 - unset SERVICE_TOKEN - unset SERVICE_ENDPOINT - export OS_USERNAME=$1 - export OS_PASSWORD=$2 - export OS_TENANT_NAME=$3 - export OS_AUTH_URL=$4 - export OS_REGION_NAME=$5 +cat <<-EOF +export OS_AUTH_URL=$4 +export OS_USERNAME=$1 +export OS_PASSWORD=$2 +export OS_USER_DOMAIN_NAME=admin_domain +export OS_PROJECT_DOMAIN_NAME=admin_domain +export OS_PROJECT_NAME=$3 +export OS_TENANT_NAME=$3 +export OS_REGION_NAME=$5 +export OS_IDENTITY_API_VERSION=3 +# Swift needs this: +export OS_AUTH_VERSION=3 EOF - -fi } if [ "$API_FQDN" != "None" ]; then @@ -232,36 +216,38 @@ neutron subnet-show ext-subnet > /dev/null 2>&1 || neutron subnet-create ext-net --name ext-subnet --allocation-pool start=$EXTNET_FIP,end=$EXTNET_LIP \ --disable-dhcp --gateway $EXTNET_GW $EXTNET_NET +#congress team is not updating and supporting charm anymore so defer it. + # Create Congress datasources -sudo apt-get install -y python-congressclient - -openstack congress datasource create nova "nova" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$keystoneIp:5000/v2.0 -openstack congress datasource create neutronv2 "neutronv2" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$keystoneIp:5000/v2.0 -openstack congress datasource create ceilometer "ceilometer" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$keystoneIp:5000/v2.0 -openstack congress datasource create cinder "cinder" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$keystoneIp:5000/v2.0 -openstack congress datasource create glancev2 "glancev2" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$keystoneIp:5000/v2.0 -openstack congress datasource create keystone "keystone" \ - --config username=$OS_USERNAME \ - --config tenant_name=$OS_TENANT_NAME \ - --config password=$OS_PASSWORD \ - --config auth_url=http://$keystoneIp:5000/v2.0 +#sudo apt-get install -y python-congressclient + +#openstack congress datasource create nova "nova" \ +# --config username=$OS_USERNAME \ +# --config tenant_name=$OS_TENANT_NAME \ +# --config password=$OS_PASSWORD \ +# --config auth_url=http://$keystoneIp:5000/v2.0 +#openstack congress datasource create neutronv2 "neutronv2" \ +# --config username=$OS_USERNAME \ +# --config tenant_name=$OS_TENANT_NAME \ +# --config password=$OS_PASSWORD \ +# --config auth_url=http://$keystoneIp:5000/v2.0 +#openstack congress datasource create ceilometer "ceilometer" \ +# --config username=$OS_USERNAME \ +# --config tenant_name=$OS_TENANT_NAME \ +# --config password=$OS_PASSWORD \ +# --config auth_url=http://$keystoneIp:5000/v2.0 +#openstack congress datasource create cinder "cinder" \ +# --config username=$OS_USERNAME \ +# --config tenant_name=$OS_TENANT_NAME \ +# --config password=$OS_PASSWORD \ +# --config auth_url=http://$keystoneIp:5000/v2.0 +#openstack congress datasource create glancev2 "glancev2" \ +# --config username=$OS_USERNAME \ +# --config tenant_name=$OS_TENANT_NAME \ +# --config password=$OS_PASSWORD \ +# --config auth_url=http://$keystoneIp:5000/v2.0 +#openstack congress datasource create keystone "keystone" \ +# --config username=$OS_USERNAME \ +# --config tenant_name=$OS_TENANT_NAME \ +# --config password=$OS_PASSWORD \ +# --config auth_url=http://$keystoneIp:5000/v2.0 diff --git a/juju/joid-configure-openstack b/juju/joid-configure-openstack index 34661281..71e4f712 100755 --- a/juju/joid-configure-openstack +++ b/juju/joid-configure-openstack @@ -43,7 +43,7 @@ neutron subnet-show private_subnet > /dev/null 2>&1 || neutron subnet-create pri SUBNET_ID=$(neutron subnet-show private_subnet | grep " id" | awk '{print $4}') #Create router for external network and private network -neutron router-show provider-router > /dev/null 2>&1 || neutron router-create --tenant-id $TENANT_ID provider-router +openstack router list provider-router > /dev/null 2>&1 || openstack router create --project-domain=$OS_PROJECT_DOMAIN_NAME --project $OS_PROJECT_NAME provider-router ROUTER_ID=$(neutron router-show provider-router | grep " id" | awk '{print $4}') neutron router-gateway-clear provider-router || true -- cgit 1.2.3-korg