[lxc-users] Fail to convert LXC container configuration into a domain XML fragment
Daniel P. Berrange
berrange at redhat.com
Thu Mar 6 14:53:50 UTC 2014
On Thu, Mar 06, 2014 at 08:50:46AM -0600, Serge Hallyn wrote:
> Quoting Daniel P. Berrange (berrange at redhat.com):
> > On Thu, Mar 06, 2014 at 08:31:16AM -0600, Serge Hallyn wrote:
> > > Quoting Du Jun (dj199008 at gmail.com):
> > > > Hi, all,
> > > > I used lxc-tools to create a linux container. I am trying to transfrom LXC
> > > > container configuration into a domain XML fragment using the following
> > > > command:
> > > >
> > > > *$ virsh -c lxc:/// domxml-from-native lxc /var/lib/lxc/my_conatiner/config*
> > > >
> > > > However, I get the error message,
> > > > error: this function is not supported by the connection driver:
> > > > virConnectDomainXMLFromNative
> > > >
> > > > It seems that *virConnectDomainXMLFromNative *is not supported in libvrit
> > > > LXC driver. However, I find the command in the official documentation of
> > > > libvirt. Besides, my libvirt's version is 1.2.2(the latest version).
> > > >
> > > > I wonder whether I can convert LXC container configuration into a domain
> > > > XML fragment using *domxml-from-native*? If I can't, how cant I translate
> > > > it?
> > > >
> > > > PS:
> > > > I care about the rules in my LXC container configuration file, such as:
> > > > *lxc.aa_profile = unconfined*
> > > >
> > > > *lxc.cgroup.devices.deny = a*
> > > > *# Allow any mknod (but not using the node)*
> > > > *lxc.cgroup.devices.allow = c *:* m*
> > > > *lxc.cgroup.devices.allow = b *:* m*
> > > > *lxc.cgroup.devices.allow = b 7:* rwm*
> > > >
> > > >
> > > > I just don't know how to express the rules above using xml format. Please
> > > > help! Thanks!
> > >
> > > Since libvirt-lxc does not use lxc as a back-end, the lxc-tools
> > > configuration file is not 'native' format for virsh domxml-from-native.
> > > There is no tool to do this conversion, and maintaining such a tool
> > > would not really be tractable as the two projects are both developing
> > > at a rather fast pace.
> >
> > On the contrary, the current libvirt 1.2.2 release implements exactly
> > this. In this context 'native' refers to any format that is used by
> > a non-libvirt tool. The Libvirt LXC driver will parse the lxc tools
> > config formats and make a best effort turn it into valid libvirt XML.
>
> Oh, cool. Thanks for setting me straight :)
There are a few things our convertor doesn't cope with, which we're
documenting as we find them
http://libvirt.org/drvlxc.html#usageConvert
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the lxc-users
mailing list