Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
b6465e1a
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看板
提交
b6465e1a
编写于
6月 08, 2016
作者:
P
Pavel Hrdina
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
graphics: introduce new listen type 'socket'
Signed-off-by:
N
Pavel Hrdina
<
phrdina@redhat.com
>
上级
c5caecab
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
116 addition
and
5 deletion
+116
-5
docs/formatdomain.html.in
docs/formatdomain.html.in
+8
-0
docs/schemas/domaincommon.rng
docs/schemas/domaincommon.rng
+10
-0
src/conf/domain_conf.c
src/conf/domain_conf.c
+58
-2
src/conf/domain_conf.h
src/conf/domain_conf.h
+6
-0
src/libvirt_private.syms
src/libvirt_private.syms
+1
-0
src/qemu/qemu_hotplug.c
src/qemu/qemu_hotplug.c
+9
-0
src/qemu/qemu_process.c
src/qemu/qemu_process.c
+9
-0
src/security/virt-aa-helper.c
src/security/virt-aa-helper.c
+15
-3
未找到文件。
docs/formatdomain.html.in
浏览文件 @
b6465e1a
...
...
@@ -5360,6 +5360,14 @@ qemu-kvm -net nic,model=? /dev/null
of the first forward dev will be used.
</p>
</dd>
<dt><code>
socket
</code>
<span
class=
"since"
>
since 1.3.6 (QEMU only)
</span></dt>
<dd>
<p>
This listen type tells a graphics server to listen on unix socket.
Attribute
<code>
socket
</code>
contains a path to unix socket. If this
attribute is omitted libvirt will generate this path for you.
</p>
</dd>
</dl>
<h4><a
name=
"elementsVideo"
>
Video devices
</a></h4>
...
...
docs/schemas/domaincommon.rng
浏览文件 @
b6465e1a
...
...
@@ -2976,6 +2976,16 @@
</attribute>
</optional>
</group>
<group>
<attribute
name=
"type"
>
<value>
socket
</value>
</attribute>
<optional>
<attribute
name=
"socket"
>
<ref
name=
"absFilePath"
/>
</attribute>
</optional>
</group>
</choice>
</element>
</zeroOrMore>
...
...
src/conf/domain_conf.c
浏览文件 @
b6465e1a
...
...
@@ -561,7 +561,8 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
VIR_ENUM_IMPL(virDomainGraphicsListen, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST,
"none",
"address",
"network")
"network",
"socket")
VIR_ENUM_IMPL(virDomainGraphicsAuthConnected,
VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST,
...
...
@@ -1229,6 +1230,7 @@ virDomainGraphicsListenDefClear(virDomainGraphicsListenDefPtr def)
VIR_FREE(def->address);
VIR_FREE(def->network);
VIR_FREE(def->socket);
return;
}
...
...
@@ -10895,6 +10897,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
/**
* virDomainGraphicsListenDefParseXML:
* @def: listen def pointer to be filled
* @graphics: graphics def pointer
* @node: xml node of <listen/> element
* @parent: xml node of <graphics/> element
* @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
...
...
@@ -10906,6 +10909,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
virDomainGraphicsDefPtr graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
...
...
@@ -10914,8 +10918,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
char *type = virXMLPropString(node, "type");
char *address = virXMLPropString(node, "address");
char *network = virXMLPropString(node, "network");
char *socket = virXMLPropString(node, "socket");
char *fromConfig = virXMLPropString(node, "fromConfig");
char *addressCompat = NULL;
const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
int tmp, typeVal;
if (parent)
...
...
@@ -10934,6 +10940,13 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
}
def->type = typeVal;
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("listen type 'socket' is not available for "
"graphics type '%s'"), graphicsType);
goto error;
}
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
...
...
@@ -10968,6 +10981,17 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
network = NULL;
}
if (socket && socket[0]) {
if (def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'socket' attribute is valid only for listen "
"type 'socket'"));
goto error;
}
def->socket = socket;
socket = NULL;
}
if (fromConfig &&
flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) {
...
...
@@ -10986,6 +11010,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
VIR_FREE(type);
VIR_FREE(address);
VIR_FREE(network);
VIR_FREE(socket);
VIR_FREE(fromConfig);
VIR_FREE(addressCompat);
return ret;
...
...
@@ -11025,7 +11050,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def,
goto error;
for (i = 0; i < nListens; i++) {
if (virDomainGraphicsListenDefParseXML(&def->listens[i],
if (virDomainGraphicsListenDefParseXML(&def->listens[i],
def,
listenNodes[i],
i == 0 ? node : NULL,
flags) < 0)
...
...
@@ -21707,6 +21732,13 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, " network='%s'", def->network);
}
if (def->socket &&
def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET &&
!(def->autoGenerated &&
(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))) {
virBufferEscapeString(buf, " socket='%s'", def->socket);
}
if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS)
virBufferAsprintf(buf, " fromConfig='%d'", def->fromConfig);
...
...
@@ -24208,6 +24240,30 @@ virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def,
}
int
virDomainGraphicsListenAppendSocket(virDomainGraphicsDefPtr def,
const char *socket)
{
virDomainGraphicsListenDef listen;
memset(&listen, 0, sizeof(listen));
listen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET;
if (VIR_STRDUP(listen.socket, socket) < 0)
goto error;
if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, listen) < 0)
goto error;
return 0;
error:
VIR_FREE(listen.socket);
return -1;
}
/**
* virDomainNetFind:
* @def: domain's def
...
...
src/conf/domain_conf.h
浏览文件 @
b6465e1a
...
...
@@ -1418,6 +1418,7 @@ typedef enum {
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE
=
0
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
}
virDomainGraphicsListenType
;
...
...
@@ -1434,7 +1435,9 @@ struct _virDomainGraphicsListenDef {
virDomainGraphicsListenType
type
;
char
*
address
;
char
*
network
;
char
*
socket
;
bool
fromConfig
;
/* true if the @address is config file originated */
bool
autoGenerated
;
};
struct
_virDomainGraphicsDef
{
...
...
@@ -2751,6 +2754,9 @@ virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i);
int
virDomainGraphicsListenAppendAddress
(
virDomainGraphicsDefPtr
def
,
const
char
*
address
)
ATTRIBUTE_NONNULL
(
1
);
int
virDomainGraphicsListenAppendSocket
(
virDomainGraphicsDefPtr
def
,
const
char
*
socket
)
ATTRIBUTE_NONNULL
(
1
);
int
virDomainNetGetActualType
(
virDomainNetDefPtr
iface
);
const
char
*
virDomainNetGetActualBridgeName
(
virDomainNetDefPtr
iface
);
...
...
src/libvirt_private.syms
浏览文件 @
b6465e1a
...
...
@@ -307,6 +307,7 @@ virDomainGraphicsAuthConnectedTypeToString;
virDomainGraphicsDefFree;
virDomainGraphicsGetListen;
virDomainGraphicsListenAppendAddress;
virDomainGraphicsListenAppendSocket;
virDomainGraphicsSpiceChannelModeTypeFromString;
virDomainGraphicsSpiceChannelModeTypeToString;
virDomainGraphicsSpiceChannelNameTypeFromString;
...
...
src/qemu/qemu_hotplug.c
浏览文件 @
b6465e1a
...
...
@@ -2624,6 +2624,15 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
break
;
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET
:
if
(
STRNEQ_NULLABLE
(
newlisten
->
socket
,
oldlisten
->
socket
))
{
virReportError
(
VIR_ERR_OPERATION_UNSUPPORTED
,
_
(
"cannot change listen socket setting "
"on '%s' graphics"
),
type
);
goto
cleanup
;
}
break
;
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE
:
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
:
/* nada */
...
...
src/qemu/qemu_process.c
浏览文件 @
b6465e1a
...
...
@@ -4080,6 +4080,15 @@ qemuProcessGraphicsSetupListen(virQEMUDriverConfigPtr cfg,
return
-
1
;
break
;
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET
:
if
(
!
glisten
->
socket
)
{
if
(
virAsprintf
(
&
glisten
->
socket
,
"%s/%s.sock"
,
priv
->
libDir
,
type
)
<
0
)
return
-
1
;
glisten
->
autoGenerated
=
true
;
}
break
;
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE
:
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
:
break
;
...
...
src/security/virt-aa-helper.c
浏览文件 @
b6465e1a
...
...
@@ -1007,10 +1007,22 @@ get_files(vahControl * ctl)
goto
cleanup
;
for
(
i
=
0
;
i
<
ctl
->
def
->
ngraphics
;
i
++
)
{
if
(
ctl
->
def
->
graphics
[
i
]
->
type
==
VIR_DOMAIN_GRAPHICS_TYPE_VNC
&&
ctl
->
def
->
graphics
[
i
]
->
data
.
vnc
.
socket
&&
vah_add_file
(
&
buf
,
ctl
->
def
->
graphics
[
i
]
->
data
.
vnc
.
socket
,
"w"
))
virDomainGraphicsDefPtr
graphics
=
ctl
->
def
->
graphics
[
i
];
size_t
n
;
if
(
graphics
->
type
==
VIR_DOMAIN_GRAPHICS_TYPE_VNC
&&
graphics
->
data
.
vnc
.
socket
&&
vah_add_file
(
&
buf
,
graphics
->
data
.
vnc
.
socket
,
"w"
))
goto
cleanup
;
for
(
n
=
0
;
n
<
graphics
->
nListens
;
n
++
)
{
virDomainGraphicsListenDef
listenObj
=
graphics
->
listens
[
n
];
if
(
listenObj
.
type
==
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET
&&
listenObj
.
socket
&&
vah_add_file
(
&
buf
,
listenObj
.
socket
,
"rw"
))
goto
cleanup
;
}
}
if
(
ctl
->
def
->
ngraphics
==
1
&&
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录