Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
69e0cd33
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,发现更多精彩内容 >>
提交
69e0cd33
编写于
6月 20, 2016
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Add command 'guestvcpus' implementing virDomain(GS)etGuestVcpus
Add a straightforward implementation for using the new APIs.
上级
3ebf7ca0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
103 addition
and
0 deletion
+103
-0
tools/virsh-domain.c
tools/virsh-domain.c
+93
-0
tools/virsh.pod
tools/virsh.pod
+10
-0
未找到文件。
tools/virsh-domain.c
浏览文件 @
69e0cd33
...
...
@@ -6762,6 +6762,93 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
return
ret
;
}
/*
* "guestvcpus" command
*/
static
const
vshCmdInfo
info_guestvcpus
[]
=
{
{.
name
=
"help"
,
.
data
=
N_
(
"query or modify state of vcpu in the guest (via agent)"
)
},
{.
name
=
"desc"
,
.
data
=
N_
(
"Use the guest agent to query or set cpu state from guest's "
"point of view"
)
},
{.
name
=
NULL
}
};
static
const
vshCmdOptDef
opts_guestvcpus
[]
=
{
VIRSH_COMMON_OPT_DOMAIN_FULL
,
{.
name
=
"cpulist"
,
.
type
=
VSH_OT_STRING
,
.
help
=
N_
(
"list of cpus to enable or disable"
)
},
{.
name
=
"enable"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"enable cpus specified by cpulist"
)
},
{.
name
=
"disable"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"disable cpus specified by cpulist"
)
},
{.
name
=
NULL
}
};
static
bool
cmdGuestvcpus
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
bool
enable
=
vshCommandOptBool
(
cmd
,
"enable"
);
bool
disable
=
vshCommandOptBool
(
cmd
,
"disable"
);
virTypedParameterPtr
params
=
NULL
;
unsigned
int
nparams
=
0
;
const
char
*
cpulist
=
NULL
;
int
state
=
0
;
size_t
i
;
bool
ret
=
false
;
VSH_EXCLUSIVE_OPTIONS_VAR
(
enable
,
disable
);
VSH_REQUIRE_OPTION
(
"enable"
,
"cpulist"
);
VSH_REQUIRE_OPTION
(
"disable"
,
"cpulist"
);
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"cpulist"
,
&
cpulist
))
return
false
;
if
(
cpulist
&&
!
(
enable
|
disable
))
{
vshError
(
ctl
,
_
(
"One of options --enable or --disable is required by "
"option --cpulist"
));
return
false
;
}
if
(
!
(
dom
=
virshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
false
;
if
(
enable
)
state
=
1
;
if
(
cpulist
)
{
if
(
virDomainSetGuestVcpus
(
dom
,
cpulist
,
state
,
0
)
<
0
)
goto
cleanup
;
}
else
{
if
(
virDomainGetGuestVcpus
(
dom
,
&
params
,
&
nparams
,
0
)
<
0
)
goto
cleanup
;
for
(
i
=
0
;
i
<
nparams
;
i
++
)
{
char
*
str
=
vshGetTypedParamValue
(
ctl
,
&
params
[
i
]);
vshPrint
(
ctl
,
"%-15s: %s
\n
"
,
params
[
i
].
field
,
str
);
VIR_FREE
(
str
);
}
}
ret
=
true
;
cleanup:
virTypedParamsFree
(
params
,
nparams
);
virDomainFree
(
dom
);
return
ret
;
}
/*
* "iothreadinfo" command
*/
...
...
@@ -13602,5 +13689,11 @@ const vshCmdDef domManagementCmds[] = {
.
info
=
info_vncdisplay
,
.
flags
=
0
},
{.
name
=
"guestvcpus"
,
.
handler
=
cmdGuestvcpus
,
.
opts
=
opts_guestvcpus
,
.
info
=
info_guestvcpus
,
.
flags
=
0
},
{.
name
=
NULL
}
};
tools/virsh.pod
浏览文件 @
69e0cd33
...
...
@@ -2501,6 +2501,16 @@ Both I<--live> and I<--config> flags may be given if I<cpulist> is present,
but I<--current> is exclusive.
If no flag is specified, behavior is different depending on hypervisor.
=item B<guestvcpus> I<domain> [[I<--enable>] | [I<--disable>]] [I<cpulist>]
Query or change state of vCPUs from guest's point of view using the guest agent.
When invoked without I<cpulist> the guest is queried for available guest vCPUs,
their state and possibility to be offlined.
If I<cpulist> is provided then one of I<--enable> or I<--disable> must be
provided too. The desired operation is then executed on the domain.
See B<vcpupin> for information on I<cpulist>.
=item B<vncdisplay> I<domain>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录