You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "howie yu (JIRA)" <ji...@apache.org> on 2013/12/17 11:16:07 UTC

[jira] [Created] (CLOUDSTACK-5526) LibvirtDomainXMLParser

howie yu created CLOUDSTACK-5526:
------------------------------------

             Summary: LibvirtDomainXMLParser 
                 Key: CLOUDSTACK-5526
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-5526
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
          Components: KVM
    Affects Versions: 4.4.0
         Environment: CentOS 6.4 with KVM 0.1002
Libvirt 0.5.1
            Reporter: howie yu
            Priority: Trivial


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

}






--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Re: [jira] [Created] (CLOUDSTACK-5526) LibvirtDomainXMLParser

Posted by Wei ZHOU <us...@gmail.com>.
I think Wido already fixed this issue in the following commit
https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=commit;h=088247b61b4ecea7bb757becd233e10c97a7a75a


2013/12/17 howie yu (JIRA) <ji...@apache.org>

> howie yu created CLOUDSTACK-5526:
> ------------------------------------
>
>              Summary: LibvirtDomainXMLParser
>                  Key: CLOUDSTACK-5526
>                  URL:
> https://issues.apache.org/jira/browse/CLOUDSTACK-5526
>              Project: CloudStack
>           Issue Type: Bug
>       Security Level: Public (Anyone can view this level - this is the
> default.)
>           Components: KVM
>     Affects Versions: 4.4.0
>          Environment: CentOS 6.4 with KVM 0.1002
> Libvirt 0.5.1
>             Reporter: howie yu
>             Priority: Trivial
>
>
> 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));
>
> }
>
>
>
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.1.4#6159)
>