list [--inactive | --all]
[--managed-save] [--title]
- { [--table] | --name | --uuid | --id }
+ { [--table] | --name | --id } [--uuid]
[--persistent] [--transient]
[--with-managed-save] [--without-managed-save]
[--autostart] [--no-autostart]
are printed indead of names. However, it is possible to combine
*--name*, *--uuid* and *--id* to select only desired fields for
printing. Flag *--table* specifies that the legacy table-formatted
-output should be used, but it is mutually exclusive with *--name*,
-*--uuid* and *--id*. This is the default and will be used if neither of
-*--name*, *--uuid* or *--id* is specified. If neither *--name* nor *--uuid* is
-specified, but *--id* is, then only active domains are listed, even with the
-*--all* parameter as otherwise the output would just contain bunch of lines
-with just *-1*.
+output should be used, but it is mutually exclusive with *--name*, and *--id*.
+This is the default and will be used if neither of *--name*, *--uuid* or *--id*
+is specified. If neither *--name* nor *--uuid* is specified, but *--id* is,
+then only active domains are listed, even with the *--all* parameter as otherwise
+the output would just contain bunch of lines with just *-1*. If *--table* is
+combined with *--uuid*, then domain uuid is printed as an extra column.
If *--title* is specified, then the short domain description (title) is
printed in an extra column. This flag is usable only with the default
FILTER("state-other", VIR_CONNECT_LIST_DOMAINS_OTHER);
VSH_EXCLUSIVE_OPTIONS("table", "name");
- VSH_EXCLUSIVE_OPTIONS("table", "uuid");
VSH_EXCLUSIVE_OPTIONS("table", "id");
- if (!optUUID && !optName && !optID)
+ if (!optName && !optID)
optTable = true;
if (!(list = virshDomainListCollect(ctl, flags)))
/* print table header in legacy mode */
if (optTable) {
- if (optTitle)
+ if (optTitle && !optUUID)
table = vshTableNew(_("Id"), _("Name"), _("State"), _("Title"), NULL);
+ else if (optUUID && !optTitle)
+ table = vshTableNew(_("Id"), _("Name"), _("State"), _("UUID"), NULL);
+ else if (optUUID && optTitle)
+ table = vshTableNew(_("Id"), _("Name"), _("State"), _("Title"), _("UUID"), NULL);
else
table = vshTableNew(_("Id"), _("Name"), _("State"), NULL);
virDomainHasManagedSaveImage(dom, 0) > 0)
state = -2;
- if (optTitle) {
+ if (optTitle && !optUUID) {
g_autofree char *title = NULL;
if (!(title = virshGetDomainDescription(ctl, dom, true, 0)))
: virshDomainStateToString(state),
title, NULL) < 0)
goto cleanup;
+ } else if (optUUID && !optTitle) {
+ if (virDomainGetUUIDString(dom, uuid) < 0) {
+ vshError(ctl, "%s", _("Failed to get domain's UUID"));
+ goto cleanup;
+ }
+ if (vshTableRowAppend(table, id_buf,
+ virDomainGetName(dom),
+ state == -2 ? _("saved")
+ : virshDomainStateToString(state),
+ uuid, NULL) < 0)
+ goto cleanup;
+ } else if (optUUID && optTitle) {
+ g_autofree char *title = NULL;
+
+ if (!(title = virshGetDomainDescription(ctl, dom, true, 0)))
+ goto cleanup;
+ if (virDomainGetUUIDString(dom, uuid) < 0) {
+ vshError(ctl, "%s", _("Failed to get domain's UUID"));
+ goto cleanup;
+ }
+ if (vshTableRowAppend(table, id_buf,
+ virDomainGetName(dom),
+ state == -2 ? _("saved")
+ : virshDomainStateToString(state),
+ title, uuid, NULL) < 0)
+ goto cleanup;
} else {
if (vshTableRowAppend(table, id_buf,
virDomainGetName(dom),