[PATCH v2 15/18] 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                            | 9 +++++++++
 tests/lxcconf2xmldata/lxcconf2xml-simple.config | 1 +
 tests/lxcconf2xmldata/lxcconf2xml-simple.xml    | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 346dbba..98a9e12 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -787,6 +787,15 @@ lxcParseConfigString(const char *config)
     if (VIR_STRDUP(vmdef->os.type, "exe") < 0)
         goto error;
 
+    if ((value = virConfGetValue(properties, "lxc.arch")) && value->str) {
+        virArch arch = virArchFromString(value->str);
+        if (arch == VIR_ARCH_NONE && STREQ(value->str, "x86"))
+            arch = VIR_ARCH_I686;
+        else if (arch == VIR_ARCH_NONE && STREQ(value->str, "amd64"))
+            arch = VIR_ARCH_X86_64;
+        vmdef->os.arch = arch;
+    }
+
     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 f75e8fc..b90abc1 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-simple.config
+++ b/tests/lxcconf2xmldata/lxcconf2xml-simple.config
@@ -14,6 +14,7 @@ lxc.mount.entry = tmpfs run tmpfs size=8m,mode=0755,nodev,nosuid 0 0
 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 711e0d9..6ec0f17 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]