CLOUDSTACK-2102: Anti-Affinity - Even after reserved capacity has been released for a Vm in "Stopped" state , we are not allowed to deploy new Vms as part of same anti-affinity group in the last_host_id where the stopped Vm was running.

Changes:
Do not add the last_host_id of a Stopped VM to avoid set, if the VM has been stopped for more that capacity.skip.counting.hours time limit
CLOUDSTACK-2070: Anti-Affinity - When Vm deployment fails because of not being able to satisfy the anti-affinity rule , user should be provided with more informative message.

Changes:
- There is no good mechanism currently to figure out if the  deployment failed due to affinity groups only
- We can just hint the user that the deployment might have failed due to the affinity groups and ask to review the input
CLOUDSTACK-751: 41-42 DB upgrade - insert new global config blacklisted.routes
CLOUDSTACK-2365: Anti-Affinity - As admin , we are allowed to deploy a Vm in an affinity group that belongs to different user.

CLOUDSTACK-2349: Anti-Affinity - As admin user , using updateVMAffinityGroup() , we are allowed to update the affinity group of a Vm (that belongs to a regular user) to be set to admin's affinity group.

Changes:
- Even for root-admin make sure that the affinity group and the VM belong to same account
Better parse domain XMLs so network devices can be detached as well
CLOUDSTACK-2554: CloudStack fails to load XCP 1.6 hypervisors

Missing default constructor fails the agent manager reloading the XCP
resource on reboot of management server. This is fixed by using the
default constructor as do other Xen resources and include a new resource
ala XenServers for XCP1.6.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
Fixing multiple minor annoyances:

1. Keeping the description consistent - Memory not RAM when referring to
overcommit
2. getters And setters grouped, provided right casing.
3. Removed wildcard imports

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
CLOUDSTACK-2554: Ensuring that we honor hypervisor xen's memory constraints

When setting memory constraints on Xen guests we should honor:
static-min <= dynamic-min <= dynamic-max <= static-max

Our VmSpec while allows the guests to like between dynamic-min and
dynamic-max the memory set by the resource set the static min to be
equal to the dynamic max. This restricts the hypervisor from ensuring
optimized memory handling of guests.

see: http://wiki.xen.org/wiki/XCP_FAQ_Dynamic_Memory_Control#How_does_XCP_choose_targets_for_guests_in_dynamic_range_mode.3F

Another fix was related the restrict_dmc option. when enabled (true)
this option disallows scaling a vm. The logic was reverse handled
allowing scaling when restrict_dmc was on. This control flow is now
fixed.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
CLOUDSTACK-2554: Incorrect compute of minmemory and cpu

23e54bb0 introduced multiple hypervisors support for cpu and memory
overcommit. Here the HypervisorGuru base which determines the min, max
range for the memory for all hypervisors computes the minCpu using the
MemoryOverCommit ratio and minMemory using the CpuOverCommit ratio.

Minor typo/logic issue but massive damage across all HV if enabled ;)

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
CLOUDSTACK-1871 : domainId parameter to uploadVolume not working

1. Remove duplicated lines for setting domainId.
2. Set domainId with owner's domain if the owner is specified.
CLOUDSTACK-1901 : API:MS: DeleteEvents deletes Archived events as well
CLOUDSTACK-2297 : Delete Account/Domain is not updating the resources usage of the parent domain
CLOUDSTACK-2576. AWS API not returning values in CFSimpleXML Object format.
PHP SDK calls the CFSimpleXML parser class to parse the response body into CFSimpleXML Object format.
In AWSAPI added an XML declaration during serialization of Axis beans to XML output
CLOUDSTACK-2287: Tests for the LDAP system

API tests for the LDAP config/remove commands

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
CLOUDSTACK-2085: DMC enable guest scaling

When dmc is enabled allow cloudstack to scale the VM between dynamic
ranges. This requires a further commit where there is enough memory
available between dynamic-max and static-max for the VM to scale under
memory pressure. See the TODO in Xenserver56FP1Resource.java

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
Detect the second zone for copyImage operation

When copying templates and ISOs detect that a second zone is available.
Else skip the test.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
migrate only when hosts are available

Identify the hosts that are suitable for migration before proceeding
with migrateVM

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
LDAP moved to regression suite.

LDAP requires a Directory server which isn't available by default in
most environments. Moving this to the regression suite so it can be run
on demand.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
CLOUDSTACK-2553: Made ACL item action case-insensitive
CLOUDSTACK-2379: Fix for issue destroy vm causing NPE. Made the following changes.
1. Made a fix to make sure a null object is added to the exception.
2. Also fixed the marvin test cases for the feature. Account cleanup will remove the vms deployed for the account. There is no need to explicitly delete the vms for the account.
3. Fixed the assertion checks for the vm created for an account. If there are multiple vms for an account, the test script needs to compare the ids with the correct instance.