[libvirt] Creating multiple network interfaces in libvirt Domain.

Hi, I want to create a Domain with two interfaces. I am using LXC hypervisor in the libvirt. My domain XML is shown below: <domain type='lxc' id='1'> <name>srikanth_vm2</name> <memory>500000</memory> <os> <type>exe</type> <init>/bin/sh</init> </os> <vcpu>1</vcpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount'> <source dir='/root/lxc/fedora1'/> <target dir='/'/> </filesystem> <interface type='network'> <source network='default'/> </interface> <interface type='network'> <source network='default'/> </interface> <console type='pty' /> </devices> </domain> I am able to define the Domain. But, I am not able to start the Domain. While starting the domain, I am getting the following error: error: Failed to start domain srikanth_vm2 error: internal error Failed to create veth device pair: 512 Can you please let me know where I am going wrong? Regards, Srikanth.

On Wed, Apr 28, 2010 at 5:56 PM, Kumar L Srikanth-B22348 <B22348@freescale.com> wrote:
Hi,
I want to create a Domain with two interfaces. I am using LXC hypervisor in the libvirt.
My domain XML is shown below:
<domain type='lxc' id='1'>
<name>srikanth_vm2</name>
<memory>500000</memory>
<os>
<type>exe</type>
<init>/bin/sh</init>
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount'>
<source dir='/root/lxc/fedora1'/>
<target dir='/'/>
</filesystem>
<interface type='network'>
<source network='default'/>
</interface>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty' />
</devices>
</domain>
I am able to define the Domain. But, I am not able to start the Domain. While starting the domain, I am getting the following error:
error: Failed to start domain srikanth_vm2
error: internal error Failed to create veth device pair: 512
Can you please let me know where I am going wrong?
You should be doing correct. I found a bug in lxc_driver.c. Could you try the following patch? diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 2851a2a..018e9f8 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -883,6 +883,9 @@ static int lxcSetupInterfaces(virConnectPtr conn, goto error_exit; } + /* Prevent auto-assigned names re-used */ + parentVeth[0] = '\0'; + containerVeth[0] = '\0'; } rc = 0; ---
Regards,
Srikanth.
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Hi Kumar On Thu, Apr 29, 2010 at 9:50 PM, Ryota Ozaki <ozaki.ryota@gmail.com> wrote:
On Wed, Apr 28, 2010 at 5:56 PM, Kumar L Srikanth-B22348 <B22348@freescale.com> wrote:
Hi,
I want to create a Domain with two interfaces. I am using LXC hypervisor in the libvirt.
My domain XML is shown below:
<domain type='lxc' id='1'>
<name>srikanth_vm2</name>
<memory>500000</memory>
<os>
<type>exe</type>
<init>/bin/sh</init>
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount'>
<source dir='/root/lxc/fedora1'/>
<target dir='/'/>
</filesystem>
<interface type='network'>
<source network='default'/>
</interface>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty' />
</devices>
</domain>
I am able to define the Domain. But, I am not able to start the Domain. While starting the domain, I am getting the following error:
error: Failed to start domain srikanth_vm2
error: internal error Failed to create veth device pair: 512
Can you please let me know where I am going wrong?
You should be doing correct.
Sorry, my English was wrong. I wanted to say 'You were doing correct thing'. And I've confirmed the following patch fixes your problem. So I'll send the patch to ML later. Thanks, ozaki-r
I found a bug in lxc_driver.c. Could you try the following patch?
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 2851a2a..018e9f8 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -883,6 +883,9 @@ static int lxcSetupInterfaces(virConnectPtr conn, goto error_exit; }
+ /* Prevent auto-assigned names re-used */ + parentVeth[0] = '\0'; + containerVeth[0] = '\0'; }
rc = 0; ---
Regards,
Srikanth.
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Kumar L Srikanth-B22348
-
Ryota Ozaki