OpenVZ-legacy
  1. OpenVZ-legacy

ploop.ovzl

Public
AuthorCommitMessageCommit dateIssues
Kir KolyshkinKir Kolyshkin
2bdd4e8783cReleased ploop 1.13Changelog: see https://openvz.org/Download/ploop/1.13/changes Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
576ae64dba6normalize_image_name(): fix for slash-ended basedirAfter commit f11090d, when basedir already ends with '/' character, this function stops working correctly. Ideally, we have to check if basedir ends with slash, add it if missing then compare the beginning of image file name with that string. Practically, that would mean copying the basedir string over to some new place, adding slash, etc. So, we'd better compare the strings without the slash...
Kir KolyshkinKir Kolyshkin
1747e45c492snapshot-merge: fix/improve message about deltasI just noticed that ploop snapshot-merge with -n prints somewhat confusing information about merged deltas, i.e. it always prints "child_delta -> parent_delta", although in case of "-n new_delta" it shoulld be something like "child_delta parent_delta -> new_delta". Also, all delta files are printed as absolute paths, making the output a bit cluttered. This patch makes use of normalize_image_na...
Kir KolyshkinKir Kolyshkin
92936d6aa8cploop(8): move restore-descriptor description... to the appropriate subsection (under "Misc commands"). Previously it was in "Ballooning" subsection. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
2c96a0b16b1ploop(8): describe snapshot-merge -n optionThis is an addition to commit 7f5bcab. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
cee262e89c3ploop_replace_image(): fix wrt levelThe code very incorrectly assumed that dd.xml idx == level. This is surely not true in case dd.xml contains non-linear chain of snapshots/deltas. Fix by treating index and level separately. While at it, also enable the case of replacing an unused delta on a running ploop device. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
1faeae7201ffind_image_idx_by_file(): normalize imageInstead of requiring from a caller to normalize image file name, let the function itself do it. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
02873a84b31ploop_get_delta_attr_str(): addThis is currently only used to get file name of image file for a given level. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
04aab34117bfind_level_by_delta(): rework/improveFirst and most important change in find_delta_by_level() is it now compares files by the device and inode numbers, not by names. Also: * return SYSEXIT_* codes * found level is returned via last argument This way we can simplify its callers a bit. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
ad3a614e090Return back multi-level snapshot mergeMulti-level snapshot merge functionality was always available: 1. merge_image() function -- but it is not part of public ploop lib API 2. ploop merge with multiple deltas or levels -- but it is not using DiskDescriptor.xml This commit brings back the multi-level merge functionality. Now, if ploop_merge_param.guid2 is set, ploop_merge_snapshot() tries to merge all snapshots in the guid...
Kir KolyshkinKir Kolyshkin
8640698e693ploop_merge_snapshot_by_guid(): fix error messageFix message "Unable to merge snapshot %s: it has %d children": * merge snapshot -> merge to snapshot * Unable to -> Can't Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
c2c9b0f65e4ploop_di_merge_image: fix error messages1. Message "Unable to merge snapshot %s: it has %d children" is wrong, because: - it talks about guid but it should be parent guid - it says "merge snapshot" but we are not merging it -- we are merging TO it. Note this message can never be seen because we do the very same check earlier in ploop_merge_snapshot_by_guid(). 2. Message "Unable to merge image %s" is wrong, it sh...
Kir KolyshkinKir Kolyshkin
557a3ae3b5fploop(8): expand description of snapshot-mergeThere is a certain incomprehension in what is the difference between snapshot-delete and snapshot-merge. This patch tries to improve snapshot-merge description by telling what exactly is going on during this operation. Note that snapshot-delete is already described. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
e899a7db70dcheck_snapshot_mount(): add is_device_inuse() checkTemporary snapshots are supposed to be removed as long as they are not in use anymore. There is a way to mark the temporary snapshot as being used -- open its corresponding ploop device (see holder_fd parameter to ploop_create_temporary_snapshot()). Other places dealing with temporary snapshots check that the snapshot is not in use (see merge_temporary_snapshots() that calls is_snapshot_in_use(...
Kir KolyshkinKir Kolyshkin
c80141418bbRework check_snapshot_mount() v2This commit tries to make check_snapshot_mount() easier. The motivation behind the change is it was used incorrectly from do_delete_snapshot(). In do_delete_snapshot() we only want to check one snapshot and we don't care about the parent one. So, let's simplify it to only check one snapshot. In ploop_merge_snapshot_by_guid() we want to check two snapshots -- the parent one and the child one. ...
Kir KolyshkinKir Kolyshkin
c46f3887548ploop_merge_snapshot_by_guid: fix ending messageWe should always print the name of the parent snapshot, i.e. the one that was merged into a child one and which UUID remains. Otherwise it's not clear which snapshot was merged into which. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
3c41e09b5c4Introduce make_images_list_by_guids()1. Modify existing make_images_list() function, adding the end_guid parameter. If end_guid == NULL it works exactly as before. 2. Rename it to make_images_list_by_guids() 3. Add make_images_list() wrapper for compatibility 4. Document the new function. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
1661e17d00aploop_merge_snapshot_by_guid(): fix error messageThis is a fix to commit 7f5bcabe. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
79a2ee30001ploop_merge_snapshot_by_guid(): untangleUntangle the PLOOP_MERGE_WITH_PARENT/PLOOP_MERGE_WITH_CHILD mess so now it is more readable and shorter (no duplicated code). The only downside is we can no longer distinguish between "no parent guid found" and "can't merge base image" errors, so let's modify the error message accordingly. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
530455021d7mv get_child_by_uuid -> find_child_by_guidRename ploop_get_child_by_uuid() to ploop_find_child_by_guid() This is done for readability and uniformity with ploop_find_parent_by_guid() Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
aeed3c34f94ploop_di_merge_image(): remove last argumentThis function is only called from ploop_merge_snapshot_by_guid(), and in there we already know the file name corresponds to child_guid. Remove it, making the code just a little bit less cryptic. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
f6df47393f6merge_image(): documentThis patch just adds some comments describing merge_image(). Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
54f0be0a38eploop tool: usage formatting fixes1. Unify parameters presentation -- should be uppercase and unquoted, e.g. UUID (not uuid, not <uuid). 2. When describing a parameter, use "NAME := description" style. 3. Don't use tabs inside strings printed by usage_*() functions. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
b94759077b6ploop tsnapshot(): fix usageWrong usage (from snapshot not tsnapshot) was printed in case of invalid command line. This is a fix to commit 785f4da. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
04042fc4fc3ploop_merge_snapshot_by_guid(): fix error messageDo not free() the filename string before printing it. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
95748c49c5eploop_replace_image(): rm param NULL checkLet's not check param argument for being NULL, as 1 It should never be NULL anyway 2. Since commit fafab72 we are dereferencing it before doing this check (in keep assignment) so the check is totally useless now. This is an addition to commit fafab72. Reported by Coverity, CID 1287120. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
65450555658ploop_umount_fs(): simplify retThere's no need to check ret value. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
1558fa6daadploop_umount(): don't return -1, use SYSEXIT_*The return value from this function is returned by a few functions that expect to return SYSEXIT_* values, such as ploop_delete_snapshot() and ploop_merge_snapshot(). Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
c876e3eb95dploop replace: implement offline replaceAn offline replace is just a way to replace a file name in DiskDescriptor.xml with some other file name. In this mode, same checks are performed in a new delta. Flag --keep-name is also supported, in such case ploop replace works like "mv -f" but with bells and whistles (all the checks etc.) Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
aa30858a8e0ploop_replace_image(): optimization for keep_nameIn case KEEP_NAME flag is set, we need to rename the new image file to the current (old) one. But as in-kernel ploop driver doesn't allow to remove (or rename(), as it comes out) a delta file which is in use unless its hardlink count is > 1, we have to make a trick here: - create a hardlink to the file - rename it - remove the hardlink It just occured to me we can avoid doing this trick if ...
Kir KolyshkinKir Kolyshkin
0f65c267627ploop replace: add long option --keep-nameThis is the same as recently introduced -k. Man page and usage() modified accordingly. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
e832147211bploop_replace_image(): always unlock dd.xmlSpotted a few cases when we return error right away, without unlocking DiskDescriptor.xml. Fix those. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
f11090d2cffnormalize_image_name(): fix for corner caseChances to hit this bug are pretty slim, but I just did it. For the following input parameters: basedir="/vz/private/104/root.hdd" image="/vz/private/104/root.hdd.{86be108e-d30e-4054-b6d4-412d4d0c2ce6}" function errorneously returned {86be108e-d30e-4054-b6d4-412d4d0c2ce6} Apparently, we need to add a check for '/' right after basedir. Note we do this check right after strncmp which retu...
Kir KolyshkinKir Kolyshkin
ef40cb081b7setver.sh: add -o|--oldpackage optionSame as --oldpackage for RPM. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
24bb4497121setver.sh: also set version in Makefile.incAs per previous commit, now we need to set version (and, optionally, release) in Makefile.inc. Logic is similar to that for the spec file, aside the special treating for RELEASE variable: - release of "1" becomes empty - non-empty release is prepended with a dash Fix trap statements accordingly, due to more complex rollback procedure. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
55327e48c33Makefile.inc: specify package versionDue to a new build environment we won't use a spec file from the same repository as the sources, so we can't rely on .spec file to hold the version of the package. Therefore, let's specify package version (and optional RELEASE which should usually be empty) in Makefile.inc which is included into other Makefiles. lib/Makefile determines library version from the package version the same way as b...
Kir KolyshkinKir Kolyshkin
a8304792b9aploop_replace_image(): add check for keep_nameWhen KEEP_NAME flag is set, do a check that a file could be renamed to old file. to error out early if it couldn't. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
fafab72fca9ploop replace: implement -kCurrently, replacing a delta means changing its file name. This commit adds a flag to keep the same file name. If this flag is set, after successful replace a new delta is renamed to the old one (removing it!). This makes it possible to replace a delta without modifying dd.xml Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
5be788835fd[style] ploop_replace_file(): comment style fixesNo change to the code. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
4952a0abdc2[style] ploop_replace_image: reuse oldfile varDo not mess with oldfile variable while writing conf_tmp dd.xml file. Use oldfile when printing "Replacing ..." log message, so that oldfile will look exactly like specified from the command line (if specified). Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihIgor Sukhih
5691b39d8fbsetting library version from ploop.speclets do not use ploop.spec to set library version * spec is not part of API * spec is not stored in same sources tree Signed-off-by: Igor Sukhih <igor@parallels.com>
Kir KolyshkinKir Kolyshkin
28dc464d271copy_delta(): 32-bit compile fixThis is a fix to commit 6c781717. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
37d72b004d5grow_lower_delta(): fix a memory leakReported by Coverity, CID 1270998. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
a5befc982eaprint_sys_block_ploop(): compile fixThis is a fix to commit 6d00f65 -- I accidentally commited old version Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
b9e953422cdlib/ploop-copy.c: compile fixThis is an addition to commit c6c0650 after 1f548e2. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
232eb869855ploop merge: obsolete form with DD.xmlIt's not quite clear how ploop tool ended up with two commands doing the same thing, but it did: - ploop merge <dd.xml> - ploop snapshot-merge <dd.xml> are doing the same thing. Now, "ploop merge" was originally a low-level ploop command, while "ploop snapshot-merge" is a form to be used with dd.xml. Let's make it this way to avoid user confusion and code repetition. Now, if ploop merge is...
Kir KolyshkinKir Kolyshkin
c6c0650206dRemove delta_fopsThis came from a prehistoric implementation. Currently we only use standard filesystems operations (and do not use update_size() op), so this abstraction layer is no longer required. Acked-by: Igor Sukhih <igor@parallels.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
6d00f65cb6cprint_sys_block_ploop(): print less infoThis function is called when EBUSY is returned from ADD_DELTA or REPLACE_DELTA ploop ioctl, in order to figure out why delta is busy (presumably it is used by another ploop device). As we don't need to print the whole contents of /sys/block/ploop*, but rather some specific info from pdelta. According to Maxim Patlasov, having pdelta/{image,ro,io} is enough. This helps to reduce the output, as...
Igor SukhihIgor Sukhih
3ed1e46506etest: test python ploop copy functionality* local pcopy test * remote pcopy test Signed-off-by: Igor Sukhih <igor@parallels.com>
Igor SukhihIgor Sukhih
fb1f0881ba3MAJOR added pyhton binding to ploop copy functionalitystatic PyMethodDef PloopMethods[] = { { "open_dd", libploop_open_dd, METH_VARARGS, "Open DiskDescriptor.xml" }, { "close_dd", libploop_close_dd, METH_VARARGS, "Close DiskDescriptor.xml" }, { "copy_init", libploop_copy_init, METH_VARARGS, "Init ploop copy handle" }, { "copy_start", libploop_copy_start, METH_VARARGS, "Make initial ploop copy" }, { "copy_nex...PSBM-28485