diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 1a9550e438..b2ab2c08e3 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1055,6 +1055,8 @@ static char *lxcConnectDomainXMLFromNative(virConnectPtr conn,
{
char *xml = NULL;
virDomainDefPtr def = NULL;
+ virLXCDriverPtr driver = conn->privateData;
+ virCapsPtr caps = virLXCDriverGetCapabilities(driver, false);
virCheckFlags(0, NULL);
@@ -1067,12 +1069,13 @@ static char *lxcConnectDomainXMLFromNative(virConnectPtr conn,
goto cleanup;
}
- if (!(def = lxcParseConfigString(nativeConfig)))
+ if (!(def = lxcParseConfigString(nativeConfig, caps, driver->xmlopt)))
goto cleanup;
xml = virDomainDefFormat(def, 0);
cleanup:
+ virObjectUnref(caps);
virDomainDefFree(def);
return xml;
}
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 2f9559735a..8ff2253b46 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -991,7 +991,9 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties)
}
virDomainDefPtr
-lxcParseConfigString(const char *config)
+lxcParseConfigString(const char *config,
+ virCapsPtr caps,
+ virDomainXMLOptionPtr xmlopt)
{
virDomainDefPtr vmdef = NULL;
virConfPtr properties = NULL;
@@ -1088,6 +1090,10 @@ lxcParseConfigString(const char *config)
/* lxc.cap.drop */
lxcSetCapDrop(vmdef, properties);
+ if (virDomainDefPostParse(vmdef, caps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
+ xmlopt) < 0)
+ goto cleanup;
+
goto cleanup;
error:
diff --git a/src/lxc/lxc_native.h b/src/lxc/lxc_native.h
index a80f2b1eaf..15fa0d5474 100644
--- a/src/lxc/lxc_native.h
+++ b/src/lxc/lxc_native.h
@@ -27,6 +27,8 @@
# define LXC_CONFIG_FORMAT "lxc-tools"
-virDomainDefPtr lxcParseConfigString(const char *config);
+virDomainDefPtr lxcParseConfigString(const char *config,
+ virCapsPtr caps,
+ virDomainXMLOptionPtr xmlopt);
#endif /* __LXC_NATIVE_H__ */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e1e28eca93..1d57b39108 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -659,7 +659,7 @@ lxcxml2xmltest_SOURCES = \
lxcxml2xmltest_LDADD = $(lxc_LDADDS)
lxcconf2xmltest_SOURCES = \
- lxcconf2xmltest.c \
+ lxcconf2xmltest.c testutilslxc.c testutilslxc.h \
testutils.c testutils.h
lxcconf2xmltest_LDADD = $(lxc_LDADDS)
else ! WITH_LXC
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
index c9c046969a..641edb94fa 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
500
@@ -33,6 +33,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
index e7863fa13f..bafaa960f8 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
@@ -21,6 +21,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml b/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
index 50c5358abe..f7f8041dd6 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
1024
@@ -23,6 +23,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml b/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml
index 80a83ff78a..dd3843d5cb 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
exe
@@ -22,6 +22,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml
index 3105b8cefc..a345e8e019 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
exe
@@ -17,6 +17,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml b/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
index 7df1ef0e98..57e751aaba 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
1048576
- 0
+ 1048576
1048576
131072
@@ -23,6 +23,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml
index e002b99a66..0122ab05c7 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
exe
@@ -17,6 +17,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
index dc9d6350f5..04ea280b3c 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
exe
@@ -18,6 +18,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml
index 79bcfa003e..4fb3f954e0 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
exe
@@ -17,6 +17,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple.xml b/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
index 45a2012c5a..5234bab7f2 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
exe
@@ -21,6 +21,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml
index 712be3e1ec..47ed898b0f 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml
@@ -2,7 +2,7 @@
migrate_test
c7a5fdbd-edaf-9455-926a-d65c16db1809
65536
- 0
+ 65536
1
exe
@@ -17,6 +17,7 @@
restart
destroy
+ /usr/libexec/libvirt_lxc
diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c
index 6255942cb0..ed21e8a389 100644
--- a/tests/lxcconf2xmltest.c
+++ b/tests/lxcconf2xmltest.c
@@ -5,9 +5,14 @@
#ifdef WITH_LXC
# include "lxc/lxc_native.h"
+# include "lxc/lxc_conf.h"
+# include "testutilslxc.h"
# define VIR_FROM_THIS VIR_FROM_NONE
+static virCapsPtr caps;
+static virDomainXMLOptionPtr xmlopt;
+
static int
blankProblemElements(char *data)
{
@@ -30,7 +35,7 @@ testCompareXMLToConfigFiles(const char *xml,
if (virtTestLoadFile(configfile, &config) < 0)
goto fail;
- vmdef = lxcParseConfigString(config);
+ vmdef = lxcParseConfigString(config, caps, xmlopt);
if ((vmdef && expectError) || (!vmdef && !expectError))
goto fail;
@@ -93,6 +98,14 @@ mymain(void)
{
int ret = EXIT_SUCCESS;
+ if (!(caps = testLXCCapsInit()))
+ return EXIT_FAILURE;
+
+ if (!(xmlopt = lxcDomainXMLConfInit())) {
+ virObjectUnref(caps);
+ return EXIT_FAILURE;
+ }
+
# define DO_TEST(name, expectError) \
do { \
const struct testInfo info = { name, expectError }; \
@@ -115,6 +128,9 @@ mymain(void)
DO_TEST("cpusettune", false);
DO_TEST("blkiotune", false);
+ virObjectUnref(xmlopt);
+ virObjectUnref(caps);
+
return ret;
}