do not add disk cache mode from an empty string (#12248)

Co-authored-by: Daan Hoogland <dahn@apache.org>
This commit is contained in:
dahn 2026-01-26 15:35:17 +01:00 committed by GitHub
parent 63c8b5fc56
commit fa3dee886e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -111,7 +111,9 @@ public class LibvirtDomainXMLParser {
def.defNetworkBasedDisk(diskPath, host, port, authUserName, poolUuid, diskLabel,
DiskDef.DiskBus.valueOf(bus.toUpperCase()),
DiskDef.DiskProtocol.valueOf(protocol.toUpperCase()), fmt);
def.setCacheMode(DiskDef.DiskCacheMode.valueOf(diskCacheMode.toUpperCase()));
if (StringUtils.isNotBlank(diskCacheMode)) {
def.setCacheMode(DiskDef.DiskCacheMode.valueOf(diskCacheMode.toUpperCase()));
}
} else {
String diskFmtType = getAttrValue("driver", "type", disk);
String diskCacheMode = getAttrValue("driver", "cache", disk);