You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Howie YU <ho...@gmail.com> on 2014/02/19 03:38:26 UTC
Re: Review Request 16337: [CLOUDSTACK-5526] Fix LibvirtDomainXMLParser error
when diskCacheMode is empty string
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16337/
-----------------------------------------------------------
(Updated Feb. 19, 2014, 2:38 a.m.)
Review request for cloudstack, Wei Zhou and Wido den Hollander.
Changes
-------
Patch again from master
Bugs: CLOUDSTACK-5526
https://issues.apache.org/jira/browse/CLOUDSTACK-5526
Repository: cloudstack-git
Description
-------
When using LibvirtDomainXMLParser parser xml from Domain.
The attribute diskCacheMode not always have value , and will be empty string
String diskCacheMode = getAttrValue("driver", "cache", disk);
when the code go to here valueOf
} else if (type.equalsIgnoreCase("block")) {
def.defBlockBasedDisk(diskDev, diskLabel,
DiskDef.diskBus.valueOf(bus.toUpperCase()));
def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
}
There will be cause IllegalArgumentException at
at java.lang.Enum.valueOf(Enum.java:196)
I suggest we may check if diskCacheMode is empty string , such as
if (diskCacheMode == null || diskCacheMode.isEmpty()) {
def.setCacheMode(DiskDef.diskCacheMode.NONE);
} else {
def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
}
Diffs (updated)
-----
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java 9cf6a90
Diff: https://reviews.apache.org/r/16337/diff/
Testing
-------
Thanks,
Howie YU