Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
0d00c7a3
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0d00c7a3
编写于
3月 01, 2013
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh-snapshot: Add ability to print only snapshot names
Help script creators by not having to parse the names from the table.
上级
be1c364d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
10 deletion
+31
-10
tools/virsh-snapshot.c
tools/virsh-snapshot.c
+24
-6
tools/virsh.pod
tools/virsh.pod
+7
-4
未找到文件。
tools/virsh-snapshot.c
浏览文件 @
0d00c7a3
...
...
@@ -1556,6 +1556,12 @@ static const vshCmdOptDef opts_snapshot_list[] = {
.
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
}
};
...
...
@@ -1578,10 +1584,17 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
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
;
...
...
@@ -1660,7 +1673,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
tree
))
==
NULL
)
goto
cleanup
;
if
(
!
tree
)
{
if
(
!
tree
&&
!
name
)
{
if
(
show_parent
)
vshPrintExtra
(
ctl
,
" %-20s %-25s %-15s %s"
,
_
(
"Name"
),
_
(
"Creation Time"
),
_
(
"State"
),
...
...
@@ -1689,7 +1702,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
}
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
);
...
...
@@ -1699,8 +1712,13 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
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
)
...
...
@@ -1731,9 +1749,9 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
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
;
...
...
tools/virsh.pod
浏览文件 @
0d00c7a3
...
...
@@ -2854,10 +2854,11 @@ accessible only from the original name.
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.
...
...
@@ -2866,7 +2867,9 @@ If I<--parent> is specified, add a column to the output table giving
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,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录