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

Daniel P. Berrange berrange at redhat.com
Tue Feb 4 12:17:44 UTC 2014


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.

> 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.


ACK modulo the 2 questions.

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 libvir-list mailing list