Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
16793534
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,发现更多精彩内容 >>
提交
16793534
编写于
7月 21, 2012
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
esx: Improve error reporting for unknown VI types
Print the actual unknown type name instead of <other> for AnyType objects.
上级
ce53382b
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
30 addition
and
13 deletion
+30
-13
src/esx/esx_vi.c
src/esx/esx_vi.c
+1
-1
src/esx/esx_vi_types.c
src/esx/esx_vi_types.c
+28
-12
src/esx/esx_vi_types.h
src/esx/esx_vi_types.h
+1
-0
未找到文件。
src/esx/esx_vi.c
浏览文件 @
16793534
...
...
@@ -1481,7 +1481,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Expecting type '%s' but found '%s'"
),
esxVI_Type_ToString
(
enumeration
->
type
),
esxVI_
Type_ToString
(
anyType
->
t
ype
));
esxVI_
AnyType_TypeToString
(
anyT
ype
));
return
-
1
;
}
...
...
src/esx/esx_vi_types.c
浏览文件 @
16793534
...
...
@@ -533,8 +533,8 @@
* Macros to implement dynamic dispatched functions
*/
#define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _
_type, _dispatch,
\
_
error_return)
\
#define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _
actual_type_name, __type,
\
_
dispatch, _error_return)
\
switch (_actual_type) { \
_dispatch \
\
...
...
@@ -543,8 +543,8 @@
\
default: \
virReportError(VIR_ERR_INTERNAL_ERROR, \
_("Call to %s for unexpected type '%s'"),
__FUNCTION__,
\
esxVI_Type_ToString(_actual_type));
\
_("Call to %s for unexpected type '%s'"),
\
__FUNCTION__, _actual_type_name);
\
return _error_return; \
}
...
...
@@ -586,7 +586,9 @@
#define ESX_VI__TEMPLATE__DYNAMIC_FREE(__type, _dispatch, _body) \
ESX_VI__TEMPLATE__FREE(__type, \
ESX_VI__TEMPLATE__DISPATCH(item->_type, __type, _dispatch, \
ESX_VI__TEMPLATE__DISPATCH(item->_type, \
esxVI_Type_ToString(item->_type), \
__type, _dispatch, \
/* nothing */
) \
_body)
...
...
@@ -620,21 +622,27 @@
#define ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY(__type, _dispatch, _deep_copy) \
ESX_VI__TEMPLATE__DEEP_COPY(__type, \
ESX_VI__TEMPLATE__DISPATCH(src->_type, __type, _dispatch, -1) \
ESX_VI__TEMPLATE__DISPATCH(src->_type, \
esxVI_Type_ToString(src->_type), \
__type, _dispatch, -1) \
_deep_copy)
#define ESX_VI__TEMPLATE__DYNAMIC_CAST_FROM_ANY_TYPE(__type, _dispatch) \
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(__type, esxVI_##__type, \
ESX_VI__TEMPLATE__DISPATCH(anyType->type, __type, _dispatch, -1), \
ESX_VI__TEMPLATE__DISPATCH(anyType->type, \
esxVI_AnyType_TypeToString(anyType), \
__type, _dispatch, -1), \
/* nothing */
)
#define ESX_VI__TEMPLATE__DYNAMIC_SERIALIZE(__type, _dispatch, _serialize) \
ESX_VI__TEMPLATE__SERIALIZE_EXTRA(__type, \
ESX_VI__TEMPLATE__DISPATCH(item->_type, __type, _dispatch, -1), \
ESX_VI__TEMPLATE__DISPATCH(item->_type, \
esxVI_Type_ToString(item->_type), \
__type, _dispatch, -1), \
_serialize)
...
...
@@ -690,7 +698,7 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
*
actualType
=
esxVI_Type_FromString
(
type
);
if
(
*
actualType
==
esxVI_Type_Undefined
)
{
if
(
*
actualType
==
esxVI_Type_Undefined
||
*
actualType
==
esxVI_Type_Other
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Unknown value '%s' for %s 'type' property"
),
type
,
esxVI_Type_ToString
(
baseType
));
...
...
@@ -869,6 +877,16 @@ ESX_VI__TEMPLATE__FREE(AnyType,
VIR_FREE
(
item
->
value
);
})
const
char
*
esxVI_AnyType_TypeToString
(
esxVI_AnyType
*
anyType
)
{
if
(
anyType
->
type
==
esxVI_Type_Other
)
{
return
anyType
->
other
;
}
else
{
return
esxVI_Type_ToString
(
anyType
->
type
);
}
}
int
esxVI_AnyType_ExpectType
(
esxVI_AnyType
*
anyType
,
esxVI_Type
type
)
{
...
...
@@ -876,9 +894,7 @@ esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Expecting type '%s' but found '%s'"
),
esxVI_Type_ToString
(
type
),
anyType
->
type
!=
esxVI_Type_Other
?
esxVI_Type_ToString
(
anyType
->
type
)
:
anyType
->
other
);
esxVI_AnyType_TypeToString
(
anyType
));
return
-
1
;
}
...
...
src/esx/esx_vi_types.h
浏览文件 @
16793534
...
...
@@ -154,6 +154,7 @@ struct _esxVI_AnyType {
int
esxVI_AnyType_Alloc
(
esxVI_AnyType
**
anyType
);
void
esxVI_AnyType_Free
(
esxVI_AnyType
**
anyType
);
const
char
*
esxVI_AnyType_TypeToString
(
esxVI_AnyType
*
anyType
);
int
esxVI_AnyType_ExpectType
(
esxVI_AnyType
*
anyType
,
esxVI_Type
type
);
int
esxVI_AnyType_DeepCopy
(
esxVI_AnyType
**
dest
,
esxVI_AnyType
*
src
);
int
esxVI_AnyType_Deserialize
(
xmlNodePtr
node
,
esxVI_AnyType
**
anyType
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录