Discussion:
[libvirt] [PATCH v4 0/2] Adding partial support for LXC 3.0 rebased configs.
Julio Faracco
2018-11-14 17:25:44 UTC
Permalink
This series adds enhacements for LXC to cover rebased config settings
for version 3.0 without remove legacy ones. This serie includes some
test cases to cover new config files too. The title mentions the word
"partial" because there is a huge change with network settings which
this commit does not cover.

History:
v1-v2: Michal's suggestions to handle differences between versions.
v2-v3: Adding suggestions from Pino and John too.
v3-v4: Appluing tests for LXC v3.

Julio Faracco (2):
lxc: Include support to lxc version 3.0 or higher.
tests: Adding tests cases to cover rebased settings for LXC 3.0.

src/lxc/lxc_native.c | 52 ++++++++++++++-----
.../lxcconf2xml-blkiotune-v3.config | 11 ++++
.../lxcconf2xml-cpusettune-v3.config | 6 +++
.../lxcconf2xml-cputune-v3.config | 7 +++
.../lxcconf2xml-ethernet-v3.config | 44 ++++++++++++++++
.../lxcconf2xml-fstab-v3.config | 37 +++++++++++++
.../lxcconf2xml-idmap-v3.config | 5 ++
.../lxcconf2xml-macvlannetwork-v3.config | 13 +++++
.../lxcconf2xml-memtune-v3.config | 10 ++++
.../lxcconf2xml-nonenetwork-v3.config | 4 ++
.../lxcconf2xml-nonetwork-v3.config | 3 ++
.../lxcconf2xml-physnetwork-v3.config | 11 ++++
.../lxcconf2xml-simple-v3.config | 45 ++++++++++++++++
.../lxcconf2xml-vlannetwork-v3.config | 12 +++++
tests/lxcconf2xmltest.c | 51 +++++++++++++++++-
15 files changed, 295 insertions(+), 16 deletions(-)
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
--
2.19.1
Julio Faracco
2018-11-14 17:25:46 UTC
Permalink
This commit includes new test cases to cover LXC version 3.0 and higher.
This LXC version rebased some settings entries and deprecated other ones.
As we support both, we should include tests to minimize problems with
integration between them.

Signed-off-by: Julio Faracco <***@gmail.com>
---
.../lxcconf2xml-blkiotune-v3.config | 11 ++++
.../lxcconf2xml-cpusettune-v3.config | 6 +++
.../lxcconf2xml-cputune-v3.config | 7 +++
.../lxcconf2xml-ethernet-v3.config | 44 ++++++++++++++++
.../lxcconf2xml-fstab-v3.config | 37 ++++++++++++++
.../lxcconf2xml-idmap-v3.config | 5 ++
.../lxcconf2xml-macvlannetwork-v3.config | 13 +++++
.../lxcconf2xml-memtune-v3.config | 10 ++++
.../lxcconf2xml-nonenetwork-v3.config | 4 ++
.../lxcconf2xml-nonetwork-v3.config | 3 ++
.../lxcconf2xml-physnetwork-v3.config | 11 ++++
.../lxcconf2xml-simple-v3.config | 45 ++++++++++++++++
.../lxcconf2xml-vlannetwork-v3.config | 12 +++++
tests/lxcconf2xmltest.c | 51 ++++++++++++++++++-
14 files changed, 257 insertions(+), 2 deletions(-)
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config

diff --git a/tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
new file mode 100644
index 0000000000..6d82ac74eb
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
@@ -0,0 +1,11 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+lxc.cgroup.blkio.weight = 500
+lxc.cgroup.blkio.device_weight = 8:16 1000
+lxc.cgroup.blkio.device_weight = 8:0 300
+lxc.cgroup.blkio.throttle.read_bps_device = 8:16 1234
+lxc.cgroup.blkio.throttle.write_bps_device = 8:16 5678
+lxc.cgroup.blkio.throttle.read_iops_device = 8:16 4321
+lxc.cgroup.blkio.throttle.write_iops_device = 8:16 8765
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
new file mode 100644
index 0000000000..248874b198
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
@@ -0,0 +1,6 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+lxc.cgroup.cpuset.cpus = 1,2,5-7
+lxc.cgroup.cpuset.mems = 1-4
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
new file mode 100644
index 0000000000..bd2da94ec2
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
@@ -0,0 +1,7 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+lxc.cgroup.cpu.shares = 1024
+lxc.cgroup.cpu.cfs_quota_us = -1
+lxc.cgroup.cpu.cfs_period_us = 500000
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
new file mode 100644
index 0000000000..630cb2ebb6
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
@@ -0,0 +1,44 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.name = eth0
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+#remove next line if host DNS configuration should not be available to container
+lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
+lxc.mount.entry = sysfs sys sysfs defaults 0 0
+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.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.arch = x86
+lxc.autodev=1
+lxc.tty.max = 2
+lxc.pts = 1024
+lxc.cap.drop = sys_module mac_admin mac_override mknod
+
+# When using LXC with apparmor, uncomment the next line to run unconfined:
+#lxc.aa_profile = unconfined
+
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
new file mode 100644
index 0000000000..8b62818657
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
@@ -0,0 +1,37 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.link = virbr0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.name = eth0
+
+#remove next line if host DNS configuration should not be available to container
+lxc.mount.fstab = /var/lib/lxc/migrate_test/fstab
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+lxc.tty.max = 2
+lxc.pts = 1024
+lxc.cap.drop = sys_module mac_admin mac_override mknod
+
+# When using LXC with apparmor, uncomment the next line to run unconfined:
+#lxc.aa_profile = unconfined
+
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
new file mode 100644
index 0000000000..2caae864cc
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
@@ -0,0 +1,5 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+
+lxc.idmap = u 10000 0 2000
+lxc.idmap = g 10000 0 1000
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
new file mode 100644
index 0000000000..631f07ecca
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
@@ -0,0 +1,13 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = macvlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.macvlan.mode = vepa
+
+#remove next line if host DNS configuration should not be available to container
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
new file mode 100644
index 0000000000..5bd928eb1a
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
@@ -0,0 +1,10 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+# 1GiB
+lxc.cgroup.memory.limit_in_bytes = 1073741824
+# 128MiB
+lxc.cgroup.memory.soft_limit_in_bytes = 134217728
+# 2GiB
+lxc.cgroup.memory.memsw.limit_in_bytes = 2147483648
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
new file mode 100644
index 0000000000..f81a786f1e
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
@@ -0,0 +1,4 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+lxc.network.type = none
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
new file mode 100644
index 0000000000..b33d5780b6
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
@@ -0,0 +1,3 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
new file mode 100644
index 0000000000..92729841d7
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
@@ -0,0 +1,11 @@
+lxc.network.type = phys
+lxc.network.link = eth0
+lxc.network.name = eth1
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
new file mode 100644
index 0000000000..a0036a482e
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
@@ -0,0 +1,45 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.link = virbr0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.name = eth0
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+#remove next line if host DNS configuration should not be available to container
+lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
+lxc.mount.entry = sysfs sys sysfs defaults 0 0
+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.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.arch = x86
+lxc.autodev=1
+lxc.tty.max = 2
+lxc.pts = 1024
+lxc.cap.drop = sys_module mac_admin mac_override mknod
+
+# When using LXC with apparmor, uncomment the next line to run unconfined:
+#lxc.aa_profile = unconfined
+
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
new file mode 100644
index 0000000000..31e26997dd
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
@@ -0,0 +1,12 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = vlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.vlan.id = 2
+
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c
index 360d840e2e..0766239ec4 100644
--- a/tests/lxcconf2xmltest.c
+++ b/tests/lxcconf2xmltest.c
@@ -64,7 +64,7 @@ struct testInfo {
};

static int
-testCompareXMLToConfigHelper(const void *data)
+testCompareXMLToConfigHelperLegacy(const void *data)
{
int result = -1;
const struct testInfo *info = data;
@@ -85,6 +85,29 @@ testCompareXMLToConfigHelper(const void *data)
return result;
}

+static int
+testCompareXMLToConfigHelperV3(const void *data)
+{
+ int result = -1;
+ const struct testInfo *info = data;
+ char *xml = NULL;
+ char *config = NULL;
+
+ if (virAsprintf(&xml, "%s/lxcconf2xmldata/lxcconf2xml-%s.xml",
+ abs_srcdir, info->name) < 0 ||
+ virAsprintf(&config, "%s/lxcconf2xmldata/lxcconf2xml-%s-v3.config",
+ abs_srcdir, info->name) < 0)
+ goto cleanup;
+
+ result = testCompareXMLToConfigFiles(xml, config, info->expectError);
+
+ cleanup:
+ VIR_FREE(xml);
+ VIR_FREE(config);
+ return result;
+}
+
+
static int
mymain(void)
{
@@ -102,7 +125,7 @@ mymain(void)
do { \
const struct testInfo info = { name, expectError }; \
if (virTestRun("LXC Native-2-XML " name, \
- testCompareXMLToConfigHelper, \
+ testCompareXMLToConfigHelperLegacy, \
&info) < 0) \
ret = EXIT_FAILURE; \
} while (0)
@@ -121,6 +144,30 @@ mymain(void)
DO_TEST("blkiotune", false);
DO_TEST("ethernet", false);

+ /* Tests for LXC 3.0 and higher */
+# define DO_TEST3(name, expectError) \
+ do { \
+ const struct testInfo info = { name, expectError }; \
+ if (virTestRun("LXC Native-3-XML " name, \
+ testCompareXMLToConfigHelperV3, \
+ &info) < 0) \
+ ret = EXIT_FAILURE; \
+ } while (0)
+
+ DO_TEST3("simple", false);
+ DO_TEST3("fstab", true);
+ DO_TEST3("nonetwork", false);
+ DO_TEST3("nonenetwork", false);
+ DO_TEST3("physnetwork", false);
+ DO_TEST3("macvlannetwork", false);
+ DO_TEST3("vlannetwork", false);
+ DO_TEST3("idmap", false);
+ DO_TEST3("memtune", false);
+ DO_TEST3("cputune", false);
+ DO_TEST3("cpusettune", false);
+ DO_TEST3("blkiotune", false);
+ DO_TEST3("ethernet", false);
+
virObjectUnref(xmlopt);
virObjectUnref(caps);
--
2.19.1
Julio Faracco
2018-11-14 17:27:12 UTC
Permalink
Do you have any other suggestion for this?

I tried to keep it as simple as possible. Without creating new XML files for V3.

--
Julio Cesar Faracco

Em qua, 14 de nov de 2018 às 15:26, Julio Faracco
Post by Julio Faracco
This commit includes new test cases to cover LXC version 3.0 and higher.
This LXC version rebased some settings entries and deprecated other ones.
As we support both, we should include tests to minimize problems with
integration between them.
---
.../lxcconf2xml-blkiotune-v3.config | 11 ++++
.../lxcconf2xml-cpusettune-v3.config | 6 +++
.../lxcconf2xml-cputune-v3.config | 7 +++
.../lxcconf2xml-ethernet-v3.config | 44 ++++++++++++++++
.../lxcconf2xml-fstab-v3.config | 37 ++++++++++++++
.../lxcconf2xml-idmap-v3.config | 5 ++
.../lxcconf2xml-macvlannetwork-v3.config | 13 +++++
.../lxcconf2xml-memtune-v3.config | 10 ++++
.../lxcconf2xml-nonenetwork-v3.config | 4 ++
.../lxcconf2xml-nonetwork-v3.config | 3 ++
.../lxcconf2xml-physnetwork-v3.config | 11 ++++
.../lxcconf2xml-simple-v3.config | 45 ++++++++++++++++
.../lxcconf2xml-vlannetwork-v3.config | 12 +++++
tests/lxcconf2xmltest.c | 51 ++++++++++++++++++-
14 files changed, 257 insertions(+), 2 deletions(-)
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
new file mode 100644
index 0000000000..6d82ac74eb
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
@@ -0,0 +1,11 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+lxc.cgroup.blkio.weight = 500
+lxc.cgroup.blkio.device_weight = 8:16 1000
+lxc.cgroup.blkio.device_weight = 8:0 300
+lxc.cgroup.blkio.throttle.read_bps_device = 8:16 1234
+lxc.cgroup.blkio.throttle.write_bps_device = 8:16 5678
+lxc.cgroup.blkio.throttle.read_iops_device = 8:16 4321
+lxc.cgroup.blkio.throttle.write_iops_device = 8:16 8765
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
new file mode 100644
index 0000000000..248874b198
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
@@ -0,0 +1,6 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+lxc.cgroup.cpuset.cpus = 1,2,5-7
+lxc.cgroup.cpuset.mems = 1-4
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
new file mode 100644
index 0000000000..bd2da94ec2
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
@@ -0,0 +1,7 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+lxc.cgroup.cpu.shares = 1024
+lxc.cgroup.cpu.cfs_quota_us = -1
+lxc.cgroup.cpu.cfs_period_us = 500000
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
new file mode 100644
index 0000000000..630cb2ebb6
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
@@ -0,0 +1,44 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.name = eth0
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+#remove next line if host DNS configuration should not be available to container
+lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
+lxc.mount.entry = sysfs sys sysfs defaults 0 0
+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.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.arch = x86
+lxc.autodev=1
+lxc.tty.max = 2
+lxc.pts = 1024
+lxc.cap.drop = sys_module mac_admin mac_override mknod
+
+#lxc.aa_profile = unconfined
+
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
new file mode 100644
index 0000000000..8b62818657
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
@@ -0,0 +1,37 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.link = virbr0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.name = eth0
+
+#remove next line if host DNS configuration should not be available to container
+lxc.mount.fstab = /var/lib/lxc/migrate_test/fstab
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+lxc.tty.max = 2
+lxc.pts = 1024
+lxc.cap.drop = sys_module mac_admin mac_override mknod
+
+#lxc.aa_profile = unconfined
+
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
new file mode 100644
index 0000000000..2caae864cc
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
@@ -0,0 +1,5 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+
+lxc.idmap = u 10000 0 2000
+lxc.idmap = g 10000 0 1000
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
new file mode 100644
index 0000000000..631f07ecca
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
@@ -0,0 +1,13 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = macvlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.macvlan.mode = vepa
+
+#remove next line if host DNS configuration should not be available to container
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
new file mode 100644
index 0000000000..5bd928eb1a
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
@@ -0,0 +1,10 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+
+# 1GiB
+lxc.cgroup.memory.limit_in_bytes = 1073741824
+# 128MiB
+lxc.cgroup.memory.soft_limit_in_bytes = 134217728
+# 2GiB
+lxc.cgroup.memory.memsw.limit_in_bytes = 2147483648
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
new file mode 100644
index 0000000000..f81a786f1e
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
@@ -0,0 +1,4 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
+lxc.network.type = none
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
new file mode 100644
index 0000000000..b33d5780b6
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
@@ -0,0 +1,3 @@
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
new file mode 100644
index 0000000000..92729841d7
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
@@ -0,0 +1,11 @@
+lxc.network.type = phys
+lxc.network.link = eth0
+lxc.network.name = eth1
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
new file mode 100644
index 0000000000..a0036a482e
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
@@ -0,0 +1,45 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.link = virbr0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.name = eth0
+lxc.network.ipv4 = 192.168.122.2/24
+lxc.network.ipv4.gateway = 192.168.122.1
+lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.network.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+#remove next line if host DNS configuration should not be available to container
+lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
+lxc.mount.entry = sysfs sys sysfs defaults 0 0
+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.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.arch = x86
+lxc.autodev=1
+lxc.tty.max = 2
+lxc.pts = 1024
+lxc.cap.drop = sys_module mac_admin mac_override mknod
+
+#lxc.aa_profile = unconfined
+
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
new file mode 100644
index 0000000000..31e26997dd
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
@@ -0,0 +1,12 @@
+# Template used to create this container: opensuse
+# Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075ef
+
+lxc.network.type = vlan
+lxc.network.flags = up
+lxc.network.link = eth0
+lxc.network.hwaddr = 02:00:15:8f:05:c1
+lxc.network.vlan.id = 2
+
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c
index 360d840e2e..0766239ec4 100644
--- a/tests/lxcconf2xmltest.c
+++ b/tests/lxcconf2xmltest.c
@@ -64,7 +64,7 @@ struct testInfo {
};
static int
-testCompareXMLToConfigHelper(const void *data)
+testCompareXMLToConfigHelperLegacy(const void *data)
{
int result = -1;
const struct testInfo *info = data;
@@ -85,6 +85,29 @@ testCompareXMLToConfigHelper(const void *data)
return result;
}
+static int
+testCompareXMLToConfigHelperV3(const void *data)
+{
+ int result = -1;
+ const struct testInfo *info = data;
+ char *xml = NULL;
+ char *config = NULL;
+
+ if (virAsprintf(&xml, "%s/lxcconf2xmldata/lxcconf2xml-%s.xml",
+ abs_srcdir, info->name) < 0 ||
+ virAsprintf(&config, "%s/lxcconf2xmldata/lxcconf2xml-%s-v3.config",
+ abs_srcdir, info->name) < 0)
+ goto cleanup;
+
+ result = testCompareXMLToConfigFiles(xml, config, info->expectError);
+
+ VIR_FREE(xml);
+ VIR_FREE(config);
+ return result;
+}
+
+
static int
mymain(void)
{
@@ -102,7 +125,7 @@ mymain(void)
do { \
const struct testInfo info = { name, expectError }; \
if (virTestRun("LXC Native-2-XML " name, \
- testCompareXMLToConfigHelper, \
+ testCompareXMLToConfigHelperLegacy, \
&info) < 0) \
ret = EXIT_FAILURE; \
} while (0)
@@ -121,6 +144,30 @@ mymain(void)
DO_TEST("blkiotune", false);
DO_TEST("ethernet", false);
+ /* Tests for LXC 3.0 and higher */
+# define DO_TEST3(name, expectError) \
+ do { \
+ const struct testInfo info = { name, expectError }; \
+ if (virTestRun("LXC Native-3-XML " name, \
+ testCompareXMLToConfigHelperV3, \
+ &info) < 0) \
+ ret = EXIT_FAILURE; \
+ } while (0)
+
+ DO_TEST3("simple", false);
+ DO_TEST3("fstab", true);
+ DO_TEST3("nonetwork", false);
+ DO_TEST3("nonenetwork", false);
+ DO_TEST3("physnetwork", false);
+ DO_TEST3("macvlannetwork", false);
+ DO_TEST3("vlannetwork", false);
+ DO_TEST3("idmap", false);
+ DO_TEST3("memtune", false);
+ DO_TEST3("cputune", false);
+ DO_TEST3("cpusettune", false);
+ DO_TEST3("blkiotune", false);
+ DO_TEST3("ethernet", false);
+
virObjectUnref(xmlopt);
virObjectUnref(caps);
--
2.19.1
Julio Faracco
2018-11-14 17:25:45 UTC
Permalink
This patch introduce the new settings for LXC 3.0 or higher. The older
versions keep the compatibility to deprecated settings for LXC, but
after release 3.0, the compatibility was removed. This commit adds the
support to the refactored settings.

v1-v2: Michal's suggestions to handle differences between versions.
v2-v3: Adding suggestions from Pino and John too.
v3-v4: Appluing tests for LXC v3.

Signed-off-by: Julio Faracco <***@gmail.com>
---
src/lxc/lxc_native.c | 52 ++++++++++++++++++++++++++++++++------------
1 file changed, 38 insertions(+), 14 deletions(-)

diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index cbdec723dd..9f6d4b3de8 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -200,8 +200,13 @@ lxcSetRootfs(virDomainDefPtr def,
int type = VIR_DOMAIN_FS_TYPE_MOUNT;
VIR_AUTOFREE(char *) value = NULL;

- if (virConfGetValueString(properties, "lxc.rootfs", &value) <= 0)
- return -1;
+ if (virConfGetValueString(properties, "lxc.rootfs.path", &value) <= 0) {
+ virResetLastError();
+
+ /* Check for pre LXC 3.0 legacy key */
+ if (virConfGetValueString(properties, "lxc.rootfs", &value) <= 0)
+ return -1;
+ }

if (STRPREFIX(value, "/dev/"))
type = VIR_DOMAIN_FS_TYPE_BLOCK;
@@ -684,8 +689,13 @@ lxcCreateConsoles(virDomainDefPtr def, virConfPtr properties)
virDomainChrDefPtr console;
size_t i;

- if (virConfGetValueString(properties, "lxc.tty", &value) <= 0)
- return 0;
+ if (virConfGetValueString(properties, "lxc.tty.max", &value) <= 0) {
+ virResetLastError();
+
+ /* Check for pre LXC 3.0 legacy key */
+ if (virConfGetValueString(properties, "lxc.tty", &value) <= 0)
+ return 0;
+ }

if (virStrToLong_i(value, NULL, 10, &nbttys) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse int: '%s'"),
@@ -724,13 +734,16 @@ lxcIdmapWalkCallback(const char *name, virConfValuePtr value, void *data)
char type;
unsigned long start, target, count;

- if (STRNEQ(name, "lxc.id_map") || !value->str)
- return 0;
+ /* LXC 3.0 uses "lxc.idmap", while legacy used "lxc.id_map" */
+ if (STRNEQ(name, "lxc.idmap") || !value->str) {
+ if (!value->str || STRNEQ(name, "lxc.id_map"))
+ return 0;
+ }

if (sscanf(value->str, "%c %lu %lu %lu", &type,
&target, &start, &count) != 4) {
- virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid lxc.id_map: '%s'"),
- value->str);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid %s: '%s'"),
+ name, value->str);
return -1;
}

@@ -1041,19 +1054,30 @@ lxcParseConfigString(const char *config,
if (VIR_STRDUP(vmdef->os.init, "/sbin/init") < 0)
goto error;

- if (virConfGetValueString(properties, "lxc.utsname", &value) <= 0 ||
- VIR_STRDUP(vmdef->name, value) < 0)
+ if (virConfGetValueString(properties, "lxc.uts.name", &value) <= 0) {
+ virResetLastError();
+
+ /* Check for pre LXC 3.0 legacy key */
+ if (virConfGetValueString(properties, "lxc.utsname", &value) <= 0)
+ goto error;
+ }
+
+ if (VIR_STRDUP(vmdef->name, value) < 0)
goto error;
+
if (!vmdef->name && (VIR_STRDUP(vmdef->name, "unnamed") < 0))
goto error;

if (lxcSetRootfs(vmdef, properties) < 0)
goto error;

- /* Look for fstab: we shouldn't have it */
- if (virConfGetValue(properties, "lxc.mount")) {
+ /* LXC 3.0 uses "lxc.mount.fstab", while legacy used just "lxc.mount".
+ * In either case, generate the error to use "lxc.mount.entry" instead */
+ if (virConfGetValue(properties, "lxc.mount.fstab") ||
+ virConfGetValue(properties, "lxc.mount")) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("lxc.mount found, use lxc.mount.entry lines instead"));
+ _("lxc.mount.fstab or lxc.mount found, use "
+ "lxc.mount.entry lines instead"));
goto error;
}

@@ -1069,7 +1093,7 @@ lxcParseConfigString(const char *config,
if (lxcCreateConsoles(vmdef, properties) < 0)
goto error;

- /* lxc.id_map */
+ /* lxc.idmap or legacy lxc.id_map */
if (virConfWalk(properties, lxcIdmapWalkCallback, vmdef) < 0)
goto error;
--
2.19.1
John Ferlan
2018-11-14 20:05:52 UTC
Permalink
Post by Julio Faracco
This series adds enhacements for LXC to cover rebased config settings
for version 3.0 without remove legacy ones. This serie includes some
test cases to cover new config files too. The title mentions the word
"partial" because there is a huge change with network settings which
this commit does not cover.
v1-v2: Michal's suggestions to handle differences between versions.
v2-v3: Adding suggestions from Pino and John too.
v3-v4: Appluing tests for LXC v3.
lxc: Include support to lxc version 3.0 or higher.
tests: Adding tests cases to cover rebased settings for LXC 3.0.
src/lxc/lxc_native.c | 52 ++++++++++++++-----
.../lxcconf2xml-blkiotune-v3.config | 11 ++++
.../lxcconf2xml-cpusettune-v3.config | 6 +++
.../lxcconf2xml-cputune-v3.config | 7 +++
.../lxcconf2xml-ethernet-v3.config | 44 ++++++++++++++++
.../lxcconf2xml-fstab-v3.config | 37 +++++++++++++
.../lxcconf2xml-idmap-v3.config | 5 ++
.../lxcconf2xml-macvlannetwork-v3.config | 13 +++++
.../lxcconf2xml-memtune-v3.config | 10 ++++
.../lxcconf2xml-nonenetwork-v3.config | 4 ++
.../lxcconf2xml-nonetwork-v3.config | 3 ++
.../lxcconf2xml-physnetwork-v3.config | 11 ++++
.../lxcconf2xml-simple-v3.config | 45 ++++++++++++++++
.../lxcconf2xml-vlannetwork-v3.config | 12 +++++
tests/lxcconf2xmltest.c | 51 +++++++++++++++++-
15 files changed, 295 insertions(+), 16 deletions(-)
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cpusettune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-idmap-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-memtune-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config
Reviewed-by: John Ferlan <***@redhat.com>
(and pushed)

John

(now let's see if the various CI builders are happy too)

Loading...