Add --with-snapshots to vitastor-cli modify --rename #191
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:cli-rename-snapshots"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Snapshots are separate inodes named
<image>@<snap>, tied to their image only by that name.vitastor-cli modify <image> --rename <new>renames the image alone, so its snapshots keep the old name: they no longer show up as the image's snapshots (the OpenStack driver looks them up as<volume>@<snap>), and a new image created under the old name would look like their owner.This adds
--with-snapshotstomodify --rename. The default stays as it was. With the option, after the image is renamed, every<old>@*is renamed to<new>@*one by one through the usual single-image rename. The rename is refused before anything changes if any<new>@*already exists. If a snapshot rename fails, the error says that the image is already renamed and names the snapshot that is not.Found: seen on a test stand: after an image was renamed, its snapshot kept the old name, dropped out of the image's snapshot list and was left behind when the image was deleted.
Tested: new
tests/test_modify_image_rename.sh(etcd only). It checks that with--with-snapshotsthe snapshots, the/index/imagekeys andparent_namefollow the rename. It also checks that the rename is refused with nothing changed when<new>@*exists, and that without the option only the image is renamed. Passes with the change; on master the option is ignored and the first check fails.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
Ну по дефолту так делать точно не нужно
В крайнем случае можно добавить опцию --with-snapshots или типа того
Кстати транзакционно это делать особо-то и не нужно, их можно последовательно переименовать вполне
Rename snapshots together with the image in vitastor-cli modifyto Add --with-snapshots to vitastor-cli modify --renameПеределал: по умолчанию всё как было, снимки переименовываются только с
--with-snapshots, по одному после образа обычным rename, без общей транзакции.Отказ, если какой-то
<new>@*уже существует, оставил; тест проверяет и опцию, и поведение без неё.