From: Max Reitz <mreitz@redhat.com>
To: Pavel Butsykin <pbutsykin@virtuozzo.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: jsnow@redhat.com, kwolf@redhat.com, eblake@redhat.com,
armbru@redhat.com, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH v8 1/4] qemu-img: add --shrink flag for resize
Date: Mon, 18 Sep 2017 20:12:15 +0200 [thread overview]
Message-ID: <79cf9910-e76e-7c6d-f7c8-a81d84db0dd0@redhat.com> (raw)
In-Reply-To: <20170918124230.8152-2-pbutsykin@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 1907 bytes --]
On 2017-09-18 14:42, Pavel Butsykin wrote:
> The flag is additional precaution against data loss. Perhaps in the future the
> operation shrink without this flag will be blocked for all formats, but for now
> we need to maintain compatibility with raw.
>
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: John Snow <jsnow@redhat.com>
> ---
> qemu-img-cmds.hx | 4 ++--
> qemu-img.c | 23 +++++++++++++++++++++++
> qemu-img.texi | 6 +++++-
> tests/qemu-iotests/102 | 4 ++--
> tests/qemu-iotests/106 | 2 +-
> 5 files changed, 33 insertions(+), 6 deletions(-)
[...]
> diff --git a/qemu-img.c b/qemu-img.c
> index 56ef49e214..b7b2386cbd 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
[...]
> @@ -3571,6 +3577,23 @@ static int img_resize(int argc, char **argv)
> goto out;
> }
>
> + if (total_size < current_size && !shrink) {
> + warn_report("Shrinking an image will delete all data beyond the "
> + "shrunken image's end. Before performing such an "
> + "operation, make sure there is no important data there.");
> +
> + if (g_strcmp0(bdrv_get_format_name(blk_bs(blk)), "raw") != 0) {
> + error_report(
> + "Use the --shrink option to perform a shrink operation.");
> + ret = -1;
> + goto out;
> + } else {
> + warn_report("Using the --shrink option will suppress this message."
Still missing a space here.
Max
> + "Note that future versions of qemu-img may refuse to "
> + "shrink images without this option.");
> + }
> + }
> +
> ret = blk_truncate(blk, total_size, prealloc, &err);
> if (!ret) {
> qprintf(quiet, "Image resized.\n");
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2017-09-18 18:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 12:42 [Qemu-devel] [PATCH v8 0/4] Add shrink image for qcow2 Pavel Butsykin
2017-09-18 12:42 ` [Qemu-devel] [PATCH v8 1/4] qemu-img: add --shrink flag for resize Pavel Butsykin
2017-09-18 18:12 ` Max Reitz [this message]
2017-09-18 12:42 ` [Qemu-devel] [PATCH v8 2/4] qcow2: add qcow2_cache_discard Pavel Butsykin
2017-09-18 12:42 ` [Qemu-devel] [PATCH v8 3/4] qcow2: add shrink image support Pavel Butsykin
2017-09-18 12:42 ` [Qemu-devel] [PATCH v8 4/4] qemu-iotests: add shrinking image test Pavel Butsykin
2017-09-18 18:22 ` [Qemu-devel] [PATCH v8 0/4] Add shrink image for qcow2 Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=79cf9910-e76e-7c6d-f7c8-a81d84db0dd0@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbutsykin@virtuozzo.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).