Github user swill commented on the pull request:
https://github.com/apache/cloudstack/pull/1539#issuecomment-218654451
Sorry for the delay getting to this. I think this probably works in all
cases, but I suspect it will not clean up correctly always. Because this was
working sometimes and failing sometimes, I believe that means that the cleanup
of `account` does not always clean up the snapshots (otherwise it would have
never worked).
I think the code should be like this to make sure it cleans up everything
up and does not fail.
```
cls._cleanup = [
cls.snapshot_1,
cls.snapshot_2,
cls.snapshot_3,
cls.disk_offering,
cls.account,
cls.service_offering
]
```
Does this make sense to you guys? This way it will remove the snapshots
first and then it will clean up everything else. I could be wrong, but since
the current code ever worked, I think this guarantees that the cleanup of
everything will happen and the `account` won't error when it tries to clean up.
I guess if the account keeps a reference to the snapshot after it is deleted,
that could cause the account deletion to fail. Feedback please...
---
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.
---