From: Cédric Bosdonnat Date: Wed, 30 Jul 2014 09:20:59 +0000 (+0200) Subject: Domain config: write if some capabilities are set. X-Git-Tag: v1.2.7-rc2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=251d75a86324b8de09a88c9289229ca88cf58892;p=thirdparty%2Flibvirt.git Domain config: write if some capabilities are set. If all features are set to default (including the capabilities policy), but some capabilities are toggled, we need to output the element when formatting the config. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2a8cdeb03b..421a44af6c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17860,7 +17860,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, break; } - if (i != VIR_DOMAIN_FEATURE_LAST) { + if (i != VIR_DOMAIN_FEATURE_LAST || + virDomainDefHasCapabilitiesFeatures(def)) { virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); diff --git a/tests/lxcxml2xmldata/lxc-capabilities.xml b/tests/lxcxml2xmldata/lxc-capabilities.xml new file mode 100644 index 0000000000..04d64e3e41 --- /dev/null +++ b/tests/lxcxml2xmldata/lxc-capabilities.xml @@ -0,0 +1,34 @@ + + jessie + e21987a5-e98e-9c99-0e35-803e4d9ad1fe + 1048576 + 1048576 + 1 + + /machine + + + exe + /sbin/init + + + + + + + + destroy + restart + restart + + /usr/libexec/libvirt_lxc + + + + + + + + + + diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c index 8144989660..6dce070db2 100644 --- a/tests/lxcxml2xmltest.c +++ b/tests/lxcxml2xmltest.c @@ -144,6 +144,7 @@ mymain(void) DO_TEST_DIFFERENT("filesystem-ram"); DO_TEST("filesystem-root"); DO_TEST("idmap"); + DO_TEST("capabilities"); virObjectUnref(caps); virObjectUnref(xmlopt);