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
...
@@ -5360,6 +5360,14 @@ qemu-kvm -net nic,model=? /dev/null
of the first forward dev will be used.
of the first forward dev will be used.
</p>
</p>
</dd>
</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>
</dl>
<h4><a
name=
"elementsVideo"
>
Video devices
</a></h4>
<h4><a
name=
"elementsVideo"
>
Video devices
</a></h4>
...
...
docs/schemas/domaincommon.rng
浏览文件 @
b6465e1a
...
@@ -2976,6 +2976,16 @@
...
@@ -2976,6 +2976,16 @@
</attribute>
</attribute>
</optional>
</optional>
</group>
</group>
<group>
<attribute
name=
"type"
>
<value>
socket
</value>
</attribute>
<optional>
<attribute
name=
"socket"
>
<ref
name=
"absFilePath"
/>
</attribute>
</optional>
</group>
</choice>
</choice>
</element>
</element>
</zeroOrMore>
</zeroOrMore>
...
...
src/conf/domain_conf.c
浏览文件 @
b6465e1a
...
@@ -561,7 +561,8 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
...
@@ -561,7 +561,8 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
VIR_ENUM_IMPL(virDomainGraphicsListen, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST,
VIR_ENUM_IMPL(virDomainGraphicsListen, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST,
"none",
"none",
"address",
"address",
"network")
"network",
"socket")
VIR_ENUM_IMPL(virDomainGraphicsAuthConnected,
VIR_ENUM_IMPL(virDomainGraphicsAuthConnected,
VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST,
VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST,
...
@@ -1229,6 +1230,7 @@ virDomainGraphicsListenDefClear(virDomainGraphicsListenDefPtr def)
...
@@ -1229,6 +1230,7 @@ virDomainGraphicsListenDefClear(virDomainGraphicsListenDefPtr def)
VIR_FREE(def->address);
VIR_FREE(def->address);
VIR_FREE(def->network);
VIR_FREE(def->network);
VIR_FREE(def->socket);
return;
return;
}
}
...
@@ -10895,6 +10897,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
...
@@ -10895,6 +10897,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
/**
/**
* virDomainGraphicsListenDefParseXML:
* virDomainGraphicsListenDefParseXML:
* @def: listen def pointer to be filled
* @def: listen def pointer to be filled
* @graphics: graphics def pointer
* @node: xml node of <listen/> element
* @node: xml node of <listen/> element
* @parent: xml node of <graphics/> element
* @parent: xml node of <graphics/> element
* @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
* @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
...
@@ -10906,6 +10909,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
...
@@ -10906,6 +10909,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
*/
static int
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
virDomainGraphicsDefPtr graphics,
xmlNodePtr node,
xmlNodePtr node,
xmlNodePtr parent,
xmlNodePtr parent,
unsigned int flags)
unsigned int flags)
...
@@ -10914,8 +10918,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
...
@@ -10914,8 +10918,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
char *type = virXMLPropString(node, "type");
char *type = virXMLPropString(node, "type");
char *address = virXMLPropString(node, "address");
char *address = virXMLPropString(node, "address");
char *network = virXMLPropString(node, "network");
char *network = virXMLPropString(node, "network");
char *socket = virXMLPropString(node, "socket");
char *fromConfig = virXMLPropString(node, "fromConfig");
char *fromConfig = virXMLPropString(node, "fromConfig");
char *addressCompat = NULL;
char *addressCompat = NULL;
const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
int tmp, typeVal;
int tmp, typeVal;
if (parent)
if (parent)
...
@@ -10934,6 +10940,13 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
...
@@ -10934,6 +10940,13 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
}
}
def->type = typeVal;
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 (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
...
@@ -10968,6 +10981,17 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
...
@@ -10968,6 +10981,17 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
network = NULL;
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 &&
if (fromConfig &&
flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) {
if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) {
...
@@ -10986,6 +11010,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
...
@@ -10986,6 +11010,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
VIR_FREE(type);
VIR_FREE(type);
VIR_FREE(address);
VIR_FREE(address);
VIR_FREE(network);
VIR_FREE(network);
VIR_FREE(socket);
VIR_FREE(fromConfig);
VIR_FREE(fromConfig);
VIR_FREE(addressCompat);
VIR_FREE(addressCompat);
return ret;
return ret;
...
@@ -11025,7 +11050,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def,
...
@@ -11025,7 +11050,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def,
goto error;
goto error;
for (i = 0; i < nListens; i++) {
for (i = 0; i < nListens; i++) {
if (virDomainGraphicsListenDefParseXML(&def->listens[i],
if (virDomainGraphicsListenDefParseXML(&def->listens[i],
def,
listenNodes[i],
listenNodes[i],
i == 0 ? node : NULL,
i == 0 ? node : NULL,
flags) < 0)
flags) < 0)
...
@@ -21707,6 +21732,13 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf,
...
@@ -21707,6 +21732,13 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, " network='%s'", def->network);
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)
if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS)
virBufferAsprintf(buf, " fromConfig='%d'", def->fromConfig);
virBufferAsprintf(buf, " fromConfig='%d'", def->fromConfig);
...
@@ -24208,6 +24240,30 @@ virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def,
...
@@ -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:
* virDomainNetFind:
* @def: domain's def
* @def: domain's def
...
...
src/conf/domain_conf.h
浏览文件 @
b6465e1a
...
@@ -1418,6 +1418,7 @@ typedef enum {
...
@@ -1418,6 +1418,7 @@ typedef enum {
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE
=
0
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE
=
0
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET
,
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
}
virDomainGraphicsListenType
;
}
virDomainGraphicsListenType
;
...
@@ -1434,7 +1435,9 @@ struct _virDomainGraphicsListenDef {
...
@@ -1434,7 +1435,9 @@ struct _virDomainGraphicsListenDef {
virDomainGraphicsListenType
type
;
virDomainGraphicsListenType
type
;
char
*
address
;
char
*
address
;
char
*
network
;
char
*
network
;
char
*
socket
;
bool
fromConfig
;
/* true if the @address is config file originated */
bool
fromConfig
;
/* true if the @address is config file originated */
bool
autoGenerated
;
};
};
struct
_virDomainGraphicsDef
{
struct
_virDomainGraphicsDef
{
...
@@ -2751,6 +2754,9 @@ virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i);
...
@@ -2751,6 +2754,9 @@ virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i);
int
virDomainGraphicsListenAppendAddress
(
virDomainGraphicsDefPtr
def
,
int
virDomainGraphicsListenAppendAddress
(
virDomainGraphicsDefPtr
def
,
const
char
*
address
)
const
char
*
address
)
ATTRIBUTE_NONNULL
(
1
);
ATTRIBUTE_NONNULL
(
1
);
int
virDomainGraphicsListenAppendSocket
(
virDomainGraphicsDefPtr
def
,
const
char
*
socket
)
ATTRIBUTE_NONNULL
(
1
);
int
virDomainNetGetActualType
(
virDomainNetDefPtr
iface
);
int
virDomainNetGetActualType
(
virDomainNetDefPtr
iface
);
const
char
*
virDomainNetGetActualBridgeName
(
virDomainNetDefPtr
iface
);
const
char
*
virDomainNetGetActualBridgeName
(
virDomainNetDefPtr
iface
);
...
...
src/libvirt_private.syms
浏览文件 @
b6465e1a
...
@@ -307,6 +307,7 @@ virDomainGraphicsAuthConnectedTypeToString;
...
@@ -307,6 +307,7 @@ virDomainGraphicsAuthConnectedTypeToString;
virDomainGraphicsDefFree;
virDomainGraphicsDefFree;
virDomainGraphicsGetListen;
virDomainGraphicsGetListen;
virDomainGraphicsListenAppendAddress;
virDomainGraphicsListenAppendAddress;
virDomainGraphicsListenAppendSocket;
virDomainGraphicsSpiceChannelModeTypeFromString;
virDomainGraphicsSpiceChannelModeTypeFromString;
virDomainGraphicsSpiceChannelModeTypeToString;
virDomainGraphicsSpiceChannelModeTypeToString;
virDomainGraphicsSpiceChannelNameTypeFromString;
virDomainGraphicsSpiceChannelNameTypeFromString;
...
...
src/qemu/qemu_hotplug.c
浏览文件 @
b6465e1a
...
@@ -2624,6 +2624,15 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
...
@@ -2624,6 +2624,15 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
break
;
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_NONE
:
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
:
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
:
/* nada */
/* nada */
...
...
src/qemu/qemu_process.c
浏览文件 @
b6465e1a
...
@@ -4080,6 +4080,15 @@ qemuProcessGraphicsSetupListen(virQEMUDriverConfigPtr cfg,
...
@@ -4080,6 +4080,15 @@ qemuProcessGraphicsSetupListen(virQEMUDriverConfigPtr cfg,
return
-
1
;
return
-
1
;
break
;
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_NONE
:
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
:
case
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
:
break
;
break
;
...
...
src/security/virt-aa-helper.c
浏览文件 @
b6465e1a
...
@@ -1007,10 +1007,22 @@ get_files(vahControl * ctl)
...
@@ -1007,10 +1007,22 @@ get_files(vahControl * ctl)
goto
cleanup
;
goto
cleanup
;
for
(
i
=
0
;
i
<
ctl
->
def
->
ngraphics
;
i
++
)
{
for
(
i
=
0
;
i
<
ctl
->
def
->
ngraphics
;
i
++
)
{
if
(
ctl
->
def
->
graphics
[
i
]
->
type
==
VIR_DOMAIN_GRAPHICS_TYPE_VNC
&&
virDomainGraphicsDefPtr
graphics
=
ctl
->
def
->
graphics
[
i
];
ctl
->
def
->
graphics
[
i
]
->
data
.
vnc
.
socket
&&
size_t
n
;
vah_add_file
(
&
buf
,
ctl
->
def
->
graphics
[
i
]
->
data
.
vnc
.
socket
,
"w"
))
if
(
graphics
->
type
==
VIR_DOMAIN_GRAPHICS_TYPE_VNC
&&
graphics
->
data
.
vnc
.
socket
&&
vah_add_file
(
&
buf
,
graphics
->
data
.
vnc
.
socket
,
"w"
))
goto
cleanup
;
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
&&
if
(
ctl
->
def
->
ngraphics
==
1
&&
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录