This will prevent a user from inadvertantly reapplying a diff twice.
Signed-off-by: Sage Weil <sage@inktank.com>
rbd export-diff foo@three --from-snap two foo.diff
rbd import-diff foo.diff foo.copy
+rbd import-diff foo.diff foo.copy && exit 1 || true # this should fail with EEXIST on the end snap
rbd snap ls foo.copy | grep three
rbd export foo foo.out
if (r < 0)
goto done;
dout(2) << " to snap " << to << dendl;
+
+ // verify this snap isn't already present
+ if (image.snap_exists(to.c_str())) {
+ cerr << "end snapshot '" << to << "' already exists, aborting" << std::endl;
+ r = -EEXIST;
+ goto done;
+ }
}
else if (tag == 's') {
uint64_t end_size;