OpenVZ-legacy
  1. OpenVZ-legacy

ploop.ovzl

Public
AuthorCommitMessageCommit dateIssues
Kir KolyshkinKir Kolyshkin
33c7e878d5bReleased ploop 1.12Changelog: see https://openvz.org/Download/ploop/1.12/changes Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
b68f919cacbploop info help: add -dThis is an addition to commit 0b51f0d. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
276dfc7aa4eploop_check(): use reopen_rw()1. reopen_rw(): check the result of close(), reassign new fd 2. modify check_and_repair_sparse to use *fd not fd 3. use reopen_rw() in ploop_check() Reference: ploop@1037067
Igor SukhihKir KolyshkinIgor Sukhih
9c528410b89[style] check.c: rearrange code to remove function declarationmove up: static int reopen_rw(const char *image, int *fd); static int fill_hole(const char *image, int *fd, off_t start, off_t end, int *log, int repair); static int check_and_repair_sparse(const char *image, int fd, __u64 cluster, int flags); Reference: ploop@1037054
Igor SukhihKir KolyshkinIgor Sukhih
f9eb8195141ploop_check: fixed reopen fd logicThis is a fix to commit 1bfbe42. Reference: ploop@1037051
Kir KolyshkinKir Kolyshkin
058480ef46amake_fs(): add tunefs -e remount-roAs suggested in bug #3025, it is good to remount ploop inner filesystem read-only as soon as kernel sees it is corrupted, in order to prevent any more damage. https://bugzilla.openvz.org/3025 Reported-by: Pavel Odintsov <pavel.odintsov@gmail.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
1bfbe4236bbploop_check(): don't pass -1 to closeThis fixes a complain from Coverity Scan: > CID 1228664 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS) > negative_returns: fd is passed to a parameter that cannot be negative. While at it, use close_safe() to close the old fd, so we can detect and report an error. Reference: ploop@1036954 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
e548c2d2e09check_and_repair_sparse(): reopen image rw if neededAfter the commit r1036784, we can be in the situation when image is opened as read-only but check_and_repair_sparse() needs to write to it. As we don't know beforehand whether we will need to write to an image file or not, let's fix it in a somewhat kludgy way -- as soon as we found out we need to write, check opened fd mode and reopen the image read/write if necessary. Note this is only perfo...2 Jira Issues
Kir KolyshkinKir Kolyshkin
b3aae6bc170fill_hole: use *fdReplace fd argument with pointer to it. This is a preparation for the next commit, to make it easier to read. Reference: ploop@1036951 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
7ea107768d6check_and_repair_sparse: use fill_hole ret codeSince fill_hole returns SYSEXIT_* values it makes sense to return those explicitly. Reference: ploop@1036950 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
164d098eab6fill_hole(): no need to bzero static bufIn C, statically-allocated objects without an explicit initializer are initialized to zero, so there is no need for explicit bzero(). While at it, mark buf as const to make sure it is kept as is (all zeroes). Reference: ploop@1036949 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
d5cbe9ae829ploop_check(): open image RO, reopen RW laterMost of the time writing to the image file is not required, so let's optimize for this case and open the file read only. Later, if an image has dirty flag set, of CHECK_DETAILED is set, reopen the file in read/write mode. This also helps with filesystems on which opening the file read/write is more expensive than opening it read-only. Reference: PSBM-26499 References: ploop@1036784, ploop@103...PSBM-26499
Kir KolyshkinKir Kolyshkin
a25968cf30fploop_create_{image,dd}: use ploop_di_add_image ret valueAs ploop_di_add_image is always returning proper SYSEXIT_* code, let's just use it directly, saving a couple lines of code. This also fixes a few cases of returning SYSEXIT_MALLOC instead of SYSEXIT_PARAM which ploop_di_add_image() returns sometimes. Reference: ploop@1031842 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
0da809ed5a3Added ploop_create_dd()Added functionality to create DiskDescriptor.xml at custom path int ploop_create_dd(const char *ddxml, struct ploop_create_param *param) Reference: PSBM-26581 References: ploop@1031445, ploop@1031841 Signed-off-by: Kir Kolyshkin <kir@openvz.org>PSBM-26581
Igor SukhihKir KolyshkinIgor Sukhih
8e5b3a75cc1fsutils.c: quiet fsckfsck output can broke tools parser. There is no quiet option for fsck so just redirect stdout to /dev/null # fsck -p /dev/ploop26995p1 fsck from util-linux-ng 2.17.2 /dev/ploop26995p1: clean, 12/655360 files, 83119/2620928 blocks [kir@: errors from fsck will still be shown on stderr] Reference: PSBM-26738 Reference: ploop@1008262PSBM-26738
Kir KolyshkinKir Kolyshkin
a093baa5839ploop_get_max_size: improve description, move to cWe do not have descriptions of our public functions in libploop.h file, so let's not start doing it. So far, the best documentation for such functions is their code itself, so let's keep the description close to the code. This is an addition to the previous commit 71be8d5 Cc: Nikolay Shirokovskiy <nshirokovskiy@parallels.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Nikolay ShirokovskiyKir KolyshkinNikolay Shirokovskiy
b46eecff3e6ploop_get_max_size(): add[kir@: add dynload.h entry] Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com> Acked-by: Igor Sukhih <igor@parallels.com> Reference: PSBM-26570 - ""ploop convert" fails to convert the container due to huge limit for "diskinodes"" Reference: ploop@1028131 Signed-off-by: Kir Kolyshkin <kir@openvz.org>PSBM-26570
Kir KolyshkinKir Kolyshkin
5d606213507De-introduce SYSEXIT_INUSEThis was introduced by the previous commit 22ff44b (aka ploop@1025736) for the sole purpose of reporting the "in-use flag is set" condition from get_image_param_offline(), which, in turn, takes it from errno value explicitly set to EBUSY by open_delta(). This condition is then checked in the only place -- do_create_snapshot(). Note that SYSEXIT_* codes are part of public API, but this new valu...
Igor SukhihKir KolyshkinIgor Sukhih
ebb6e5213b3create_snapshot: clear stale top delta inuse flagSometimes after the node crash the top delta in-use flag is left set, so snapshot creation returns an error. Handle this particular case by calling check_delta to validate top delta and drop inuse flag on create snapshot. Reference: PSBM-27694 "Failed to create the snapshot: Operation failed. %1 after node crash" References: ploop@1025736, ploop@1026188 Signed-off-by: Kir Kolyshkin <kir@openv...PSBM-27694
Kir KolyshkinKir Kolyshkin
c9439349f67ploop(8): document ploop info -dThis is an addition to commit 0b51f0d Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Nikolay ShirokovskiyKir KolyshkinNikolay Shirokovskiy
0b51f0d7d85ploop info: add -d to show ploop deviceReference: PSBM-26990 Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com> Acked-by: Igor Sukhih <igor@parallels.com> References: ploop@1025015, ploop@1026043PSBM-26990
Kir KolyshkinKir Kolyshkin
9d151b06195tune_fs: fix error message, assorted nitpicksA few nitpicks after commit 5a0ab39 (ploop@1022894), in the order of importance; 1. Fix an error message (s/for size/to/, obviously a copy-paste error) 2. Pass errno to ploop_err() to know why ioctl failed 3. An empty line between variable declarations and code 4. Some more empty lines to improve code readability. 5. A comma in a comment. Reference: ploop@1025878 Signed-off-by: Kir Kolysh...
Dmitriy MonakhovKir KolyshkinDmitriy Monakhov
5a0ab39da92tune_fs(): use EXT4_IOC_SET_RSV_BLOCKS if availableWe have to update reservation block counts according to balloon size. One can do that directly via tune2fs which is not good for mounted fs, and should use this ioctl instead EXT4_IOC_SET_RSV_BLOCKS is available since 042stab092.1. In case it's not there, fall back to old implementation. Signed-off-by: dmonakhov@openvz.org Committed-by: igor@openvz.org Reference: PSBM-25929 "Error in __ploop_...PSBM-25929
Igor SukhihKir KolyshkinIgor Sukhih
71c50ce3835ploop_delete_snapshot: fix for temp snapshotIn case snapshot guid supplied is one of temp snapshot, we first implicitly delete it in merge_temporary_snapshots(), then try to delete it again explicitly in do_delete_snapshot() and we fail. To fix, move merge_temporary_snapshots() to after do_delete_snapshot. Reference: PSBM-27327 "Error in do_delete_snapshot (snapshot.c:61): Can't find snapshot by uuid" Reference: ploop@1021028, ploop@10...PSBM-27327
Kir KolyshkinKir Kolyshkin
01e7bd62da5reset_top_delta(): rm irrelevant messageApparently a copy-paste leftover. This is an addition to commit 86f3119 (ploop@1019626) Reference: ploop@1020175 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
86f31196486ploop_switch_snapshot_ex: fixed case with PLOOP_SNAP_SKIP_TOPDELTA_CREATEThe PLOOP_SNAP_SKIP_TOPDELTA_CREATE used in rollback, move logic to separate function Reference: ploop@1019626
Igor SukhihKir KolyshkinIgor Sukhih
9f7a9f831bemerge_temporary_snapshots: fix infinite loopIn case a snapshot with references deleted, there's an infinite loop. Reference: ploop@1019621
Kir KolyshkinKir Kolyshkin
89b657c221ado_delete_snapshot(): fix a warningFix and improve a warning message about inability to remove a snapshot with >1 references to it, and marking it as temp. This is an addition to commit ploop@1016663 aka 32711a4. Reference: ploop@1016859 Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
eeb46fe42c9do_delete_snapshot: deny delete top delta in case parent snapshot is temporaryCreating temporary snapshot and deleting top delta broke DiskDescriptor.xml: ploop tsnapshot -u {aff55492-7320-4d72-aedd-c1e303a22cc1} -c test DiskDescriptor.xml ploop snapshot-delete -u {5fbaabe3-6958-40ff-92a7-860e329aab41} DiskDescriptor.xml ploop mount DiskDescriptor.xml Error in validate_disk_descriptor (xml.c:327): Validation of /vz/igor/Virtuozzo/current/ploop/DiskDescriptor.xml f...
Igor SukhihKir KolyshkinIgor Sukhih
32711a466daBUGFIX Can not delete snapshot with multiple refsThe direct way to delete snapshot with > 1 references is to make a copy of a snapshot image and merge with the copy * Delete A A -> B => A -> B => B \-> C A -> C A -> C Let's handle in another way, mark as temporary and merge when it will be possible Reference: PSBM-27154 "Can not delete snapshot of Container - double referenced" Reference: ploop@1016663PSBM-27154
Kir KolyshkinKir Kolyshkin
d77b58792cfploop_switch_snapshot_ex(): don't return 0 if guid_old is badCode checks that param->guid_old is (1) valid and (2) non-existent, and prints and error if any of those checks fails, but returns 0 instead of an error. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
31fc986e249do_delete_snapshot: fix wrt temp snapshot uuidTemporary snapshot uuid is changed if topdelta is deleted. Call check_snapshot_mount() to validate snapshot-delete action Use case: ploop tsnapshot ploop snapshot-delete <TOP_DELTA_UUID> Reference: ploop@1015313
Kir KolyshkinKir Kolyshkin
17a8a4181dcploop_resize_image(): handle get_mount_dir() errorget_mount_dir() return value is not boolean, but rather a 3-state. It doesn't make sense to proceed if it returned an error, as it's probably fatal. While at it, document get_mount_dir() return values. Signed-off-by: Kir Kolyshkin <kir@openvz.org> git-svn-id: https://svn.parallels.com/parallels/vzlin/utils/current/ploop@1015021 3f79cd19-dd19-0410-83c5-8b167e6f9dce Signed-off-by: Kir Kolyshki...
Igor SukhihKir KolyshkinIgor Sukhih
a60cc48a742ploop_resize_image: auto-mount fsProblem: unable to resize ploop if it is running but fs is not mounted Solution: automount file system before performing online resize Reference: PSBM-26764 Reference: ploop@1013361PSBM-26764
Kir KolyshkinKir Kolyshkin
d83a0ff52c4ploop_store_diskdescriptor(): fix error msgAfter commit b519e4c, we call a different function, so fix the error message accordingly. @noreview Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
b1026985fcaploop_store_diskdescriptor: fix typo, show errno1 s/Faled/Failed/ to fix a typo. 2 s/Failed/Can't/ to use a verb we tend to use more often. 3 Pass errno to ploop_err() to show why exactly we can't. This is an addition to commit b519e4c Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Igor SukhihKir KolyshkinIgor Sukhih
b519e4c630eploop_store_diskdescriptor: fsync DiskDescriptor.xmlProblem: DiskDescriptor.xml is empty after host's hard reboot Solution: call fsync() before rename Reference: PSBM-27028 Reference: ploop@1013886PSBM-27028
Kir KolyshkinKir Kolyshkin
802af7ca006ploop copy: fix open_mount_point err handlingBefore this patch: # ploop -vvvv copy -s /dev/ploop47147 -d file [ 0.000337] Error in open_mount_point (pcopy.c:357): Can't open : No such file or directory Apparently, ploop_get_mnt_by_dev() can return 1 in case there is no error, but mount point can't be found, therefore we should check for non-zero, not just < 0. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
cdfea9d65c9ploop_copy_send(): fix potential NULL derefAs pointed out by Coverity, CID 1216781. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
c0c69ddc376ploop_copy_send(): add check for feedback_fdIf feedback_fd is specified, check that it is a pipe or a socket. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
9af38b5d5b5ploop_copy_receive(): improve fd checksUse is_fd_pipe() to check both input fd and feedback fd. Also, print fd in error message. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
28243231ae4ploop_copy_send_param: remove ofd_is_pipeThere is no need to explicitly specify if a file descriptor is a pipe/socket or not, as we can just use stat() to find it out. While at it, move the check for valid fd from plooptool_copy() to ploop_copy_send(), and make it more strict -- instead of checking that FD is not a TTY we require a file, a pipe, or a socket. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
a1c7b0efc75lib/pcopy.c: mark send_thread() as staticSigned-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
6662365ec33ploop copy -s -d: remove file in case of failureIn case ploop copy send form is used to write directly to a file, we create the file in tools/ploop-copy.c and we should remove it in case ploop_copy_send() failed. While at it, close fd as well. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
bcaf7c76020ploop copy: improve error messageSigned-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
8bb826b4579ploop_copy*: check arg for non-NULLRather than segfault on NULL argument, return SYSEXIT_PARAM. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
a55e26e9606ploop_copy_send(): implement async sendAs pointed out by a comment (removed by this patch), reads from ploop delta files are O_DIRECT, as ploop is avoiding using page cache (to prevent double caching, as caching is done on an inner fs level). So, O_DIRECT reads are slow, and therefore it is good if we can do those in parallel with writes. This is what this patch implements. We use two buffers and a separate thread to send data. Fi...
Kir KolyshkinKir Kolyshkin
b22f552ee18ploop_copy_send(): introduce/use do_pread macroWe do the same thing a few times -- read, check if the result is negative. Let's wrap it in a macro. While at it, fix some error checks and appropriate messages: * negative number is an error (and is taken care of inside a macro * 0 is an EOF and it depends whether it's an error or OK * any number less than required can be either a short read error or OK Signed-off-by: Kir Kolyshkin <kir@open...
Kir KolyshkinKir Kolyshkin
0946af95a9bploop copy: add -f feedback_fd optionAdd support for feedback_fd for ploop copy tool. See previous commit for explanation. Document it in ploop(8). TODO: add examples. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Kir KolyshkinKir Kolyshkin
20d754c9107ploop_copy_*: add feedback_fdBefore now, ploop copy protocol used to be one way, from a sender to a receiver. While it is perfectly fine for most scenarios, there is one particular operation that can benefit from the explicit completion notification -- this is remote fsync() introduced in commit d56654a. Now, if there is a way to establish either a two-way pipe (say using socketpair() or ssh port forwarding) or just a sec...