qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, phrdina@redhat.com, famz@redhat.com,
	armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com,
	stefanha@redhat.com, pbonzini@redhat.com, dietmar@proxmox.com
Subject: Re: [Qemu-devel] [PATCH V3 4/9] qmp: add internal snapshot support in qmp_transaction
Date: Thu, 4 Jul 2013 14:35:33 +0200	[thread overview]
Message-ID: <20130704123533.GA4213@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1372300908-7546-5-git-send-email-xiawenc@linux.vnet.ibm.com>

On Thu, Jun 27, 2013 at 10:41:43AM +0800, Wenchao Xia wrote:
> +    /* check whether a snapshot with name exist, no need to check id, since
> +       name will be checked later to make sure it does not mess up with id. */
> +    ret = bdrv_snapshot_find_by_id_and_name(bs, NULL, name, &sn, errp);
> +    if (error_is_set(errp)) {
> +        return;
> +    }
> +    if (ret) {
> +        error_setg(errp,
> +                   "Snapshot with name '%s' already exist on device '%s'",

s/exist/exists/

> +                   name, device);
> +        return;
> +    }
> +
> +    /* Forbid having a name similar to id, empty name is also forbidden. */
> +    if (!snapshot_name_wellformed(name)) {
> +        error_setg(errp, "Name '%s' on device '%s' is not a valid one",
> +                   name, device);
> +        return;
> +    }
> +
> +    /* 3. take the snapshot */
> +    sn1 = &state->sn;
> +    pstrcpy(sn1->name, sizeof(sn1->name), name);
> +    qemu_gettimeofday(&tv);
> +    sn1->date_sec = tv.tv_sec;
> +    sn1->date_nsec = tv.tv_usec * 1000;
> +    sn1->vm_clock_nsec = qemu_get_clock_ns(vm_clock);
> +
> +    if (bdrv_snapshot_create(bs, sn1) < 0) {
> +        error_setg(errp, "Failed to create snapshot '%s' on device '%s'",
> +                   name, device);

Please use error_setg_errno() to include the bdrv_snapshot_create()
error message.

> @@ -1009,6 +1010,18 @@ the new image file has the same contents as the current one; QEMU cannot
>  perform any meaningful check.  Typically this is achieved by using the
>  current image file as the backing file for the new image.
>  
> +On failure, the original disks pre-snapshot attempt will be used.
> +
> +For internal snapshots, the dictionary contains the device and the snapshot's
> +name.  If name is a numeric string which will mess up with ID, the request will

This is about namespace collision.  "Collide" or "conflict" are usually
used to describe identical naming problems.  Instead of "mess up" I
would say something like:

The name must not be a numeric string since this collides with snapshot
IDs and an error will be returned.

> +be rejected.  For example, name "99" is not a valid name.  If an internal
> +snapshot matching name already exists, the request will be also rejected.  Only
> +some image formats support it, for example, qcow2, rbd, and sheepdog.
> +
> +On failure, qemu will try delete new created internal snapshot in the

s/new created/the newly created/

> +transaction.  When I/O error causes deletion failure, the user needs to fix it

When an I/O error occurs during deletion, ...

  reply	other threads:[~2013-07-04 12:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27  2:41 [Qemu-devel] [PATCH V3 0/9] add internal snapshot support at block device level Wenchao Xia
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 1/9] snapshot: new function bdrv_snapshot_find_by_id_and_name() Wenchao Xia
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 2/9] snapshot: add paired functions for internal snapshot id and name Wenchao Xia
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 3/9] snapshot: distinguish id and name in snapshot delete Wenchao Xia
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 4/9] qmp: add internal snapshot support in qmp_transaction Wenchao Xia
2013-07-04 12:35   ` Stefan Hajnoczi [this message]
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 5/9] qmp: add interface blockdev-snapshot-internal-sync Wenchao Xia
2013-07-04 12:37   ` Stefan Hajnoczi
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 6/9] qmp: add interface blockdev-snapshot-delete-internal-sync Wenchao Xia
2013-07-04 12:42   ` Stefan Hajnoczi
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 7/9] hmp: add interface hmp_snapshot_blkdev_internal Wenchao Xia
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 8/9] hmp: add interface hmp_snapshot_delete_blkdev_internal Wenchao Xia
2013-06-27  2:41 ` [Qemu-devel] [PATCH V3 9/9] qemu-iotests: add 056 internal snapshot for block device test case Wenchao Xia
2013-07-03  1:52 ` [Qemu-devel] [PATCH V3 0/9] add internal snapshot support at block device level Wenchao Xia
2013-07-04 12:44   ` Stefan Hajnoczi
2013-07-07 22:38     ` Wenchao Xia

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=20130704123533.GA4213@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=armbru@redhat.com \
    --cc=dietmar@proxmox.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=phrdina@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xiawenc@linux.vnet.ibm.com \
    /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).