From 20edbad7769df6bb23e1132aee186090db5e8856 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 14 Sep 2017 16:09:35 +0200 Subject: [PATCH] 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 --- src/cpu/cpu_s390.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) 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, };