Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
408aae38
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看板
提交
408aae38
编写于
8月 25, 2014
作者:
J
Ján Tomko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add RPC implementation for virDomainOpenGraphicsFd
上级
3ddc8544
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
136 addition
and
1 deletion
+136
-1
daemon/remote.c
daemon/remote.c
+44
-0
src/remote/remote_driver.c
src/remote/remote_driver.c
+43
-0
src/remote/remote_protocol.x
src/remote/remote_protocol.x
+14
-1
src/remote_protocol-structs
src/remote_protocol-structs
+6
-0
src/rpc/virnetmessage.c
src/rpc/virnetmessage.c
+26
-0
src/rpc/virnetmessage.h
src/rpc/virnetmessage.h
+3
-0
未找到文件。
daemon/remote.c
浏览文件 @
408aae38
...
...
@@ -4398,6 +4398,50 @@ remoteDispatchDomainOpenGraphics(virNetServerPtr server ATTRIBUTE_UNUSED,
return
rv
;
}
static
int
remoteDispatchDomainOpenGraphicsFd
(
virNetServerPtr
server
ATTRIBUTE_UNUSED
,
virNetServerClientPtr
client
ATTRIBUTE_UNUSED
,
virNetMessagePtr
msg
,
virNetMessageErrorPtr
rerr
,
remote_domain_open_graphics_fd_args
*
args
)
{
virDomainPtr
dom
=
NULL
;
int
rv
=
-
1
;
int
fd
=
-
1
;
struct
daemonClientPrivate
*
priv
=
virNetServerClientGetPrivateData
(
client
);
if
(
!
priv
->
conn
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"connection not open"
));
goto
cleanup
;
}
if
(
!
(
dom
=
get_nonnull_domain
(
priv
->
conn
,
args
->
dom
)))
goto
cleanup
;
if
(
virDomainOpenGraphicsFD
(
dom
,
args
->
idx
,
&
fd
,
args
->
flags
)
<
0
)
goto
cleanup
;
if
(
virNetMessageAddFD
(
msg
,
fd
)
<
0
)
goto
cleanup
;
/* return 1 here to let virNetServerProgramDispatchCall know
* we are passing a FD */
rv
=
1
;
cleanup:
VIR_FORCE_CLOSE
(
fd
);
if
(
rv
<
0
)
{
virNetMessageSaveError
(
rerr
);
}
if
(
dom
)
virDomainFree
(
dom
);
return
rv
;
}
static
int
remoteDispatchDomainGetInterfaceParameters
(
virNetServerPtr
server
ATTRIBUTE_UNUSED
,
virNetServerClientPtr
client
ATTRIBUTE_UNUSED
,
...
...
src/remote/remote_driver.c
浏览文件 @
408aae38
...
...
@@ -6445,6 +6445,48 @@ remoteDomainOpenGraphics(virDomainPtr dom,
}
static
int
remoteDomainOpenGraphicsFD
(
virDomainPtr
dom
,
unsigned
int
idx
,
int
*
fd
,
unsigned
int
flags
)
{
int
rv
=
-
1
;
remote_domain_open_graphics_args
args
;
struct
private_data
*
priv
=
dom
->
conn
->
privateData
;
int
*
fdout
=
NULL
;
size_t
fdoutlen
=
0
;
remoteDriverLock
(
priv
);
make_nonnull_domain
(
&
args
.
dom
,
dom
);
args
.
idx
=
idx
;
args
.
flags
=
flags
;
if
(
callFull
(
dom
->
conn
,
priv
,
0
,
NULL
,
0
,
&
fdout
,
&
fdoutlen
,
REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD
,
(
xdrproc_t
)
xdr_remote_domain_open_graphics_fd_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_void
,
NULL
)
==
-
1
)
goto
done
;
if
(
fdoutlen
!=
1
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no file descriptor received"
));
goto
done
;
}
*
fd
=
fdout
[
0
];
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
int
remoteConnectSetKeepAlive
(
virConnectPtr
conn
,
int
interval
,
unsigned
int
count
)
{
...
...
@@ -7963,6 +8005,7 @@ static virDriver remote_driver = {
.
domainOpenConsole
=
remoteDomainOpenConsole
,
/* 0.8.6 */
.
domainOpenChannel
=
remoteDomainOpenChannel
,
/* 1.0.2 */
.
domainOpenGraphics
=
remoteDomainOpenGraphics
,
/* 0.9.7 */
.
domainOpenGraphicsFD
=
remoteDomainOpenGraphicsFD
,
/* 1.2.8 */
.
domainInjectNMI
=
remoteDomainInjectNMI
,
/* 0.9.2 */
.
domainMigrateBegin3
=
remoteDomainMigrateBegin3
,
/* 0.9.2 */
.
domainMigratePrepare3
=
remoteDomainMigratePrepare3
,
/* 0.9.2 */
...
...
src/remote/remote_protocol.x
浏览文件 @
408aae38
...
...
@@ -2733,6 +2733,12 @@ struct remote_domain_open_graphics_args {
unsigned
int
flags
;
};
struct
remote_domain_open_graphics_fd_args
{
remote_nonnull_domain
dom
;
unsigned
int
idx
;
unsigned
int
flags
;
};
struct
remote_node_suspend_for_duration_args
{
unsigned
int
target
;
unsigned
hyper
duration
;
...
...
@@ -5420,5 +5426,12 @@ enum remote_procedure {
* @generate: both
* @acl: connect:write
*/
REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES
=
342
REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES
=
342
,
/**
* @generate: none
* @acl: domain:open_graphics
*/
REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD
=
343
};
src/remote_protocol-structs
浏览文件 @
408aae38
...
...
@@ -2153,6 +2153,11 @@ struct remote_domain_open_graphics_args {
u_int
idx
;
u_int
flags
;
};
struct
remote_domain_open_graphics_fd_args
{
remote_nonnull_domain
dom
;
u_int
idx
;
u_int
flags
;
};
struct
remote_node_suspend_for_duration_args
{
u_int
target
;
uint64_t
duration
;
...
...
@@ -2862,4 +2867,5 @@ enum remote_procedure {
REMOTE_PROC_NODE_GET_FREE_PAGES
=
340
,
REMOTE_PROC_NETWORK_GET_DHCP_LEASES
=
341
,
REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES
=
342
,
REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD
=
343
,
};
src/rpc/virnetmessage.c
浏览文件 @
408aae38
...
...
@@ -564,3 +564,29 @@ int virNetMessageDupFD(virNetMessagePtr msg,
}
return
fd
;
}
int
virNetMessageAddFD
(
virNetMessagePtr
msg
,
int
fd
)
{
int
newfd
=
-
1
;
if
((
newfd
=
dup
(
fd
))
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Unable to duplicate FD %d"
),
fd
);
goto
error
;
}
if
(
virSetInherit
(
newfd
,
false
)
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Cannot set close-on-exec %d"
),
newfd
);
goto
error
;
}
if
(
VIR_APPEND_ELEMENT
(
msg
->
fds
,
msg
->
nfds
,
newfd
)
<
0
)
goto
error
;
return
0
;
error:
VIR_FORCE_CLOSE
(
newfd
);
return
-
1
;
}
src/rpc/virnetmessage.h
浏览文件 @
408aae38
...
...
@@ -96,4 +96,7 @@ void virNetMessageSaveError(virNetMessageErrorPtr rerr)
int
virNetMessageDupFD
(
virNetMessagePtr
msg
,
size_t
slot
);
int
virNetMessageAddFD
(
virNetMessagePtr
msg
,
int
fd
);
#endif
/* __VIR_NET_MESSAGE_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录