CLOUDSTACK-4302: Instance wizard UI: Support affinity groups for dedicated zones

Changes:
- Add affinityGroupUuid in the listzones response for dedicatedZones.
CLOUDSTACK-4324: need to clean up snapshot_store_ref, if creating snapshot failed.
CLOUDSTACK-4318: clean up snapshot stored in staging area, after backup snapshot to object store
CLOUDSTACK-4288: Fix the way that VmwareClient is using vSphere 5.1 SDK which caused huge memory footprint
Revert "fix CLOUDSTACK-2989, do not list network offering with specifyvlan=true for non-root-admin user"

This reverts commit 94254e3c2bd38573adac22d0c66817db3cfa1873.

Conflicts:
	server/src/com/cloud/configuration/ConfigurationManagerImpl.java

Regular user should be able to list the network offering with specifyVlan=true. He just can't use when create the network as he is unaware of the physical network topology. But as the admin can create the network on the user's behalf using this kind of offering, so the user should be able to see the offering's details
CLOUDSTACK-4325: if userdispersing algorithm is used, then zone wide storages never been picked up
CLOUDSTACK-4337 Dedicated Resources: Zone dedicated to an account should only be visible and accessible to that account

Changes:
- When listing a zone, add clause in the search to check the account_id for a dedicated zone
- When listsing a zone with a domainid, add a similar clause.
- DomainCheck:: checkAccess() for a zone should consider that zone can now be dediacted to a specific account and check access accordingly.
CLOUDSTACK-4315: add code to clean up libvirt data structure after plug/unplug, that's the only thing I can do to fix this kind of libvirt issue
CLOUDSTACK-4341: UI > zone wizard > call dedicateZone API right after createZone API returns success.
CLOUDSTACK-4302: UI > VM wizard > affinity group step > if selected zone is dedicated, pre-select ExplicitDedication affinity group and make it non-editable.
CLOUDSTACK-4302: UI > affinity group > hide delete action when affinity group type is ExplicitDedication for regular user.
CLOUDSTACK-2583: [Object_Store_Refactor] Failed to create snapshot from
root disk of a guest VM.
CLOUDSTACK-4318:[Object_Store_Refactor] Failed to delete snapshot copied
to Staging storage during snapshot creation.
CLOUDSTACK-4338: catch up exception in case of deleting volume in parallel: it's possible that two threads can delete one volume at the same time, if the volume state is in Expunging
CLOUDSTACK-3594: New affinity group tests

- list all vms in affinity group
- delete an affinity group by id
- admin deletes affinity groups
- list affinity groups as admin
- list affinity groups by accountid/domainid
- list affinity groups by group id
- user deletes his affinity group

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
Removed Invalid test from TestRemoveUserFromAccount see -> http://markmail.org/message/vk7wyl3b57cltj44

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
Additional tests for custom_hostname

- vm with existing displayname
- change display name post deploy
- deploy with unsupported chars in display name
- vm.instancename.flag = true and deploy vm
- vm.instancename.flag = false and deploy vm

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit d5203b19e017eb45299899205fdd97fe023c7cc0)
CLOUDSTACK-4317 make the regular expressions in dnsmasq.sh more tighter to avoid matching of ip6dns

Signed-off-by: Jayapal <jayapal@apache.org>
CLOUDSTACK-4308: UI > volume page > if hypervisor is KVM, show/hide takeSnapshot, recurringSnapshot action upon KVMsnapshotenabled property returned by listCapabilities API.
CLOUDSTACK-4287: Template sync should remove template_store_ref entry
for corrupted template.