mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
parent
411cdb6150
commit
fae7a7354c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user