Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
7022759b
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看板
提交
7022759b
编写于
5月 08, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add new VIR_ERR_OPERATION_INVALID error code & use it in Xen & QEMU drivers
上级
2a1c7b57
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
75 addition
and
29 deletion
+75
-29
ChangeLog
ChangeLog
+8
-0
include/libvirt/virterror.h
include/libvirt/virterror.h
+1
-0
src/qemu_driver.c
src/qemu_driver.c
+31
-15
src/virterror.c
src/virterror.c
+6
-0
src/xen_internal.c
src/xen_internal.c
+22
-7
src/xend_internal.c
src/xend_internal.c
+7
-7
未找到文件。
ChangeLog
浏览文件 @
7022759b
Fri May 8 10:56:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
* include/libvirt/virterror.h, src/virterror.c: Add new error
code VIR_ERR_OPERATION_INVALID for operations that are not
applicable at this time (eg, pause on an inactive guest)
* src/qemu_driver.c, src/xen_internal.c, src/xend_internal.c:
Use new error code where relevant.
Thu May 7 09:31:22 CEST 2009 Daniel Veillard <veillard@redhat.com>
* qemud/libvirtd.init.in: improve the LSB init header for the
...
...
include/libvirt/virterror.h
浏览文件 @
7022759b
...
...
@@ -157,6 +157,7 @@ typedef enum {
VIR_ERR_INVALID_NODE_DEVICE
,
/* invalid node device object */
VIR_ERR_NO_NODE_DEVICE
,
/* node device not found */
VIR_ERR_NO_SECURITY_MODEL
,
/* security model not found */
VIR_ERR_OPERATION_INVALID
,
/* operation is not applicable at this time */
}
virErrorNumber
;
/**
...
...
src/qemu_driver.c
浏览文件 @
7022759b
...
...
@@ -1325,7 +1325,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
FD_ZERO
(
&
keepfd
);
if
(
virDomainIsActive
(
vm
))
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_
INTERNAL_ERROR
,
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_
OPERATION_INVALID
,
"%s"
,
_
(
"VM is already active"
));
return
-
1
;
}
...
...
@@ -2216,7 +2216,7 @@ static int qemudDomainSuspend(virDomainPtr dom) {
goto
cleanup
;
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
...
...
@@ -2269,7 +2269,7 @@ static int qemudDomainResume(virDomainPtr dom) {
goto
cleanup
;
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
...
...
@@ -2757,7 +2757,7 @@ static int qemudDomainSave(virDomainPtr dom,
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
...
...
@@ -2892,7 +2892,7 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
}
if
(
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
NO_SUPPORT
,
"%s"
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
OPERATION_INVALID
,
"%s"
,
_
(
"cannot change vcpu count of an active domain"
));
goto
cleanup
;
}
...
...
@@ -2944,8 +2944,16 @@ qemudDomainPinVcpu(virDomainPtr dom,
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
qemuDriverUnlock
(
driver
);
if
(
!
vm
)
{
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
virUUIDFormat
(
dom
->
uuid
,
uuidstr
);
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_NO_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
goto
cleanup
;
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
INVALID_ARG
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
OPERATION_INVALID
,
"%s"
,
_
(
"cannot pin vcpus on an inactive domain"
));
goto
cleanup
;
}
...
...
@@ -3005,8 +3013,16 @@ qemudDomainGetVcpus(virDomainPtr dom,
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
qemuDriverUnlock
(
driver
);
if
(
!
vm
)
{
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
virUUIDFormat
(
dom
->
uuid
,
uuidstr
);
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_NO_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
goto
cleanup
;
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
INVALID_ARG
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
OPERATION_INVALID
,
"%s"
,
_
(
"cannot pin vcpus on an inactive domain"
));
goto
cleanup
;
}
...
...
@@ -3260,7 +3276,7 @@ static int qemudDomainRestore(virConnectPtr conn,
vm
=
virDomainFindByName
(
&
driver
->
domains
,
def
->
name
);
if
(
vm
)
{
if
(
virDomainIsActive
(
vm
))
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
_
(
"domain is already active as '%s'"
),
vm
->
def
->
name
);
goto
cleanup
;
}
else
{
...
...
@@ -3513,7 +3529,7 @@ static int qemudDomainUndefine(virDomainPtr dom) {
}
if
(
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
INTERNAL_ERROR
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
OPERATION_INVALID
,
"%s"
,
_
(
"cannot delete active domain"
));
goto
cleanup
;
}
...
...
@@ -3910,7 +3926,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
if
(
!
virDomainIsActive
(
vm
))
{
qemuDriverUnlock
(
driver
);
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
INTERNAL_ERROR
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
OPERATION_INVALID
,
"%s"
,
_
(
"cannot attach device on inactive domain"
));
goto
cleanup
;
}
...
...
@@ -4062,7 +4078,7 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
if
(
!
virDomainIsActive
(
vm
))
{
qemuDriverUnlock
(
driver
);
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
INTERNAL_ERROR
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_
OPERATION_INVALID
,
"%s"
,
_
(
"cannot detach device on inactive domain"
));
goto
cleanup
;
}
...
...
@@ -4222,7 +4238,7 @@ qemudDomainBlockStats (virDomainPtr dom,
goto
cleanup
;
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
...
...
@@ -4361,7 +4377,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
...
...
@@ -4507,7 +4523,7 @@ qemudDomainMemoryPeek (virDomainPtr dom,
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
...
...
@@ -4832,7 +4848,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
}
if
(
!
virDomainIsActive
(
vm
))
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
FAILE
D
,
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_
INVALI
D
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
...
...
src/virterror.c
浏览文件 @
7022759b
...
...
@@ -1018,6 +1018,12 @@ virErrorMsg(virErrorNumber error, const char *info)
else
errmsg
=
_
(
"Security model not found: %s"
);
break
;
case
VIR_ERR_OPERATION_INVALID
:
if
(
info
==
NULL
)
errmsg
=
_
(
"Requested operation is not valid"
);
else
errmsg
=
_
(
"Requested operation is not valid: %s"
);
break
;
}
return
(
errmsg
);
}
...
...
src/xen_internal.c
浏览文件 @
7022759b
...
...
@@ -1068,9 +1068,14 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
}
priv
=
(
xenUnifiedPrivatePtr
)
domain
->
conn
->
privateData
;
if
(
priv
->
handle
<
0
||
domain
->
id
<
0
)
{
if
(
priv
->
handle
<
0
)
{
virXenErrorFunc
(
domain
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
,
"priv->handle or domain->id invalid"
,
0
);
"priv->handle invalid"
,
0
);
return
NULL
;
}
if
(
domain
->
id
<
0
)
{
virXenError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
return
NULL
;
}
...
...
@@ -1143,9 +1148,14 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
}
priv
=
(
xenUnifiedPrivatePtr
)
domain
->
conn
->
privateData
;
if
(
priv
->
handle
<
0
||
domain
->
id
<
0
)
{
if
(
priv
->
handle
<
0
)
{
virXenErrorFunc
(
domain
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
,
"priv->handle or domain->id invalid"
,
0
);
"priv->handle invalid"
,
0
);
return
-
1
;
}
if
(
domain
->
id
<
0
)
{
virXenError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
return
-
1
;
}
...
...
@@ -1241,9 +1251,14 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
}
priv
=
(
xenUnifiedPrivatePtr
)
domain
->
conn
->
privateData
;
if
(
priv
->
handle
<
0
||
domain
->
id
<
0
)
{
virXenErrorFunc
(
domain
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
,
"priv->handle or domain->id invalid"
,
0
);
if
(
priv
->
handle
<
0
)
{
virXenErrorFunc
(
domain
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
,
"priv->handle invalid"
,
0
);
return
-
1
;
}
if
(
domain
->
id
<
0
)
{
virXenError
(
domain
->
conn
,
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
return
-
1
;
}
...
...
src/xend_internal.c
浏览文件 @
7022759b
...
...
@@ -2982,7 +2982,7 @@ xenDaemonDomainSuspend(virDomainPtr domain)
}
if
(
domain
->
id
<
0
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_
INVALID_ARG
,
virXendError
(
domain
->
conn
,
VIR_ERR_
OPERATION_INVALID
,
_
(
"Domain %s isn't running."
),
domain
->
name
);
return
(
-
1
);
}
...
...
@@ -3009,7 +3009,7 @@ xenDaemonDomainResume(virDomainPtr domain)
}
if
(
domain
->
id
<
0
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_
INVALID_ARG
,
virXendError
(
domain
->
conn
,
VIR_ERR_
OPERATION_INVALID
,
_
(
"Domain %s isn't running."
),
domain
->
name
);
return
(
-
1
);
}
...
...
@@ -3037,7 +3037,7 @@ xenDaemonDomainShutdown(virDomainPtr domain)
}
if
(
domain
->
id
<
0
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_
INVALID_ARG
,
virXendError
(
domain
->
conn
,
VIR_ERR_
OPERATION_INVALID
,
_
(
"Domain %s isn't running."
),
domain
->
name
);
return
(
-
1
);
}
...
...
@@ -3066,7 +3066,7 @@ xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
}
if
(
domain
->
id
<
0
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_
INVALID_ARG
,
virXendError
(
domain
->
conn
,
VIR_ERR_
OPERATION_INVALID
,
_
(
"Domain %s isn't running."
),
domain
->
name
);
return
(
-
1
);
}
...
...
@@ -3097,7 +3097,7 @@ xenDaemonDomainDestroy(virDomainPtr domain)
}
if
(
domain
->
id
<
0
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_
INVALID_ARG
,
virXendError
(
domain
->
conn
,
VIR_ERR_
OPERATION_INVALID
,
_
(
"Domain %s isn't running."
),
domain
->
name
);
return
(
-
1
);
}
...
...
@@ -3172,7 +3172,7 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename)
}
if
(
domain
->
id
<
0
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_
INVALID_ARG
,
virXendError
(
domain
->
conn
,
VIR_ERR_
OPERATION_INVALID
,
_
(
"Domain %s isn't running."
),
domain
->
name
);
return
(
-
1
);
}
...
...
@@ -3209,7 +3209,7 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
}
if
(
domain
->
id
<
0
)
{
virXendError
(
domain
->
conn
,
VIR_ERR_
INVALID_ARG
,
virXendError
(
domain
->
conn
,
VIR_ERR_
OPERATION_INVALID
,
_
(
"Domain %s isn't running."
),
domain
->
name
);
return
(
-
1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录