cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howie YU" <howie...@gmail.com>
Subject Re: Review Request 16337: [CLOUDSTACK-5526] Fix LibvirtDomainXMLParser error when diskCacheMode is empty string
Date Wed, 19 Feb 2014 02:38:26 GMT

-----------------------------------------------------------
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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message