Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
48605960
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,发现更多精彩内容 >>
提交
48605960
编写于
8月 21, 2012
作者:
H
Hu Tao
提交者:
Daniel Veillard
8月 22, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
new command emulatorpin
上级
272570df
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
204 addition
and
0 deletion
+204
-0
tools/virsh-domain.c
tools/virsh-domain.c
+188
-0
tools/virsh.pod
tools/virsh.pod
+16
-0
未找到文件。
tools/virsh-domain.c
浏览文件 @
48605960
...
...
@@ -4820,6 +4820,193 @@ parse_error:
goto
cleanup
;
}
/*
* "emulatorpin" command
*/
static
const
vshCmdInfo
info_emulatorpin
[]
=
{
{
"help"
,
N_
(
"control or query domain emulator affinity"
)},
{
"desc"
,
N_
(
"Pin domain emulator threads to host physical CPUs."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_emulatorpin
[]
=
{
{
"domain"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
N_
(
"domain name, id or uuid"
)},
{
"cpulist"
,
VSH_OT_DATA
,
VSH_OFLAG_EMPTY_OK
,
N_
(
"host cpu number(s) to set, or omit option to query"
)},
{
"config"
,
VSH_OT_BOOL
,
0
,
N_
(
"affect next boot"
)},
{
"live"
,
VSH_OT_BOOL
,
0
,
N_
(
"affect running domain"
)},
{
"current"
,
VSH_OT_BOOL
,
0
,
N_
(
"affect current domain"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
bool
cmdEmulatorPin
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
virNodeInfo
nodeinfo
;
const
char
*
cpulist
=
NULL
;
bool
ret
=
true
;
unsigned
char
*
cpumap
=
NULL
;
unsigned
char
*
cpumaps
=
NULL
;
size_t
cpumaplen
;
int
i
,
cpu
,
lastcpu
,
maxcpu
;
bool
unuse
=
false
;
const
char
*
cur
;
bool
config
=
vshCommandOptBool
(
cmd
,
"config"
);
bool
live
=
vshCommandOptBool
(
cmd
,
"live"
);
bool
current
=
vshCommandOptBool
(
cmd
,
"current"
);
bool
query
=
false
;
/* Query mode if no cpulist */
unsigned
int
flags
=
0
;
if
(
current
)
{
if
(
live
||
config
)
{
vshError
(
ctl
,
"%s"
,
_
(
"--current must be specified exclusively"
));
return
false
;
}
flags
=
VIR_DOMAIN_AFFECT_CURRENT
;
}
else
{
if
(
config
)
flags
|=
VIR_DOMAIN_AFFECT_CONFIG
;
if
(
live
)
flags
|=
VIR_DOMAIN_AFFECT_LIVE
;
/* neither option is specified */
if
(
!
live
&&
!
config
)
flags
=
-
1
;
}
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
return
false
;
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
false
;
if
(
vshCommandOptString
(
cmd
,
"cpulist"
,
&
cpulist
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"emulatorpin: Missing cpulist."
));
virDomainFree
(
dom
);
return
false
;
}
query
=
!
cpulist
;
if
(
virNodeGetInfo
(
ctl
->
conn
,
&
nodeinfo
)
!=
0
)
{
virDomainFree
(
dom
);
return
false
;
}
maxcpu
=
VIR_NODEINFO_MAXCPUS
(
nodeinfo
);
cpumaplen
=
VIR_CPU_MAPLEN
(
maxcpu
);
/* Query mode: show CPU affinity information then exit.*/
if
(
query
)
{
/* When query mode and neither "live", "config" nor "current"
* is specified, set VIR_DOMAIN_AFFECT_CURRENT as flags */
if
(
flags
==
-
1
)
flags
=
VIR_DOMAIN_AFFECT_CURRENT
;
cpumaps
=
vshMalloc
(
ctl
,
cpumaplen
);
if
(
virDomainGetEmulatorPinInfo
(
dom
,
cpumaps
,
cpumaplen
,
flags
)
>=
0
)
{
vshPrint
(
ctl
,
"%s %s
\n
"
,
_
(
"emulator:"
),
_
(
"CPU Affinity"
));
vshPrint
(
ctl
,
"----------------------------------
\n
"
);
vshPrint
(
ctl
,
" *: "
);
ret
=
vshPrintPinInfo
(
cpumaps
,
cpumaplen
,
maxcpu
,
0
);
vshPrint
(
ctl
,
"
\n
"
);
}
else
{
ret
=
false
;
}
VIR_FREE
(
cpumaps
);
goto
cleanup
;
}
/* Pin mode: pinning emulator threads to specified physical cpus*/
cpumap
=
vshCalloc
(
ctl
,
cpumaplen
,
sizeof
(
cpumap
));
/* Parse cpulist */
cur
=
cpulist
;
if
(
*
cur
==
0
)
{
goto
parse_error
;
}
else
if
(
*
cur
==
'r'
)
{
for
(
cpu
=
0
;
cpu
<
maxcpu
;
cpu
++
)
VIR_USE_CPU
(
cpumap
,
cpu
);
cur
=
""
;
}
while
(
*
cur
!=
0
)
{
/* the char '^' denotes exclusive */
if
(
*
cur
==
'^'
)
{
cur
++
;
unuse
=
true
;
}
/* parse physical CPU number */
if
(
!
c_isdigit
(
*
cur
))
goto
parse_error
;
cpu
=
virParseNumber
(
&
cur
);
if
(
cpu
<
0
)
{
goto
parse_error
;
}
if
(
cpu
>=
maxcpu
)
{
vshError
(
ctl
,
_
(
"Physical CPU %d doesn't exist."
),
cpu
);
goto
parse_error
;
}
virSkipSpaces
(
&
cur
);
if
(
*
cur
==
','
||
*
cur
==
0
)
{
if
(
unuse
)
{
VIR_UNUSE_CPU
(
cpumap
,
cpu
);
}
else
{
VIR_USE_CPU
(
cpumap
,
cpu
);
}
}
else
if
(
*
cur
==
'-'
)
{
/* the char '-' denotes range */
if
(
unuse
)
{
goto
parse_error
;
}
cur
++
;
virSkipSpaces
(
&
cur
);
/* parse the end of range */
lastcpu
=
virParseNumber
(
&
cur
);
if
(
lastcpu
<
cpu
)
{
goto
parse_error
;
}
if
(
lastcpu
>=
maxcpu
)
{
vshError
(
ctl
,
_
(
"Physical CPU %d doesn't exist."
),
maxcpu
);
goto
parse_error
;
}
for
(
i
=
cpu
;
i
<=
lastcpu
;
i
++
)
{
VIR_USE_CPU
(
cpumap
,
i
);
}
virSkipSpaces
(
&
cur
);
}
if
(
*
cur
==
','
)
{
cur
++
;
virSkipSpaces
(
&
cur
);
unuse
=
false
;
}
else
if
(
*
cur
==
0
)
{
break
;
}
else
{
goto
parse_error
;
}
}
if
(
flags
==
-
1
)
flags
=
VIR_DOMAIN_AFFECT_LIVE
;
if
(
virDomainPinEmulator
(
dom
,
cpumap
,
cpumaplen
,
flags
)
!=
0
)
ret
=
false
;
cleanup:
VIR_FREE
(
cpumap
);
virDomainFree
(
dom
);
return
ret
;
parse_error:
vshError
(
ctl
,
"%s"
,
_
(
"cpulist: Invalid format."
));
ret
=
false
;
goto
cleanup
;
}
/*
* "setvcpus" command
*/
...
...
@@ -8252,6 +8439,7 @@ const vshCmdDef domManagementCmds[] = {
{
"vcpucount"
,
cmdVcpucount
,
opts_vcpucount
,
info_vcpucount
,
0
},
{
"vcpuinfo"
,
cmdVcpuinfo
,
opts_vcpuinfo
,
info_vcpuinfo
,
0
},
{
"vcpupin"
,
cmdVcpuPin
,
opts_vcpupin
,
info_vcpupin
,
0
},
{
"emulatorpin"
,
cmdEmulatorPin
,
opts_emulatorpin
,
info_emulatorpin
,
0
},
{
"vncdisplay"
,
cmdVNCDisplay
,
opts_vncdisplay
,
info_vncdisplay
,
0
},
{
NULL
,
NULL
,
NULL
,
NULL
,
0
}
};
tools/virsh.pod
浏览文件 @
48605960
...
...
@@ -1614,6 +1614,22 @@ If no flag is specified, behavior is different depending on hypervisor.
B<Note>: The expression is sequentially evaluated, so "0-15,^8" is
identical to "9-14,0-7,15" but not identical to "^8,0-15".
=item B<emulatorpin> I<domain> [I<cpulist>] [[I<--live>] [I<--config>]
| [I<--current>]]
Query or change the pinning of domain's emulator threads to host physical
CPUs.
See B<vcpupin> for I<cpulist>.
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
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<vncdisplay> I<domain>
Output the IP address and port number for the VNC display. If the information
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录