[libvirt-users] Sharing network namespace between containers

Daniel P. Berrange berrange at redhat.com
Tue Nov 8 09:58:55 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,?]:
> 
> Is this supported in libvirt 1.2.15 - the document doesnt specify a minimum
> version of libvirt.

It requires libvirt 1.2.19 I'm afraid. I'll fix the docs.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvirt-users mailing list