conf: Validate disk source configuration also for the backing store

Since we already parse the <backingStore> of a disk source, we should
also validate the configuration for the whole backing chain and not only
for the top level image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Peter Krempa 2018-03-08 17:23:46 +01:00
parent c4e7c1f212
commit 28e1068c4f

View File

@ -8974,6 +8974,8 @@ virDomainDiskSourceDefParseAuthValidate(const virStorageSource *src)
static int
virDomainDiskDefParseValidate(const virDomainDiskDef *def)
{
virStorageSourcePtr next;
if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
if (def->event_idx != VIR_TRISTATE_SWITCH_ABSENT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@ -9044,11 +9046,12 @@ virDomainDiskDefParseValidate(const virDomainDiskDef *def)
}
}
if (virDomainDiskSourceDefParseAuthValidate(def->src) < 0)
for (next = def->src; next; next = next->backingStore) {
if (virDomainDiskSourceDefParseAuthValidate(next) < 0)
return -1;
if (def->src->encryption) {
virStorageEncryptionPtr encryption = def->src->encryption;
if (next->encryption) {
virStorageEncryptionPtr encryption = next->encryption;
if (encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS &&
encryption->encinfo.cipher_name) {
@ -9059,6 +9062,7 @@ virDomainDiskDefParseValidate(const virDomainDiskDef *def)
return -1;
}
}
}
return 0;
}