|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +source experiment/run-library.sh |
| 4 | + |
| 5 | +organization="${PARAM_organization:-Default Organization}" |
| 6 | +manifest="${PARAM_manifest:-conf/contperf/manifest_SCA.zip}" |
| 7 | +inventory="${PARAM_inventory:-conf/contperf/inventory.ini}" |
| 8 | +local_conf="${PARAM_local_conf:-conf/satperf.local.yaml}" |
| 9 | + |
| 10 | +concurrent_registrations=${PARAM_concurrent_registrations:-125} |
| 11 | + |
| 12 | +wait_interval=${PARAM_wait_interval:-30} |
| 13 | + |
| 14 | +cdn_url_full="${PARAM_cdn_url_full:-https://cdn.redhat.com/}" |
| 15 | + |
| 16 | +repo_sat_tools="${PARAM_repo_sat_tools:-http://mirror.example.com/Satellite_Tools_x86_64/}" |
| 17 | +# repo_sat_tools_puppet="${PARAM_repo_sat_tools_puppet:-none}" # Older example: http://mirror.example.com/Satellite_Tools_Puppet_4_6_3_RHEL7_x86_64/ |
| 18 | + |
| 19 | +# repo_sat_client_7="${PARAM_repo_sat_client_7:-http://mirror.example.com/Satellite_Client_7_x86_64/}" |
| 20 | +repo_sat_client_8="${PARAM_repo_sat_client_8:-http://mirror.example.com/Satellite_Client_8_x86_64/}" |
| 21 | +# repo_sat_client_9="${PARAM_repo_sat_client_9:-http://mirror.example.com/Satellite_Client_9_x86_64/}" |
| 22 | + |
| 23 | +rhel_subscription="${PARAM_rhel_subscription:-Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)}" |
| 24 | + |
| 25 | +dl="Default Location" |
| 26 | + |
| 27 | +opts="--forks 100 -i $inventory" |
| 28 | +opts_adhoc="$opts -e @conf/satperf.yaml -e @$local_conf" |
| 29 | + |
| 30 | + |
| 31 | +section "Checking environment" |
| 32 | +generic_environment_check |
| 33 | + |
| 34 | + |
| 35 | +section "Prepare for Red Hat content" |
| 36 | +h_out "--no-headers --csv organization list --fields name" | grep --quiet "^$organization$" \ |
| 37 | + || h 00-ensure-org.log "organization create --name '$organization'" |
| 38 | +skip_measurement='true' h 00-ensure-loc-in-org.log "organization add-location --name '$organization' --location '$dl'" |
| 39 | +skip_measurement='true' ap 01-manifest-excercise.log \ |
| 40 | + -e "manifest=../../$manifest" \ |
| 41 | + playbooks/tests/manifest-excercise.yaml |
| 42 | +e ManifestUpload $logs/01-manifest-excercise.log |
| 43 | +e ManifestRefresh $logs/01-manifest-excercise.log |
| 44 | +e ManifestDelete $logs/01-manifest-excercise.log |
| 45 | +skip_measurement='true' h 02-manifest-upload.log "subscription upload --file '/root/manifest-auto.zip' --organization '$organization'" |
| 46 | +s $wait_interval |
| 47 | + |
| 48 | + |
| 49 | +export skip_measurement='true' |
| 50 | +section "Sync from CDN" # do not measure becasue of unpredictable network latency |
| 51 | +h 00b-set-cdn-stage.log "organization update --name '$organization' --redhat-repository-url '$cdn_url_full'" |
| 52 | + |
| 53 | +h 00b-manifest-refresh.log "subscription refresh-manifest --organization '$organization'" |
| 54 | + |
| 55 | +# h 12b-reposet-enable-rhel7.log "repository-set enable --organization '$organization' --product 'Red Hat Enterprise Linux Server' --name 'Red Hat Enterprise Linux 7 Server (RPMs)' --releasever '7Server' --basearch 'x86_64'" |
| 56 | +# h 12b-repo-sync-rhel7.log "repository synchronize --organization '$organization' --product 'Red Hat Enterprise Linux Server' --name 'Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server'" |
| 57 | +# s $wait_interval |
| 58 | +# h 12b-repo-sync-rhel7optional.log "repository synchronize --organization '$organization' --product 'Red Hat Enterprise Linux Server' --name 'Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server'" |
| 59 | +# s $wait_interval |
| 60 | + |
| 61 | +h 12b-reposet-enable-rhel8baseos.log "repository-set enable --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)' --releasever '8' --basearch 'x86_64'" |
| 62 | +h 12b-repo-sync-rhel8baseos.log "repository synchronize --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8'" |
| 63 | +s $wait_interval |
| 64 | +h 12b-reposet-enable-rhel8appstream.log "repository-set enable --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)' --releasever '8' --basearch 'x86_64'" |
| 65 | +h 12b-repo-sync-rhel8appstream.log "repository synchronize --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8'" |
| 66 | +s $wait_interval |
| 67 | + |
| 68 | +# h 12b-reposet-enable-rhel9baseos.log "repository-set enable --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)' --releasever '9' --basearch 'x86_64'" |
| 69 | +# h 12b-repo-sync-rhel9baseos.log "repository synchronize --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9'" |
| 70 | +# s $wait_interval |
| 71 | +# h 12b-reposet-enable-rhel9appstream.log "repository-set enable --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)' --releasever '9' --basearch 'x86_64'" |
| 72 | +# h 12b-repo-sync-rhel9appstream.log "repository synchronize --organization '$organization' --product 'Red Hat Enterprise Linux for x86_64' --name 'Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs 9'" |
| 73 | +# s $wait_interval |
| 74 | +unset skip_measurement |
| 75 | + |
| 76 | + |
| 77 | +export skip_measurement='true' |
| 78 | +section "Sync Tools repo" |
| 79 | +h product-create.log "product create --organization '$organization' --name SatToolsProduct" |
| 80 | + |
| 81 | +h repository-create-sat-tools.log "repository create --organization '$organization' --product SatToolsProduct --name SatToolsRepo --content-type yum --url '$repo_sat_tools'" |
| 82 | +h repository-sync-sat-tools.log "repository synchronize --organization '$organization' --product SatToolsProduct --name SatToolsRepo" & |
| 83 | + |
| 84 | +# [ "$repo_sat_tools_puppet" != "none" ] \ |
| 85 | +# && h repository-create-puppet-upgrade.log "repository create --organization '$organization' --product SatToolsProduct --name SatToolsPuppetRepo --content-type yum --url '$repo_sat_tools_puppet'" |
| 86 | +# [ "$repo_sat_tools_puppet" != "none" ] \ |
| 87 | +# && h repository-sync-puppet-upgrade.log "repository synchronize --organization '$organization' --product SatToolsProduct --name SatToolsPuppetRepo" & |
| 88 | +wait |
| 89 | +unset skip_measurement |
| 90 | + |
| 91 | + |
| 92 | +export skip_measurement='true' |
| 93 | +section "Sync Client repos" |
| 94 | +h 30-sat-client-product-create.log "product create --organization '$organization' --name SatClientProduct" |
| 95 | + |
| 96 | +# h 30-repository-create-sat-client_7.log "repository create --organization '$organization' --product SatClientProduct --name SatClient7Repo --content-type yum --url '$repo_sat_client_7'" |
| 97 | +# h 30-repository-sync-sat-client_7.log "repository synchronize --organization '$organization' --product SatClientProduct --name SatClient7Repo" & |
| 98 | + |
| 99 | +h 30-repository-create-sat-client_8.log "repository create --organization '$organization' --product SatClientProduct --name SatClient8Repo --content-type yum --url '$repo_sat_client_8'" |
| 100 | +h 30-repository-sync-sat-client_8.log "repository synchronize --organization '$organization' --product SatClientProduct --name SatClient8Repo" & |
| 101 | + |
| 102 | +# h 30-repository-create-sat-client_9.log "repository create --organization '$organization' --product SatClientProduct --name SatClient9Repo --content-type yum --url '$repo_sat_client_9'" |
| 103 | +# h 30-repository-sync-sat-client_9.log "repository synchronize --organization '$organization' --product SatClientProduct --name SatClient9Repo" & |
| 104 | +wait |
| 105 | +unset skip_measurement |
| 106 | + |
| 107 | + |
| 108 | +export skip_measurement='true' |
| 109 | +section "Synchronise capsules" |
| 110 | +tmp=$( mktemp ) |
| 111 | +h_out "--no-headers --csv capsule list --organization '$organization'" | grep '^[0-9]\+,' >$tmp |
| 112 | +for capsule_id in $( cat $tmp | cut -d ',' -f 1 | grep -v '1' ); do |
| 113 | + h 13b-capsule-sync-$capsule_id.log "capsule content synchronize --organization '$organization' --id '$capsule_id'" |
| 114 | +done |
| 115 | +s $wait_interval |
| 116 | +unset skip_measurement |
| 117 | + |
| 118 | + |
| 119 | +export skip_measurement='true' |
| 120 | +section "Prepare for registrations" |
| 121 | +tmp=$( mktemp ) |
| 122 | + |
| 123 | +h_out "--no-headers --csv domain list --search 'name = {{ containers_domain }}'" | grep --quiet '^[0-9]\+,' \ |
| 124 | + || h 42-domain-create.log "domain create --name '{{ containers_domain }}' --organizations '$organization'" |
| 125 | + |
| 126 | +h_out "--no-headers --csv location list --organization '$organization'" | grep '^[0-9]\+,' >$tmp |
| 127 | +location_ids=$( cut -d ',' -f 1 $tmp | tr '\n' ',' | sed 's/,$//' ) |
| 128 | +h 42-domain-update.log "domain update --name '{{ containers_domain }}' --organizations '$organization' --location-ids '$location_ids'" |
| 129 | + |
| 130 | +h 43-ak-create.log "activation-key create --content-view '$organization View' --lifecycle-environment Library --name ActivationKey --organization '$organization'" |
| 131 | + |
| 132 | +h_out "--csv subscription list --organization '$organization' --search 'name = \"$rhel_subscription\"'" >$logs/subs-list-rhel.log |
| 133 | +rhel_subs_id=$( tail -n 1 $logs/subs-list-rhel.log | cut -d ',' -f 1 ) |
| 134 | +h 43-ak-add-subs-rhel.log "activation-key add-subscription --organization '$organization' --name ActivationKey --subscription-id '$rhel_subs_id'" |
| 135 | + |
| 136 | +h_out "--csv subscription list --organization '$organization' --search 'name = SatToolsProduct'" >$logs/subs-list-tools.log |
| 137 | +tools_subs_id=$( tail -n 1 $logs/subs-list-tools.log | cut -d ',' -f 1 ) |
| 138 | +h 43-ak-add-subs-tools.log "activation-key add-subscription --organization '$organization' --name ActivationKey --subscription-id '$tools_subs_id'" |
| 139 | + |
| 140 | +h_out "--csv subscription list --organization '$organization' --search 'name = SatClientProduct'" >$logs/subs-list-client.log |
| 141 | +client_subs_id=$( tail -n 1 $logs/subs-list-client.log | cut -d ',' -f 1 ) |
| 142 | +h 43-ak-add-subs-client.log "activation-key add-subscription --organization '$organization' --name ActivationKey --subscription-id '$client_subs_id'" |
| 143 | + |
| 144 | +tmp=$( mktemp ) |
| 145 | +h_out "--no-headers --csv capsule list --organization '$organization'" | grep '^[0-9]\+,' >$tmp |
| 146 | +for row in $( cut -d ' ' -f 1 $tmp ); do |
| 147 | + capsule_id=$( echo "$row" | cut -d ',' -f 1 ) |
| 148 | + capsule_name=$( echo "$row" | cut -d ',' -f 2 ) |
| 149 | + subnet_name="subnet-for-$capsule_name" |
| 150 | + hostgroup_name="hostgroup-for-$capsule_name" |
| 151 | + if [ "$capsule_id" -eq 1 ]; then |
| 152 | + location_name="$dl" |
| 153 | + else |
| 154 | + location_name="Location for $capsule_name" |
| 155 | + fi |
| 156 | + |
| 157 | + h_out "--no-headers --csv subnet list --search 'name = $subnet_name'" | grep --quiet '^[0-9]\+,' \ |
| 158 | + || h 44-subnet-create-$capsule_name.log "subnet create --name '$subnet_name' --ipam None --domains '{{ containers_domain }}' --organization '$organization' --network 172.0.0.0 --mask 255.0.0.0 --location '$location_name'" |
| 159 | + |
| 160 | + subnet_id=$( h_out "--output yaml subnet info --name '$subnet_name'" | grep '^Id:' | cut -d ' ' -f 2 ) |
| 161 | + a 45-subnet-add-rex-capsule-$capsule_name.log satellite6 \ |
| 162 | + -m "shell" \ |
| 163 | + -a "curl --silent --insecure -u {{ sat_user }}:{{ sat_pass }} -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' https://localhost/api/v2/subnets/$subnet_id -d '{\"subnet\": {\"remote_execution_proxy_ids\": [\"$capsule_id\"]}}'" |
| 164 | + h_out "--no-headers --csv hostgroup list --search 'name = $hostgroup_name'" | grep --quiet '^[0-9]\+,' \ |
| 165 | + || ap 41-hostgroup-create-$capsule_name.log \ |
| 166 | + -e "organization='$organization'" \ |
| 167 | + -e "hostgroup_name=$hostgroup_name" \ |
| 168 | + -e "subnet_name=$subnet_name" \ |
| 169 | + playbooks/satellite/hostgroup-create.yaml |
| 170 | +done |
| 171 | + |
| 172 | +ap 44-generate-host-registration-command.log \ |
| 173 | + -e "ak=ActivationKey" \ |
| 174 | + playbooks/satellite/host-registration_generate-command.yaml |
| 175 | +ap 44-recreate-client-scripts.log \ |
| 176 | + playbooks/satellite/client-scripts.yaml |
| 177 | +unset skip_measurement |
| 178 | + |
| 179 | + |
| 180 | +section "Register" |
| 181 | +number_container_hosts=$( ansible -i $inventory --list-hosts container_hosts 2>/dev/null | grep '^ hosts' | sed 's/^ hosts (\([0-9]\+\)):$/\1/' ) |
| 182 | +number_containers_per_container_host=$( ansible -i $inventory -m debug -a "var=containers_count" container_hosts[0] | awk '/ "containers_count":/ {print $NF}' ) |
| 183 | +total_number_containers=$(( number_container_hosts * number_containers_per_container_host )) |
| 184 | +registration_iterations=$(( ( total_number_containers + concurrent_registrations - 1 ) / concurrent_registrations )) # We want ceiling rounding: Ceiling( X / Y ) = ( X + Y – 1 ) / Y |
| 185 | +concurrent_registrations_per_container_host=$(( concurrent_registrations / number_container_hosts )) |
| 186 | + |
| 187 | +log "Going to register $total_number_containers hosts: $concurrent_registrations_per_container_host hosts per container host ($number_container_hosts available) in $(( registration_iterations + 1 )) batches." |
| 188 | + |
| 189 | +for (( i=1; i <= ( registration_iterations + 1 ); i++ )); do |
| 190 | + skip_measurement='true' ap 44b-register-$i.log \ |
| 191 | + -e "size=${concurrent_registrations_per_container_host}" \ |
| 192 | + -e "registration_logs='../../$logs/44b-register-container-host-client-logs'" \ |
| 193 | + -e "method=clients_host-registration" \ |
| 194 | + playbooks/tests/registrations.yaml |
| 195 | + s $wait_interval |
| 196 | +done |
| 197 | +grep Register $logs/44b-register-*.log >$logs/44b-register-overall.log |
| 198 | +e Register $logs/44b-register-overall.log |
| 199 | + |
| 200 | + |
| 201 | +section "Sosreport" |
| 202 | +ap sosreporter-gatherer.log \ |
| 203 | + -e "sosreport_gatherer_local_dir='../../$logs/sosreport/'" \ |
| 204 | + playbooks/satellite/sosreport_gatherer.yaml |
| 205 | + |
| 206 | +junit_upload |
0 commit comments