Raghu Nallamothu
2013-May-25 04:11 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. Regards Raghu _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Liu
2013-May-25 13:45 UTC
Re: Attaching pre created tap interfaces to a VM in Xen for Routed Networking
Hi This list is mainly about Xen development. You might have better luck asking this kind of questions on xen-users@lists.xen.org Wei. On Fri, May 24, 2013 at 09:11:04PM -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). 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. > > Regards > Raghu> _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel