mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virsh: domain: use early return when possible
Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
6e1cdf928c
commit
24ddb0cdfe
@ -5883,13 +5883,13 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd)
|
||||
rv = virDomainShutdownFlags(dom, flags);
|
||||
else
|
||||
rv = virDomainShutdown(dom);
|
||||
if (rv == 0) {
|
||||
vshPrintExtra(ctl, _("Domain '%s' is being shutdown\n"), name);
|
||||
} else {
|
||||
|
||||
if (rv != 0) {
|
||||
vshError(ctl, _("Failed to shutdown domain '%s'"), name);
|
||||
return false;
|
||||
}
|
||||
|
||||
vshPrintExtra(ctl, _("Domain '%s' is being shutdown\n"), name);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -5959,13 +5959,12 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
|
||||
if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
|
||||
return false;
|
||||
|
||||
if (virDomainReboot(dom, flags) == 0) {
|
||||
vshPrintExtra(ctl, _("Domain '%s' is being rebooted\n"), name);
|
||||
} else {
|
||||
if (virDomainReboot(dom, flags) != 0) {
|
||||
vshError(ctl, _("Failed to reboot domain '%s'"), name);
|
||||
return false;
|
||||
}
|
||||
|
||||
vshPrintExtra(ctl, _("Domain '%s' is being rebooted\n"), name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user