Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
d87f7210
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看板
提交
d87f7210
编写于
3月 21, 2013
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh-domain: Add --live, --config, --current logic to cmdDetachDevice
Use the established approach to improve this function too.
上级
c3d9f399
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
13 deletion
+46
-13
tools/virsh-domain.c
tools/virsh-domain.c
+31
-9
tools/virsh.pod
tools/virsh.pod
+15
-4
未找到文件。
tools/virsh-domain.c
浏览文件 @
d87f7210
...
...
@@ -9101,13 +9101,21 @@ static const vshCmdOptDef opts_detach_device[] = {
.
help
=
N_
(
"XML file"
)
},
{.
name
=
"persistent"
,
.
type
=
VSH_OT_
ALIAS
,
.
help
=
"config"
.
type
=
VSH_OT_
BOOL
,
.
help
=
N_
(
"make live change persistent"
)
},
{.
name
=
"config"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"affect next boot"
)
},
{.
name
=
"live"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"affect running domain"
)
},
{.
name
=
"current"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"affect current domain"
)
},
{.
name
=
NULL
}
};
...
...
@@ -9119,11 +9127,29 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
char
*
buffer
=
NULL
;
int
ret
;
bool
funcRet
=
false
;
unsigned
int
flags
;
bool
current
=
vshCommandOptBool
(
cmd
,
"current"
);
bool
config
=
vshCommandOptBool
(
cmd
,
"config"
);
bool
live
=
vshCommandOptBool
(
cmd
,
"live"
);
bool
persistent
=
vshCommandOptBool
(
cmd
,
"persistent"
);
unsigned
int
flags
=
VIR_DOMAIN_AFFECT_CURRENT
;
VSH_EXCLUSIVE_OPTIONS_VAR
(
persistent
,
current
);
VSH_EXCLUSIVE_OPTIONS_VAR
(
current
,
live
);
VSH_EXCLUSIVE_OPTIONS_VAR
(
current
,
config
);
if
(
config
||
persistent
)
flags
|=
VIR_DOMAIN_AFFECT_CONFIG
;
if
(
live
)
flags
|=
VIR_DOMAIN_AFFECT_LIVE
;
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
false
;
if
(
persistent
&&
virDomainIsActive
(
dom
)
==
1
)
flags
|=
VIR_DOMAIN_AFFECT_LIVE
;
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"file"
,
&
from
)
<
0
)
goto
cleanup
;
...
...
@@ -9132,14 +9158,10 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
goto
cleanup
;
}
if
(
vshCommandOptBool
(
cmd
,
"config"
))
{
flags
=
VIR_DOMAIN_AFFECT_CONFIG
;
if
(
virDomainIsActive
(
dom
)
==
1
)
flags
|=
VIR_DOMAIN_AFFECT_LIVE
;
if
(
flags
!=
0
)
ret
=
virDomainDetachDeviceFlags
(
dom
,
buffer
,
flags
);
}
else
{
else
ret
=
virDomainDetachDevice
(
dom
,
buffer
);
}
if
(
ret
<
0
)
{
vshError
(
ctl
,
_
(
"Failed to detach device from %s"
),
from
);
...
...
tools/virsh.pod
浏览文件 @
d87f7210
...
...
@@ -1859,16 +1859,27 @@ B<Note>: the optional target value is the name of a device to be created
as the back-end on the node. If not provided a device named "vnetN" or "vifN"
will be created automatically.
=item B<detach-device> I<domain> I<FILE> [I<--config>]
=item B<detach-device> I<domain> I<FILE>
[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
Detach a device from the domain, takes the same kind of XML descriptions
as command B<attach-device>.
If I<--config> is specified, alter persistent configuration, effect observed
on next boot, for compatibility purposes, I<--persistent> is alias of
I<--config>.
For passthrough host devices, see also B<nodedev-reattach>, needed if
the device does not use managed mode.
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.
Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
For compatibility purposes, I<--persistent> behaves like I<--config> for
an offline domain, and like I<--live> I<--config> for a running domain.
Note that older versions of virsh used I<--config> as an alias for
I<--persistent>.
=item B<detach-disk> I<domain> I<target> [I<--config>]
Detach a disk device from a domain. The I<target> is the device as seen
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录