set_pool_image_name(destname, (char **)&dest_poolname,
(char **)&destname, (char **)&dest_snapname);
+ if (dest_snapname) {
+ // no command uses dest_snapname
+ cerr << "rbd: destination snapname specified for a command that doesn't use it"
+ << std::endl;
+ return EXIT_FAILURE;
+ }
if (opt_cmd == OPT_IMPORT) {
if (poolname && dest_poolname) {
return EXIT_FAILURE;
}
- if ((opt_cmd == OPT_CLONE) && dest_snapname) {
- cerr << "rbd: cannot clone to a snapshot" << std::endl;
- return EXIT_FAILURE;
- }
-
if ((opt_cmd == OPT_CLONE) && size) {
cerr << "rbd: clone must begin at size of parent" << std::endl;
return EXIT_FAILURE;
$ rbd lock remove --snap=snap img id client.1234
rbd: snapname specified for a command that doesn't use it
[1]
+
+ $ rbd clone foo@snap bar@snap
+ rbd: destination snapname specified for a command that doesn't use it
+ [1]
+ $ rbd import /bin/ls ls@snap
+ rbd: destination snapname specified for a command that doesn't use it
+ [1]
+ $ rbd cp foo bar@snap
+ rbd: destination snapname specified for a command that doesn't use it
+ [1]
+ $ rbd cp foo@snap bar@snap
+ rbd: destination snapname specified for a command that doesn't use it
+ [1]
+ $ rbd mv foo bar@snap
+ rbd: destination snapname specified for a command that doesn't use it
+ [1]
$ rbd unmap
rbd: unmap requires either image name or device path
[1]
- $ rbd clone foo@snap bar@snap
- rbd: cannot clone to a snapshot
- [1]
$ rbd cp foo
rbd: destination image name was not specified
[1]