[PATCH 14/16] LXC from native: map lxc.arch to /domain/os/type@arch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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;
+    }
+
     if (VIR_STRDUP(vmdef->os.init, "/sbin/init") < 0)
         goto error;
 
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple.config b/tests/lxcconf2xmldata/lxcconf2xml-simple.config
index 12428bb..3553881 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-simple.config
+++ b/tests/lxcconf2xmldata/lxcconf2xml-simple.config
@@ -11,6 +11,7 @@ lxc.network.name = eth0
 lxc.mount.entry = /etc/resolv.conf etc/resolv.conf none bind,ro 0 0
 lxc.rootfs = /var/lib/lxc/migrate_test/rootfs
 lxc.utsname = migrate_test
+lxc.arch = x86
 lxc.autodev=1
 lxc.tty = 2
 lxc.pts = 1024
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple.xml b/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
index 763ba1b..4027ea7 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
@@ -5,7 +5,7 @@
   <currentMemory unit='KiB'>0</currentMemory>
   <vcpu placement='static' current='0'>1</vcpu>
   <os>
-    <type>exe</type>
+    <type arch='i686'>exe</type>
     <init>/sbin/init</init>
   </os>
   <clock offset='utc'/>
-- 
1.8.5.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]