On 2/16/26 16:50, Lucas Amaral wrote:
> When virStoragePoolGetAutostart(), virNetworkGetAutostart(), or
> virNodeDeviceGetAutostart() fails, the respective info commands
> report "no autostart". This is incorrect: the API failure means
> we cannot determine the autostart state, not that autostart is
> disabled.
> 
> The persistent field in the same functions already correctly
> reports "unknown" on API failure. Apply the same pattern to the
> autostart field for consistency and correctness.
> 
> Signed-off-by: Lucas Amaral <[email protected]>
> ---
> Found by code audit. The inconsistency dates back to c2160b137d
> (Jun 2010), which introduced both the "Persistent" and "Autostart"
> fields for pool-info. The persistent field used _("unknown") on
> failure while the autostart field used _("no autostart") — the
> mismatch was then copied into net-info, pool-list, net-list, and
> nodedev-info as those were added.
> 
> All 5 instances across 3 files (virsh-pool.c, virsh-network.c,
> virsh-nodedev.c) are fixed in this patch.
> 
> Tested on CentOS Stream 9 — full test suite passes (307 OK,
> 1 Expected Fail, 0 Fail).
> 
>  tools/virsh-network.c | 4 ++--
>  tools/virsh-nodedev.c | 2 +-
>  tools/virsh-pool.c    | 4 ++--
>  3 files changed, 5 insertions(+), 5 deletions(-)


Reviewed-by: Michal Privoznik <[email protected]>

and merged.

Michal

Reply via email to