Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2811cc61
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看板
提交
2811cc61
编写于
7月 23, 2014
作者:
C
Cédric Bosdonnat
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow network capabilities hostdev to configure IP addresses
上级
12a75f37
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
70 addition
and
4 deletion
+70
-4
docs/formatdomain.html.in
docs/formatdomain.html.in
+8
-0
docs/schemas/domaincommon.rng
docs/schemas/domaincommon.rng
+24
-4
src/conf/domain_conf.c
src/conf/domain_conf.c
+34
-0
src/conf/domain_conf.h
src/conf/domain_conf.h
+2
-0
tests/lxcxml2xmldata/lxc-hostdev.xml
tests/lxcxml2xmldata/lxc-hostdev.xml
+2
-0
未找到文件。
docs/formatdomain.html.in
浏览文件 @
2811cc61
...
...
@@ -4330,6 +4330,14 @@ qemu-kvm -net nic,model=? /dev/null
<
target dev='vnet0'/
>
<b>
<
ip family='ipv4' address='192.168.122.5' prefix='24'/
>
</b>
<
/interface
>
...
<
hostdev mode='capabilities' type='net'
>
<
source
>
<
interface
>
eth0
<
/interface
>
<
/source
>
<b>
<
ip family='ipv4' address='192.168.122.6' prefix='24'/
>
</b>
<
/hostdev
>
<
/devices
>
...
</pre>
...
...
docs/schemas/domaincommon.rng
浏览文件 @
2811cc61
...
...
@@ -3808,11 +3808,31 @@
<attribute
name=
"type"
>
<value>
net
</value>
</attribute>
<element
name=
"source"
>
<element
name=
"interface"
>
<ref
name=
"deviceName"
/>
<interleave>
<element
name=
"source"
>
<element
name=
"interface"
>
<ref
name=
"deviceName"
/>
</element>
</element>
</element>
<zeroOrMore>
<element
name=
"ip"
>
<attribute
name=
"address"
>
<ref
name=
"ipAddr"
/>
</attribute>
<optional>
<attribute
name=
"family"
>
<ref
name=
"addr-family"
/>
</attribute>
</optional>
<optional>
<attribute
name=
"prefix"
>
<ref
name=
"ipPrefix"
/>
</attribute>
</optional>
<empty/>
</element>
</zeroOrMore>
</interleave>
</define>
<define
name=
"usbproduct"
>
...
...
src/conf/domain_conf.c
浏览文件 @
2811cc61
...
...
@@ -1818,6 +1818,8 @@ virDomainHostdevSubsysSCSIiSCSIClear(virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc
void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
{
size_t i;
if (!def)
return;
...
...
@@ -1842,6 +1844,9 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
break;
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET:
VIR_FREE(def->source.caps.u.net.iface);
for (i = 0; i < def->source.caps.u.net.nips; i++)
VIR_FREE(def->source.caps.u.net.ips[i]);
VIR_FREE(def->source.caps.u.net.ips);
break;
}
break;
...
...
@@ -4833,6 +4838,8 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node ATTRIBUTE_UNUSED,
virDomainHostdevDefPtr def)
{
xmlNodePtr sourcenode;
xmlNodePtr *ipnodes = NULL;
int nipnodes;
int ret = -1;
/* @type is passed in from the caller rather than read from the
...
...
@@ -4887,6 +4894,26 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node ATTRIBUTE_UNUSED,
_("Missing <interface> element in hostdev net device"));
goto error;
}
/* Parse possible IP addresses */
if ((nipnodes = virXPathNodeSet("./ip", ctxt, &ipnodes)) < 0)
goto error;
if (nipnodes) {
size_t i;
for (i = 0; i < nipnodes; i++) {
virDomainNetIpDefPtr ip = virDomainNetIpParseXML(ipnodes[i]);
if (!ip)
goto error;
if (VIR_APPEND_ELEMENT(def->source.caps.u.net.ips,
def->source.caps.u.net.nips, ip) < 0) {
VIR_FREE(ip);
goto error;
}
}
}
break;
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
...
...
@@ -4896,6 +4923,7 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node ATTRIBUTE_UNUSED,
}
ret = 0;
error:
VIR_FREE(ipnodes);
return ret;
}
...
...
@@ -17302,6 +17330,12 @@ virDomainHostdevDefFormatCaps(virBufferPtr buf,
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</source>\n");
if (def->source.caps.type == VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET) {
virDomainNetIpsFormat(buf, def->source.caps.u.net.ips,
def->source.caps.u.net.nips);
}
return 0;
}
...
...
src/conf/domain_conf.h
浏览文件 @
2811cc61
...
...
@@ -498,6 +498,8 @@ struct _virDomainHostdevCaps {
}
misc
;
struct
{
char
*
iface
;
size_t
nips
;
virDomainNetIpDefPtr
*
ips
;
}
net
;
}
u
;
};
...
...
tests/lxcxml2xmldata/lxc-hostdev.xml
浏览文件 @
2811cc61
...
...
@@ -35,6 +35,8 @@
<source>
<interface>
eth0
</interface>
</source>
<ip
address=
'192.168.122.2'
family=
'ipv4'
/>
<ip
address=
'2003:db8:1:0:214:1234:fe0b:3596'
family=
'ipv6'
prefix=
'24'
/>
</hostdev>
</devices>
</domain>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录