Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
342fc56f
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看板
提交
342fc56f
编写于
1月 31, 2012
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remote protocol for virDomainGetDiskErrors
上级
02af3e13
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
219 addition
and
1 deletion
+219
-1
daemon/remote.c
daemon/remote.c
+103
-0
src/remote/remote_driver.c
src/remote/remote_driver.c
+77
-0
src/remote/remote_protocol.x
src/remote/remote_protocol.x
+22
-1
src/remote_protocol-structs
src/remote_protocol-structs
+17
-0
未找到文件。
daemon/remote.c
浏览文件 @
342fc56f
...
...
@@ -98,6 +98,12 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val,
int
limit
,
int
*
nparams
);
static
int
remoteSerializeDomainDiskErrors
(
virDomainDiskErrorPtr
errors
,
int
nerrors
,
remote_domain_disk_error
**
ret_errors_val
,
u_int
*
ret_errors_len
);
#include "remote_dispatch.h"
#include "qemu_dispatch.h"
...
...
@@ -3591,6 +3597,69 @@ cleanup:
return
rv
;
}
static
int
remoteDispatchDomainGetDiskErrors
(
virNetServerPtr
server
ATTRIBUTE_UNUSED
,
virNetServerClientPtr
client
,
virNetMessagePtr
msg
ATTRIBUTE_UNUSED
,
virNetMessageErrorPtr
rerr
,
remote_domain_get_disk_errors_args
*
args
,
remote_domain_get_disk_errors_ret
*
ret
)
{
int
rv
=
-
1
;
virDomainPtr
dom
=
NULL
;
virDomainDiskErrorPtr
errors
=
NULL
;
int
len
;
struct
daemonClientPrivate
*
priv
=
virNetServerClientGetPrivateData
(
client
);
if
(
!
priv
->
conn
)
{
virNetError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"connection not open"
));
goto
cleanup
;
}
if
(
!
(
dom
=
get_nonnull_domain
(
priv
->
conn
,
args
->
dom
)))
goto
cleanup
;
if
(
args
->
maxerrors
>
REMOTE_DOMAIN_DISK_ERRORS_MAX
)
{
virNetError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"maxerrors too large"
));
goto
cleanup
;
}
if
(
args
->
maxerrors
&&
VIR_ALLOC_N
(
errors
,
args
->
maxerrors
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
if
((
len
=
virDomainGetDiskErrors
(
dom
,
errors
,
args
->
maxerrors
,
args
->
flags
))
<
0
)
goto
cleanup
;
ret
->
nerrors
=
len
;
if
(
errors
&&
remoteSerializeDomainDiskErrors
(
errors
,
len
,
&
ret
->
errors
.
errors_val
,
&
ret
->
errors
.
errors_len
)
<
0
)
goto
cleanup
;
rv
=
0
;
cleanup:
if
(
rv
<
0
)
virNetMessageSaveError
(
rerr
);
if
(
dom
)
virDomainFree
(
dom
);
if
(
errors
)
{
int
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
VIR_FREE
(
errors
[
i
].
disk
);
}
VIR_FREE
(
errors
);
return
rv
;
}
/*----- Helpers. -----*/
/* get_nonnull_domain and get_nonnull_network turn an on-wire
...
...
@@ -3721,3 +3790,37 @@ make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDo
snapshot_dst
->
name
=
strdup
(
snapshot_src
->
name
);
make_nonnull_domain
(
&
snapshot_dst
->
dom
,
snapshot_src
->
domain
);
}
static
int
remoteSerializeDomainDiskErrors
(
virDomainDiskErrorPtr
errors
,
int
nerrors
,
remote_domain_disk_error
**
ret_errors_val
,
u_int
*
ret_errors_len
)
{
remote_domain_disk_error
*
val
=
NULL
;
int
i
=
0
;
if
(
VIR_ALLOC_N
(
val
,
nerrors
)
<
0
)
goto
no_memory
;
for
(
i
=
0
;
i
<
nerrors
;
i
++
)
{
if
(
!
(
val
[
i
].
disk
=
strdup
(
errors
[
i
].
disk
)))
goto
no_memory
;
val
[
i
].
error
=
errors
[
i
].
error
;
}
*
ret_errors_len
=
nerrors
;
*
ret_errors_val
=
val
;
return
0
;
no_memory:
if
(
val
)
{
int
j
;
for
(
j
=
0
;
j
<
i
;
j
++
)
VIR_FREE
(
val
[
j
].
disk
);
VIR_FREE
(
val
);
}
virReportOOMError
();
return
-
1
;
}
src/remote/remote_driver.c
浏览文件 @
342fc56f
...
...
@@ -1423,6 +1423,39 @@ cleanup:
return
rv
;
}
static
int
remoteDeserializeDomainDiskErrors
(
remote_domain_disk_error
*
ret_errors_val
,
u_int
ret_errors_len
,
int
limit
,
virDomainDiskErrorPtr
errors
,
int
maxerrors
)
{
int
i
=
0
;
int
j
;
if
(
ret_errors_len
>
limit
||
ret_errors_len
>
maxerrors
)
{
remoteError
(
VIR_ERR_RPC
,
"%s"
,
_
(
"returned number of disk errors exceeds limit"
));
goto
error
;
}
for
(
i
=
0
;
i
<
ret_errors_len
;
i
++
)
{
if
(
!
(
errors
[
i
].
disk
=
strdup
(
ret_errors_val
[
i
].
disk
)))
{
virReportOOMError
();
goto
error
;
}
errors
[
i
].
error
=
ret_errors_val
[
i
].
error
;
}
return
0
;
error:
for
(
j
=
0
;
j
<
i
;
j
++
)
VIR_FREE
(
errors
[
i
].
disk
);
return
-
1
;
}
static
int
remoteDomainBlockStatsFlags
(
virDomainPtr
domain
,
const
char
*
path
,
...
...
@@ -4438,6 +4471,49 @@ remoteIsAlive(virConnectPtr conn)
}
static
int
remoteDomainGetDiskErrors
(
virDomainPtr
dom
,
virDomainDiskErrorPtr
errors
,
unsigned
int
maxerrors
,
unsigned
int
flags
)
{
int
rv
=
-
1
;
struct
private_data
*
priv
=
dom
->
conn
->
privateData
;
remote_domain_get_disk_errors_args
args
;
remote_domain_get_disk_errors_ret
ret
;
remoteDriverLock
(
priv
);
make_nonnull_domain
(
&
args
.
dom
,
dom
);
args
.
maxerrors
=
maxerrors
;
args
.
flags
=
flags
;
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
dom
->
conn
,
priv
,
0
,
REMOTE_PROC_DOMAIN_GET_DISK_ERRORS
,
(
xdrproc_t
)
xdr_remote_domain_get_disk_errors_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_remote_domain_get_disk_errors_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
remoteDeserializeDomainDiskErrors
(
ret
.
errors
.
errors_val
,
ret
.
errors
.
errors_len
,
REMOTE_DOMAIN_DISK_ERRORS_MAX
,
errors
,
maxerrors
)
<
0
)
goto
cleanup
;
rv
=
ret
.
nerrors
;
cleanup:
xdr_free
((
xdrproc_t
)
xdr_remote_domain_get_disk_errors_ret
,
(
char
*
)
&
ret
);
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
#include "remote_client_bodies.h"
#include "qemu_client_bodies.h"
...
...
@@ -4840,6 +4916,7 @@ static virDriver remote_driver = {
.
domainSetNumaParameters
=
remoteDomainSetNumaParameters
,
/* 0.9.9 */
.
domainGetNumaParameters
=
remoteDomainGetNumaParameters
,
/* 0.9.9 */
.
domainGetCPUStats
=
remoteDomainGetCPUStats
,
/* 0.9.10 */
.
domainGetDiskErrors
=
remoteDomainGetDiskErrors
,
/* 0.9.10 */
};
static
virNetworkDriver
network_driver
=
{
...
...
src/remote/remote_protocol.x
浏览文件 @
342fc56f
...
...
@@ -219,6 +219,11 @@ const REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX = 128;
*/
const
REMOTE_DOMAIN_GET_CPU_STATS_MAX
=
2048
;
/*
* Upper limit on number of disks with errors
*/
const
REMOTE_DOMAIN_DISK_ERRORS_MAX
=
256
;
/* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */
typedef
opaque
remote_uuid
[
VIR_UUID_BUFLEN
];
...
...
@@ -359,6 +364,10 @@ struct remote_node_get_memory_stats {
unsigned
hyper
value
;
};
struct
remote_domain_disk_error
{
remote_nonnull_string
disk
;
int
error
;
};
/*----- Calls. -----*/
...
...
@@ -2397,6 +2406,17 @@ struct remote_domain_shutdown_flags_args {
unsigned
int
flags
;
};
struct
remote_domain_get_disk_errors_args
{
remote_nonnull_domain
dom
;
unsigned
int
maxerrors
;
unsigned
int
flags
;
};
struct
remote_domain_get_disk_errors_ret
{
remote_domain_disk_error
errors
<
REMOTE_DOMAIN_DISK_ERRORS_MAX
>
;
int
nerrors
;
};
/*----- Protocol. -----*/
...
...
@@ -2708,7 +2728,8 @@ enum remote_procedure {
REMOTE_PROC_STORAGE_VOL_RESIZE
=
260
,
/* autogen autogen */
REMOTE_PROC_DOMAIN_PM_SUSPEND_FOR_DURATION
=
261
,
/* autogen autogen */
REMOTE_PROC_DOMAIN_GET_CPU_STATS
=
262
/* skipgen skipgen */
REMOTE_PROC_DOMAIN_GET_CPU_STATS
=
262
,
/* skipgen skipgen */
REMOTE_PROC_DOMAIN_GET_DISK_ERRORS
=
263
/* skipgen skipgen */
/*
* Notice how the entries are grouped in sets of 10 ?
...
...
src/remote_protocol-structs
浏览文件 @
342fc56f
...
...
@@ -94,6 +94,10 @@ struct remote_node_get_memory_stats {
remote_nonnull_string
field
;
uint64_t
value
;
};
struct
remote_domain_disk_error
{
remote_nonnull_string
disk
;
int
error
;
};
struct
remote_open_args
{
remote_string
name
;
u_int
flags
;
...
...
@@ -1866,6 +1870,18 @@ struct remote_domain_shutdown_flags_args {
remote_nonnull_domain
dom
;
u_int
flags
;
};
struct
remote_domain_get_disk_errors_args
{
remote_nonnull_domain
dom
;
u_int
maxerrors
;
u_int
flags
;
};
struct
remote_domain_get_disk_errors_ret
{
struct
{
u_int
errors_len
;
remote_domain_disk_error
*
errors_val
;
}
errors
;
int
nerrors
;
};
enum
remote_procedure
{
REMOTE_PROC_OPEN
=
1
,
REMOTE_PROC_CLOSE
=
2
,
...
...
@@ -2129,4 +2145,5 @@ enum remote_procedure {
REMOTE_PROC_STORAGE_VOL_RESIZE
=
260
,
REMOTE_PROC_DOMAIN_PM_SUSPEND_FOR_DURATION
=
261
,
REMOTE_PROC_DOMAIN_GET_CPU_STATS
=
262
,
REMOTE_PROC_DOMAIN_GET_DISK_ERRORS
=
263
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录