GitHub user nvazquez opened a pull request:
https://github.com/apache/cloudstack/pull/1735
CLOUDSTACK-9570: Bug in listSnapshots for snapshots with deleted data stores
## 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):
`client/api?command=listSnapshots&isrecursive=true&listall=true`
```xml
<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>
```
## 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`
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nvazquez/cloudstack list-snapshots-issue
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cloudstack/pull/1735.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1735
----
commit dd7d85a71d5e9f889974c5ed4d5d14a5e70354a3
Author: nvazquez <[email protected]>
Date: 2016-10-06T18:28:20Z
CLOUDSTACK-9570: Bug in listSnapshots for snapshots with deleted data stores
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---