From: Jiri Denemark Date: Thu, 14 Sep 2017 14:09:35 +0000 (+0200) Subject: cpu_s390: Implement virCPUValidateFeatures X-Git-Tag: v3.8.0-rc1~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20edbad7769df6bb23e1132aee186090db5e8856;p=thirdparty%2Flibvirt.git cpu_s390: Implement virCPUValidateFeatures Only feature policy is checked on s390, which was previously done in virCPUUpdate, but that's not the correct place for the check once we have virCPUValidateFeatures. Signed-off-by: Jiri Denemark --- diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c index 2ef03367d7..3d10f920ba 100644 --- a/src/cpu/cpu_s390.c +++ b/src/cpu/cpu_s390.c @@ -78,14 +78,6 @@ virCPUs390Update(virCPUDefPtr guest, goto cleanup; for (i = 0; i < guest->nfeatures; i++) { - if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("only cpu feature policies 'require' and " - "'disable' are supported for %s"), - guest->features[i].name); - goto cleanup; - } - if (virCPUDefUpdateFeature(updated, guest->features[i].name, guest->features[i].policy) < 0) @@ -102,6 +94,26 @@ virCPUs390Update(virCPUDefPtr guest, return ret; } + +static int +virCPUs390ValidateFeatures(virCPUDefPtr cpu) +{ + size_t i; + + for (i = 0; i < cpu->nfeatures; i++) { + if (cpu->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("only cpu feature policies 'require' and " + "'disable' are supported for %s"), + cpu->features[i].name); + return -1; + } + } + + return 0; +} + + struct cpuArchDriver cpuDriverS390 = { .name = "s390", .arch = archs, @@ -111,4 +123,5 @@ struct cpuArchDriver cpuDriverS390 = { .encode = NULL, .baseline = NULL, .update = virCPUs390Update, + .validateFeatures = virCPUs390ValidateFeatures, };