.flags = 0,
.help = N_("with --from, list all descendants")
},
+ {.name = "name",
+ .type = VSH_OT_BOOL,
+ .flags = 0,
+ .help = N_("list snapshot names only")
+ },
+
{.name = NULL}
};
char timestr[100];
struct tm time_info;
bool tree = vshCommandOptBool(cmd, "tree");
+ bool name = vshCommandOptBool(cmd, "name");
const char *from = NULL;
virDomainSnapshotPtr start = NULL;
vshSnapshotListPtr snaplist = NULL;
+ if (tree && name) {
+ vshError(ctl, "%s",
+ _("--tree and --name are mutually exclusive"));
+ return false;
+ }
+
dom = vshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
tree)) == NULL)
goto cleanup;
- if (!tree) {
+ if (!tree && !name) {
if (show_parent)
vshPrintExtra(ctl, " %-20s %-25s %-15s %s",
_("Name"), _("Creation Time"), _("State"),
}
for (i = 0; i < snaplist->nsnaps; i++) {
- const char *name;
+ const char *snap_name;
/* free up memory from previous iterations of the loop */
VIR_FREE(parent);
VIR_FREE(doc);
snapshot = snaplist->snaps[i].snap;
- name = virDomainSnapshotGetName(snapshot);
- assert(name);
+ snap_name = virDomainSnapshotGetName(snapshot);
+ assert(snap_name);
+
+ if (name) {
+ vshPrint(ctl, "%s\n", snap_name);
+ continue;
+ }
doc = virDomainSnapshotGetXMLDesc(snapshot, 0);
if (!doc)
if (parent)
vshPrint(ctl, " %-20s %-25s %-15s %s\n",
- name, timestr, state, parent);
+ snap_name, timestr, state, parent);
else
- vshPrint(ctl, " %-20s %-25s %s\n", name, timestr, state);
+ vshPrint(ctl, " %-20s %-25s %s\n", snap_name, timestr, state);
}
ret = true;
Output basic information about a named <snapshot>, or the current snapshot
with I<--current>.
-=item B<snapshot-list> I<domain> [{I<--parent> | I<--roots> | I<--tree>}]
+=item B<snapshot-list> I<domain> [I<--metadata>] [I<--no-metadata>]
+[{I<--parent> | I<--roots> | [{I<--tree> | I<--name>}]}]
[{[I<--from>] B<snapshot> | I<--current>} [I<--descendants>]]
-[I<--metadata>] [I<--no-metadata>] [I<--leaves>] [I<--no-leaves>]
-[I<--inactive>] [I<--active>] [I<--disk-only>] [I<--internal>] [I<--external>]
+[I<--leaves>] [I<--no-leaves>] p[I<--inactive>] [I<--active>]
+[I<--disk-only>] [I<--internal>] [I<--external>]
List all of the available snapshots for the given domain, defaulting
to show columns for the snapshot name, creation time, and domain state.
the name of the parent of each snapshot. If I<--roots> is specified,
the list will be filtered to just snapshots that have no parents.
If I<--tree> is specified, the output will be in a tree format, listing
-just snapshot names. These three options are mutually exclusive.
+just snapshot names. These three options are mutually exclusive. If
+I<--name> is specified only the snapshot name is printed. This option is
+mutually exclusive with I<--tree>.
If I<--from> is provided, filter the list to snapshots which are
children of the given B<snapshot>; or if I<--current> is provided,