Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e991b09d
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,发现更多精彩内容 >>
提交
e991b09d
编写于
3月 06, 2014
作者:
C
Chunyan Liu
提交者:
Daniel P. Berrange
3月 12, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add 3 wrapper functions for prepare/reattach/update domain hostdevs
上级
4dd9f103
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
128 addition
and
1 deletion
+128
-1
src/libvirt_private.syms
src/libvirt_private.syms
+5
-1
src/util/virhostdev.c
src/util/virhostdev.c
+103
-0
src/util/virhostdev.h
src/util/virhostdev.h
+20
-0
未找到文件。
src/libvirt_private.syms
浏览文件 @
e991b09d
...
...
@@ -1297,20 +1297,24 @@ virHookInitialize;
virHookPresent;
#util/virhostdev.h
#
util/virhostdev.h
virHostdevManagerGetDefault;
virHostdevPCINodeDeviceDetach;
virHostdevPCINodeDeviceReAttach;
virHostdevPCINodeDeviceReset;
virHostdevPrepareDomainDevices;
virHostdevPreparePCIDevices;
virHostdevPrepareSCSIDevices;
virHostdevPrepareUSBDevices;
virHostdevReAttachDomainDevices;
virHostdevReAttachPCIDevices;
virHostdevReAttachSCSIDevices;
virHostdevReAttachUSBDevices;
virHostdevUpdateActivePCIDevices;
virHostdevUpdateActiveSCSIDevices;
virHostdevUpdateActiveUSBDevices;
virHostdevUpdateDomainActiveDevices;
# util/viridentity.h
virIdentityGetAttr;
...
...
src/util/virhostdev.c
浏览文件 @
e991b09d
...
...
@@ -1468,3 +1468,106 @@ out:
virObjectUnlock
(
hostdev_mgr
->
activePCIHostdevs
);
return
ret
;
}
int
virHostdevPrepareDomainDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
)
{
if
(
!
def
->
nhostdevs
)
return
0
;
if
(
mgr
==
NULL
)
return
-
1
;
if
(
flags
&
VIR_HOSTDEV_SP_PCI
)
{
if
(
virHostdevPreparePCIDevices
(
mgr
,
driver
,
def
->
name
,
def
->
uuid
,
def
->
hostdevs
,
def
->
nhostdevs
,
flags
)
<
0
)
return
-
1
;
}
if
(
flags
&
VIR_HOSTDEV_SP_USB
)
{
if
(
virHostdevPrepareUSBDevices
(
mgr
,
driver
,
def
->
name
,
def
->
hostdevs
,
def
->
nhostdevs
,
flags
)
<
0
)
return
-
1
;
}
if
(
flags
&
VIR_HOSTDEV_SP_SCSI
)
{
if
(
virHostdevPrepareSCSIDevices
(
mgr
,
driver
,
def
->
name
,
def
->
hostdevs
,
def
->
nhostdevs
)
<
0
)
return
-
1
;
}
return
0
;
}
/* @oldStateDir
* For upgrade purpose: see virHostdevReAttachPciHostdevs
*/
void
virHostdevReAttachDomainDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
,
const
char
*
oldStateDir
)
{
if
(
!
def
->
nhostdevs
||
!
mgr
)
return
;
if
(
flags
&
VIR_HOSTDEV_SP_PCI
)
{
virHostdevReAttachPCIDevices
(
mgr
,
driver
,
def
->
name
,
def
->
hostdevs
,
def
->
nhostdevs
,
oldStateDir
);
}
if
(
flags
&
VIR_HOSTDEV_SP_USB
)
{
virHostdevReAttachUSBDevices
(
mgr
,
driver
,
def
->
name
,
def
->
hostdevs
,
def
->
nhostdevs
);
}
if
(
flags
&
VIR_HOSTDEV_SP_SCSI
)
{
virHostdevReAttachSCSIDevices
(
mgr
,
driver
,
def
->
name
,
def
->
hostdevs
,
def
->
nhostdevs
);
}
}
int
virHostdevUpdateDomainActiveDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
)
{
if
(
!
def
->
nhostdevs
)
return
0
;
if
(
flags
&
VIR_HOSTDEV_SP_PCI
)
{
if
(
virHostdevUpdateActivePCIDevices
(
mgr
,
def
->
hostdevs
,
def
->
nhostdevs
,
driver
,
def
->
name
)
<
0
)
return
-
1
;
}
if
(
flags
&
VIR_HOSTDEV_SP_USB
)
{
if
(
virHostdevUpdateActiveUSBDevices
(
mgr
,
def
->
hostdevs
,
def
->
nhostdevs
,
driver
,
def
->
name
)
<
0
)
return
-
1
;
}
if
(
flags
&
VIR_HOSTDEV_SP_SCSI
)
{
if
(
virHostdevUpdateActiveSCSIDevices
(
mgr
,
def
->
hostdevs
,
def
->
nhostdevs
,
driver
,
def
->
name
)
<
0
)
return
-
1
;
}
return
0
;
}
src/util/virhostdev.h
浏览文件 @
e991b09d
...
...
@@ -35,6 +35,10 @@
typedef
enum
{
VIR_HOSTDEV_STRICT_ACS_CHECK
=
(
1
<<
0
),
/* strict acs check */
VIR_HOSTDEV_COLD_BOOT
=
(
1
<<
1
),
/* cold boot */
VIR_HOSTDEV_SP_PCI
=
(
1
<<
8
),
/* support pci passthrough */
VIR_HOSTDEV_SP_USB
=
(
1
<<
9
),
/* support usb passthrough */
VIR_HOSTDEV_SP_SCSI
=
(
1
<<
10
),
/* support scsi passthrough */
}
virHostdevFlag
;
...
...
@@ -108,6 +112,22 @@ virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr,
int
nhostdevs
,
const
char
*
drv_name
,
const
char
*
dom_name
);
int
virHostdevUpdateDomainActiveDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
);
int
virHostdevPrepareDomainDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
);
void
virHostdevReAttachDomainDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
,
const
char
*
oldStateDir
);
/* functions used by NodeDevDetach/Reattach/Reset */
int
virHostdevPCINodeDeviceDetach
(
virHostdevManagerPtr
mgr
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录