Harish Vishwanath
2016-Nov-08 03:31 UTC
[libvirt-users] Sharing network namespace between containers
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. Appreciate your help. Regards, Harish
Martin Kletzander
2016-Nov-08 08:06 UTC
Re: [libvirt-users] Sharing network namespace between containers
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@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users
Harish Vishwanath
2016-Nov-08 09:18 UTC
Re: [libvirt-users] Sharing network namespace between containers
Thank you. It looks like after I 'ignore', nothing is persisted in xml for the app. Any idea what is the minimum version of libvirt required for this feature? Regards, Harish On Tue, Nov 8, 2016 at 1:36 PM, Martin Kletzander <mkletzan@redhat.com> wrote:> 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@redhat.com >> https://www.redhat.com/mailman/listinfo/libvirt-users >> >
Daniel P. Berrange
2016-Nov-08 09:58 UTC
Re: [libvirt-users] Sharing network namespace between containers
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/ :|