qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 06/11] block: rename and alter bdrv_all_find_snapshot sema


From: Eric Blake
Subject: Re: [PATCH v9 06/11] block: rename and alter bdrv_all_find_snapshot semantics
Date: Wed, 20 Jan 2021 12:48:16 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 1/20/21 4:44 AM, Daniel P. Berrangé wrote:
> Currently bdrv_all_find_snapshot() will return 0 if it finds
> a snapshot, -1 if an error occurs, or if it fails to find a
> snapshot. New callers to be added want to distinguish between
> the error scenario and failing to find a snapshot.
> 
> Rename it to bdrv_all_has_snapshot and make it return -1 on
> error, 0 if no snapshot is found and 1 if snapshot is found.
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---

> +++ b/migration/savevm.c
> @@ -2942,10 +2942,15 @@ bool load_snapshot(const char *name, Error **errp)
>      if (!bdrv_all_can_snapshot(false, NULL, errp)) {
>          return false;
>      }
> -    ret = bdrv_all_find_snapshot(name, false, NULL, errp);
> +    ret = bdrv_all_has_snapshot(name, false, NULL, errp);
>      if (ret < 0) {
>          return false;
>      }
> +    if (ret == 0) {
> +        error_setg(errp, "Snapshot '%s' does not exist in one or more 
> devices",
> +                   name);
> +        return -1;

s/-1/false/ (hoist that hunk from 11/11).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]