Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
89b7bb75
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看板
提交
89b7bb75
编写于
7月 09, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Add qemuDomainReleaseDeviceAddress to remove any address
上级
dc4cdc57
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
71 deletion
+47
-71
src/qemu/qemu_command.c
src/qemu/qemu_command.c
+31
-4
src/qemu/qemu_command.h
src/qemu/qemu_command.h
+4
-4
src/qemu/qemu_hotplug.c
src/qemu/qemu_hotplug.c
+12
-63
未找到文件。
src/qemu/qemu_command.c
浏览文件 @
89b7bb75
...
@@ -1180,8 +1180,9 @@ qemuDomainCCWAddressValidate(virDomainDefPtr def ATTRIBUTE_UNUSED,
...
@@ -1180,8 +1180,9 @@ qemuDomainCCWAddressValidate(virDomainDefPtr def ATTRIBUTE_UNUSED,
return
qemuDomainCCWAddressAssign
(
info
,
data
,
false
);
return
qemuDomainCCWAddressAssign
(
info
,
data
,
false
);
}
}
int
qemuDomainCCWAddressReleaseAddr
(
qemuDomainCCWAddressSetPtr
addrs
,
static
int
virDomainDeviceInfoPtr
dev
)
qemuDomainCCWAddressReleaseAddr
(
qemuDomainCCWAddressSetPtr
addrs
,
virDomainDeviceInfoPtr
dev
)
{
{
char
*
addr
;
char
*
addr
;
int
ret
;
int
ret
;
...
@@ -1820,8 +1821,9 @@ int qemuDomainPCIAddressReleaseAddr(qemuDomainPCIAddressSetPtr addrs,
...
@@ -1820,8 +1821,9 @@ int qemuDomainPCIAddressReleaseAddr(qemuDomainPCIAddressSetPtr addrs,
return
0
;
return
0
;
}
}
int
qemuDomainPCIAddressReleaseSlot
(
qemuDomainPCIAddressSetPtr
addrs
,
static
int
virDevicePCIAddressPtr
addr
)
qemuDomainPCIAddressReleaseSlot
(
qemuDomainPCIAddressSetPtr
addrs
,
virDevicePCIAddressPtr
addr
)
{
{
if
(
!
qemuPCIAddressValidate
(
addrs
,
addr
))
if
(
!
qemuPCIAddressValidate
(
addrs
,
addr
))
return
-
1
;
return
-
1
;
...
@@ -1914,6 +1916,31 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
...
@@ -1914,6 +1916,31 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
}
}
void
qemuDomainReleaseDeviceAddress
(
virDomainObjPtr
vm
,
virDomainDeviceInfoPtr
info
,
const
char
*
devstr
)
{
qemuDomainObjPrivatePtr
priv
=
vm
->
privateData
;
if
(
!
devstr
)
devstr
=
info
->
alias
;
if
(
info
->
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW
&&
STREQLEN
(
vm
->
def
->
os
.
machine
,
"s390-ccw"
,
8
)
&&
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_VIRTIO_CCW
)
&&
qemuDomainCCWAddressReleaseAddr
(
priv
->
ccwaddrs
,
info
)
<
0
)
VIR_WARN
(
"Unable to release CCW address on %s"
,
NULLSTR
(
devstr
));
else
if
(
info
->
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI
&&
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
info
->
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on %s"
,
NULLSTR
(
devstr
));
}
#define IS_USB2_CONTROLLER(ctrl) \
#define IS_USB2_CONTROLLER(ctrl) \
(((ctrl)->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) && \
(((ctrl)->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) && \
((ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1 || \
((ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1 || \
...
...
src/qemu/qemu_command.h
浏览文件 @
89b7bb75
...
@@ -221,6 +221,10 @@ int qemuDomainAssignAddresses(virDomainDefPtr def,
...
@@ -221,6 +221,10 @@ int qemuDomainAssignAddresses(virDomainDefPtr def,
int
qemuDomainAssignSpaprVIOAddresses
(
virDomainDefPtr
def
,
int
qemuDomainAssignSpaprVIOAddresses
(
virDomainDefPtr
def
,
virQEMUCapsPtr
qemuCaps
);
virQEMUCapsPtr
qemuCaps
);
void
qemuDomainReleaseDeviceAddress
(
virDomainObjPtr
vm
,
virDomainDeviceInfoPtr
info
,
const
char
*
devstr
);
int
qemuDomainAssignPCIAddresses
(
virDomainDefPtr
def
,
int
qemuDomainAssignPCIAddresses
(
virDomainDefPtr
def
,
virQEMUCapsPtr
qemuCaps
,
virQEMUCapsPtr
qemuCaps
,
virDomainObjPtr
obj
);
virDomainObjPtr
obj
);
...
@@ -237,16 +241,12 @@ int qemuDomainPCIAddressEnsureAddr(qemuDomainPCIAddressSetPtr addrs,
...
@@ -237,16 +241,12 @@ int qemuDomainPCIAddressEnsureAddr(qemuDomainPCIAddressSetPtr addrs,
virDomainDeviceInfoPtr
dev
);
virDomainDeviceInfoPtr
dev
);
int
qemuDomainPCIAddressReleaseAddr
(
qemuDomainPCIAddressSetPtr
addrs
,
int
qemuDomainPCIAddressReleaseAddr
(
qemuDomainPCIAddressSetPtr
addrs
,
virDevicePCIAddressPtr
addr
);
virDevicePCIAddressPtr
addr
);
int
qemuDomainPCIAddressReleaseSlot
(
qemuDomainPCIAddressSetPtr
addrs
,
virDevicePCIAddressPtr
addr
);
void
qemuDomainPCIAddressSetFree
(
qemuDomainPCIAddressSetPtr
addrs
);
void
qemuDomainPCIAddressSetFree
(
qemuDomainPCIAddressSetPtr
addrs
);
int
qemuAssignDevicePCISlots
(
virDomainDefPtr
def
,
int
qemuAssignDevicePCISlots
(
virDomainDefPtr
def
,
virQEMUCapsPtr
qemuCaps
,
virQEMUCapsPtr
qemuCaps
,
qemuDomainPCIAddressSetPtr
addrs
);
qemuDomainPCIAddressSetPtr
addrs
);
int
qemuDomainCCWAddressReleaseAddr
(
qemuDomainCCWAddressSetPtr
addrs
,
virDomainDeviceInfoPtr
dev
);
int
qemuDomainCCWAddressAssign
(
virDomainDeviceInfoPtr
dev
,
qemuDomainCCWAddressSetPtr
addrs
,
int
qemuDomainCCWAddressAssign
(
virDomainDeviceInfoPtr
dev
,
qemuDomainCCWAddressSetPtr
addrs
,
bool
autoassign
);
bool
autoassign
);
void
qemuDomainCCWAddressSetFree
(
qemuDomainCCWAddressSetPtr
addrs
);
void
qemuDomainCCWAddressSetFree
(
qemuDomainCCWAddressSetPtr
addrs
);
...
...
src/qemu/qemu_hotplug.c
浏览文件 @
89b7bb75
...
@@ -327,16 +327,8 @@ cleanup:
...
@@ -327,16 +327,8 @@ cleanup:
return
ret
;
return
ret
;
error:
error:
if
(
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
releaseaddr
)
{
if
(
releaseaddr
)
if
(
disk
->
info
.
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI
&&
qemuDomainReleaseDeviceAddress
(
vm
,
&
disk
->
info
,
disk
->
src
);
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
disk
->
info
.
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on %s"
,
disk
->
src
);
else
if
(
disk
->
info
.
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW
&&
qemuDomainCCWAddressReleaseAddr
(
priv
->
ccwaddrs
,
&
disk
->
info
)
<
0
)
VIR_WARN
(
"Unable to release CCW address on %s"
,
disk
->
src
);
}
if
(
virSecurityManagerRestoreImageLabel
(
driver
->
securityManager
,
if
(
virSecurityManagerRestoreImageLabel
(
driver
->
securityManager
,
vm
->
def
,
disk
)
<
0
)
vm
->
def
,
disk
)
<
0
)
...
@@ -405,13 +397,8 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver,
...
@@ -405,13 +397,8 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver,
}
}
cleanup:
cleanup:
if
((
ret
!=
0
)
&&
if
(
ret
!=
0
&&
releaseaddr
)
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
qemuDomainReleaseDeviceAddress
(
vm
,
&
controller
->
info
,
NULL
);
(
controller
->
info
.
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI
)
&&
releaseaddr
&&
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
controller
->
info
.
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on controller"
);
VIR_FREE
(
devstr
);
VIR_FREE
(
devstr
);
return
ret
;
return
ret
;
...
@@ -930,19 +917,8 @@ cleanup:
...
@@ -930,19 +917,8 @@ cleanup:
if
(
!
ret
)
{
if
(
!
ret
)
{
vm
->
def
->
nets
[
vm
->
def
->
nnets
++
]
=
net
;
vm
->
def
->
nets
[
vm
->
def
->
nnets
++
]
=
net
;
}
else
{
}
else
{
if
(
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
if
(
releaseaddr
)
net
->
info
.
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI
&&
qemuDomainReleaseDeviceAddress
(
vm
,
&
net
->
info
,
NULL
);
releaseaddr
&&
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
net
->
info
.
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on NIC"
);
else
if
(
STREQLEN
(
vm
->
def
->
os
.
machine
,
"s390-ccw"
,
8
)
&&
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_VIRTIO_CCW
)
&&
net
->
info
.
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW
&&
releaseaddr
&&
qemuDomainCCWAddressReleaseAddr
(
priv
->
ccwaddrs
,
&
net
->
info
)
<
0
)
VIR_WARN
(
"Unable to release CCW address on NIC"
);
if
(
iface_connected
)
{
if
(
iface_connected
)
{
virDomainConfNWFilterTeardown
(
net
);
virDomainConfNWFilterTeardown
(
net
);
...
@@ -1113,12 +1089,8 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
...
@@ -1113,12 +1089,8 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
return
0
;
return
0
;
error:
error:
if
(
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
if
(
releaseaddr
)
(
hostdev
->
info
->
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI
)
&&
qemuDomainReleaseDeviceAddress
(
vm
,
hostdev
->
info
,
NULL
);
releaseaddr
&&
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
hostdev
->
info
->
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on host device"
);
qemuDomainReAttachHostdevDevices
(
driver
,
vm
->
def
->
name
,
&
hostdev
,
1
);
qemuDomainReAttachHostdevDevices
(
driver
,
vm
->
def
->
name
,
&
hostdev
,
1
);
...
@@ -2341,16 +2313,7 @@ int qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
...
@@ -2341,16 +2313,7 @@ int qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
virDomainAuditDisk
(
vm
,
detach
->
src
,
NULL
,
"detach"
,
true
);
virDomainAuditDisk
(
vm
,
detach
->
src
,
NULL
,
"detach"
,
true
);
if
(
detach
->
info
.
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW
&&
qemuDomainReleaseDeviceAddress
(
vm
,
&
detach
->
info
,
dev
->
data
.
disk
->
src
);
STREQLEN
(
vm
->
def
->
os
.
machine
,
"s390-ccw"
,
8
)
&&
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_VIRTIO_CCW
)
&&
qemuDomainCCWAddressReleaseAddr
(
priv
->
ccwaddrs
,
&
detach
->
info
)
<
0
)
{
VIR_WARN
(
"Unable to release CCW address on %s"
,
dev
->
data
.
disk
->
src
);
}
else
if
(
detach
->
info
.
type
==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI
&&
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
detach
->
info
.
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on %s"
,
dev
->
data
.
disk
->
src
);
virDomainDiskRemove
(
vm
->
def
,
idx
);
virDomainDiskRemove
(
vm
->
def
,
idx
);
...
@@ -2565,13 +2528,9 @@ int qemuDomainDetachPciControllerDevice(virQEMUDriverPtr driver,
...
@@ -2565,13 +2528,9 @@ int qemuDomainDetachPciControllerDevice(virQEMUDriverPtr driver,
qemuDomainObjExitMonitor
(
driver
,
vm
);
qemuDomainObjExitMonitor
(
driver
,
vm
);
virDomainControllerRemove
(
vm
->
def
,
idx
);
virDomainControllerRemove
(
vm
->
def
,
idx
);
qemuDomainReleaseDeviceAddress
(
vm
,
&
detach
->
info
,
NULL
);
virDomainControllerDefFree
(
detach
);
virDomainControllerDefFree
(
detach
);
if
(
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
detach
->
info
.
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on controller"
);
ret
=
0
;
ret
=
0
;
cleanup:
cleanup:
...
@@ -2643,10 +2602,7 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver,
...
@@ -2643,10 +2602,7 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver,
virObjectUnlock
(
driver
->
activePciHostdevs
);
virObjectUnlock
(
driver
->
activePciHostdevs
);
virObjectUnlock
(
driver
->
inactivePciHostdevs
);
virObjectUnlock
(
driver
->
inactivePciHostdevs
);
if
(
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
qemuDomainReleaseDeviceAddress
(
vm
,
detach
->
info
,
NULL
);
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
detach
->
info
->
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on host device"
);
cleanup:
cleanup:
virObjectUnref
(
cfg
);
virObjectUnref
(
cfg
);
...
@@ -2969,14 +2925,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
...
@@ -2969,14 +2925,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
virDomainAuditNet
(
vm
,
detach
,
NULL
,
"detach"
,
true
);
virDomainAuditNet
(
vm
,
detach
,
NULL
,
"detach"
,
true
);
if
(
STREQLEN
(
vm
->
def
->
os
.
machine
,
"s390-ccw"
,
8
)
&&
qemuDomainReleaseDeviceAddress
(
vm
,
&
detach
->
info
,
NULL
);
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_VIRTIO_CCW
))
{
if
(
qemuDomainCCWAddressReleaseAddr
(
priv
->
ccwaddrs
,
&
detach
->
info
)
<
0
)
VIR_WARN
(
"Unable to release CCW address on NIC"
);
}
else
if
(
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
)
&&
qemuDomainPCIAddressReleaseSlot
(
priv
->
pciaddrs
,
&
detach
->
info
.
addr
.
pci
)
<
0
)
VIR_WARN
(
"Unable to release PCI address on NIC"
);
virDomainConfNWFilterTeardown
(
detach
);
virDomainConfNWFilterTeardown
(
detach
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录