ploop: check qcow2 images on device umount, #PSBM-152511Implement a check of images when umounting a qcow2 backed device.
Fix order of methods in dynload.h - they need to be at the
end of the struct.
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: validate images before creating ddxml, #PSBM-152511When creating qcow2 device there is no ddxml so we create it
internally - to avoid inconsistencies validate all images
provided as arguments. And only if valid build ddxml from them.
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: remove support for qcow2 image with specific name, #PSBM-152511Can not use fixed file name when working with multiple images.
So remove the support for it.
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
libploop: implement get_img_fd kernel interface, #PSBM-154498It is implemented both in dm-ploop and dm-qcow2 drivers
add library support for it.
https://virtuozzo.atlassian.net/browse/PSBM-154498
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
libploop: add interface for qcow2 merge backwards, #PSBM-152511implement library function for backward merge of qcow2 images
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
libploop: add missing check for failed allocation, #PSBM-152511Check if strdup succeeded and cleanup if not.
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: allow passing a list of images for mounting, #PSBM-152511Introduce -a option to mount a list of qcow2 images.
It is important to follow the bottom to top order of deltas.
ploop mount -a img1.qcow2 img2.qcow2 ....
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
libploop: qcow2: support for multiple images, #PSBM-152511Do not use just a single image but process all images referenced in
struct ploop_disk_images_data.
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
libploop: qcow2: load backing store file names, #PSBM-152511To implement basic validation of images order we need to use
backing store file names from images. Load and cache so we can
perform validation.
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
libploop: introduce helpers for managing runtime data, #PSBM-152511move managing runtime data into helper functions.
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
libploop: introduce helpers for opening list of images,#PSBM-152511struct ploop_disk_images_data is filled from DiskDescriptor.xml
but in the case of qcow2 images there is no such file.
Build it instead from a list of images provided.
https://virtuozzo.atlassian.net/browse/PSBM-152511
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
statistics: introduce public function for storing statfs #PSBM-154495Signed-off-by: Aleksandr Leskin <aleksandr.leskin@virtuozzo.com>
Conflicts:
include/dynload.h
lib/ploop.c
Merge pull request #294 in OVZ/ploop from ~AATANASOV/ploop:PSBM-151232-take2 to master* commit 'ec79248e2bb43fc819cb0275e7f7018adfaba722':
ploop: Disable xfs defrag since it only works on files, #PSBM-151232, #PSBM-151557
ploop: Disable xfs defrag since it only works on files, #PSBM-151232, #PSBM-151557Disable xfs defrag until it works properly
We want to defragment filesystem and release unused blocks
but xfs_fsr only does defragment files. The problem is that
defragmentation process makes copies of each file and allocates
more clusters instead of releasing free ones.
As a result after the temporary files are removed we observe
x5-8 grow of used space on the undelaying device.
https://virtu...
ploop: fix crash on umount when device is not available, #VSTOR-76762On umount a ploop_check is performed on the device and on failure
it is retried with the device suspended but during HA event
it is possible device to be unavailable and the second check to crash
on suspend. Handle gracefuly this situation - do not attempt to
suspend a NULL device.
https://pmc.acronis.work/browse/VSTOR-76762
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: typo fix #PSBM-151232Fix typo for commit: 45fcd9671051293f25fabb8840c3a00c670e706e
ploop: fix balloon discard for ext4 and xfs, #PSBM-151232
Alexander Atanasov <alexander.atanasov@virtuozzo.com>
Signed-off-by: Aleksandr Leskin <aleksandr.leskin@virtuozzo.com>
ploop: reduce defrag tools output when not running on a tty, #PSBM-151232Both defragmentation utilities e4defrag and xfs_fsr produce an output
tailored for console with lots of escape sequencies - making progress bar.
This confuses the python test tools that collect the output and they timeout.
Redirect output to /dev/null to avoid that.
xfs_fsr starts to log to syslog if not on a terminal but e4defrag does not
have such feature. Both tools do not have quiet mode op...
ploop: fix balloon discard for ext4 and xfs, #PSBM-151232ploop ballon discard --defrag is broken for vz9 in several ways:
- it uses ploop-e4defrag which is clone of e4defrag with vz7 specific
additions and it is not installed by default on vz9.
- xfs defragmentation is not implemented.
- order of operations is wrong - it first does FITRIM and next defrag.
As a result balloon discard worked as a noop.
To fix this:
- use e4defrag for ext4 defragmentat...
ploop: init update help message, #PSBM-151232update help to reflect changed default fs type
from ext4 to xfs
https://jira.vzint.dev/browse/PSBM-151232
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: do not leak semaphore on failed dm tasks, #VSTOR-75750Currently on error dm_task_run skipped the call to dm_udev_wait.
But that leaked a semaphore which was already upped.
To fix that always call dm_udev_wait which takes care to down and
remove the semaphore.
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: allow to specify dm target granularity #PSBM-142079Add new argument 'blocksize' for ploop_tg_init(). Currently new dm
target granularity is arbitrarily decided by libploop. And we want
to be able to provide this parameter, as bitmaps can use different
granularity
https://jira.vzint.dev/browse/PSBM-142079
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
Merge pull request #289 in OVZ/ploop from ~AATANASOV/ploop:VSTOR-72842v2 to master* commit 'f0642107749210c28b5f9f0272c97e0ad7180237':
ploop: clear in use flag when replacing images, #VSTOR-72842
ploop: device mapper replace image check, #VSTOR-72842
ploop: clear in use flag when replacing images, #VSTOR-72842In block ploop kernel manages the in use flag, on start/stop in
device mapper based ploop it must be managed in userspace tool.
When replacing a delta clear in use flag for the old delta, since
it is very likely write to that image to fail in real world scenario
just log an error and continue.
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: device mapper replace image check, #VSTOR-72842Image is check performed twice - first one is too early and with wrong flags.
second one is correct and uses the right flags.
To fix this remove the first check.
https://pmc.acronis.work/browse/VSTOR-72842
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: device mapper replace image check, #VSTOR-72842Image is check performed twice - first one is too early and with wrong flags.
second one is correct and uses the right flags.
To fix this remove the first check.
https://pmc.acronis.work/browse/VSTOR-72842
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
ploop: implement dm-ploop replace functionality, #VSTOR-71011Replacing deltas in classic ploop and dm-ploop is very different.
Main difference is that since dm-ploop does not expose currently
loaded deltas via sysfs it can not support replace without ddxml
file. We need to query the driver via get_img_name and match files
by name. Other difference is the kernel implementation of the replace
one is done by the driver the other is implemented in device map...