virsh: Make code flow in cmdManagedSaveRemove more straightforward

By doing so we can get rid of the code which violates our coding style
guidelines.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Jiri Denemark 2021-09-15 16:15:11 +02:00
parent 4d31c02f05
commit 88810c5267

View File

@ -4788,18 +4788,19 @@ cmdManagedSaveRemove(vshControl *ctl, const vshCmd *cmd)
return false;
}
if (hassave) {
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;
}
else
vshPrintExtra(ctl, _("Removed managedsave image for domain '%s'"), name);
}
else
vshPrintExtra(ctl, _("Domain '%s' has no manage save image; removal skipped"),
name);
return true;
}