[libvirt] [PATCH v3] virt-aa-helper: Skip feature support checks while parsing

virt-aa-helper need not verify the feature support as libvirt does it during domain creation anyway. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com> --- src/conf/domain_conf.c | 3 +++ src/conf/domain_conf.h | 1 + src/security/virt-aa-helper.c | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e827b2a81..92929a289 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4736,6 +4736,9 @@ static int virDomainDefPostParseCheckFeatures(virDomainDefPtr def, virDomainXMLOptionPtr xmlopt) { + if (!UNSUPPORTED(VIR_DOMAIN_DEF_FEATURE_SKIP_VALIDATE)) + return 0; + if (UNSUPPORTED(VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG) && virDomainDefCheckUnsupportedMemoryHotplug(def) < 0) return -1; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 21e004515..c36d29fd9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2539,6 +2539,7 @@ typedef enum { VIR_DOMAIN_DEF_FEATURE_NAME_SLASH = (1 << 3), VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS = (1 << 4), VIR_DOMAIN_DEF_FEATURE_USER_ALIAS = (1 << 5), + VIR_DOMAIN_DEF_FEATURE_SKIP_VALIDATE = (1 << 6), } virDomainDefFeatures; diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index f7ccae0b0..b15fea7eb 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -654,6 +654,9 @@ caps_mockup(vahControl * ctl, const char *xmlStr) return rc; } +virDomainDefParserConfig virAAHelperDomainDefParserConfig = { + .features = VIR_DOMAIN_DEF_FEATURE_SKIP_VALIDATE, +}; static int get_definition(vahControl * ctl, const char *xmlStr) @@ -673,7 +676,8 @@ get_definition(vahControl * ctl, const char *xmlStr) goto exit; } - if (!(ctl->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL))) { + if (!(ctl->xmlopt = virDomainXMLOptionNew(&virAAHelperDomainDefParserConfig, + NULL, NULL, NULL, NULL))) { vah_error(ctl, 0, _("Failed to create XML config object")); goto exit; }

On Mon, Feb 05, 2018 at 08:11:02 -0500, Shivaprasad G Bhat wrote:
virt-aa-helper need not verify the feature support as libvirt does it during domain creation anyway.
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com> --- src/conf/domain_conf.c | 3 +++ src/conf/domain_conf.h | 1 + src/security/virt-aa-helper.c | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e827b2a81..92929a289 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4736,6 +4736,9 @@ static int virDomainDefPostParseCheckFeatures(virDomainDefPtr def, virDomainXMLOptionPtr xmlopt) { + if (!UNSUPPORTED(VIR_DOMAIN_DEF_FEATURE_SKIP_VALIDATE))
I don't think the 'UNSUPPORTED' macro should be used in this case.
+ return 0; + if (UNSUPPORTED(VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG) && virDomainDefCheckUnsupportedMemoryHotplug(def) < 0) return -1; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 21e004515..c36d29fd9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2539,6 +2539,7 @@ typedef enum { VIR_DOMAIN_DEF_FEATURE_NAME_SLASH = (1 << 3), VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS = (1 << 4), VIR_DOMAIN_DEF_FEATURE_USER_ALIAS = (1 << 5), + VIR_DOMAIN_DEF_FEATURE_SKIP_VALIDATE = (1 << 6),
The name is slightly misleading, since it does not skip the validation callback, only the feature checking. I was also thinking that this flag should be part of VIR_DOMAIN_DEF_PARSE flags and not the features itself.
participants (2)
-
Peter Krempa
-
Shivaprasad G Bhat