conf: Move <disk> encryption validation

Rather than checking during XML processing, move the check for
valid <encryption> into virDomainDiskDefParseValidate and alter
the text of the message slightly to be a bit more correct.
This commit is contained in:
John Ferlan 2017-09-14 11:01:40 -04:00
parent 411cdb6150
commit fae7a7354c

View File

@ -8605,6 +8605,19 @@ virDomainDiskDefParseValidate(const virDomainDiskDef *def)
if (virDomainDiskSourceDefParseAuthValidate(def->src) < 0)
return -1;
if (def->src->encryption) {
virStorageEncryptionPtr encryption = def->src->encryption;
if (encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS &&
encryption->encinfo.cipher_name) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("supplying <cipher> for domain disk definition "
"is unnecessary"));
return -1;
}
}
return 0;
}
@ -9095,17 +9108,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
def->startupPolicy = val;
}
if (encryption) {
if (encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS &&
encryption->encinfo.cipher_name) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("supplying the <cipher> for a domain is "
"unnecessary"));
goto error;
}
}
def->dst = target;
target = NULL;
def->src->auth = authdef;