]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd: disallow migrating when image has group/trash snapshot
authorsongweibin <song.weibin@zte.com.cn>
Thu, 3 Jan 2019 07:34:30 +0000 (15:34 +0800)
committersongweibin <song.weibin@zte.com.cn>
Thu, 3 Jan 2019 08:39:00 +0000 (16:39 +0800)
commit9c9dd1cfadc6cee352a10c0be82e9afddcd11afe
tree4d42fc273d40938ac36bdf086df19a03a9ed8402
parent5c71f5421c13f6e7ff2e82c8313b40a857d6ec36
librbd: disallow migrating when image has group/trash snapshot

Fixes:
Two potential problems with group/trash snapshot:
(1) ENOENT is returned when retrieving the snapshot status;
(2) if ignore ENOENT from (1) and allow migrating, it will failed too
when removing src image in the `migration commit` step.
So disallowing migration directly.
```
[swb@ ~/ceph/ceph-dev/build]$ rbd snap rm img1@snap1
Removing snap: 100% complete...done.
[swb@ ~/ceph/ceph-dev/build]$ rbd snap ls -a img1
SNAPID NAME                                 SIZE   PROTECTED TIMESTAMP                NAMESPACE
     4 cfeca8c8-237e-4682-b0b8-2875fd17251d 10 MiB           Thu Jan  3 15:58:59 2019 trash (snap1)
[swb@ ~/ceph/ceph-dev/build]$ rbd migration prepare img1 m1
2019-01-03 16:00:09.374 7fa758b1d040 -1 librbd::Migration: list_snaps: failed retrieving snapshot status: (2) No such file or directory
rbd: preparing migration failed: (2) No such file or directory
```

Signed-off-by: songweibin <song.weibin@zte.com.cn>
src/librbd/api/Migration.cc