Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
7c21e500
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,发现更多精彩内容 >>
提交
7c21e500
编写于
4月 30, 2013
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify the Xen domain VCPU driver methods
Signed-off-by:
N
Daniel P. Berrange
<
berrange@redhat.com
>
上级
48610ebe
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
43 addition
and
190 deletion
+43
-190
src/xen/xen_driver.c
src/xen/xen_driver.c
+37
-54
src/xen/xen_driver.h
src/xen/xen_driver.h
+0
-2
src/xen/xen_hypervisor.c
src/xen/xen_hypervisor.c
+0
-90
src/xen/xen_hypervisor.h
src/xen/xen_hypervisor.h
+0
-3
src/xen/xend_internal.c
src/xen/xend_internal.c
+4
-28
src/xen/xm_internal.c
src/xen/xm_internal.c
+2
-13
未找到文件。
src/xen/xen_driver.c
浏览文件 @
7c21e500
...
@@ -1004,7 +1004,6 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
...
@@ -1004,7 +1004,6 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
unsigned
int
flags
)
unsigned
int
flags
)
{
{
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
int
ret
;
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_CONFIG
|
...
@@ -1028,38 +1027,25 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
...
@@ -1028,38 +1027,25 @@ xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
/* Try non-hypervisor methods first, then hypervisor direct method
/* Try non-hypervisor methods first, then hypervisor direct method
* as a last resort.
* as a last resort.
*/
*/
if
(
priv
->
opened
[
XEN_UNIFIED_XEND_OFFSET
])
{
if
(
dom
->
id
<
0
&&
priv
->
xendConfigVersion
<
XEND_CONFIG_VERSION_3_0_4
)
ret
=
xenDaemonDomainSetVcpusFlags
(
dom
,
nvcpus
,
flags
);
return
xenXMDomainSetVcpusFlags
(
dom
,
nvcpus
,
flags
);
if
(
ret
!=
-
2
)
else
return
ret
;
return
xenDaemonDomainSetVcpusFlags
(
dom
,
nvcpus
,
flags
);
}
if
(
priv
->
opened
[
XEN_UNIFIED_XM_OFFSET
])
{
ret
=
xenXMDomainSetVcpusFlags
(
dom
,
nvcpus
,
flags
);
if
(
ret
!=
-
2
)
return
ret
;
}
if
(
flags
==
VIR_DOMAIN_VCPU_LIVE
)
return
xenHypervisorSetVcpus
(
dom
,
nvcpus
);
virReportError
(
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
return
-
1
;
}
}
static
int
static
int
xenUnifiedDomainSetVcpus
(
virDomainPtr
dom
,
unsigned
int
nvcpus
)
xenUnifiedDomainSetVcpus
(
virDomainPtr
dom
,
unsigned
int
nvcpus
)
{
{
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
unsigned
int
flags
=
VIR_DOMAIN_VCPU_LIVE
;
unsigned
int
flags
=
VIR_DOMAIN_VCPU_LIVE
;
/* Per the documented API, it is hypervisor-dependent whether this
/* Per the documented API, it is hypervisor-dependent whether this
* affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
* affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
* depends on xendConfigVersion. */
* depends on xendConfigVersion. */
if
(
dom
)
{
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
if
(
priv
->
xendConfigVersion
>=
XEND_CONFIG_VERSION_3_0_4
)
if
(
priv
->
xendConfigVersion
>=
XEND_CONFIG_VERSION_3_0_4
)
flags
|=
VIR_DOMAIN_VCPU_CONFIG
;
flags
|=
VIR_DOMAIN_VCPU_CONFIG
;
return
xenUnifiedDomainSetVcpusFlags
(
dom
,
nvcpus
,
flags
);
return
xenUnifiedDomainSetVcpusFlags
(
dom
,
nvcpus
,
flags
);
}
return
-
1
;
}
}
static
int
static
int
...
@@ -1067,15 +1053,15 @@ xenUnifiedDomainPinVcpu(virDomainPtr dom, unsigned int vcpu,
...
@@ -1067,15 +1053,15 @@ xenUnifiedDomainPinVcpu(virDomainPtr dom, unsigned int vcpu,
unsigned
char
*
cpumap
,
int
maplen
)
unsigned
char
*
cpumap
,
int
maplen
)
{
{
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
int
i
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
xenDomainPinVcpu
&&
drivers
[
i
]
->
xenDomainPinVcpu
(
dom
,
vcpu
,
cpumap
,
maplen
)
==
0
)
return
0
;
return
-
1
;
if
(
dom
->
id
<
0
)
{
if
(
priv
->
xendConfigVersion
<
XEND_CONFIG_VERSION_3_0_4
)
return
xenXMDomainPinVcpu
(
dom
,
vcpu
,
cpumap
,
maplen
);
else
return
xenDaemonDomainPinVcpu
(
dom
,
vcpu
,
cpumap
,
maplen
);
}
else
{
return
xenHypervisorPinVcpu
(
dom
,
vcpu
,
cpumap
,
maplen
);
}
}
}
static
int
static
int
...
@@ -1084,42 +1070,39 @@ xenUnifiedDomainGetVcpus(virDomainPtr dom,
...
@@ -1084,42 +1070,39 @@ xenUnifiedDomainGetVcpus(virDomainPtr dom,
unsigned
char
*
cpumaps
,
int
maplen
)
unsigned
char
*
cpumaps
,
int
maplen
)
{
{
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
int
i
,
ret
;
if
(
dom
->
id
<
0
)
{
if
(
priv
->
xendConfigVersion
<
XEND_CONFIG_VERSION_3_0_4
)
{
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
xenDomainGetVcpus
)
{
_
(
"Cannot get VCPUs of inactive domain"
));
ret
=
drivers
[
i
]
->
xenDomainGetVcpus
(
dom
,
info
,
maxinfo
,
cpumaps
,
maplen
);
if
(
ret
>
0
)
return
ret
;
}
return
-
1
;
return
-
1
;
}
else
{
return
xenDaemonDomainGetVcpus
(
dom
,
info
,
maxinfo
,
cpumaps
,
maplen
);
}
}
else
{
return
xenHypervisorGetVcpus
(
dom
,
info
,
maxinfo
,
cpumaps
,
maplen
);
}
}
}
static
int
static
int
xenUnifiedDomainGetVcpusFlags
(
virDomainPtr
dom
,
unsigned
int
flags
)
xenUnifiedDomainGetVcpusFlags
(
virDomainPtr
dom
,
unsigned
int
flags
)
{
{
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
xenUnifiedPrivatePtr
priv
=
dom
->
conn
->
privateData
;
int
ret
;
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
if
(
priv
->
opened
[
XEN_UNIFIED_XEND_OFFSET
])
{
if
(
dom
->
id
<
0
)
{
ret
=
xenDaemonDomainGetVcpusFlags
(
dom
,
flags
);
if
(
priv
->
xendConfigVersion
<
XEND_CONFIG_VERSION_3_0_4
)
if
(
ret
!=
-
2
)
return
xenXMDomainGetVcpusFlags
(
dom
,
flags
);
return
ret
;
else
}
return
xenDaemonDomainGetVcpusFlags
(
dom
,
flags
);
if
(
priv
->
opened
[
XEN_UNIFIED_XM_OFFSET
])
{
}
else
{
ret
=
xenXMDomainGetVcpusFlags
(
dom
,
flags
);
if
(
ret
!=
-
2
)
return
ret
;
}
if
(
flags
==
(
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_MAXIMUM
))
if
(
flags
==
(
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_MAXIMUM
))
return
xenHypervisorGetVcpuMax
(
dom
);
return
xenHypervisorGetVcpuMax
(
dom
);
else
virReportError
(
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
return
xenDaemonDomainGetVcpusFlags
(
dom
,
flags
);
return
-
1
;
}
}
}
static
int
static
int
...
...
src/xen/xen_driver.h
浏览文件 @
7c21e500
...
@@ -93,8 +93,6 @@ extern int xenRegister (void);
...
@@ -93,8 +93,6 @@ extern int xenRegister (void);
* structure with direct calls in xen_unified.c.
* structure with direct calls in xen_unified.c.
*/
*/
struct
xenUnifiedDriver
{
struct
xenUnifiedDriver
{
virDrvDomainPinVcpu
xenDomainPinVcpu
;
virDrvDomainGetVcpus
xenDomainGetVcpus
;
virDrvConnectListDefinedDomains
xenListDefinedDomains
;
virDrvConnectListDefinedDomains
xenListDefinedDomains
;
virDrvConnectNumOfDefinedDomains
xenNumOfDefinedDomains
;
virDrvConnectNumOfDefinedDomains
xenNumOfDefinedDomains
;
virDrvDomainCreate
xenDomainCreate
;
virDrvDomainCreate
xenDomainCreate
;
...
...
src/xen/xen_hypervisor.c
浏览文件 @
7c21e500
...
@@ -646,25 +646,6 @@ struct xen_v2d5_setmaxmem {
...
@@ -646,25 +646,6 @@ struct xen_v2d5_setmaxmem {
};
};
typedef
struct
xen_v2d5_setmaxmem
xen_v2d5_setmaxmem
;
typedef
struct
xen_v2d5_setmaxmem
xen_v2d5_setmaxmem
;
/*
* The information for a setmaxvcpu system hypercall
*/
#define XEN_V0_OP_SETMAXVCPU 41
#define XEN_V1_OP_SETMAXVCPU 41
#define XEN_V2_OP_SETMAXVCPU 15
struct
xen_v0_setmaxvcpu
{
domid_t
domain
;
uint32_t
maxvcpu
;
};
typedef
struct
xen_v0_setmaxvcpu
xen_v0_setmaxvcpu
;
typedef
struct
xen_v0_setmaxvcpu
xen_v1_setmaxvcpu
;
struct
xen_v2_setmaxvcpu
{
uint32_t
maxvcpu
;
};
typedef
struct
xen_v2_setmaxvcpu
xen_v2_setmaxvcpu
;
/*
/*
* The information for a setvcpumap system hypercall
* The information for a setvcpumap system hypercall
* Note that between 1 and 2 the limitation to 64 physical CPU was lifted
* Note that between 1 and 2 the limitation to 64 physical CPU was lifted
...
@@ -814,7 +795,6 @@ struct xen_op_v0 {
...
@@ -814,7 +795,6 @@ struct xen_op_v0 {
xen_v0_getdomaininfolistop
getdomaininfolist
;
xen_v0_getdomaininfolistop
getdomaininfolist
;
xen_v0_domainop
domain
;
xen_v0_domainop
domain
;
xen_v0_setmaxmem
setmaxmem
;
xen_v0_setmaxmem
setmaxmem
;
xen_v0_setmaxvcpu
setmaxvcpu
;
xen_v0_setvcpumap
setvcpumap
;
xen_v0_setvcpumap
setvcpumap
;
xen_v0_vcpuinfo
getvcpuinfo
;
xen_v0_vcpuinfo
getvcpuinfo
;
uint8_t
padding
[
128
];
uint8_t
padding
[
128
];
...
@@ -846,7 +826,6 @@ struct xen_op_v2_dom {
...
@@ -846,7 +826,6 @@ struct xen_op_v2_dom {
union
{
union
{
xen_v2_setmaxmem
setmaxmem
;
xen_v2_setmaxmem
setmaxmem
;
xen_v2d5_setmaxmem
setmaxmemd5
;
xen_v2d5_setmaxmem
setmaxmemd5
;
xen_v2_setmaxvcpu
setmaxvcpu
;
xen_v2_setvcpumap
setvcpumap
;
xen_v2_setvcpumap
setvcpumap
;
xen_v2d5_setvcpumap
setvcpumapd5
;
xen_v2d5_setvcpumap
setvcpumapd5
;
xen_v2_vcpuinfo
getvcpuinfo
;
xen_v2_vcpuinfo
getvcpuinfo
;
...
@@ -871,8 +850,6 @@ typedef struct xen_op_v2_dom xen_op_v2_dom;
...
@@ -871,8 +850,6 @@ typedef struct xen_op_v2_dom xen_op_v2_dom;
#endif
#endif
struct
xenUnifiedDriver
xenHypervisorDriver
=
{
struct
xenUnifiedDriver
xenHypervisorDriver
=
{
.
xenDomainPinVcpu
=
xenHypervisorPinVcpu
,
.
xenDomainGetVcpus
=
xenHypervisorGetVcpus
,
.
xenDomainGetSchedulerType
=
xenHypervisorGetSchedulerType
,
.
xenDomainGetSchedulerType
=
xenHypervisorGetSchedulerType
,
.
xenDomainGetSchedulerParameters
=
xenHypervisorGetSchedulerParameters
,
.
xenDomainGetSchedulerParameters
=
xenHypervisorGetSchedulerParameters
,
.
xenDomainSetSchedulerParameters
=
xenHypervisorSetSchedulerParameters
,
.
xenDomainSetSchedulerParameters
=
xenHypervisorSetSchedulerParameters
,
...
@@ -1517,48 +1494,6 @@ virXen_setmaxmem(int handle, int id, unsigned long memory)
...
@@ -1517,48 +1494,6 @@ virXen_setmaxmem(int handle, int id, unsigned long memory)
return
ret
;
return
ret
;
}
}
/**
* virXen_setmaxvcpus:
* @handle: the hypervisor handle
* @id: the domain id
* @vcpus: the numbers of vcpus
*
* Do a low level hypercall to change the max vcpus amount
*
* Returns 0 or -1 in case of failure
*/
static
int
virXen_setmaxvcpus
(
int
handle
,
int
id
,
unsigned
int
vcpus
)
{
int
ret
=
-
1
;
if
(
hv_versions
.
hypervisor
>
1
)
{
xen_op_v2_dom
op
;
memset
(
&
op
,
0
,
sizeof
(
op
));
op
.
cmd
=
XEN_V2_OP_SETMAXVCPU
;
op
.
domain
=
(
domid_t
)
id
;
op
.
u
.
setmaxvcpu
.
maxvcpu
=
vcpus
;
ret
=
xenHypervisorDoV2Dom
(
handle
,
&
op
);
}
else
if
(
hv_versions
.
hypervisor
==
1
)
{
xen_op_v1
op
;
memset
(
&
op
,
0
,
sizeof
(
op
));
op
.
cmd
=
XEN_V1_OP_SETMAXVCPU
;
op
.
u
.
setmaxvcpu
.
domain
=
(
domid_t
)
id
;
op
.
u
.
setmaxvcpu
.
maxvcpu
=
vcpus
;
ret
=
xenHypervisorDoV1Op
(
handle
,
&
op
);
}
else
if
(
hv_versions
.
hypervisor
==
0
)
{
xen_op_v0
op
;
memset
(
&
op
,
0
,
sizeof
(
op
));
op
.
cmd
=
XEN_V0_OP_SETMAXVCPU
;
op
.
u
.
setmaxvcpu
.
domain
=
(
domid_t
)
id
;
op
.
u
.
setmaxvcpu
.
maxvcpu
=
vcpus
;
ret
=
xenHypervisorDoV0Op
(
handle
,
&
op
);
}
return
ret
;
}
/**
/**
* virXen_setvcpumap:
* virXen_setvcpumap:
...
@@ -3003,31 +2938,6 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
...
@@ -3003,31 +2938,6 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
}
}
/**
* xenHypervisorSetVcpus:
* @domain: pointer to domain object
* @nvcpus: the new number of virtual CPUs for this domain
*
* Dynamically change the number of virtual CPUs used by the domain.
*
* Returns 0 in case of success, -1 in case of failure.
*/
int
xenHypervisorSetVcpus
(
virDomainPtr
domain
,
unsigned
int
nvcpus
)
{
int
ret
;
xenUnifiedPrivatePtr
priv
=
domain
->
conn
->
privateData
;
if
(
domain
->
id
<
0
||
nvcpus
<
1
)
return
-
1
;
ret
=
virXen_setmaxvcpus
(
priv
->
handle
,
domain
->
id
,
nvcpus
);
if
(
ret
<
0
)
return
-
1
;
return
0
;
}
/**
/**
* xenHypervisorPinVcpu:
* xenHypervisorPinVcpu:
* @domain: pointer to domain object
* @domain: pointer to domain object
...
...
src/xen/xen_hypervisor.h
浏览文件 @
7c21e500
...
@@ -86,9 +86,6 @@ int xenHypervisorSetMaxMemory (virDomainPtr domain,
...
@@ -86,9 +86,6 @@ int xenHypervisorSetMaxMemory (virDomainPtr domain,
ATTRIBUTE_NONNULL
(
1
);
ATTRIBUTE_NONNULL
(
1
);
int
xenHypervisorCheckID
(
virConnectPtr
conn
,
int
xenHypervisorCheckID
(
virConnectPtr
conn
,
int
id
);
int
id
);
int
xenHypervisorSetVcpus
(
virDomainPtr
domain
,
unsigned
int
nvcpus
)
ATTRIBUTE_NONNULL
(
1
);
int
xenHypervisorPinVcpu
(
virDomainPtr
domain
,
int
xenHypervisorPinVcpu
(
virDomainPtr
domain
,
unsigned
int
vcpu
,
unsigned
int
vcpu
,
unsigned
char
*
cpumap
,
unsigned
char
*
cpumap
,
...
...
src/xen/xend_internal.c
浏览文件 @
7c21e500
...
@@ -1778,8 +1778,7 @@ xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
...
@@ -1778,8 +1778,7 @@ xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
*
*
* Change virtual CPUs allocation of domain according to flags.
* Change virtual CPUs allocation of domain according to flags.
*
*
* Returns 0 on success, -1 if an error message was issued, and -2 if
* Returns 0 on success, -1 if an error message was issued
* the unified driver should keep trying.
*/
*/
int
int
xenDaemonDomainSetVcpusFlags
(
virDomainPtr
domain
,
xenDaemonDomainSetVcpusFlags
(
virDomainPtr
domain
,
...
@@ -1787,7 +1786,6 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
...
@@ -1787,7 +1786,6 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
unsigned
int
flags
)
unsigned
int
flags
)
{
{
char
buf
[
VIR_UUID_BUFLEN
];
char
buf
[
VIR_UUID_BUFLEN
];
xenUnifiedPrivatePtr
priv
=
domain
->
conn
->
privateData
;
int
max
;
int
max
;
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
...
@@ -1799,21 +1797,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
...
@@ -1799,21 +1797,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain,
return
-
1
;
return
-
1
;
}
}
if
((
domain
->
id
<
0
&&
priv
->
xendConfigVersion
<
XEND_CONFIG_VERSION_3_0_4
)
||
if
(
domain
->
id
<
0
)
{
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
))
return
-
2
;
/* With xendConfigVersion 2, only _LIVE is supported. With
* xendConfigVersion 3, only _LIVE|_CONFIG is supported for
* running domains, or _CONFIG for inactive domains. */
if
(
priv
->
xendConfigVersion
<
XEND_CONFIG_VERSION_3_0_4
)
{
if
(
flags
&
VIR_DOMAIN_VCPU_CONFIG
)
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Xend version does not support modifying "
"persistent config"
));
return
-
1
;
}
}
else
if
(
domain
->
id
<
0
)
{
if
(
flags
&
VIR_DOMAIN_VCPU_LIVE
)
{
if
(
flags
&
VIR_DOMAIN_VCPU_LIVE
)
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain not running"
));
_
(
"domain not running"
));
...
@@ -1943,7 +1927,7 @@ cleanup:
...
@@ -1943,7 +1927,7 @@ cleanup:
* Extract information about virtual CPUs of domain according to flags.
* Extract information about virtual CPUs of domain according to flags.
*
*
* Returns the number of vcpus on success, -1 if an error message was
* Returns the number of vcpus on success, -1 if an error message was
* issued
, and -2 if the unified driver should keep trying.
* issued
*/
*/
int
int
...
@@ -1951,17 +1935,11 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
...
@@ -1951,17 +1935,11 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
{
{
struct
sexpr
*
root
;
struct
sexpr
*
root
;
int
ret
;
int
ret
;
xenUnifiedPrivatePtr
priv
=
domain
->
conn
->
privateData
;
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
virCheckFlags
(
VIR_DOMAIN_VCPU_LIVE
|
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
/* If xendConfigVersion is 2, then we can only report _LIVE (and
* xm_internal reports _CONFIG). If it is 3, then _LIVE and
* _CONFIG are always in sync for a running system. */
if
(
domain
->
id
<
0
&&
priv
->
xendConfigVersion
<
XEND_CONFIG_VERSION_3_0_4
)
return
-
2
;
if
(
domain
->
id
<
0
&&
(
flags
&
VIR_DOMAIN_VCPU_LIVE
))
{
if
(
domain
->
id
<
0
&&
(
flags
&
VIR_DOMAIN_VCPU_LIVE
))
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain not active"
));
_
(
"domain not active"
));
...
@@ -1979,7 +1957,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
...
@@ -1979,7 +1957,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
ret
=
MIN
(
vcpus
,
ret
);
ret
=
MIN
(
vcpus
,
ret
);
}
}
if
(
!
ret
)
if
(
!
ret
)
ret
=
-
2
;
ret
=
-
1
;
sexpr_free
(
root
);
sexpr_free
(
root
);
return
ret
;
return
ret
;
}
}
...
@@ -3415,8 +3393,6 @@ xenDaemonDomainBlockPeek(virDomainPtr domain,
...
@@ -3415,8 +3393,6 @@ xenDaemonDomainBlockPeek(virDomainPtr domain,
}
}
struct
xenUnifiedDriver
xenDaemonDriver
=
{
struct
xenUnifiedDriver
xenDaemonDriver
=
{
.
xenDomainPinVcpu
=
xenDaemonDomainPinVcpu
,
.
xenDomainGetVcpus
=
xenDaemonDomainGetVcpus
,
.
xenListDefinedDomains
=
xenDaemonListDefinedDomains
,
.
xenListDefinedDomains
=
xenDaemonListDefinedDomains
,
.
xenNumOfDefinedDomains
=
xenDaemonNumOfDefinedDomains
,
.
xenNumOfDefinedDomains
=
xenDaemonNumOfDefinedDomains
,
.
xenDomainCreate
=
xenDaemonDomainCreate
,
.
xenDomainCreate
=
xenDaemonDomainCreate
,
...
...
src/xen/xm_internal.c
浏览文件 @
7c21e500
...
@@ -81,7 +81,6 @@ static int xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
...
@@ -81,7 +81,6 @@ static int xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
#define XM_XML_ERROR "Invalid xml"
#define XM_XML_ERROR "Invalid xml"
struct
xenUnifiedDriver
xenXMDriver
=
{
struct
xenUnifiedDriver
xenXMDriver
=
{
.
xenDomainPinVcpu
=
xenXMDomainPinVcpu
,
.
xenListDefinedDomains
=
xenXMListDefinedDomains
,
.
xenListDefinedDomains
=
xenXMListDefinedDomains
,
.
xenNumOfDefinedDomains
=
xenXMNumOfDefinedDomains
,
.
xenNumOfDefinedDomains
=
xenXMNumOfDefinedDomains
,
.
xenDomainCreate
=
xenXMDomainCreate
,
.
xenDomainCreate
=
xenXMDomainCreate
,
...
@@ -662,8 +661,7 @@ cleanup:
...
@@ -662,8 +661,7 @@ cleanup:
*
*
* Change virtual CPUs allocation of domain according to flags.
* Change virtual CPUs allocation of domain according to flags.
*
*
* Returns 0 on success, -1 if an error message was issued, and -2 if
* Returns 0 on success, -1 if an error message was issued
* the unified driver should keep trying.
*/
*/
int
int
xenXMDomainSetVcpusFlags
(
virDomainPtr
domain
,
xenXMDomainSetVcpusFlags
(
virDomainPtr
domain
,
...
@@ -680,8 +678,6 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain,
...
@@ -680,8 +678,6 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain,
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
if
(
domain
->
id
!=
-
1
)
return
-
2
;
if
(
flags
&
VIR_DOMAIN_VCPU_LIVE
)
{
if
(
flags
&
VIR_DOMAIN_VCPU_LIVE
)
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
_
(
"domain is not running"
));
...
@@ -741,7 +737,7 @@ cleanup:
...
@@ -741,7 +737,7 @@ cleanup:
* Extract information about virtual CPUs of domain according to flags.
* Extract information about virtual CPUs of domain according to flags.
*
*
* Returns the number of vcpus on success, -1 if an error message was
* Returns the number of vcpus on success, -1 if an error message was
* issued
, and -2 if the unified driver should keep trying.
* issued
*/
*/
int
int
xenXMDomainGetVcpusFlags
(
virDomainPtr
domain
,
unsigned
int
flags
)
xenXMDomainGetVcpusFlags
(
virDomainPtr
domain
,
unsigned
int
flags
)
...
@@ -755,8 +751,6 @@ xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
...
@@ -755,8 +751,6 @@ xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_CONFIG
|
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
VIR_DOMAIN_VCPU_MAXIMUM
,
-
1
);
if
(
domain
->
id
!=
-
1
)
return
-
2
;
if
(
flags
&
VIR_DOMAIN_VCPU_LIVE
)
{
if
(
flags
&
VIR_DOMAIN_VCPU_LIVE
)
{
virReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"domain not active"
));
virReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"domain not active"
));
return
-
1
;
return
-
1
;
...
@@ -804,11 +798,6 @@ xenXMDomainPinVcpu(virDomainPtr domain,
...
@@ -804,11 +798,6 @@ xenXMDomainPinVcpu(virDomainPtr domain,
virReportError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virReportError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
-
1
;
return
-
1
;
}
}
if
(
domain
->
id
!=
-
1
)
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"not inactive domain"
));
return
-
1
;
}
xenUnifiedLock
(
priv
);
xenUnifiedLock
(
priv
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录