diff options
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/clean.sh | 29 | ||||
-rwxr-xr-x | ci/deploy.sh | 30 |
2 files changed, 31 insertions, 28 deletions
diff --git a/ci/clean.sh b/ci/clean.sh index 40ae6edd..2a91b7ce 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -11,7 +11,9 @@ #Clean script to uninstall provisioning server for Apex #author: Dan Radez (dradez@redhat.com) #author: Tim Rozet (trozet@redhat.com) -CONFIG=/var/opt/opnfv + +# Use default if no param passed +CONFIG=${1-"/var/opt/opnfv"} ##LIBRARIES source $CONFIG/lib/common-functions.sh @@ -21,31 +23,26 @@ ovs_bridges="br-admin br-private br-public br-storage" # Clean off instack/undercloud VM for vm in instack undercloud; do - virsh destroy $vm 2> /dev/null || echo -n '' - virsh undefine $vm 2> /dev/null || echo -n '' - if ! virsh vol-delete ${vm}.qcow2 --pool default 2> /dev/null; then - if [ ! -e /var/lib/libvirt/images/${vm}.qcow2 ]; then - /usr/bin/touch /var/lib/libvirt/images/${vm}.qcow2 - virsh vol-delete ${vm}.qcow2 --pool default - fi - fi + virsh destroy $vm 2> /dev/null | xargs echo -n + virsh undefine $vm 2> /dev/null | xargs echo -n + /usr/bin/touch /var/lib/libvirt/images/${vm}.qcow2 + virsh vol-delete ${vm}.qcow2 --pool default 2> /dev/null | xargs echo -n + rm -f /var/lib/libvirt/images/${vm}.qcow2 2> /dev/null done -rm -f /var/lib/libvirt/images/undercloud.qcow2 2> /dev/null - # Clean off baremetal VMs in case they exist for i in $(seq 0 $vm_index); do - virsh destroy baremetal$i 2> /dev/null || echo -n '' - virsh undefine baremetal$i 2> /dev/null || echo -n '' + virsh destroy baremetal$i 2> /dev/null | xargs echo -n + virsh undefine baremetal$i 2> /dev/null | xargs echo -n /usr/bin/touch /var/lib/libvirt/images/baremetal${i}.qcow2 - virsh vol-delete baremetal${i}.qcow2 --pool default 2> /dev/null + virsh vol-delete baremetal${i}.qcow2 --pool default 2> /dev/null | xargs echo -n rm -f /var/lib/libvirt/images/baremetal${i}.qcow2 2> /dev/null done # Clean off created bridges for bridge in ${ovs_bridges}; do - virsh net-destroy ${bridge} 2> /dev/null - virsh net-undefine ${bridge} 2> /dev/null + virsh net-destroy ${bridge} 2> /dev/null | xargs echo -n + virsh net-undefine ${bridge} 2> /dev/null | xargs echo -n if detach_interface_from_ovs ${bridge} 2> /dev/null; then ovs-vsctl del-br ${bridge} 2> /dev/null fi diff --git a/ci/deploy.sh b/ci/deploy.sh index 8aeb5f5f..9e317c8a 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -29,6 +29,7 @@ ntp_server="pool.ntp.org" net_isolation_enabled="TRUE" post_config="TRUE" debug="FALSE" +nics_cfg='' declare -i CNT declare UNDERCLOUD @@ -648,7 +649,7 @@ function define_vm () { if virsh vol-list default | grep ${1}.qcow2 2>&1> /dev/null; then volume_path=$(virsh vol-path --pool default ${1}.qcow2 || echo "/var/lib/libvirt/images/${1}.qcow2") echo "Volume ${1} exists. Deleting Existing Volume $volume_path" - virsh vol-dumpxml ${1}.qcow2 --pool default + virsh vol-dumpxml ${1}.qcow2 --pool default > /dev/null || echo '' #ok for this to fail touch $volume_path virsh vol-delete ${1}.qcow2 --pool default fi @@ -674,9 +675,8 @@ function define_vm () { ##Set network-environment settings ##params: network-environment file to edit function configure_network_environment { - local tht_dir nic_ext + local tht_dir tht_dir=/usr/share/openstack-tripleo-heat-templates/network - nic_ext='' sed -i '/ControlPlaneSubnetCidr/c\\ ControlPlaneSubnetCidr: "'${admin_network_cidr##*/}'"' $1 sed -i '/ControlPlaneDefaultRoute/c\\ ControlPlaneDefaultRoute: '${admin_network_provisioner_ip}'' $1 @@ -692,7 +692,7 @@ function configure_network_environment { sed -i 's#^.*Compute::Ports::TenantPort:.*$# OS::TripleO::Compute::Ports::TenantPort: '${tht_dir}'/ports/tenant.yaml#' $1 sed -i "/TenantAllocationPools/c\\ TenantAllocationPools: [{'start': '${private_network_usable_ip_range%%,*}', 'end': '${private_network_usable_ip_range##*,}'}]" $1 sed -i '/TenantNetCidr/c\\ TenantNetCidr: '${private_network_cidr}'' $1 - nic_ext+=_private + nics_cfg+=_private else sed -i 's#^.*Network::Tenant.*$# OS::TripleO::Network::Tenant: '${tht_dir}'/noop.yaml#' $1 sed -i 's#^.*Controller::Ports::TenantPort:.*$# OS::TripleO::Controller::Ports::TenantPort: '${tht_dir}'/ports/noop.yaml#' $1 @@ -702,27 +702,24 @@ function configure_network_environment { # check for storage network if [[ ! -z "$storage_network_enabled" && "$storage_network_enabled" == "true" ]]; then sed -i 's#^.*Network::Storage:.*$# OS::TripleO::Network::Storage: '${tht_dir}'/storage.yaml#' $1 + sed -i 's#^.*Network::Ports::StorageVipPort:.*$# OS::TripleO::Network::Ports::StorageVipPort: '${tht_dir}'/ports/storage.yaml#' $1 sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1 sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1 sed -i "/StorageAllocationPools/c\\ StorageAllocationPools: [{'start': '${storage_network_usable_ip_range%%,*}', 'end': '${storage_network_usable_ip_range##*,}'}]" $1 sed -i '/StorageNetCidr/c\\ StorageNetCidr: '${storage_network_cidr}'' $1 - nic_ext+=_storage + nics_cfg+=_storage else sed -i 's#^.*Network::Storage:.*$# OS::TripleO::Network::Storage: '${tht_dir}'/noop.yaml#' $1 + sed -i 's#^.*Network::Ports::StorageVipPort:.*$# OS::TripleO::Network::Ports::StorageVipPort: '${tht_dir}'/ports/noop.yaml#' $1 sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1 sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1 fi - sed -i 's#^.*Controller::Net::SoftwareConfig:.*$# OS::TripleO::Controller::Net::SoftwareConfig: nics/controller'${nic_ext}'.yaml#' $1 - # check for ODL L3 if [ "${deploy_options_array['sdn_l3']}" == 'true' ]; then - nic_ext+=_br-ex_no-public-ip + nics_cfg+=_br-ex_no-public-ip fi - # set nics appropriately - sed -i 's#^.*Compute::Net::SoftwareConfig:.*$# OS::TripleO::Compute::Net::SoftwareConfig: nics/compute'${nic_ext}'.yaml#' $1 - } ##Copy over the glance images and instackenv json file ##params: none @@ -735,8 +732,16 @@ function configure_undercloud { echo -e "${blue}Network Environment set for Deployment: ${reset}" cat $CONFIG/network-environment.yaml scp ${SSH_OPTIONS[@]} $CONFIG/network-environment.yaml "stack@$UNDERCLOUD": + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI +mkdir nics/ +cat > nics/controller.yaml << EOF +$(nics_cfg=$nics_cfg sh $CONFIG/nics-controller.yaml.template) +EOF +cat > nics/compute.yaml << EOF +$(nics_cfg=$nics_cfg sh $CONFIG/nics-compute.yaml.template) +EOF +EOI fi - scp ${SSH_OPTIONS[@]} -r $CONFIG/nics/ "stack@$UNDERCLOUD": # ensure stack user on Undercloud machine has an ssh key ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "if [ ! -e ~/.ssh/id_rsa.pub ]; then ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa; fi" @@ -878,6 +883,7 @@ function undercloud_prep_overcloud_deploy { fi echo "Copying overcloud image to Undercloud" + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "rm -f overcloud-full.qcow2" scp ${SSH_OPTIONS[@]} $RESOURCES/overcloud-full-${SDN_IMAGE}.qcow2 "stack@$UNDERCLOUD":overcloud-full.qcow2 # make sure ceph is installed |