if (!dev)
goto cleanup;
- if (virNodeDeviceUndefine(dev, 0) == 0) {
- vshPrintExtra(ctl, _("Undefined node device '%s'\n"), device_value);
- } else {
+ if (virNodeDeviceUndefine(dev, 0) < 0) {
vshError(ctl, _("Failed to undefine node device '%s'"), device_value);
goto cleanup;
}
+ vshPrintExtra(ctl, _("Undefined node device '%s'\n"), device_value);
ret = true;
cleanup:
return ret;
goto cleanup;
}
- if ((vol = virStorageVolCreateXML(pool, buffer, flags))) {
- vshPrintExtra(ctl, _("Vol %s created from %s\n"),
- virStorageVolGetName(vol), from);
- ret = true;
- } else {
+ if (!(vol = virStorageVolCreateXML(pool, buffer, flags))) {
vshError(ctl, _("Failed to create vol from %s"), from);
+ goto cleanup;
}
+ vshPrintExtra(ctl, _("Vol %s created from %s\n"),
+ virStorageVolGetName(vol), from);
+ ret = true;
cleanup:
return ret;
}
newvol = virStorageVolCreateXMLFrom(pool, buffer, inputvol, flags);
- if (newvol != NULL) {
- vshPrintExtra(ctl, _("Vol %s created from input vol %s\n"),
- virStorageVolGetName(newvol), virStorageVolGetName(inputvol));
- } else {
+ if (!newvol) {
vshError(ctl, _("Failed to create vol from %s"), from);
goto cleanup;
}
+ vshPrintExtra(ctl, _("Vol %s created from input vol %s\n"),
+ virStorageVolGetName(newvol), virStorageVolGetName(inputvol));
ret = true;
cleanup:
return ret;
goto cleanup;
}
- if (virStorageVolResize(vol, capacity, flags) == 0) {
- vshPrintExtra(ctl,
- delta ? _("Size of volume '%s' successfully changed by %s\n")
- : _("Size of volume '%s' successfully changed to %s\n"),
- virStorageVolGetName(vol), capacityStr);
- ret = true;
- } else {
+ if (virStorageVolResize(vol, capacity, flags) < 0) {
vshError(ctl,
delta ? _("Failed to change size of volume '%s' by %s")
: _("Failed to change size of volume '%s' to %s"),
virStorageVolGetName(vol), capacityStr);
- ret = false;
+ goto cleanup;
}
+ vshPrintExtra(ctl,
+ delta ? _("Size of volume '%s' successfully changed by %s\n")
+ : _("Size of volume '%s' successfully changed to %s\n"),
+ virStorageVolGetName(vol), capacityStr);
+ ret = true;
cleanup:
return ret;
}