Kaitlin Rupert wrote:
>>
>> Well, the providers should be creating <source
network='something'>,
>> so I need to check and make sure we're doing that.
>>
> I checked whether the provider adds the <source network='something'>
> and it does for KVM.
> I tried creating the KVM guest with two interface types:
>
> 1) Network Type :
>
> It needs the following fields in the xml file:
> <interface type='network'>
> <mac address='11:22:33:aa:bb:cc'/>
> <source network='default-net'/>
> </interface>
>
>
> We are handling this in the provider code.
>
> 2) Bridge Type :
> It needs the following fields in the xml file:
>
> <interface type='bridge'>
> <mac address='11:22:33:aa:bb:cc'/>
> <source bridge='testbridge'/>
> </interface>
> The provider code in the xmlgen.c file does not support the KVM
> guest to be created with the "bridge" type.
Excellent find Deepti. Thanks for looking into this - I think this is
an issue with the provider.
You're correct - this is an issue in xmlgen.c What is happening here
is the following:
1) Guest is created using virsh using network type bridge.
2) xen_net_to_xml() in xmlgen.c gets called instead of kvm_net_to_xml().
3) Since xend is fine with using a bridge interface without the
<source bridge=''/> tag defined, we don't specify one in the xmlgen
code. QEMU borks when it attempts to create the guest with the new XML.
>
> 1) Also, I noticed that for creating the Xen guest we do not require
> the <source > field in the <interface > section for both Network and
> Bridge interface Types.
> But for the KVM guest its compulsory to have the <source > field in
> the <interface > section for both Network and Bridge interface Types.
> 2) Any specific reason for not supporting the KVM guest to be created
> for the bridge type interface, and supporting Xen guest with only
> bridge type ?
If you use the network interface type, the libvirt gets all the
necessary network information from the virtual network. We don't have
to worry about whether the bridge exists, etc.
Well, I think we still need the
bridge to exist on the system, to be
able to use the virtual network available on the machine.
In order to see whether the bridge is really required to be present on
the machine.
I created a virtual network with the following network config file.
<network>
<name>default</name>
<uuid>91e73602-dd76-464c-aaf7-99002d45d289</uuid>
<forward/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254' />
</dhcp>
</ip>
</network>
Though I have not specified the bridge info anywhere in the config file
, the libvirt assigned its own bridge "vnet0" , see the dump below:
virsh net-dumpxml default
<network>
<name>default</name>
<uuid>91e73602-dd76-464c-aaf7-99002d45d289</uuid>
<forward mode='nat'/>
<bridge name='vnet0' stp='on' forwardDelay='0' />
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254' />
</dhcp>
</ip>
</network>
I then
1) brought the vnet0 down
2) deleted the bridge
3) tried creating the KVM guest with the following network information
in it:
<interface type="network">
<mac address="00:11:22:33:44:aa"/>
<source network="default"/>
</interface>
and got the following error while creating the guest
virsh create new_kvm_net.xml
libvir: QEMU error : internal error Failed to add tap interface 'vnet%d'
to bridge 'vnet0' : Operation not supported
error: Failed to create domain from new_kvm_net.xml
Is there any other way to create the virtual network where it does not
bother to have a bridge to exist?
> 3) Also, I did not understand the need for the script field in the
> interface section. We can create the Xen, KVM guests without this.
This is a good point. Actually, I thought there was some talk of
having both Xen and KVM guests use the network interface, but I might
be mistaken.
>
>
>> KR> Dan - should the provider return an error if the guest doesn't use
>> KR> a network type interface?
>>
>> Meaning an existing guest created outside the providers with a network
>> type we don't support? I dunno, I'll have to think on that one.
>>
Right - that's the issue here. We have a KVM guest with a bridge
network type. The AddResource() call fails because it generates the
new XML incorrectly.
Thanks and Regards,
Deepti.