Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
690969af
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看板
提交
690969af
编写于
4月 04, 2016
作者:
V
Vasiliy Tolstov
提交者:
Daniel P. Berrange
4月 07, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libvirt domain xml allow to set peer address
Signed-off-by:
N
Vasiliy Tolstov
<
v.tolstov@selfip.ru
>
上级
b3d06987
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
30 addition
and
2 deletion
+30
-2
docs/formatdomain.html.in
docs/formatdomain.html.in
+11
-1
docs/schemas/domaincommon.rng
docs/schemas/domaincommon.rng
+5
-0
src/conf/domain_conf.c
src/conf/domain_conf.c
+13
-1
src/conf/domain_conf.h
src/conf/domain_conf.h
+1
-0
未找到文件。
docs/formatdomain.html.in
浏览文件 @
690969af
...
@@ -4758,6 +4758,7 @@ qemu-kvm -net nic,model=? /dev/null
...
@@ -4758,6 +4758,7 @@ qemu-kvm -net nic,model=? /dev/null
<
source network='default'/
>
<
source network='default'/
>
<
target dev='vnet0'/
>
<
target dev='vnet0'/
>
<b>
<
ip address='192.168.122.5' prefix='24'/
>
</b>
<b>
<
ip address='192.168.122.5' prefix='24'/
>
</b>
<b>
<
ip address='192.168.122.5' prefix='24' peer='10.0.0.10'/
>
</b>
<b>
<
route family='ipv4' address='192.168.122.0' prefix='24' gateway='192.168.122.1'/
>
</b>
<b>
<
route family='ipv4' address='192.168.122.0' prefix='24' gateway='192.168.122.1'/
>
</b>
<b>
<
route family='ipv4' address='192.168.122.8' gateway='192.168.122.1'/
>
</b>
<b>
<
route family='ipv4' address='192.168.122.8' gateway='192.168.122.1'/
>
</b>
<
/interface
>
<
/interface
>
...
@@ -4790,7 +4791,16 @@ qemu-kvm -net nic,model=? /dev/null
...
@@ -4790,7 +4791,16 @@ qemu-kvm -net nic,model=? /dev/null
to define the network routes to use for the network device. The attributes
to define the network routes to use for the network device. The attributes
of this element are described in the documentation for the
<code>
route
</code>
of this element are described in the documentation for the
<code>
route
</code>
element in
<a
href=
"formatnetwork.html#elementsStaticroute"
>
network definitions
</a>
.
element in
<a
href=
"formatnetwork.html#elementsStaticroute"
>
network definitions
</a>
.
This is only used by the LXC driver.
This is used by the LXC driver and
<span
class=
"since"
>
Since 1.3.3
</span>
by the QEMU
driver.
</p>
<p>
<span
class=
"since"
>
Since 1.3.3
</span>
ip elements can hold peer attribute to assign
a point-to-point address for the network device. The attributes of this element
are described in the documentation for the
<code>
ip
</code>
element in
<a
href=
"formatnetwork.html#elementsAddress"
>
network definitions
</a>
.
This is only used by the LXC and QEMU drivers.
</p>
</p>
<h5><a
name=
"elementVhostuser"
>
vhost-user interface
</a></h5>
<h5><a
name=
"elementVhostuser"
>
vhost-user interface
</a></h5>
...
...
docs/schemas/domaincommon.rng
浏览文件 @
690969af
...
@@ -2393,6 +2393,11 @@
...
@@ -2393,6 +2393,11 @@
<ref
name=
"ipPrefix"
/>
<ref
name=
"ipPrefix"
/>
</attribute>
</attribute>
</optional>
</optional>
<optional>
<attribute
name=
"peer"
>
<ref
name=
"ipAddr"
/>
</attribute>
</optional>
<empty/>
<empty/>
</element>
</element>
</zeroOrMore>
</zeroOrMore>
...
...
src/conf/domain_conf.c
浏览文件 @
690969af
...
@@ -5733,7 +5733,7 @@ virDomainNetIpParseXML(xmlNodePtr node)
...
@@ -5733,7 +5733,7 @@ virDomainNetIpParseXML(xmlNodePtr node)
unsigned int prefixValue = 0;
unsigned int prefixValue = 0;
char *familyStr = NULL;
char *familyStr = NULL;
int family = AF_UNSPEC;
int family = AF_UNSPEC;
char *address = NULL;
char *address = NULL
, *peer = NULL
;
if (!(prefixStr = virXMLPropString(node, "prefix")) ||
if (!(prefixStr = virXMLPropString(node, "prefix")) ||
(virStrToLong_ui(prefixStr, NULL, 10, &prefixValue) < 0)) {
(virStrToLong_ui(prefixStr, NULL, 10, &prefixValue) < 0)) {
...
@@ -5747,6 +5747,9 @@ virDomainNetIpParseXML(xmlNodePtr node)
...
@@ -5747,6 +5747,9 @@ virDomainNetIpParseXML(xmlNodePtr node)
goto cleanup;
goto cleanup;
}
}
if ((peer = virXMLPropString(node, "peer")) == NULL)
VIR_DEBUG("Peer is empty");
familyStr = virXMLPropString(node, "family");
familyStr = virXMLPropString(node, "family");
if (familyStr && STREQ(familyStr, "ipv4"))
if (familyStr && STREQ(familyStr, "ipv4"))
family = AF_INET;
family = AF_INET;
...
@@ -5764,6 +5767,14 @@ virDomainNetIpParseXML(xmlNodePtr node)
...
@@ -5764,6 +5767,14 @@ virDomainNetIpParseXML(xmlNodePtr node)
address);
address);
goto cleanup;
goto cleanup;
}
}
if ((peer != NULL) && (virSocketAddrParse(&ip->peer, peer, family) < 0)) {
virReportError(VIR_ERR_INVALID_ARG,
_("Failed to parse IP address: '%s'"),
peer);
goto cleanup;
}
ip->prefix = prefixValue;
ip->prefix = prefixValue;
ret = ip;
ret = ip;
...
@@ -5773,6 +5784,7 @@ virDomainNetIpParseXML(xmlNodePtr node)
...
@@ -5773,6 +5784,7 @@ virDomainNetIpParseXML(xmlNodePtr node)
VIR_FREE(prefixStr);
VIR_FREE(prefixStr);
VIR_FREE(familyStr);
VIR_FREE(familyStr);
VIR_FREE(address);
VIR_FREE(address);
VIR_FREE(peer);
VIR_FREE(ip);
VIR_FREE(ip);
return ret;
return ret;
}
}
...
...
src/conf/domain_conf.h
浏览文件 @
690969af
...
@@ -514,6 +514,7 @@ typedef struct _virDomainNetIpDef virDomainNetIpDef;
...
@@ -514,6 +514,7 @@ typedef struct _virDomainNetIpDef virDomainNetIpDef;
typedef
virDomainNetIpDef
*
virDomainNetIpDefPtr
;
typedef
virDomainNetIpDef
*
virDomainNetIpDefPtr
;
struct
_virDomainNetIpDef
{
struct
_virDomainNetIpDef
{
virSocketAddr
address
;
/* ipv4 or ipv6 address */
virSocketAddr
address
;
/* ipv4 or ipv6 address */
virSocketAddr
peer
;
/* ipv4 or ipv6 address of peer */
unsigned
int
prefix
;
/* number of 1 bits in the net mask */
unsigned
int
prefix
;
/* number of 1 bits in the net mask */
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录