Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
cf12efe0
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看板
提交
cf12efe0
编写于
9月 21, 2018
作者:
S
Simon Kobyda
提交者:
Michal Privoznik
9月 24, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Implement vshTable API to secret-list
Signed-off-by:
N
Simon Kobyda
<
skobyda@redhat.com
>
上级
71029ef5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
8 deletion
+20
-8
tools/virsh-secret.c
tools/virsh-secret.c
+20
-8
未找到文件。
tools/virsh-secret.c
浏览文件 @
cf12efe0
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "virsecret.h"
#include "virsecret.h"
#include "virstring.h"
#include "virstring.h"
#include "virtime.h"
#include "virtime.h"
#include "vsh-table.h"
static
virSecretPtr
static
virSecretPtr
virshCommandOptSecret
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
,
const
char
**
name
)
virshCommandOptSecret
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
,
const
char
**
name
)
...
@@ -507,6 +508,7 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
...
@@ -507,6 +508,7 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
virshSecretListPtr
list
=
NULL
;
virshSecretListPtr
list
=
NULL
;
bool
ret
=
false
;
bool
ret
=
false
;
unsigned
int
flags
=
0
;
unsigned
int
flags
=
0
;
vshTablePtr
table
=
NULL
;
if
(
vshCommandOptBool
(
cmd
,
"ephemeral"
))
if
(
vshCommandOptBool
(
cmd
,
"ephemeral"
))
flags
|=
VIR_CONNECT_LIST_SECRETS_EPHEMERAL
;
flags
|=
VIR_CONNECT_LIST_SECRETS_EPHEMERAL
;
...
@@ -523,15 +525,17 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
...
@@ -523,15 +525,17 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if
(
!
(
list
=
virshSecretListCollect
(
ctl
,
flags
)))
if
(
!
(
list
=
virshSecretListCollect
(
ctl
,
flags
)))
return
false
;
return
false
;
vshPrintExtra
(
ctl
,
" %-36s %s
\n
"
,
_
(
"UUID"
),
_
(
"Usage"
)
);
table
=
vshTableNew
(
_
(
"UUID"
),
_
(
"Usage"
),
NULL
);
vshPrintExtra
(
ctl
,
"----------------------------------------"
if
(
!
table
)
"----------------------------------------
\n
"
)
;
goto
cleanup
;
for
(
i
=
0
;
i
<
list
->
nsecrets
;
i
++
)
{
for
(
i
=
0
;
i
<
list
->
nsecrets
;
i
++
)
{
virSecretPtr
sec
=
list
->
secrets
[
i
];
virSecretPtr
sec
=
list
->
secrets
[
i
];
int
usageType
=
virSecretGetUsageType
(
sec
);
int
usageType
=
virSecretGetUsageType
(
sec
);
const
char
*
usageStr
=
virSecretUsageTypeToString
(
usageType
);
const
char
*
usageStr
=
virSecretUsageTypeToString
(
usageType
);
char
uuid
[
VIR_UUID_STRING_BUFLEN
];
char
uuid
[
VIR_UUID_STRING_BUFLEN
];
virBuffer
buf
=
VIR_BUFFER_INITIALIZER
;
VIR_AUTOFREE
(
char
*
)
usage
=
NULL
;
if
(
virSecretGetUUIDString
(
sec
,
uuid
)
<
0
)
{
if
(
virSecretGetUUIDString
(
sec
,
uuid
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"Failed to get uuid of secret"
));
vshError
(
ctl
,
"%s"
,
_
(
"Failed to get uuid of secret"
));
...
@@ -539,18 +543,26 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
...
@@ -539,18 +543,26 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
}
}
if
(
usageType
)
{
if
(
usageType
)
{
vshPrint
(
ctl
,
" %-36s %s %s
\n
"
,
virBufferStrcat
(
&
buf
,
usageStr
,
" "
,
uuid
,
usageStr
,
virSecretGetUsageID
(
sec
),
NULL
);
virSecretGetUsageID
(
sec
));
usage
=
virBufferContentAndReset
(
&
buf
);
if
(
!
usage
)
goto
cleanup
;
if
(
vshTableRowAppend
(
table
,
uuid
,
usage
,
NULL
)
<
0
)
goto
cleanup
;
}
else
{
}
else
{
vshPrint
(
ctl
,
" %-36s %s
\n
"
,
if
(
vshTableRowAppend
(
table
,
uuid
,
_
(
"Unused"
),
NULL
)
<
0
)
uuid
,
_
(
"Unused"
))
;
goto
cleanup
;
}
}
}
}
vshTablePrintToStdout
(
table
,
ctl
);
ret
=
true
;
ret
=
true
;
cleanup:
cleanup:
vshTableFree
(
table
);
virshSecretListFree
(
list
);
virshSecretListFree
(
list
);
return
ret
;
return
ret
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录