Skip to content

Commit

Permalink
update vars
Browse files Browse the repository at this point in the history
  • Loading branch information
pinikomarov committed Oct 31, 2024
1 parent 7bbae82 commit 5ae43fd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
16 changes: 8 additions & 8 deletions tests/roles/get_services_configuration/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{ shell_header }}
{{ oc_header }}
{{ mariadb_copy_shell_vars_src }}
export PULL_OPENSTACK_CONFIGURATION_DATABASES=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
export PULL_OPENSTACK_CONFIGURATION_DATABASES=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysql -rsh "$SOURCE_MARIADB_IP" -uroot -p"$SOURCE_DB_ROOT_PASSWORD" -e 'SHOW databases;')
echo "$PULL_OPENSTACK_CONFIGURATION_DATABASES"
register: _databases_check
Expand All @@ -36,7 +36,7 @@
{{ oc_header }}
{{ mariadb_copy_shell_vars_src }}
run_mysqlcheck() {
export PULL_OPENSTACK_CONFIGURATION_MYSQLCHECK_NOK=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
export PULL_OPENSTACK_CONFIGURATION_MYSQLCHECK_NOK=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysqlcheck --all-databases -h "${SOURCE_MARIADB_IP}" -uroot -p"${SOURCE_DB_ROOT_PASSWORD}" | grep -v OK)
}
run_mysqlcheck
Expand All @@ -59,7 +59,7 @@
{{ shell_header }}
{{ oc_header }}
{{ mariadb_copy_shell_vars_src }}
export PULL_OPENSTACK_CONFIGURATION_NOVADB_MAPPED_CELLS=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
export PULL_OPENSTACK_CONFIGURATION_NOVADB_MAPPED_CELLS=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysql -rsh "${SOURCE_MARIADB_IP}" -uroot -p"${SOURCE_DB_ROOT_PASSWORD}" nova_api -e \
'select uuid,name,transport_url,database_connection,disabled from cell_mappings;')
echo "$PULL_OPENSTACK_CONFIGURATION_NOVADB_MAPPED_CELLS"
Expand All @@ -70,7 +70,7 @@
{{ shell_header }}
{{ oc_header }}
{{ mariadb_copy_shell_vars_src }}
export PULL_OPENSTACK_CONFIGURATION_NOVA_COMPUTE_HOSTNAMES=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
export PULL_OPENSTACK_CONFIGURATION_NOVA_COMPUTE_HOSTNAMES=$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysql -rsh "$SOURCE_MARIADB_IP" -uroot -p"$SOURCE_DB_ROOT_PASSWORD" nova_api -e \
"select host from nova.services where services.binary='nova-compute';")
echo "$PULL_OPENSTACK_CONFIGURATION_NOVA_COMPUTE_HOSTNAMES"
Expand Down Expand Up @@ -103,14 +103,14 @@
{{ pull_openstack_configuration_ssh_shell_vars }}
cat > ~/.source_cloud_exported_variables << EOF
PULL_OPENSTACK_CONFIGURATION_DATABASES="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
PULL_OPENSTACK_CONFIGURATION_DATABASES="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysql -rsh $SOURCE_MARIADB_IP -uroot -p$SOURCE_DB_ROOT_PASSWORD -e 'SHOW databases;')"
PULL_OPENSTACK_CONFIGURATION_MYSQLCHECK_NOK="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
PULL_OPENSTACK_CONFIGURATION_MYSQLCHECK_NOK="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysqlcheck --all-databases -h $SOURCE_MARIADB_IP -u root -p$SOURCE_DB_ROOT_PASSWORD | grep -v OK)"
PULL_OPENSTACK_CONFIGURATION_NOVADB_MAPPED_CELLS="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
PULL_OPENSTACK_CONFIGURATION_NOVADB_MAPPED_CELLS="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysql -rsh $SOURCE_MARIADB_IP -uroot -p$SOURCE_DB_ROOT_PASSWORD nova_api -e \
'select uuid,name,transport_url,database_connection,disabled from cell_mappings;')"
PULL_OPENSTACK_CONFIGURATION_NOVA_COMPUTE_HOSTNAMES="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override|default('') }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
PULL_OPENSTACK_CONFIGURATION_NOVA_COMPUTE_HOSTNAMES="$(oc run mariadb-client ${MARIADB_CLIENT_ANNOTATIONS} {{ mysql_client_override }} -q --image ${MARIADB_IMAGE} -i --rm --restart=Never -- \
mysql -rsh $SOURCE_MARIADB_IP -uroot -p$SOURCE_DB_ROOT_PASSWORD nova_api -e \
"select host from nova.services where services.binary='nova-compute';")"
PULL_OPENSTACK_CONFIGURATION_NOVAMANAGE_CELL_MAPPINGS="$($CONTROLLER1_SSH sudo podman exec -it nova_api nova-manage cell_v2 list_cells)"
Expand Down
8 changes: 5 additions & 3 deletions tests/roles/mariadb_copy/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ storage_reclaim_policy: delete
source_galera_members: |-
["{{ edpm_node_hostname }}"]={{ source_mariadb_ip|default(external_mariadb_ip) }}
dpa_dir: "../.."
dpa_tests_dir: "{{ dpa_dir }}/tests"

mysql_client_override: ""

# ospdo env:
# Whether source env is OSPD Director Operator
# i.e. https://github.com/openstack-k8s-operators/osp-director-operator
Expand All @@ -12,6 +17,3 @@ ospdo_src: false
rhoso_namespace: "openstack"
# director operator namespace
org_namespace: "ospdo_openstack"
# adoption repo default location
dpa_dir: "/home/zuul/src/github.com/openstack-k8s-operators/data-plane-adoption"
dpa_tests_dir: "{{ dpa_dir }}/tests"
6 changes: 3 additions & 3 deletions tests/roles/mariadb_copy/tasks/env_vars_dst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc get svc --selector "mariadb/name=openstack" -n {{ rhoso_namespace | default('openstack') }} -ojsonpath='{.items[0].spec.clusterIP}'
oc get svc --selector "mariadb/name=openstack" -n {{ rhoso_namespace }} -ojsonpath='{.items[0].spec.clusterIP}'
register: podified_mariadb_ip_result

- name: get podified cell1 MariaDB IP
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc get svc --selector "mariadb/name=openstack-cell1" -n {{ rhoso_namespace | default('openstack') }} -ojsonpath='{.items[0].spec.clusterIP}'
oc get svc --selector "mariadb/name=openstack-cell1" -n {{ rhoso_namespace }} -ojsonpath='{.items[0].spec.clusterIP}'
register: podified_cell1_mariadb_ip_result

- name: set MariaDB copy shell vars
Expand All @@ -19,7 +19,7 @@
PODIFIED_MARIADB_IP={{ podified_mariadb_ip_result.stdout }}
PODIFIED_CELL1_MARIADB_IP={{ podified_cell1_mariadb_ip_result.stdout }}
PODIFIED_DB_ROOT_PASSWORD="{{ podified_db_root_password }}"
MARIADB_CLIENT_ANNOTATIONS="-n {{ rhoso_namespace| default('openstack') }}"
MARIADB_CLIENT_ANNOTATIONS="-n {{ rhoso_namespace }}"
# The CHARACTER_SET and collation should match the source DB
# if the do not then it will break foreign key relationships
Expand Down
8 changes: 4 additions & 4 deletions tests/roles/mariadb_copy/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
kind: PersistentVolumeClaim
metadata:
name: mariadb-data
namespace: {{ org_namespace| default('openstack') }}
namespace: {{ org_namespace }}
spec:
storageClassName: $STORAGE_CLASS
accessModes:
Expand All @@ -40,7 +40,7 @@
annotations:
openshift.io/scc: anyuid
k8s.v1.cni.cncf.io/networks: {{ copy_pods_custom_networks | default('internalapi') }}
namespace: {{ org_namespace| default('openstack') }}
namespace: {{ org_namespace }}
labels:
app: adoption
spec:
Expand Down Expand Up @@ -71,7 +71,7 @@
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
oc wait --for condition=Ready -n {{ org_namespace| default('openstack') }} pod/mariadb-copy-data --timeout=10s
oc wait --for condition=Ready -n {{ org_namespace }} pod/mariadb-copy-data --timeout=10s
register: mariadb_data_pod_result
until: mariadb_data_pod_result is success
retries: 25
Expand All @@ -85,7 +85,7 @@
{{ mariadb_copy_shell_vars_src }}
for i in "${!SOURCE_GALERA_MEMBERS[@]}"; do
echo "Checking for the database node $i WSREP status Synced"
oc rsh -n {{ org_namespace| default('openstack') }} mariadb-copy-data mysql \
oc rsh -n {{ org_namespace }} mariadb-copy-data mysql \
-h "${SOURCE_GALERA_MEMBERS[$i]}" -uroot -p"$SOURCE_DB_ROOT_PASSWORD" \
-e "show global status like 'wsrep_local_state_comment'" | \
grep -qE "\bSynced\b"
Expand Down
2 changes: 1 addition & 1 deletion tests/roles/mariadb_copy/templates/dump_dbs.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Note Filter the information and performance schema tables
# Gnocchi is no longer used as a metric store, skip dumping gnocchi database as well
# Migrating Aodh alarms from previous release is not supported, hence skip aodh database
oc rsh -n {{ org_namespace| default('openstack') }} mariadb-copy-data << EOF
oc rsh -n "{{ org_namespace }}" mariadb-copy-data << EOF
mysql -h"${SOURCE_MARIADB_IP}" -uroot -p"${SOURCE_DB_ROOT_PASSWORD}" \
-N -e "show databases" | grep -E -v "schema|mysql|gnocchi|aodh" | \
while read dbname; do
Expand Down
2 changes: 1 addition & 1 deletion tests/roles/mariadb_copy/templates/restore_dbs.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ mariadb_copy_shell_vars_src }}
{{ mariadb_copy_shell_vars_dst }}

oc rsh -n {{ org_namespace| default('openstack') }} mariadb-copy-data << EOF
oc rsh -n "{{ org_namespace }}" mariadb-copy-data << EOF
# db schemas to rename on import
declare -A db_name_map
db_name_map['nova']='nova_cell1'
Expand Down

0 comments on commit 5ae43fd

Please sign in to comment.