
On Tue, Jan 14, 2014 at 02:50:03PM +0100, Cédric Bosdonnat wrote:
--- src/lxc/lxc_native.c | 8 ++++++++ tests/lxcconf2xmldata/lxcconf2xml-simple.config | 1 + tests/lxcconf2xmldata/lxcconf2xml-simple.xml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 75e05a5..1c0f325 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -882,6 +882,7 @@ lxcParseConfigString(const char *config, { virDomainDefPtr vmdef = NULL; virPropertiesPtr properties = NULL; + char *arch = NULL; lxcFstabPtr fstabEntries = NULL; char *mountLine = NULL; lxcFstabPtr fstabIter = NULL; @@ -915,6 +916,13 @@ lxcParseConfigString(const char *config, if (VIR_STRDUP(vmdef->os.type, "exe") < 0) goto error;
+ if ((arch = virPropertiesLookup(properties, "lxc.arch"))) { + if (STREQ(arch, "x86") || STREQ(arch, "i686")) + vmdef->os.arch = VIR_ARCH_I686; + else if (STREQ(arch, "x86_64") || STREQ(arch, "amd64")) + vmdef->os.arch = VIR_ARCH_X86_64; + }
How about calling virArchFromString() to handle the common case, and then only special-case the non-standard 'x86' and 'amd64' names 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 :|