[libvirt-users] Sharing network namespace between containers

Martin Kletzander mkletzan at redhat.com
Tue Nov 8 08:06:42 UTC 2016


On Tue, Nov 08, 2016 at 09:01:34AM +0530, Harish Vishwanath wrote:
>Hello
>
>Based on the lxc driver documentation, I am trying to create an xml to
>share an existing network namespace with another container. I am running
>libvirt 1.2.15.
>
>Here is the xml:
>
><domain type='lxc' xmlns:lxc='http://libvirt.org/schemas/domain/lxc/1.0'>
>
>  <name>nt</name>
>  <uuid>43c00192-e114-4e29-8ce7-4b5487f60a75</uuid>
>  <memory unit='KiB'>65536</memory>
>  <currentMemory unit='KiB'>65536</currentMemory>
>  <vcpu placement='static'>1</vcpu>
>  <cputune>
>    <shares>2000</shares>
>  </cputune>
>  <resource>
>    <partition>/apphosting.partition</partition>
>  </resource>
>  <os>
>    <type arch='x86_64'>exe</type>
>    <init>/sbin/init</init>
>  </os>
>  <clock offset='utc'/>
>  <on_poweroff>destroy</on_poweroff>
>  <on_reboot>restart</on_reboot>
>  <on_crash>destroy</on_crash>
>  <devices>
>    <emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
>    <filesystem type='mount' accessmode='passthrough'>
>      <source dir='/work/repo-lxc/nt/rootfs_mnt'/>
>      <target dir='/'/>
>    </filesystem>
>    <filesystem type='mount' accessmode='squash'>
>      <driver type='path' wrpolicy='immediate'/>
>      <source dir='/local/local1/core_dir/nt'/>
>      <target dir='/local/local1/core_dir'/>
>    </filesystem>
>
><!--
>    <interface type='network'>
>      <mac address='52:54:dd:6d:44:d2'/>
>      <source network='dpbr_0'/>
>      <guest dev='eth0'/>
>    </interface>
>-->
>
>    <console type='pty'>
>      <target type='lxc' port='0'/>
>    </console>
>  </devices>
>
>*  <lxc:namespace>*
>*    <lxc:sharenet type='netns' value='node'/>*
>*  </lxc:namespace>*
></domain>
>
>However, the virsh edit is unable to save this file:
>
>error: XML document failed to validate against schema: Unable to validate
>doc against /usr/share/libvirt/schemas/domain.rng
>Element domain has extra content: namespace
>
>Failed. Try again? [y,n,i,f,?]:
>

the easiest check in these situations is:

 1) try whether it works when you press 'i':
     a) it doesn't, but you get a better error message
     b) it does continue with (2)
 2) if (b), then check if virsh dumpxml has all the info you had there
    (i.e. libvirt doesn't lose track of something)
     a) no data is missing -- we have an error in our Relax-NG schema
     b) some part of the XML is missing -- your libvirt version doesn't
        support it

>Is this supported in libvirt 1.2.15 - the document doesnt specify a minimum
>version of libvirt.
>
>Appreciate your help.
>
>
>
>Regards,
>Harish

>_______________________________________________
>libvirt-users mailing list
>libvirt-users at redhat.com
>https://www.redhat.com/mailman/listinfo/libvirt-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20161108/9201150d/attachment.sig>


More information about the libvirt-users mailing list