Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: rbd-mirror: compare positions using all fields #8172

Merged
merged 1 commit into from Mar 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 3 additions & 10 deletions qa/workunits/rbd/rbd_mirror.sh
Expand Up @@ -216,21 +216,14 @@ get_position()
local image=$1
local id_regexp=$2

# Parse line like below, looking for the first entry_tid
# Parse line like below, looking for the first position
# [id=, commit_position=[positions=[[object_number=1, tag_tid=3, entry_tid=9], [object_number=0, tag_tid=3, entry_tid=8], [object_number=3, tag_tid=3, entry_tid=7], [object_number=2, tag_tid=3, entry_tid=6]]]]

local status_log=${TEMPDIR}/${RMT_CLUSTER}-${POOL}-${image}.status
rbd --cluster ${RMT_CLUSTER} -p ${POOL} journal status --image ${image} |
tee ${status_log} >&2
sed -Ee 's/[][,]/ /g' ${status_log} |
awk '$1 ~ /id='"${id_regexp}"'$/ {
for (i = 1; i < NF; i++) {
if ($i ~ /entry_tid=/) {
print $i;
exit
}
}
}'
sed -nEe 's/^.*\[id='"${id_regexp}"',.*positions=\[\[([^]]*)\],.*$/\1/p' \
${status_log}
}

get_master_position()
Expand Down
13 changes: 3 additions & 10 deletions qa/workunits/rbd/rbd_mirror_image_replay.sh
Expand Up @@ -110,20 +110,13 @@ get_position()
{
local id=$1

# Parse line like below, looking for the first entry_tid
# Parse line like below, looking for the first position
# [id=, commit_position=[positions=[[object_number=1, tag_tid=3, entry_tid=9], [object_number=0, tag_tid=3, entry_tid=8], [object_number=3, tag_tid=3, entry_tid=7], [object_number=2, tag_tid=3, entry_tid=6]]]]

local status_log=${TEMPDIR}/${RMT_POOL}-${IMAGE}.status
rbd -p ${RMT_POOL} journal status --image ${IMAGE} | tee ${status_log} >&2
sed -Ee 's/[][,]/ /g' ${status_log} |
awk '$1 == "id='${id}'" {
for (i = 1; i < NF; i++) {
if ($i ~ /entry_tid=/) {
print $i;
exit
}
}
}'
sed -nEe 's/^.*\[id='"${id}"',.*positions=\[\[([^]]*)\],.*$/\1/p' \
${status_log}
}

get_master_position()
Expand Down