Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
ed9c14a7
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看板
提交
ed9c14a7
编写于
1月 13, 2010
作者:
J
Jim Fehlig
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
domain{Attach,Detach}DeviceFlags handler for drivers
Implementation of domain{Attach,Detach}DeviceFlags handlers in the drivers.
上级
ce039c3e
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
218 addition
and
42 deletion
+218
-42
src/esx/esx_driver.c
src/esx/esx_driver.c
+2
-0
src/lxc/lxc_driver.c
src/lxc/lxc_driver.c
+2
-0
src/opennebula/one_driver.c
src/opennebula/one_driver.c
+2
-0
src/openvz/openvz_driver.c
src/openvz/openvz_driver.c
+2
-0
src/phyp/phyp_driver.c
src/phyp/phyp_driver.c
+2
-0
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+26
-0
src/test/test_driver.c
src/test/test_driver.c
+2
-0
src/uml/uml_driver.c
src/uml/uml_driver.c
+2
-0
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+24
-0
src/xen/proxy_internal.c
src/xen/proxy_internal.c
+2
-2
src/xen/xen_driver.c
src/xen/xen_driver.c
+44
-4
src/xen/xen_driver.h
src/xen/xen_driver.h
+2
-2
src/xen/xen_hypervisor.c
src/xen/xen_hypervisor.c
+2
-2
src/xen/xen_inotify.c
src/xen/xen_inotify.c
+2
-2
src/xen/xend_internal.c
src/xen/xend_internal.c
+80
-18
src/xen/xm_internal.c
src/xen/xm_internal.c
+20
-10
src/xen/xs_internal.c
src/xen/xs_internal.c
+2
-2
未找到文件。
src/esx/esx_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -3372,7 +3372,9 @@ static virDriver esxDriver = {
esxDomainDefineXML
,
/* domainDefineXML */
esxDomainUndefine
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainAttachDeviceFlags */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainDetachDeviceFlags */
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
esxDomainGetSchedulerType
,
/* domainGetSchedulerType */
...
...
src/lxc/lxc_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -2427,7 +2427,9 @@ static virDriver lxcDriver = {
lxcDomainDefine
,
/* domainDefineXML */
lxcDomainUndefine
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainAttachDeviceFlags */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainDetachDeviceFlags */
lxcDomainGetAutostart
,
/* domainGetAutostart */
lxcDomainSetAutostart
,
/* domainSetAutostart */
lxcGetSchedulerType
,
/* domainGetSchedulerType */
...
...
src/opennebula/one_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -754,7 +754,9 @@ static virDriver oneDriver = {
oneDomainDefine
,
/* domainDefineXML */
oneDomainUndefine
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainAttachDeviceFlags */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainDetachDeviceFlags */
oneGetAutostart
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
src/openvz/openvz_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -1506,7 +1506,9 @@ static virDriver openvzDriver = {
openvzDomainDefineXML
,
/* domainDefineXML */
openvzDomainUndefine
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainAttachDeviceFlags */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainDetachDeviceFlags */
openvzDomainGetAutostart
,
/* domainGetAutostart */
openvzDomainSetAutostart
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
src/phyp/phyp_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -1622,7 +1622,9 @@ virDriver phypDriver = {
NULL
,
/* domainDefineXML */
NULL
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainAttachDeviceFlags */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainDetachDeviceFlags */
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
src/qemu/qemu_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -6057,6 +6057,18 @@ cleanup:
return
ret
;
}
static
int
qemudDomainAttachDeviceFlags
(
virDomainPtr
dom
,
const
char
*
xml
,
unsigned
int
flags
)
{
if
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
)
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"cannot modify the persistent configuration of a domain"
));
return
-
1
;
}
return
qemudDomainAttachDevice
(
dom
,
xml
);
}
static
int
qemudDomainDetachPciDiskDevice
(
virConnectPtr
conn
,
struct
qemud_driver
*
driver
,
virDomainObjPtr
vm
,
...
...
@@ -6464,6 +6476,18 @@ cleanup:
return
ret
;
}
static
int
qemudDomainDetachDeviceFlags
(
virDomainPtr
dom
,
const
char
*
xml
,
unsigned
int
flags
)
{
if
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
)
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"cannot modify the persistent configuration of a domain"
));
return
-
1
;
}
return
qemudDomainDetachDevice
(
dom
,
xml
);
}
static
int
qemudDomainGetAutostart
(
virDomainPtr
dom
,
int
*
autostart
)
{
struct
qemud_driver
*
driver
=
dom
->
conn
->
privateData
;
...
...
@@ -8577,7 +8601,9 @@ static virDriver qemuDriver = {
qemudDomainDefine
,
/* domainDefineXML */
qemudDomainUndefine
,
/* domainUndefine */
qemudDomainAttachDevice
,
/* domainAttachDevice */
qemudDomainAttachDeviceFlags
,
/* domainAttachDeviceFlags */
qemudDomainDetachDevice
,
/* domainDetachDevice */
qemudDomainDetachDeviceFlags
,
/* domainDetachDeviceFlags */
qemudDomainGetAutostart
,
/* domainGetAutostart */
qemudDomainSetAutostart
,
/* domainSetAutostart */
qemuGetSchedulerType
,
/* domainGetSchedulerType */
...
...
src/test/test_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -5209,7 +5209,9 @@ static virDriver testDriver = {
testDomainDefineXML
,
/* domainDefineXML */
testDomainUndefine
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainAttachDeviceFlags */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainDetachDeviceFlags */
testDomainGetAutostart
,
/* domainGetAutostart */
testDomainSetAutostart
,
/* domainSetAutostart */
testDomainGetSchedulerType
,
/* domainGetSchedulerType */
...
...
src/uml/uml_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -1895,7 +1895,9 @@ static virDriver umlDriver = {
umlDomainDefine
,
/* domainDefineXML */
umlDomainUndefine
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainAttachDeviceFlags */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainDetachDeviceFlags */
umlDomainGetAutostart
,
/* domainGetAutostart */
umlDomainSetAutostart
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
src/vbox/vbox_tmpl.c
浏览文件 @
ed9c14a7
...
...
@@ -4835,6 +4835,17 @@ cleanup:
return
ret
;
}
static
int
vboxDomainAttachDeviceFlags
(
virDomainPtr
dom
,
const
char
*
xml
,
unsigned
int
flags
)
{
if
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
)
{
vboxError
(
dom
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"cannot modify the persistent configuration of a domain"
));
return
-
1
;
}
return
vboxDomainAttachDevice
(
dom
,
xml
);
}
static
int
vboxDomainDetachDevice
(
virDomainPtr
dom
,
const
char
*
xml
)
{
VBOX_OBJECT_CHECK
(
dom
->
conn
,
int
,
-
1
);
IMachine
*
machine
=
NULL
;
...
...
@@ -4965,6 +4976,17 @@ cleanup:
return
ret
;
}
static
int
vboxDomainDetachDeviceFlags
(
virDomainPtr
dom
,
const
char
*
xml
,
unsigned
int
flags
)
{
if
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
)
{
vboxError
(
dom
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"cannot modify the persistent configuration of a domain"
));
return
-
1
;
}
return
vboxDomainDetachDevice
(
dom
,
xml
);
}
#if VBOX_API_VERSION == 2002
/* No Callback support for VirtualBox 2.2.* series */
#else
/* !(VBOX_API_VERSION == 2002) */
...
...
@@ -7001,7 +7023,9 @@ virDriver NAME(Driver) = {
vboxDomainDefineXML
,
/* domainDefineXML */
vboxDomainUndefine
,
/* domainUndefine */
vboxDomainAttachDevice
,
/* domainAttachDevice */
vboxDomainAttachDeviceFlags
,
/* domainAttachDeviceFlags */
vboxDomainDetachDevice
,
/* domainDetachDevice */
vboxDomainDetachDeviceFlags
,
/* domainDetachDeviceFlags */
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
src/xen/proxy_internal.c
浏览文件 @
ed9c14a7
...
...
@@ -76,8 +76,8 @@ struct xenUnifiedDriver xenProxyDriver = {
NULL
,
/* domainCreate */
NULL
,
/* domainDefineXML */
NULL
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainAttachDevice
Flags
*/
NULL
,
/* domainDetachDevice
Flags
*/
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
src/xen/xen_driver.c
浏览文件 @
ed9c14a7
...
...
@@ -1425,13 +1425,32 @@ xenUnifiedDomainUndefine (virDomainPtr dom)
static
int
xenUnifiedDomainAttachDevice
(
virDomainPtr
dom
,
const
char
*
xml
)
{
GET_PRIVATE
(
dom
->
conn
);
int
i
;
unsigned
int
flags
=
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
;
if
(
dom
->
id
>=
0
)
flags
|=
VIR_DOMAIN_DEVICE_MODIFY_LIVE
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainAttachDeviceFlags
&&
drivers
[
i
]
->
domainAttachDeviceFlags
(
dom
,
xml
,
flags
)
==
0
)
return
0
;
return
-
1
;
}
static
int
xenUnifiedDomainAttachDeviceFlags
(
virDomainPtr
dom
,
const
char
*
xml
,
unsigned
int
flags
)
{
GET_PRIVATE
(
dom
->
conn
);
int
i
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainAttachDevice
&&
drivers
[
i
]
->
domainAttachDevice
(
dom
,
xml
)
==
0
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainAttachDevice
Flags
&&
drivers
[
i
]
->
domainAttachDevice
Flags
(
dom
,
xml
,
flags
)
==
0
)
return
0
;
return
-
1
;
...
...
@@ -1439,13 +1458,32 @@ xenUnifiedDomainAttachDevice (virDomainPtr dom, const char *xml)
static
int
xenUnifiedDomainDetachDevice
(
virDomainPtr
dom
,
const
char
*
xml
)
{
GET_PRIVATE
(
dom
->
conn
);
int
i
;
unsigned
int
flags
=
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
;
if
(
dom
->
id
>=
0
)
flags
|=
VIR_DOMAIN_DEVICE_MODIFY_LIVE
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainDetachDeviceFlags
&&
drivers
[
i
]
->
domainDetachDeviceFlags
(
dom
,
xml
,
flags
)
==
0
)
return
0
;
return
-
1
;
}
static
int
xenUnifiedDomainDetachDeviceFlags
(
virDomainPtr
dom
,
const
char
*
xml
,
unsigned
int
flags
)
{
GET_PRIVATE
(
dom
->
conn
);
int
i
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainDetachDevice
&&
drivers
[
i
]
->
domainDetachDevice
(
dom
,
xml
)
==
0
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainDetachDevice
Flags
&&
drivers
[
i
]
->
domainDetachDevice
Flags
(
dom
,
xml
,
flags
)
==
0
)
return
0
;
return
-
1
;
...
...
@@ -1835,7 +1873,9 @@ static virDriver xenUnifiedDriver = {
xenUnifiedDomainDefineXML
,
/* domainDefineXML */
xenUnifiedDomainUndefine
,
/* domainUndefine */
xenUnifiedDomainAttachDevice
,
/* domainAttachDevice */
xenUnifiedDomainAttachDeviceFlags
,
/* domainAttachDeviceFlags */
xenUnifiedDomainDetachDevice
,
/* domainDetachDevice */
xenUnifiedDomainDetachDeviceFlags
,
/* domainDetachDeviceFlags */
xenUnifiedDomainGetAutostart
,
/* domainGetAutostart */
xenUnifiedDomainSetAutostart
,
/* domainSetAutostart */
xenUnifiedDomainGetSchedulerType
,
/* domainGetSchedulerType */
...
...
src/xen/xen_driver.h
浏览文件 @
ed9c14a7
...
...
@@ -93,8 +93,8 @@ struct xenUnifiedDriver {
virDrvDomainCreate
domainCreate
;
virDrvDomainDefineXML
domainDefineXML
;
virDrvDomainUndefine
domainUndefine
;
virDrvDomainAttachDevice
domainAttachDevice
;
virDrvDomainDetachDevice
domainDetachDevice
;
virDrvDomainAttachDevice
Flags
domainAttachDeviceFlags
;
virDrvDomainDetachDevice
Flags
domainDetachDeviceFlags
;
virDrvDomainGetAutostart
domainGetAutostart
;
virDrvDomainSetAutostart
domainSetAutostart
;
virDrvDomainGetSchedulerType
domainGetSchedulerType
;
...
...
src/xen/xen_hypervisor.c
浏览文件 @
ed9c14a7
...
...
@@ -793,8 +793,8 @@ struct xenUnifiedDriver xenHypervisorDriver = {
NULL
,
/* domainCreate */
NULL
,
/* domainDefineXML */
NULL
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainAttachDevice
Flags
*/
NULL
,
/* domainDetachDevice
Flags
*/
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
xenHypervisorGetSchedulerType
,
/* domainGetSchedulerType */
...
...
src/xen/xen_inotify.c
浏览文件 @
ed9c14a7
...
...
@@ -79,8 +79,8 @@ struct xenUnifiedDriver xenInotifyDriver = {
NULL
,
/* domainCreate */
NULL
,
/* domainDefineXML */
NULL
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainAttachDevice
Flags
*/
NULL
,
/* domainDetachDevice
Flags
*/
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
src/xen/xend_internal.c
浏览文件 @
ed9c14a7
...
...
@@ -4096,9 +4096,10 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
}
/**
* xenDaemonAttachDevice:
* xenDaemonAttachDevice
Flags
:
* @domain: pointer to domain object
* @xml: pointer to XML description of device
* @flags: an OR'ed set of virDomainDeviceModifyFlags
*
* Create a virtual device attachment to backend.
* XML description is translated into S-expression.
...
...
@@ -4106,7 +4107,8 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
* Returns 0 in case of success, -1 in case of failure.
*/
static
int
xenDaemonAttachDevice
(
virDomainPtr
domain
,
const
char
*
xml
)
xenDaemonAttachDeviceFlags
(
virDomainPtr
domain
,
const
char
*
xml
,
unsigned
int
flags
)
{
xenUnifiedPrivatePtr
priv
;
char
*
sexpr
=
NULL
;
...
...
@@ -4124,12 +4126,41 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml)
priv
=
(
xenUnifiedPrivatePtr
)
domain
->
conn
->
privateData
;
/*
* on older Xen without the inactive guests management
* avoid doing this on inactive guests
*/
if
((
domain
->
id
<
0
)
&&
(
priv
->
xendConfigVersion
<
3
))
return
-
1
;
if
(
domain
->
id
<
0
)
{
/* If xendConfigVersion < 3 only live config can be changed */
if
(
priv
->
xendConfigVersion
<
3
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Xend version does not support modifying "
"persisted config"
));
return
-
1
;
}
/* Cannot modify live config if domain is inactive */
if
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_LIVE
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Cannot modify live config if domain is inactive"
));
return
-
1
;
}
}
else
{
/* Only live config can be changed if xendConfigVersion < 3 */
if
(
priv
->
xendConfigVersion
<
3
&&
(
flags
!=
VIR_DOMAIN_DEVICE_MODIFY_CURRENT
||
flags
!=
VIR_DOMAIN_DEVICE_MODIFY_LIVE
))
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Xend version does not support modifying "
"persisted config"
));
return
-
1
;
}
/* Xen only supports modifying both live and persisted config if
* xendConfigVersion >= 3
*/
if
(
flags
!=
(
VIR_DOMAIN_DEVICE_MODIFY_LIVE
|
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
))
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Xend only supports modifying both live and "
"persisted config"
));
return
-
1
;
}
}
if
(
!
(
def
=
xenDaemonDomainFetch
(
domain
->
conn
,
domain
->
id
,
...
...
@@ -4203,16 +4234,18 @@ cleanup:
}
/**
* xenDaemonDetachDevice:
* xenDaemonDetachDevice
Flags
:
* @domain: pointer to domain object
* @xml: pointer to XML description of device
* @flags: an OR'ed set of virDomainDeviceModifyFlags
*
* Destroy a virtual device attachment to backend.
*
* Returns 0 in case of success, -1 in case of failure.
*/
static
int
xenDaemonDetachDevice
(
virDomainPtr
domain
,
const
char
*
xml
)
xenDaemonDetachDeviceFlags
(
virDomainPtr
domain
,
const
char
*
xml
,
unsigned
int
flags
)
{
xenUnifiedPrivatePtr
priv
;
char
class
[
8
],
ref
[
80
];
...
...
@@ -4230,12 +4263,41 @@ xenDaemonDetachDevice(virDomainPtr domain, const char *xml)
priv
=
(
xenUnifiedPrivatePtr
)
domain
->
conn
->
privateData
;
/*
* on older Xen without the inactive guests management
* avoid doing this on inactive guests
*/
if
((
domain
->
id
<
0
)
&&
(
priv
->
xendConfigVersion
<
3
))
return
-
1
;
if
(
domain
->
id
<
0
)
{
/* If xendConfigVersion < 3 only live config can be changed */
if
(
priv
->
xendConfigVersion
<
3
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Xend version does not support modifying "
"persisted config"
));
return
-
1
;
}
/* Cannot modify live config if domain is inactive */
if
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_LIVE
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Cannot modify live config if domain is inactive"
));
return
-
1
;
}
}
else
{
/* Only live config can be changed if xendConfigVersion < 3 */
if
(
priv
->
xendConfigVersion
<
3
&&
(
flags
!=
VIR_DOMAIN_DEVICE_MODIFY_CURRENT
||
flags
!=
VIR_DOMAIN_DEVICE_MODIFY_LIVE
))
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Xend version does not support modifying "
"persisted config"
));
return
-
1
;
}
/* Xen only supports modifying both live and persisted config if
* xendConfigVersion >= 3
*/
if
(
flags
!=
(
VIR_DOMAIN_DEVICE_MODIFY_LIVE
|
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
))
{
virXendError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Xend only supports modifying both live and "
"persisted config"
));
return
-
1
;
}
}
if
(
!
(
def
=
xenDaemonDomainFetch
(
domain
->
conn
,
domain
->
id
,
...
...
@@ -5165,8 +5227,8 @@ struct xenUnifiedDriver xenDaemonDriver = {
xenDaemonDomainCreate
,
/* domainCreate */
xenDaemonDomainDefineXML
,
/* domainDefineXML */
xenDaemonDomainUndefine
,
/* domainUndefine */
xenDaemonAttachDevice
,
/* domainAttachDevice
*/
xenDaemonDetachDevice
,
/* domainDetachDevice
*/
xenDaemonAttachDevice
Flags
,
/* domainAttachDeviceFlags
*/
xenDaemonDetachDevice
Flags
,
/* domainDetachDeviceFlags
*/
xenDaemonDomainGetAutostart
,
/* domainGetAutostart */
xenDaemonDomainSetAutostart
,
/* domainSetAutostart */
xenDaemonGetSchedulerType
,
/* domainGetSchedulerType */
...
...
src/xen/xm_internal.c
浏览文件 @
ed9c14a7
...
...
@@ -65,8 +65,10 @@
static
int
xenXMConfigSetString
(
virConfPtr
conf
,
const
char
*
setting
,
const
char
*
str
);
char
*
xenXMAutoAssignMac
(
void
);
static
int
xenXMDomainAttachDevice
(
virDomainPtr
domain
,
const
char
*
xml
);
static
int
xenXMDomainDetachDevice
(
virDomainPtr
domain
,
const
char
*
xml
);
static
int
xenXMDomainAttachDeviceFlags
(
virDomainPtr
domain
,
const
char
*
xml
,
unsigned
int
flags
);
static
int
xenXMDomainDetachDeviceFlags
(
virDomainPtr
domain
,
const
char
*
xml
,
unsigned
int
flags
);
#define XM_REFRESH_INTERVAL 10
...
...
@@ -109,8 +111,8 @@ struct xenUnifiedDriver xenXMDriver = {
xenXMDomainCreate
,
/* domainCreate */
xenXMDomainDefineXML
,
/* domainDefineXML */
xenXMDomainUndefine
,
/* domainUndefine */
xenXMDomainAttachDevice
,
/* domainAttachDevice
*/
xenXMDomainDetachDevice
,
/* domainDetachDevice
*/
xenXMDomainAttachDevice
Flags
,
/* domainAttachDeviceFlags
*/
xenXMDomainDetachDevice
Flags
,
/* domainDetachDeviceFlags
*/
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
@@ -2914,17 +2916,21 @@ cleanup:
/**
* xenXMDomainAttachDevice:
* xenXMDomainAttachDevice
Flags
:
* @domain: pointer to domain object
* @xml: pointer to XML description of device
* @flags: an OR'ed set of virDomainDeviceModifyFlags
*
* Create a virtual device attachment to backend.
* XML description is translated into config file.
* This driver only supports device allocation to
* persisted config.
*
* Returns 0 in case of success, -1 in case of failure.
*/
static
int
xenXMDomainAttachDevice
(
virDomainPtr
domain
,
const
char
*
xml
)
{
xenXMDomainAttachDeviceFlags
(
virDomainPtr
domain
,
const
char
*
xml
,
unsigned
int
flags
)
{
const
char
*
filename
=
NULL
;
xenXMConfCachePtr
entry
=
NULL
;
int
ret
=
-
1
;
...
...
@@ -2940,7 +2946,7 @@ xenXMDomainAttachDevice(virDomainPtr domain, const char *xml) {
if
(
domain
->
conn
->
flags
&
VIR_CONNECT_RO
)
return
-
1
;
if
(
domain
->
id
!=
-
1
)
if
(
domain
->
id
!=
-
1
&&
!
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
)
)
return
-
1
;
priv
=
(
xenUnifiedPrivatePtr
)
domain
->
conn
->
privateData
;
...
...
@@ -3002,16 +3008,20 @@ xenXMDomainAttachDevice(virDomainPtr domain, const char *xml) {
/**
* xenXMDomainDetachDevice:
* xenXMDomainDetachDevice
Flags
:
* @domain: pointer to domain object
* @xml: pointer to XML description of device
* @flags: an OR'ed set of virDomainDeviceModifyFlags
*
* Destroy a virtual device attachment to backend.
* This driver only supports device deallocation from
* persisted config.
*
* Returns 0 in case of success, -1 in case of failure.
*/
static
int
xenXMDomainDetachDevice
(
virDomainPtr
domain
,
const
char
*
xml
)
{
xenXMDomainDetachDeviceFlags
(
virDomainPtr
domain
,
const
char
*
xml
,
unsigned
int
flags
)
{
const
char
*
filename
=
NULL
;
xenXMConfCachePtr
entry
=
NULL
;
virDomainDeviceDefPtr
dev
=
NULL
;
...
...
@@ -3029,7 +3039,7 @@ xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) {
if
(
domain
->
conn
->
flags
&
VIR_CONNECT_RO
)
return
-
1
;
if
(
domain
->
id
!=
-
1
)
if
(
domain
->
id
!=
-
1
&&
!
(
flags
&
VIR_DOMAIN_DEVICE_MODIFY_CONFIG
)
)
return
-
1
;
priv
=
(
xenUnifiedPrivatePtr
)
domain
->
conn
->
privateData
;
...
...
src/xen/xs_internal.c
浏览文件 @
ed9c14a7
...
...
@@ -76,8 +76,8 @@ struct xenUnifiedDriver xenStoreDriver = {
NULL
,
/* domainCreate */
NULL
,
/* domainDefineXML */
NULL
,
/* domainUndefine */
NULL
,
/* domainAttachDevice */
NULL
,
/* domainDetachDevice */
NULL
,
/* domainAttachDevice
Flags
*/
NULL
,
/* domainDetachDevice
Flags
*/
NULL
,
/* domainGetAutostart */
NULL
,
/* domainSetAutostart */
NULL
,
/* domainGetSchedulerType */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录