mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
virsh: report "unknown" for autostart when API query fails
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 <lucaaamaral@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
1 parent
da815a6a7b
commit
dbdaf22b63
3 files changed
+5
-5
No files matched your search
@@ -715,7 +715,7 @@ cmdNetworkInfo(vshControl *ctl, const vshCmd *cmd)
|
||||
vshPrint(ctl, "%-15s %s\n", _("Persistent:"), persistent ? _("yes") : _("no"));
|
||||
|
||||
if (virNetworkGetAutostart(network, &autostart) < 0)
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart"));
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("unknown"));
|
||||
else
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") : _("no"));
|
||||
|
||||
@@ -1055,7 +1055,7 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
||||
|
||||
if (optTable) {
|
||||
if (virNetworkGetAutostart(network, &is_autostart) < 0)
|
||||
autostartStr = _("no autostart");
|
||||
autostartStr = _("unknown");
|
||||
else
|
||||
autostartStr = is_autostart ? _("yes") : _("no");
|
||||
|
||||
|
||||
@@ -1245,7 +1245,7 @@ cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd)
|
||||
vshPrint(ctl, "%-15s %s\n", _("Persistent:"),
|
||||
virNodeDeviceIsPersistent(device) ? _("yes") : _("no"));
|
||||
if (virNodeDeviceGetAutostart(device, &autostart) < 0)
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart"));
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("unknown"));
|
||||
else
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") : _("no"));
|
||||
|
||||
|
||||
+2
-2
@@ -1204,7 +1204,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
||||
|
||||
/* Retrieve the autostart status of the pool */
|
||||
if (virStoragePoolGetAutostart(list->pools[i], &autostart) < 0)
|
||||
poolInfoTexts[i].autostart = g_strdup(_("no autostart"));
|
||||
poolInfoTexts[i].autostart = g_strdup(_("unknown"));
|
||||
else
|
||||
poolInfoTexts[i].autostart = g_strdup(autostart ? _("yes") : _("no"));
|
||||
|
||||
@@ -1554,7 +1554,7 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
/* Check and display whether the pool is autostarted or not */
|
||||
if (virStoragePoolGetAutostart(pool, &autostart) < 0)
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart"));
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("unknown"));
|
||||
else
|
||||
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") : _("no"));
|
||||
|
||||
|
||||
Reference in new issue
Block a user