Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
6427091f
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看板
提交
6427091f
编写于
3月 02, 2009
作者:
D
Daniel Veillard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* src/virsh.c: add 3 new commands for node device detach, reattach and reset,
patch by Mark McLoughlin. Daniel
上级
737af2ea
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
133 addition
and
1 deletion
+133
-1
ChangeLog
ChangeLog
+7
-1
src/virsh.c
src/virsh.c
+126
-0
未找到文件。
ChangeLog
浏览文件 @
6427091f
Mon Mar 2 17:26:48 CET 2009 Daniel Veillard <veillard@redhat.com>
* src/virsh.c: add 3 new commands for node device detach,
reattach and reset, patch by Mark McLoughlin.
Mon Mar 2 17:19:23 CET 2009 Daniel Veillard <veillard@redhat.com>
* include/libvirt/libvirt.h include/libvirt/libvirt.h.in
...
...
@@ -5,7 +10,8 @@ Mon Mar 2 17:19:23 CET 2009 Daniel Veillard <veillard@redhat.com>
src/lxc_driver.c src/openvz_driver.c src/qemu_driver.c
src/test.c src/uml_driver.c: add the public APIs for
virNodeDeviceDettach virNodeDeviceReAttach and virNodeDeviceReset
and extends the driver structure accordingly.
and extends the driver structure accordingly, patch by Mark
McLoughlin.
Mon Mar 2 17:07:44 CET 2009 Daniel Veillard <veillard@redhat.com>
...
...
src/virsh.c
浏览文件 @
6427091f
...
...
@@ -4432,6 +4432,129 @@ cmdNodeDeviceDumpXML (vshControl *ctl, const vshCmd *cmd)
return
TRUE
;
}
/*
* "nodedev-dettach" command
*/
static
const
vshCmdInfo
info_node_device_dettach
[]
=
{
{
"help"
,
gettext_noop
(
"dettach node device its device driver"
)},
{
"desc"
,
gettext_noop
(
"Dettach node device its device driver before assigning to a domain."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_node_device_dettach
[]
=
{
{
"device"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"device key"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdNodeDeviceDettach
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
const
char
*
name
;
virNodeDevicePtr
device
;
int
ret
=
TRUE
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
name
=
vshCommandOptString
(
cmd
,
"device"
,
NULL
)))
return
FALSE
;
if
(
!
(
device
=
virNodeDeviceLookupByName
(
ctl
->
conn
,
name
)))
{
vshError
(
ctl
,
FALSE
,
"%s '%s'"
,
_
(
"Could not find matching device"
),
name
);
return
FALSE
;
}
if
(
virNodeDeviceDettach
(
device
)
==
0
)
{
vshPrint
(
ctl
,
_
(
"Device %s dettached
\n
"
),
name
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to dettach device %s"
),
name
);
ret
=
FALSE
;
}
virNodeDeviceFree
(
device
);
return
ret
;
}
/*
* "nodedev-reattach" command
*/
static
const
vshCmdInfo
info_node_device_reattach
[]
=
{
{
"help"
,
gettext_noop
(
"reattach node device its device driver"
)},
{
"desc"
,
gettext_noop
(
"Dettach node device its device driver before assigning to a domain."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_node_device_reattach
[]
=
{
{
"device"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"device key"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdNodeDeviceReAttach
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
const
char
*
name
;
virNodeDevicePtr
device
;
int
ret
=
TRUE
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
name
=
vshCommandOptString
(
cmd
,
"device"
,
NULL
)))
return
FALSE
;
if
(
!
(
device
=
virNodeDeviceLookupByName
(
ctl
->
conn
,
name
)))
{
vshError
(
ctl
,
FALSE
,
"%s '%s'"
,
_
(
"Could not find matching device"
),
name
);
return
FALSE
;
}
if
(
virNodeDeviceReAttach
(
device
)
==
0
)
{
vshPrint
(
ctl
,
_
(
"Device %s re-attached
\n
"
),
name
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to re-attach device %s"
),
name
);
ret
=
FALSE
;
}
virNodeDeviceFree
(
device
);
return
ret
;
}
/*
* "nodedev-reset" command
*/
static
const
vshCmdInfo
info_node_device_reset
[]
=
{
{
"help"
,
gettext_noop
(
"reset node device"
)},
{
"desc"
,
gettext_noop
(
"Reset node device before or after assigning to a domain."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_node_device_reset
[]
=
{
{
"device"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"device key"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdNodeDeviceReset
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
const
char
*
name
;
virNodeDevicePtr
device
;
int
ret
=
TRUE
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
name
=
vshCommandOptString
(
cmd
,
"device"
,
NULL
)))
return
FALSE
;
if
(
!
(
device
=
virNodeDeviceLookupByName
(
ctl
->
conn
,
name
)))
{
vshError
(
ctl
,
FALSE
,
"%s '%s'"
,
_
(
"Could not find matching device"
),
name
);
return
FALSE
;
}
if
(
virNodeDeviceReset
(
device
)
==
0
)
{
vshPrint
(
ctl
,
_
(
"Device %s reset
\n
"
),
name
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to reset device %s"
),
name
);
ret
=
FALSE
;
}
virNodeDeviceFree
(
device
);
return
ret
;
}
/*
* "hostkey" command
*/
...
...
@@ -5576,6 +5699,9 @@ static const vshCmdDef commands[] = {
{
"nodedev-list"
,
cmdNodeListDevices
,
opts_node_list_devices
,
info_node_list_devices
},
{
"nodedev-dumpxml"
,
cmdNodeDeviceDumpXML
,
opts_node_device_dumpxml
,
info_node_device_dumpxml
},
{
"nodedev-dettach"
,
cmdNodeDeviceDettach
,
opts_node_device_dettach
,
info_node_device_dettach
},
{
"nodedev-reattach"
,
cmdNodeDeviceReAttach
,
opts_node_device_reattach
,
info_node_device_reattach
},
{
"nodedev-reset"
,
cmdNodeDeviceReset
,
opts_node_device_reset
,
info_node_device_reset
},
{
"pool-autostart"
,
cmdPoolAutostart
,
opts_pool_autostart
,
info_pool_autostart
},
{
"pool-build"
,
cmdPoolBuild
,
opts_pool_build
,
info_pool_build
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录