[libvirt] can this vm-xml-interface works,thanks

yue libvirt at 163.com
Fri Mar 15 03:38:11 UTC 2013


thanks.
you answer my question.








At 2013-03-15 00:49:56,"Laine Stump" <laine at laine.org> wrote:
>On 03/14/2013 05:49 AM, yue wrote:
>> hi,all,please look at interface .
>> actually ,virbr0 is NAT,      my program product a vm-xml  which is
>> not standard. it use the way to product bridge interface   to product
>> a NAT interface.
>> but i want to know if this can work rightly.
>>
>> <interface type='bridge'> #"type='network'"
>>       <mac address='00:1a:4a:a8:7a:09'/>
>>       <source bridge='virbr0'/># network='virbr0'
>>       <target dev='vnet0'/>
>>       <model type='virtio'/>
>>       <boot order='3'/>
>>       <alias name='net0'/>
>>       <address type='pci' domain='0x0000' bus='0x00'! slot='0x03'
>> function='0x0'/>
>>     </interface>
>
>I'm not sure I understand your question. Are you wondering if (A) below
>is functionally the same as (B)?
>
>A
>-
>  <interface type='bridge'>
>    <mac address='00:1a:4a:a8:7a:09'/>
>    <source bridge='virbr0'/>
>    <target dev='vnet0'/>
>    <model type='virtio'/>
>    <boot order='3'/>
>    <alias name='net0'/>
>    <address type='pci' domain='0x0000' bus='0x00'! slot='0x03'
>function='0x0'/>
>  </interface>
>
>B
>-
>
>  <interface type='network'>
>    <mac address='00:1a:4a:a8:7a:09'/>
>    <source network='default'/>   <!-- you had incorrectly said "virbr0" -->
>    <target dev='vnet0'/>
>    <model type='virtio'/>
>    <boot order='3'/>
>    <alias name='net0'/>
>    <address type='pci' domain='0x0000' bus='0x00'! slot='0x03'
>function='0x0'/>
>  </interface>
>
>The answer to that question is "Yes, but...".
>
>If we assume that libvirt's "default" network has been setup, and that
>it is using the name "virbr0" for its bridge device (which is almost
>always true, but only be coincidence), then those two interface
>definitions will provide the same result.
>
>However, if there is no network named "default", or if the default
>network happened to be defined after some other network was already
>defined, and so picked a name different from "virbr0" for its bridge
>device, then (A) either wouldn't work at all, or would result in the
>guest being connected to the wrong place.
>
>Is there some reason you want to use type='bridge' rather than
>type='network'?
>
>(BTW, you may want to subscribe to libvirt-users at redhat.com and use it
>for questions like this. The amount of traffic is much lower, so your
>question would be less likely to be buried underneath bunches of patch
>emails)
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130315/ae387ded/attachment-0001.htm>


More information about the libvir-list mailing list