[libvirt] [PATCH] Domain config: write <features/> 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 <features> element when formatting the config. --- src/conf/domain_conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2a8cdeb..421a44a 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, "<features>\n"); virBufferAdjustIndent(buf, 2); -- 1.8.4.5

On 07/30/2014 11:25 AM, Cédric Bosdonnat wrote:
If all features are set to default (including the capabilities policy), but some capabilities are toggled, we need to output the <features> element when formatting the config. --- src/conf/domain_conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK. It would be also nice to extend the tests to cover this (lxcxml2xmltest?) Jan

On Wed, 2014-07-30 at 12:37 +0200, Ján Tomko wrote:
On 07/30/2014 11:25 AM, Cédric Bosdonnat wrote:
If all features are set to default (including the capabilities policy), but some capabilities are toggled, we need to output the <features> element when formatting the config. --- src/conf/domain_conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK.
It would be also nice to extend the tests to cover this (lxcxml2xmltest?)
Pushed with an additional lxcxml2xmltest capabilities test to cover that case. -- Cedric
participants (3)
-
Cedric Bosdonnat
-
Cédric Bosdonnat
-
Ján Tomko