[libvirt] [PATCH v2 02/18] LXC driver: started implementing connectDomainXMLFromNative

Cedric Bosdonnat cbosdonnat at suse.com
Tue Feb 4 12:40:00 UTC 2014


Hi Daniel,

On Tue, 2014-02-04 at 12:17 +0000, Daniel P. Berrange wrote:
> On Thu, Jan 30, 2014 at 10:55:50AM +0100, Cédric Bosdonnat wrote:
> > This function aims at converting LXC configuration into a libvirt
> > domain XML description to help users migrate from LXC to libvirt.
> > 
> > Here is an example of how the lxc configuration works:
> > virsh -c lxc:/// domxml-from-native lxc /var/lib/lxc/migrate_test/config
> 
> 
> 
> > +virDomainDefPtr
> > +lxcParseConfigString(const char *config)
> > +{
> > +    virDomainDefPtr vmdef = NULL;
> > +    virConfPtr properties = NULL;
> > +    virConfValuePtr value;
> > +
> > +    if (!(properties = virConfReadMem(config, 0, VIR_CONF_FLAG_LXC_FORMAT)))
> > +        return NULL;
> > +
> > +    if (VIR_ALLOC(vmdef) < 0)
> > +        goto error;
> > +
> > +    if (virUUIDGenerate(vmdef->uuid) < 0) {
> > +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > +                       _("failed to generate uuid"));
> > +        goto error;
> > +    }
> > +    vmdef->id = -1;
> > +    vmdef->mem.max_balloon = 64 * 1024;
> 
> I can't remember if the 'max_balloon' is a mandatory setting or
> not. If it isn't, perhaps we can just leave it out entirely.

It is mandatory, that's why I picked the same default value than the one
in the qemu argv conversion code.

> > diff --git a/src/lxc/lxc_native.h b/src/lxc/lxc_native.h
> > new file mode 100644
> > index 0000000..e43bd27
> > --- /dev/null
> > +++ b/src/lxc/lxc_native.h
> 
> > +
> > +# define LXC_CONFIG_FORMAT "lxc"
> 
> I wonder if we should call this  'lxc-tools' just to make it
> a little more precise - bare 'lxc' is such an overloaded
> term these days.

Indeed, lxc-tools would help disambiguate the thing.

--
Cedric




More information about the libvir-list mailing list