Raghu Nallamothu
2013-May-25  17:16 UTC
Attaching pre created tap interfaces to a VM in Xen for Routed Networking
Hi All.,
         I am not sure if this is possible in xen via Libvirt, but what I
am trying to do is, I want libvirt to launch a VM and attach a pre-created
tap interface to that VM ( I do not want XEN to create one, as I am running
a lot of custom scripts on my tap interface). I also dont want xen to
attach this tap interface to a bridge.
For example, lets say I have created a tap interface with name
"tap123456"
when libvirt launches my VM in xen, I want the VM to read its networking
info from this tap interface.
But I wasn''t so successful in doing this when ever I am trying to do
this,
I am seeing the following error message "VmError: Device 0 (vif) could not
be connected. Hotplug scripts not working." and "error: POST operation
failed: xend_post: error from xen daemon: (xend.err ''Device 0 (vif)
could
not be connected. Cannot rename interface vif4.0. An interface with name
tap12345 already exists.'')". But I dont want xen to create 
another
interface and rename it, rather want xen to use the existing one
=== output of lsmod ==
bash-4.1# lsmod | grep xen
xen_acpi_processor      4465  0
xen_netback            25455  0 [permanent]
xen_gntdev              9504  2
xen_evtchn              4899  3
xenfs                   2943  1
xen_privcmd             4972  19 xenfs
==== end of output ===
My Configuration : Centos 6.2 with Xen 4.2.5 along with Libvirt
Libvirt Configuration file,
<domain type=''xen''>
<name>raghu_12345</name>
<uuid>12113325-d948-4a1b-b673-888a16b90726</uuid>
<memory>1048576</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev=''hd''/>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<interface type="ethernet">
<mac address=''00:25:90:3f:25:91''/>  <!-- I want this
mac to be mac address
of a vm -->
<target dev=''tap123456''/>
</interface>
<disk type=''file'' device=''disk''>
<source file=''~/tmp/lucid.img''/>
<target dev=''hda''/>
</disk>
<console type=''pty''>
<target port=''0''/>
</console>
<graphics port=''-1'' type=''vnc''
autoport=''yes'' listen=''0.0.0.0''/>
</devices>
</domain>
I have a pre-created  tap interface with name ''tap123456'' 
with all the
networking setup with dhcp and dns running.
Thanks for your time and help.
_______________________________________________
Xen-users mailing list
Xen-users@lists.xen.org
http://lists.xen.org/xen-users
Ian Campbell
2013-May-28  08:46 UTC
Re: Attaching pre created tap interfaces to a VM in Xen for Routed Networking
On Sat, 2013-05-25 at 10:16 -0700, Raghu Nallamothu wrote:> Hi All., > I am not sure if this is possible in xen via Libvirt, but > what I am trying to do is, I want libvirt to launch a VM and attach a > pre-created tap interface to that VM ( I do not want XEN to create > one, as I am running a lot of custom scripts on my tap interface).What sort of pre-created tap interface? A Xen virtual NIC is created by qemu which is only started when the domain is launched. As far as I know there is no way to "precreate" them since they have to be created by the process which is driving them. Please can you explain precisely what you are doing?> I also dont want xen to attach this tap interface to a bridge.You should be able to control this by editing the vif-* scripts to suit your local environment. Ian.