Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
f0326d6d
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看板
提交
f0326d6d
编写于
6月 21, 2016
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Implement command for virDomainSetVcpu called setvcpu
Add a simple virsh command handler which makes use of the new API.
上级
8f657259
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
107 addition
and
0 deletion
+107
-0
tools/virsh-domain.c
tools/virsh-domain.c
+88
-0
tools/virsh.pod
tools/virsh.pod
+19
-0
未找到文件。
tools/virsh-domain.c
浏览文件 @
f0326d6d
...
...
@@ -7014,6 +7014,88 @@ cmdGuestvcpus(vshControl *ctl, const vshCmd *cmd)
}
/*
* "setvcpu" command
*/
static
const
vshCmdInfo
info_setvcpu
[]
=
{
{.
name
=
"help"
,
.
data
=
N_
(
"attach/detach vcpu or groups of threads"
)
},
{.
name
=
"desc"
,
.
data
=
N_
(
"Add or remove vcpus"
)
},
{.
name
=
NULL
}
};
static
const
vshCmdOptDef
opts_setvcpu
[]
=
{
VIRSH_COMMON_OPT_DOMAIN_FULL
,
{.
name
=
"vcpulist"
,
.
type
=
VSH_OT_DATA
,
.
flags
=
VSH_OFLAG_REQ
,
.
help
=
N_
(
"ids of vcpus to manipulate"
)
},
{.
name
=
"enable"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"enable cpus specified by cpumap"
)
},
{.
name
=
"disable"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"disable cpus specified by cpumap"
)
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG
,
VIRSH_COMMON_OPT_DOMAIN_LIVE
,
VIRSH_COMMON_OPT_DOMAIN_CURRENT
,
{.
name
=
NULL
}
};
static
bool
cmdSetvcpu
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
bool
enable
=
vshCommandOptBool
(
cmd
,
"enable"
);
bool
disable
=
vshCommandOptBool
(
cmd
,
"disable"
);
bool
config
=
vshCommandOptBool
(
cmd
,
"config"
);
bool
live
=
vshCommandOptBool
(
cmd
,
"live"
);
const
char
*
vcpulist
=
NULL
;
int
state
=
0
;
bool
ret
=
false
;
unsigned
int
flags
=
VIR_DOMAIN_AFFECT_CURRENT
;
VSH_EXCLUSIVE_OPTIONS_VAR
(
enable
,
disable
);
VSH_EXCLUSIVE_OPTIONS
(
"current"
,
"live"
);
VSH_EXCLUSIVE_OPTIONS
(
"current"
,
"config"
);
if
(
config
)
flags
|=
VIR_DOMAIN_AFFECT_CONFIG
;
if
(
live
)
flags
|=
VIR_DOMAIN_AFFECT_LIVE
;
if
(
!
(
enable
||
disable
))
{
vshError
(
ctl
,
"%s"
,
_
(
"one of --enable, --disable is required"
));
return
false
;
}
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"vcpulist"
,
&
vcpulist
))
return
false
;
if
(
!
(
dom
=
virshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
false
;
if
(
enable
)
state
=
1
;
if
(
virDomainSetVcpu
(
dom
,
vcpulist
,
state
,
flags
)
<
0
)
goto
cleanup
;
ret
=
true
;
cleanup:
virDomainFree
(
dom
);
return
ret
;
}
/*
* "iothreadinfo" command
*/
...
...
@@ -13951,5 +14033,11 @@ const vshCmdDef domManagementCmds[] = {
.
info
=
info_guestvcpus
,
.
flags
=
0
},
{.
name
=
"setvcpu"
,
.
handler
=
cmdSetvcpu
,
.
opts
=
opts_setvcpu
,
.
info
=
info_setvcpu
,
.
flags
=
0
},
{.
name
=
NULL
}
};
tools/virsh.pod
浏览文件 @
f0326d6d
...
...
@@ -2418,6 +2418,25 @@ be hot-plugged the next time the domain is booted. As such, it must only be
used with the I<--config> flag, and not with the I<--live> or the I<--current>
flag.
=item B<setvcpu> I<domain> I<vcpulist> [I<--enable>] | [I<--disable>]
[[I<--live>] [I<--config>] | [I<--current>]]
Change state of individual vCPUs using hot(un)plug mechanism.
See B<vcpupin> for information on format of I<vcpulist>. Hypervisor drivers may
require that I<vcpulist> contains exactly vCPUs belonging to one hotpluggable
entity. This is usually just a single vCPU but certain architectures such as
ppc64 require a full core to be specified at once.
Note that hypervisors may refuse to disable certain vcpus such as vcpu 0 or
others.
If I<--live> is specified, affect a running domain.
If I<--config> is specified, affect the next startup of a persistent domain.
If I<--current> is specified, affect the current domain state. This is the
default. Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive.
=item B<shutdown> I<domain> [I<--mode MODE-LIST>]
Gracefully shuts down a domain. This coordinates with the domain OS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录