[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15665336#comment-15665336
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9570:
--------------------------------------------

Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1735#discussion_r87915067
  
    --- Diff: server/src/com/cloud/api/ApiResponseHelper.java ---
    @@ -526,16 +529,18 @@ public static DataStoreRole getDataStoreRole(Snapshot 
snapshot, SnapshotDataStor
             }
     
             long storagePoolId = snapshotStore.getDataStoreId();
    -        DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, 
DataStoreRole.Primary);
    +        if (snapshotStore.getState() != null && ! 
snapshotStore.getState().equals(ObjectInDataStoreStateMachine.State.Destroyed)) 
{
    +            DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, 
DataStoreRole.Primary);
     
    -        Map<String, String> mapCapabilities = 
dataStore.getDriver().getCapabilities();
    +            Map<String, String> mapCapabilities = 
dataStore.getDriver().getCapabilities();
     
    -        if (mapCapabilities != null) {
    -            String value = 
mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
    -            Boolean supportsStorageSystemSnapshots = new Boolean(value);
    +            if (mapCapabilities != null) {
    +                String value = 
mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
    +                Boolean supportsStorageSystemSnapshots = new 
Boolean(value);
    --- End diff --
    
    `new Boolean` skips the constant pool -- putting unnecessary pressure on 
the heap and creating a potential memory leak.  Please use `Boolean.valueOf` to 
part the value to avoid this issue.


> Bug in listSnapshots for snapshots with deleted data stores
> -----------------------------------------------------------
>
>                 Key: CLOUDSTACK-9570
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9570
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: API
>            Reporter: Nicolas Vazquez
>            Assignee: Nicolas Vazquez
>
> h3. Actual behaviour
> If there is snapshot on a data store that is removed, {{listSnapshots}} still 
> tries to enumerate it and gives error (in this example data store 2 has been 
> removed):
> {code:xml|title=/client/api?command=listSnapshots&isrecursive=true&listall=true|borderStyle=solid}
> <listsnapshotsresponse cloud-stack-version="4.9.1.0-SNAPSHOT">
>    <errorcode>530</errorcode>
>    <cserrorcode>4250</cserrorcode>
>    <errortext>Unable to locate datastore with id 2</errortext>
> </listsnapshotsresponse>
> {code}
> h3. Reproduce error
> This steps can be followed to reproduce issue:
> * Take a snapshot of a volume (this creates a references for primary storage 
> and secondary storage in snapshot_store_ref table
> * Simulate retiring primary data storage where snapshot is cached (in this 
> example X is a fake data store and Y is snapshot id):
> {{UPDATE `cloud`.`snapshot_store_ref` SET `store_id`='X', `state`="Destroyed" 
> WHERE `id`='Y';}}
> * List snapshots
> {{/client/api?command=listSnapshots&isrecursive=true&listall=true}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to