Make the way stash is stopped for upgrade configurable.

- Add param $stop_stash paramter
- Add test for upgrades
Add support for permgen JVM option