Merge pull request #1594 from nvazquez/vmnetworkmapissue CLOUDSTACK-9407: vm_network_map table doesnt get cleaned up properlyJIRA TICKET: https://issues.apache.org/jira/browse/CLOUDSTACK-9407
### Introduction It was found out that in production environments `vm_network_map` table entries were slowly growing. It was investigated how this entries were cleaned up. ### Behaviour On vm creation, vm mappings are inserted on `vm_network_map`. On vm stop, mappings are deleted from `vm_network_map` for vm, as a result of the release of its nics. ### Problem If created vm is stopped from hypervisor side (at least on vSphere in which we tested it), when CloudStack realizes vm is stopped it doesn't clean up `vm_network_table,` and, as cleanup is made during vm stop, when vm is eventually destroyed and expunged it won't clean up their entries in that table. ### Proposed solution We propose to move `vm_network_map` table cleanup to expunge command instead of stop command. * pr/1594: CLOUDSTACK-9407: Refactor CLOUDSTACK-9407: Release network resources on expunge command Signed-off-by: Will Stevens <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9be93c6e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9be93c6e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9be93c6e Branch: refs/heads/4.9-bountycastle-daan Commit: 9be93c6e9022f35a2cd3dab6a099d69a77dd72ff Parents: 8d45d71 c754a0c Author: Will Stevens <[email protected]> Authored: Tue Jul 19 08:18:16 2016 -0400 Committer: Will Stevens <[email protected]> Committed: Tue Jul 19 08:18:18 2016 -0400 ---------------------------------------------------------------------- .../com/cloud/vm/VirtualMachineManagerImpl.java | 16 +++++++++------- server/src/com/cloud/vm/UserVmManagerImpl.java | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) ----------------------------------------------------------------------
