Merge pull request #37429 from trociny/wip-47665

rbd-nbd: don't ignore namespace when unmapping by image spec

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2020-09-28 19:43:53 -04:00 committed by GitHub
commit 7fb1a53172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -110,7 +110,7 @@ unmap_device()
for s in 0.5 1 2 4 8 16 32; do
sleep ${s}
rbd-nbd list-mapped | expect_false grep "^${pid}\\b" &&
! ps -p ${pid} -C rbd-nbd &&
ps -C rbd-nbd | expect_false grep "^${pid}\\b" &&
return 0
done
return 1
@ -230,6 +230,16 @@ get_pid ${NS}
unmap_device "${POOL}/${NS}/${IMAGE}@snap" ${PID}
DEV=
# unmap by image name test 2
DEV=`_sudo rbd-nbd map ${POOL}/${IMAGE}`
get_pid
pid=$PID
DEV=`_sudo rbd-nbd map ${POOL}/${NS}/${IMAGE}`
get_pid ${NS}
unmap_device ${POOL}/${NS}/${IMAGE} ${PID}
DEV=
unmap_device ${POOL}/${IMAGE} ${pid}
# auto unmap test
DEV=`_sudo rbd-nbd map ${POOL}/${IMAGE}`
get_pid

View File

@ -1602,8 +1602,8 @@ static bool find_mapped_dev_by_spec(Config *cfg) {
Config c;
NBDListIterator it;
while (it.get(&pid, &c)) {
if (c.poolname == cfg->poolname && c.imgname == cfg->imgname &&
c.snapname == cfg->snapname) {
if (c.poolname == cfg->poolname && c.nsname == cfg->nsname &&
c.imgname == cfg->imgname && c.snapname == cfg->snapname) {
*cfg = c;
return true;
}