[libvirt PATCH] virsh: Make code flow in cmdManagedSaveRemove more straightforward
Jonathon Jongsma
jjongsma at redhat.com
Wed Sep 15 16:21:04 UTC 2021
Reviewed-by: Jonathon Jongsma <jjongsma at redhat.com>
On Wed, Sep 15, 2021 at 10:16 AM Jiri Denemark <jdenemar at redhat.com> wrote:
>
> By doing so we can get rid of the code which violates our coding style
> guidelines.
>
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
> tools/virsh-domain.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index e5bd1fdd75..ca56c3b33d 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -4788,18 +4788,19 @@ cmdManagedSaveRemove(vshControl *ctl, const vshCmd *cmd)
> return false;
> }
>
> - if (hassave) {
> - if (virDomainManagedSaveRemove(dom, 0) < 0) {
> - vshError(ctl, _("Failed to remove managed save image for domain '%s'"),
> - name);
> - return false;
> - }
> - else
> - vshPrintExtra(ctl, _("Removed managedsave image for domain '%s'"), name);
> - }
> - else
> + if (hassave == 0) {
> vshPrintExtra(ctl, _("Domain '%s' has no manage save image; removal skipped"),
> name);
> + return true;
> + }
> +
> + if (virDomainManagedSaveRemove(dom, 0) < 0) {
> + vshError(ctl, _("Failed to remove managed save image for domain '%s'"),
> + name);
> + return false;
> + }
> +
> + vshPrintExtra(ctl, _("Removed managedsave image for domain '%s'"), name);
>
> return true;
> }
> --
> 2.33.0
>
More information about the libvir-list
mailing list