Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
3072ded3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3072ded3
编写于
9月 21, 2018
作者:
S
Simon Kobyda
提交者:
Michal Privoznik
9月 24, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Implement vshTable API to vcpupin, iothreadinfo, domfsinfo
Signed-off-by:
N
Simon Kobyda
<
skobyda@redhat.com
>
上级
063509a1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
70 addition
and
28 deletion
+70
-28
tools/virsh-domain.c
tools/virsh-domain.c
+70
-28
未找到文件。
tools/virsh-domain.c
浏览文件 @
3072ded3
...
...
@@ -59,6 +59,7 @@
#include "virxml.h"
#include "virsh-nodedev.h"
#include "viruri.h"
#include "vsh-table.h"
/* Gnulib doesn't guarantee SA_SIGINFO support. */
#ifndef SA_SIGINFO
...
...
@@ -6905,6 +6906,7 @@ virshVcpuPinQuery(vshControl *ctl,
size_t
i
;
int
ncpus
;
bool
ret
=
false
;
vshTablePtr
table
=
NULL
;
if
((
ncpus
=
virshCPUCountCollect
(
ctl
,
dom
,
countFlags
,
true
))
<
0
)
{
if
(
ncpus
==
-
1
)
{
...
...
@@ -6913,7 +6915,7 @@ virshVcpuPinQuery(vshControl *ctl,
else
vshError
(
ctl
,
"%s"
,
_
(
"cannot get vcpupin for transient domain"
));
}
return
false
;
goto
cleanup
;
}
if
(
got_vcpu
&&
vcpu
>=
ncpus
)
{
...
...
@@ -6927,28 +6929,39 @@ virshVcpuPinQuery(vshControl *ctl,
vshError
(
ctl
,
_
(
"vcpu %d is out of range of persistent cpu count %d"
),
vcpu
,
ncpus
);
return
false
;
goto
cleanup
;
}
cpumaplen
=
VIR_CPU_MAPLEN
(
maxcpu
);
cpumap
=
vshMalloc
(
ctl
,
ncpus
*
cpumaplen
);
if
((
ncpus
=
virDomainGetVcpuPinInfo
(
dom
,
ncpus
,
cpumap
,
cpumaplen
,
flags
))
>=
0
)
{
vshPrintExtra
(
ctl
,
"%s %s
\n
"
,
_
(
"VCPU:"
),
_
(
"CPU Affinity"
));
vshPrintExtra
(
ctl
,
"----------------------------------
\n
"
);
table
=
vshTableNew
(
_
(
"VCPU"
),
_
(
"CPU Affinity"
),
NULL
);
if
(
!
table
)
goto
cleanup
;
for
(
i
=
0
;
i
<
ncpus
;
i
++
)
{
VIR_AUTOFREE
(
char
*
)
pinInfo
=
NULL
;
VIR_AUTOFREE
(
char
*
)
vcpuStr
=
NULL
;
if
(
got_vcpu
&&
i
!=
vcpu
)
continue
;
vshPrint
(
ctl
,
"%4zu: "
,
i
);
ret
=
virshPrintPinInfo
(
ctl
,
VIR_GET_CPUMAP
(
cpumap
,
cpumaplen
,
i
),
cpumaplen
);
vshPrint
(
ctl
,
"
\n
"
);
if
(
!
ret
)
break
;
if
(
!
(
pinInfo
=
virBitmapDataFormat
(
cpumap
,
cpumaplen
)))
goto
cleanup
;
if
(
virAsprintf
(
&
vcpuStr
,
"%lu"
,
i
)
<
0
)
goto
cleanup
;
if
(
vshTableRowAppend
(
table
,
vcpuStr
,
pinInfo
,
NULL
)
<
0
)
goto
cleanup
;
}
vshTablePrintToStdout
(
table
,
ctl
);
}
ret
=
true
;
cleanup:
vshTableFree
(
table
);
VIR_FREE
(
cpumap
);
return
ret
;
}
...
...
@@ -7520,6 +7533,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
int
maxcpu
;
unsigned
int
flags
=
VIR_DOMAIN_AFFECT_CURRENT
;
virshControlPtr
priv
=
ctl
->
privData
;
vshTablePtr
table
=
NULL
;
VSH_EXCLUSIVE_OPTIONS_VAR
(
current
,
live
);
VSH_EXCLUSIVE_OPTIONS_VAR
(
current
,
config
);
...
...
@@ -7545,19 +7559,30 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
goto
cleanup
;
}
vshPrintExtra
(
ctl
,
" %-15s %-15s
\n
"
,
_
(
"IOThread ID"
),
_
(
"CPU Affinity"
));
vshPrintExtra
(
ctl
,
"---------------------------------------------------
\n
"
);
table
=
vshTableNew
(
_
(
"IOThread ID"
),
_
(
"CPU Affinity"
),
NULL
);
if
(
!
table
)
goto
cleanup
;
for
(
i
=
0
;
i
<
niothreads
;
i
++
)
{
VIR_AUTOFREE
(
char
*
)
pinInfo
=
NULL
;
VIR_AUTOFREE
(
char
*
)
iothreadIdStr
=
NULL
;
vshPrint
(
ctl
,
" %-15u "
,
info
[
i
]
->
iothread_id
);
ignore_value
(
virshPrintPinInfo
(
ctl
,
info
[
i
]
->
cpumap
,
info
[
i
]
->
cpumaplen
));
vshPrint
(
ctl
,
"
\n
"
);
virDomainIOThreadInfoFree
(
info
[
i
]);
if
(
virAsprintf
(
&
iothreadIdStr
,
"%u"
,
info
[
i
]
->
iothread_id
)
<
0
)
goto
cleanup
;
ignore_value
(
pinInfo
=
virBitmapDataFormat
(
info
[
i
]
->
cpumap
,
info
[
i
]
->
cpumaplen
));
if
(
vshTableRowAppend
(
table
,
iothreadIdStr
,
pinInfo
?
pinInfo
:
""
,
NULL
)
<
0
)
goto
cleanup
;
}
VIR_FREE
(
info
);
vshTablePrintToStdout
(
table
,
ctl
);
cleanup:
for
(
i
=
0
;
i
<
niothreads
;
i
++
)
virDomainIOThreadInfoFree
(
info
[
i
]);
VIR_FREE
(
info
);
vshTableFree
(
table
);
virshDomainFree
(
dom
);
return
niothreads
>=
0
;
}
...
...
@@ -13778,6 +13803,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
int
ret
=
-
1
;
size_t
i
,
j
;
virDomainFSInfoPtr
*
info
;
vshTablePtr
table
=
NULL
;
if
(
!
(
dom
=
virshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
false
;
...
...
@@ -13793,25 +13819,41 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
}
if
(
info
)
{
vshPrintExtra
(
ctl
,
"%-36s %-8s %-8s %s
\n
"
,
_
(
"Mountpoint"
),
_
(
"Name"
),
_
(
"Type"
),
_
(
"Target"
));
vshPrintExtra
(
ctl
,
"-------------------------------------------------------------------
\n
"
);
table
=
vshTableNew
(
_
(
"Mountpoint"
),
_
(
"Name"
),
_
(
"Type"
),
_
(
"Target"
),
NULL
);
if
(
!
table
)
goto
cleanup
;
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
vshPrint
(
ctl
,
"%-36s %-8s %-8s "
,
info
[
i
]
->
mountpoint
,
info
[
i
]
->
name
,
info
[
i
]
->
fstype
);
virBuffer
targetsBuff
=
VIR_BUFFER_INITIALIZER
;
VIR_AUTOFREE
(
char
*
)
targets
=
NULL
;
for
(
j
=
0
;
j
<
info
[
i
]
->
ndevAlias
;
j
++
)
{
v
shPrint
(
ctl
,
"%s"
,
info
[
i
]
->
devAlias
[
j
]
);
v
irBufferAdd
(
&
targetsBuff
,
info
[
i
]
->
devAlias
[
j
],
-
1
);
if
(
j
!=
info
[
i
]
->
ndevAlias
-
1
)
v
shPrint
(
ctl
,
","
);
v
irBufferAddChar
(
&
targetsBuff
,
','
);
}
vshPrint
(
ctl
,
"
\n
"
);
virDomainFSInfoFree
(
info
[
i
]);
targets
=
virBufferContentAndReset
(
&
targetsBuff
);
if
(
vshTableRowAppend
(
table
,
info
[
i
]
->
mountpoint
,
info
[
i
]
->
name
,
info
[
i
]
->
fstype
,
targets
,
NULL
)
<
0
)
goto
cleanup
;
}
VIR_FREE
(
info
);
vshTablePrintToStdout
(
table
,
ctl
);
}
cleanup:
if
(
info
)
{
for
(
i
=
0
;
i
<
ret
;
i
++
)
virDomainFSInfoFree
(
info
[
i
]);
VIR_FREE
(
info
);
}
vshTableFree
(
table
);
virshDomainFree
(
dom
);
return
ret
>=
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录