9698 Commits

Author SHA1 Message Date
Remi Bergsma
e08294a95f Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9106 - Makes Enum name compliant with Java code conventions.
  CLOUDSTACK-9106 - Adds a test to cover the changes in the applyVpnUsers() method
  CLOUDSTACK-9106 - Makes the router commands call more consistent.
  CLOUDSTACK-9106 - Enables private gateway tests on Redundant VPCs
  CLOUDSTACK-9106 - Refactor the createPrivateNicProfileForGateway() method
  CLOUDSTACK-9106 - Reduces the amount of iterations through the routers of a VPC
  Add support for not (re)starting server after cloud-setup-management.

Closed PRs that will not be considered for merge:
This closes #1158
This closes #1097
2015-12-07 21:36:36 +01:00
Abhinandan Prateek
987fcbd441 CLOUDSTACK-8592: Implement Quota service
Quota service while allowing for scalability will make sure that the cloud is
not exploited by attacks, careless use and program errors. To address this
problem, we propose to employ a quota-enforcement service that allows resource
usage within certain bounds as defined by policies and available quotas for
various entities.  Quota service extends the functionality of usage server to
provide a measurement for the resources used by the accounts and domains using a
common unit referred to as cloud currency in this document. It can be configured
to ensure that your usage won’t exceed the budget allocated to accounts/domain
in cloud currency.  It will let user know how much of the cloud resources he is
using. It will help the cloud admins, if they want, to ensure that a user does
not go beyond his allocated quota. Per usage cycle if a account is found to be
exceeding its quota then it is locked. Locking an account means that it will not
be able to initiat e a new resource allocation request, whether it is more
storage or an additional ip. Needless to say quota service as well as any action
on the account is configurable.

Changes from Github code review:

- Added marvin test for quota plugin API
- removed unused commented code
- debug messages in debug enabled check
- checks for nulls, fixed access to member variables and feature
- changes based on PR comments
- unit tests for UsageTypes
- unit tests for all Cmd classes
- unit tests for all service and manager impls
- try-catch-finally or try-with-resource in dao impls for failsafe db switching
- remove dead code
- add missing quota calculation case (regression fixed)
- replace tabs with spaces in pom.xmls
- quota: though default value for quota_calculated is 0, the usage server
  makes it null while entering usage entries. Flipping the condition so
  as to acocunt for that.
- quotatypes: fix NPE in quota type
- quota framework test fixes
- made statement period configurable
- changed default email templates to reflect the fact that exhausted quota may not result in a locked account
- added quotaUpdateCmd that refreshes quota balances and sends alerts and statements
- report quotaSummary command returns quota balance, quota usage and state for all account
- made UI framework changes to allow for text area input in edit views
- process usage entries that have greater than 0 usage
- orocess quota entries only if tariff is non zero
- if there are credit entries but no balance entry create a dummy balance entry
- remove any credit entries that are before the last balance entry
  when displaying balance statement
- on a rerun the last balance is now getting added

FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Quota+Service+-+FS
PR: https://github.com/apache/cloudstack/pull/768

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-12-07 23:02:48 +05:30
Wilder Rodrigues
14db2d3dc4 CLOUDSTACK-9106 - Makes Enum name compliant with Java code conventions. 2015-12-07 13:43:46 +01:00
Wilder Rodrigues
5973f4ea77 CLOUDSTACK-9106 - Adds a test to cover the changes in the applyVpnUsers() method
- Changed the NetworkTopologyContext class just to make the private member accessible from the test
   - Added a test class to cover the positive scenario of the VpcVirtualRouterElementTest.applyVpnUsers() method.
   - Covering when there is either no VPC or no routers.
2015-12-07 13:42:29 +01:00
Wilder Rodrigues
13eb789388 CLOUDSTACK-9106 - Makes the router commands call more consistent.
- Checks the result of a call against the previous result. Either both are true or the method returns false.
   - Do not thrown exceptions because some calls are not handling/rethrowing them. It would cause runtime problems.
   - When doing a list.addAll(Arrays.asList(String[]{}) will cause problems when trying to cast the list.toArray() into an aray of String
     It would only work if instead of calling addAll() I would pass it straight into the constructor:
     e.g. List<String> l = new ArrayList(Arrays.asList(new String[]{});
          Stirng [] s = (String[]) l.toArray();
     But I did not like that implementation because it would require 2 arrays of string and combine them at the end.
2015-12-07 13:40:12 +01:00
Wilder Rodrigues
24dafc2cc2 CLOUDSTACK-9106 - Refactor the createPrivateNicProfileForGateway() method
- Use the router to retrieve the instance ID
    - Check if the VPC is redundant in order to reuse the private gateway address.
    - Brings the private gateways interfaces up.
2015-12-07 10:30:18 +01:00
Wilder Rodrigues
a168a69c3c CLOUDSTACK-9106 - Reduces the amount of iterations through the routers of a VPC
- It was causing problems because Nics were expected to be plugged before they actually exist. Only in rVPC cases.
   - Applies ACL items to routers only after the Pvt GW is setup.
2015-12-07 10:30:17 +01:00
Rohit Yadav
f30fbe9a5c Merge branch '4.6' 2015-12-07 12:44:07 +05:30
Rohit Yadav
fbc8f5d7e9 Merge pull request #1140 from harikrishna-patnala/CLOUDSTACK-9094
CLOUDSTACK-9094: Multiple threads are being used to collect the statsCLOUDSTACK-9094: Multiple threads are being used to collect the stats from the same VR

Same thread is being intialised by two managers, VirtualNetworkApplianceManager and VpcVirtualNetworkApplianceManager

* pr/1140:
  CLOUDSTACK-9094: Multiple threads are being used to collect the stats from the same VR

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-12-07 12:43:20 +05:30
Daan Hoogland
2c4ea503f9 Merge pull request #1176 from anshul1886/CLOUDSTACK-9025-4.6
CLOUDSTACK-9025: Fixed can't create usable template from snapshot in Xenserver and Vmwarehttps://issues.apache.org/jira/browse/CLOUDSTACK-9025

Fix also reverts below commit as below solution making assumption about hypervisor which are not applicable in case of XenServer and VmWare

Revert "CLOUDSTACK-8964: Can't create template or volume from snapshot"

This reverts commit ccf5d75cfbe769b34c021ab3653ed318cae25933.

Testing:

Able to deploy VM successfully from template created from linked clone snapshot on XenServer.

* pr/1176:
  CLOUDSTACK-9025: Fixed can't create usable template from snapshot in Xenserver and Vmware

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-12-06 20:34:34 +01:00
Daan Hoogland
f33195915f Merge pull request #850 from DaanHoogland/CLOUDSTACK-8656
CLOUDSTACK-8656: tests ignoring exceptionsfinal few ignored exceptions supplied with log messages.

* pr/850:
  CLOUDSTACK-8656: tests ignoring exceptions

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-12-06 20:19:21 +01:00
Daan Hoogland
638f1cf091 Merge pull request #1049 from DaanHoogland/CLOUDSTACK-9047
CLOUDSTACK-9047 rename enumsmake enums adhere to best practice naming conventions

* pr/1049:
  CLOUDSTACK-9046 rename enums to adhere to naming conventions
  CLOUDSTACK-9046 renamed enums in kvm plugin
  CLOUDSTACK-9047 use 'State's only with context   there are more types called 'State'   (or to be called so but now 'state')   So remove imports and prepend their enclosing class/context to them.

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-12-06 20:17:04 +01:00
Daan Hoogland
998b1ba629 Merge pull request #1161 from ustcweizhou/resize-volume-issues
CLOUDSTACK-9101: fix some issues in resize volume(1) fix issue: volume size is not updated even if the operation succeed
(2) Add ui support for root volume resize
(3) resize on qcow2 type ROOT volume of stopped vm does not really work
see https://issues.apache.org/jira/browse/CLOUDSTACK-9101

* pr/1161:
  CLOUDSTACK-9101: resize root volume of stopped vm on KVM
  CLOUDSTACK-9101: add UI support for root volume resize
  CLOUDSTACK-9101: update volume size after resizevolume

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-12-06 19:44:16 +01:00
Daan Hoogland
bbe891bfc3 Merge pull request #1086 from ustcweizhou/update-nic-ipaddr
CLOUDSTACK-9051: update nic IP address of stopped vmThis provides the feature to change ip address of NIC on a stopped vm by API and UI.

* pr/1086:
  CLOUDSTACK-9051: reprogram network as a part of vm nic ip update
  CLOUDSTACK-9051: add unit tests for UpdateVmNicIp
  CLOUDSTACK-9051: update nic IP address of stopped vm

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-12-06 19:37:04 +01:00
Remi Bergsma
e37842cbd3 Merge pull request #1108 from rafaelweingartner/master-lrg-cs-hackday-004
Removed the PlannerBase class because it is does not bring contribution to ACS' code.Removed the PlannerBase class because it is does not bring contribution to ACS' code.

We changed com.cloud.deploy.FirstFitPlanner, now it doesnt extends the PlannerBase and implements the com.cloud.deploy.DeploymentPlanner.

We also removed the method com.cloud.deploy.DeploymentPlanner.check(VirtualMachineProfile, DeploymentPlan, DeployDestination, ExcludeList) that was not used anywhere.

Additionally, we removed the _ from FirstFitPlanner's attributes name, in order to have them in a more standard way.

* pr/1108:
  Removed PlannerBase empty class

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-05 19:11:21 +01:00
weingartner
6ea2b482f7 Add Javadoc to AgentBasedStandaloneConsoleProxyManager 2015-12-04 10:36:16 -02:00
Anshul Gangwar
f8790c3b9e CLOUDSTACK-9025: Fixed can't create usable template from snapshot in Xenserver and Vmware
Fix also reverts below commit as below solution making assumption about hypervisor which are not applicable
in case of XenServer and VmWare

Revert "CLOUDSTACK-8964: Can't create template or volume from snapshot"

This reverts commit ccf5d75cfbe769b34c021ab3653ed318cae25933.
2015-12-04 14:56:40 +05:30
Remi Bergsma
7e902cd505 Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9075 - Uses the same vlan since it should have been already released
  CLOUDSTACK-9075 - Adds VPC static routes test
  CLOUDSTACK-9075 - Covers Private GW ACL with Redundant VPCs
  CLOUDSTACK-9075 - Add method to get list of Physical Networks per zone
  CLOUDSTACK-6276 Removing unused parameter in integration test for projects
  CLOUDSTACK-6276 Removing unused parameter in integration test
  CLOUDSTACK-6276 Fixing affinity groups for projects
2015-12-03 20:42:41 +01:00
Remi Bergsma
9a21873c4a Merge pull request #1134 from pdube/CLOUDSTACK-6276
CLOUDSTACK-6276 Fixing affinity groups for projectsWith some contributions from @resmo and @ustcweizhou.
This closes https://github.com/apache/cloudstack/pull/508

To test manually (need at least 2 hosts):
Create a project
Create an affinity group in that project
Deploy a vm with that affinity group
Deploy a second vm with that affinity group
They should be on different hosts

Ran old and new tests for affinity groups on the simulator

Test create affinity group as admin in project ... === TestName: test_01_admin_create_aff_grp_for_project | Status : SUCCESS ===
ok
Test create affinity group as domain admin for projects ... === TestName: test_02_doadmin_create_aff_grp_for_project | Status : SUCCESS ===
ok
Test create affinity group as user for projects ... === TestName: test_03_user_create_aff_grp_for_project | Status : SUCCESS ===
ok
Test create affinity group that exists (same name) for projects ... === TestName: test_4_user_create_aff_grp_existing_name_for_project | Status : SUCCESS ===
ok
#Delete Affinity Group by id. ... === TestName: test_01_delete_aff_grp_by_id | Status : SUCCESS ===
ok
#Delete Affinity Group by id should fail for user not in project ... === TestName: test_02_delete_aff_grp_by_id_another_user | Status : SUCCESS ===
ok
test DeployVM in anti-affinity groups ... === TestName: test_01_deploy_vm_anti_affinity_group | Status : SUCCESS ===
ok
test DeployVM in anti-affinity groups with more vms than hosts. ... === TestName: test_02_deploy_vm_anti_affinity_group_fail_on_not_enough_hosts | Status : SUCCESS ===
ok
List affinity group for a vm for projects ... === TestName: test_01_list_aff_grps_for_vm | Status : SUCCESS ===
ok
List multiple affinity groups associated with a vm for projects ... === TestName: test_02_list_multiple_aff_grps_for_vm | Status : SUCCESS ===
ok
List affinity groups by id for projects ... === TestName: test_03_list_aff_grps_by_id | Status : SUCCESS ===
ok
List Affinity Groups by name for projects ... === TestName: test_04_list_aff_grps_by_name | Status : SUCCESS ===
ok
List Affinity Groups by non-existing id for projects ... === TestName: test_05_list_aff_grps_by_non_existing_id | Status : SUCCESS ===
ok
List Affinity Groups by non-existing name for projects ... === TestName: test_06_list_aff_grps_by_non_existing_name | Status : SUCCESS ===
ok
List affinity group should list all for a vms associated with that group for projects ... === TestName: test_07_list_all_vms_in_aff_grp | Status : SUCCESS ===
ok
Update the list of affinityGroups by using affinity groupids ... === TestName: test_01_update_aff_grp_by_ids | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 16 tests in 581.706s

OK

Deploy vm as Admin in Affinity Group belonging to regular user (should fail) ... === TestName: test_01_deploy_vm_another_user | Status : SUCCESS ===
ok
Create Affinity Group as admin for regular user ... === TestName: test_02_create_aff_grp_user | Status : SUCCESS ===
ok
List Affinity Groups as admin for all the users ... === TestName: test_03_list_aff_grp_all_users | Status : SUCCESS ===
ok
List Affinity Groups belonging to admin user ... === TestName: test_04_list_all_admin_aff_grp | Status : SUCCESS ===
ok
List Affinity Groups belonging to regular user passing account id and domain id ... === TestName: test_05_list_all_users_aff_grp | Status : SUCCESS ===
ok
List Affinity Groups belonging to regular user passing group id ... === TestName: test_06_list_all_users_aff_grp_by_id | Status : SUCCESS ===
ok
Delete Affinity Group belonging to regular user ... === TestName: test_07_delete_aff_grp_of_other_user | Status : SUCCESS ===
ok
Test create affinity group as admin ... === TestName: test_01_admin_create_aff_grp | Status : SUCCESS ===
ok
Test create affinity group as domain admin ... === TestName: test_02_doadmin_create_aff_grp | Status : SUCCESS ===
ok
Test create affinity group as user ... === TestName: test_03_user_create_aff_grp | Status : SUCCESS ===
ok
Test create affinity group that exists (same name) ... === TestName: test_04_user_create_aff_grp_existing_name | Status : SUCCESS ===
ok
Test create affinity group with existing name but within different account ... === TestName: test_05_create_aff_grp_same_name_diff_acc | Status : SUCCESS ===
ok
Test create affinity group of non-existing type ... === TestName: test_06_create_aff_grp_nonexisting_type | Status : SUCCESS ===
ok
Delete Affinity Group by name ... === TestName: test_01_delete_aff_grp_by_name | Status : SUCCESS ===
ok
Delete Affinity Group as admin for an account ... === TestName: test_02_delete_aff_grp_for_acc | Status : SUCCESS ===
ok
Delete Affinity Group which has vms in it ... === TestName: test_03_delete_aff_grp_with_vms | Status : SUCCESS ===
ok
Delete Affinity Group with id which does not belong to this user ... === TestName: test_05_delete_aff_grp_id | Status : SUCCESS ===
ok
Delete Affinity Group by name which does not belong to this user ... === TestName: test_06_delete_aff_grp_name | Status : SUCCESS ===
ok
Delete Affinity Group by id. ... === TestName: test_08_delete_aff_grp_by_id | Status : SUCCESS ===
ok
Root admin should be able to delete affinity group of other users ... === TestName: test_09_delete_aff_grp_root_admin | Status : SUCCESS ===
ok
Deploy VM without affinity group ... === TestName: test_01_deploy_vm_without_aff_grp | Status : SUCCESS ===
ok
Deploy VM by aff grp name ... === TestName: test_02_deploy_vm_by_aff_grp_name | Status : SUCCESS ===
ok
Deploy VM by aff grp id ... === TestName: test_03_deploy_vm_by_aff_grp_id | Status : SUCCESS ===
ok
test DeployVM in anti-affinity groups ... === TestName: test_04_deploy_vm_anti_affinity_group | Status : SUCCESS ===
ok
Deploy vms by affinity group id ... === TestName: test_05_deploy_vm_by_id | Status : SUCCESS ===
ok
Deploy vm in affinity group of another user by name ... === TestName: test_06_deploy_vm_aff_grp_of_other_user_by_name | Status : SUCCESS ===
ok
Deploy vm in affinity group of another user by id ... === TestName: test_07_deploy_vm_aff_grp_of_other_user_by_id | Status : SUCCESS ===
ok
Deploy vm in multiple affinity groups ... === TestName: test_08_deploy_vm_multiple_aff_grps | Status : SUCCESS ===
ok
Deploy multiple vms in multiple affinity groups ... === TestName: test_09_deploy_vm_multiple_aff_grps | Status : SUCCESS ===
ok
Deploy VM by aff grp name and id ... === TestName: test_10_deploy_vm_by_aff_grp_name_and_id | Status : SUCCESS ===
ok
List affinity group for a vm ... === TestName: test_01_list_aff_grps_for_vm | Status : SUCCESS ===
ok
List multiple affinity groups associated with a vm ... === TestName: test_02_list_multiple_aff_grps_for_vm | Status : SUCCESS ===
ok
List affinity groups by id ... === TestName: test_03_list_aff_grps_by_id | Status : SUCCESS ===
ok
List Affinity Groups by name ... === TestName: test_04_list_aff_grps_by_name | Status : SUCCESS ===
ok
List Affinity Groups by non-existing id ... === TestName: test_05_list_aff_grps_by_non_existing_id | Status : SUCCESS ===
ok
List Affinity Groups by non-existing name ... === TestName: test_06_list_aff_grps_by_non_existing_name | Status : SUCCESS ===
ok
List affinity group should list all for a vms associated with that group ... === TestName: test_07_list_all_vms_in_aff_grp | Status : SUCCESS ===
ok
Update the list of affinityGroups by using affinity groupids ... === TestName: test_01_update_aff_grp_by_ids | Status : SUCCESS ===
ok
Update the list of affinityGroups by using affinity groupnames ... === TestName: test_02_update_aff_grp_by_names | Status : SUCCESS ===
ok
Update the list of affinityGroups for vm which is not associated ... === TestName: test_03_update_aff_grp_for_vm_with_no_aff_grp | Status : SUCCESS ===
ok
Update the list of Affinity Groups to empty list ... SKIP: Skip - Failing - work in progress
Update the list of Affinity Groups on running vm ... === TestName: test_05_update_aff_grp_on_running_vm | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 42 tests in 976.432s

OK (SKIP=1)

* pr/1134:
  CLOUDSTACK-6276 Removing unused parameter in integration test for projects
  CLOUDSTACK-6276 Removing unused parameter in integration test
  CLOUDSTACK-6276 Fixing affinity groups for projects

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-03 20:10:16 +01:00
Remi Bergsma
3b511a139d Merge pull request #1155 from DaanHoogland/merge-4.6
Merge 4.6there is one (simple) conflict so for formailty's sake I make this a pull request.
@utscweizhou en @remibergsma please have a look/test-run

* pr/1155:
  CLOUDSTACK-9022: move storage.cleanup related global configurations to StorageManager
  CLOUDSTACK-9022: keep Destroyed volumes for sometime

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-03 19:53:56 +01:00
Wei Zhou
119b27b2c6 CLOUDSTACK-9101: update volume size after resizevolume 2015-12-03 14:54:45 +01:00
Daan Hoogland
f9775de8ff Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9022: move storage.cleanup related global configurations to StorageManager
  CLOUDSTACK-9022: keep Destroyed volumes for sometime

 Conflicts:
	server/src/com/cloud/storage/StorageManagerImpl.java
2015-12-03 10:35:00 +01:00
Remi Bergsma
186e0257c3 Merge pull request #943 from rafaelweingartner/lrg-cs-hackday-009
CLOUDSTACK-8988: Removed unused adapters from async-job-component.xml.I was looking the file /cloud-server/test/async-job-component.xml, and I found an adapter configuration that seems to have no use. The reason for that is explained as follows.

The adapter configuration is the following:
<*adapters key="com.cloud.agent.manager.allocator.StorageAllocator"*>
      <*adapter name="Storage"
        class="com.cloud.agent.manager.allocator.impl.FirstFitStorageAllocator"*>
        <*param name="storage.overprovisioning.factor"*>2<*/param*>
      <*/adapter*>
      <*adapter name="
        class="com.cloud.agent.manager.allocator.impl.RandomStoragePoolAllocator"*>
        <*param name="storage.overprovisioning.factor"*>2<*/param*>
      <*/adapter*>
<*/adapters*>

	class="com.cloud.agent.manager.allocator.impl.FirstFitStorageAllocator"

The class "com.cloud.agent.manager.allocator.impl.FirstFitStorageAllocator" does not exist. The only reference for it is found in the following file:
          -	/cloud-server/test/async-job-component.xml
Therefore, we can conclude that there is no need for this line at that file.

	class="com.cloud.agent.manager.allocator.impl.RandomStoragePoolAllocator"

Additionally, the class RandomStoragePoolAllocator.java is never used. The only reference is found in the following file:
-	/cloud-server/test/async-job-component.xml

I found a project called cloud-plugin-storage-allocator-random. This project has only one package that contains only one class, which is the RandomStoragePoolAllocator.java. Despite the names that are the same, the class in cloud-plugin-storage-allocator-random  project and the class referenced in -	/cloud-server/test/async-job-component.xml have different packages. Therefore, I removed that configuration from async-job-component.xml and the project that contains only the RandomStoragePoolAllocator class that is never used.
Consequently, I had to remove the following lines from the */cloud-client-ui/pom.xml*:
    <*dependency*>
      <*groupId*>org.apache.cloudstack<*/groupId*>
      <*artifactId*>cloud-plugin-storage-allocator-random<*/artifactId*>
      <*version*>${project.version}<*/version*>
    <*/dependency*>

Furthermore, after I removed that configuration I noticed that there is no such class StorageAllocator.java. However, it appears that exists test for it, like the following classes:
-	StorageAllocatorTestConfiguration.java
-	StorageAllocatorTest.java.

I am not sure if these classes are tests for the class StorageAllocator.java and for the possible configuration I have just removed. If they are, we can remove both classes. Can someone help me on checking that?

* pr/943:
  fixed references in async-job-component.xml for storage allocators

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-03 10:27:55 +01:00
Remi Bergsma
17d5bfa32c Merge pull request #841 from karuturi/CLOUDSTACK-8868
CLOUDSTACK-8868: use PasswordGenerator.generateRandomPassword() to generate systemvm passwordsgenerateRandomPassword() is supposed to create root user passwords. Right now it is only used on the guest VMs. The format of the passwords it creates are of the form "random 3-character string with a lowercase character, uppercase character, and a digit" + random n-character string with only lowercase characters".

For whatever reason it was that we use generateRandomPassword() for guest VM root user passwords(maybe more secure?) we should use the same function for system VM root user passwords.

Tests:
manually tested that password is generated in proper format and am able to login to cpvm with the new password. ex: zD2ztm, tR8snbwhq

```
$ mvn -pl server test -Dtest=ConfigurationServerImplTest#testUpdateSystemvmPassword
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.cloud.server.ConfigurationServerImplTest
log4j:WARN No appenders could be found for logger (com.cloud.utils.crypt.EncryptionSecretKeyChecker).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.487 sec - in com.cloud.server.ConfigurationServerImplTest

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.781 s
[INFO] Finished at: 2015-09-16T14:17:07+05:30
[INFO] Final Memory: 60M/466M
[INFO] ------------------------------------------------------------------------
```

* pr/841:
  CLOUDSTACK-8868: change the default vm.password.length to 10
  CLOUDSTACK-8868: use same method to generate passwords for system/guest vms
  removed commented code

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-03 09:58:52 +01:00
Remi Bergsma
4ffad548a5 Merge pull request #1107 from karuturi/CLOUDSTACK-9080
CLOUDSTACK-9080: Resource limits for Primary arent respected during attachprimary store resource limit check is not performed while attaching a
volume to a vm. Added them same.
Also added a marvin test case to verify the same.

Testing:
BEFORE
No error is shown in UI when trying to attach a volume even after reaching the resource limits.

```
mysql> select * from resource_limit where type="primary_storage";
+----+-----------+------------+-----------------+-------------+
| id | domain_id | account_id | type            | max         |
+----+-----------+------------+-----------------+-------------+
| 10 |      NULL |          4 | primary_storage | 21474836480 |
+----+-----------+------------+-----------------+-------------+
1 row in set (0.00 sec)

mysql> select * from resource_count where account_id=4 and type='primary_storage';
+----+------------+-----------+-----------------+-------------+
| id | account_id | domain_id | type            | count       |
+----+------------+-----------+-----------------+-------------+
| 63 |          4 |      NULL | primary_storage | 48318382080 |
+----+------------+-----------+-----------------+-------------+
1 row in set (0.00 sec)
```

AFTER
Following error message is shown in UI and the volume is not attached
![screen shot 2015-11-19 at 5 34 08 pm](https://cloud.githubusercontent.com/assets/186833/11336645/046b5bcc-920d-11e5-97af-3d0da14c0e38.png)

The resource limits stays the same

```
mysql> select * from resource_limit where type="primary_storage";
+----+-----------+------------+-----------------+-------------+
| id | domain_id | account_id | type            | max         |
+----+-----------+------------+-----------------+-------------+
| 10 |      NULL |          4 | primary_storage | 21474836480 |
+----+-----------+------------+-----------------+-------------+
1 row in set (0.01 sec)

mysql> select * from resource_count where account_id=4 and type='primary_storage';
+----+------------+-----------+-----------------+-------------+
| id | account_id | domain_id | type            | count       |
+----+------------+-----------+-----------------+-------------+
| 63 |          4 |      NULL | primary_storage | 48318382080 |
+----+------------+-----------+-----------------+-------------+
1 row in set (0.00 sec)
```

Marvin test: nosetests --with-marvin --marvin-config=setup/dev/advanced.cfg --zone=xen-zone0 --hypervisor=xenserver test/integration/component/test_ps_resource_limits_volume.py

before the change

```
# do ... === TestName: test_attach_volume_exceeding_primary_limits | Status : FAILED ===
AssertionError: Resource count 23 should match with the expected resource count 22\n
```

After the change

```
# do ... === TestName: test_attach_volume_exceeding_primary_limits | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 1 test in 1178.354s

OK
```

* pr/1107:
  CLOUDSTACK-9080: Resource limits for Primary arent respected during attach.

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-03 09:43:31 +01:00
weingartner
7453727c7b Removed PlannerBase empty class
The PlannerBase is an empty class, and does not bring contribution to
ACS code.
We changed com.cloud.deploy.FirstFitPlanner to extend the AdapterBase
and implements the com.cloud.deploy.DeploymentPlanner.

We also removed the method
com.cloud.deploy.DeploymentPlanner.check(VirtualMachineProfile,
DeploymentPlan, DeployDestination, ExcludeList) that was not used
anywhere.

Additionally, we removed the “_” from FirstFitPlanner's attributes name,
in order to have them in a more standard way.
2015-12-01 11:45:23 -02:00
Wei Zhou
4ed1e0d5f8 CLOUDSTACK-9022: move storage.cleanup related global configurations to StorageManager 2015-11-30 20:44:05 +01:00
Wei Zhou
9077c9a5b4 CLOUDSTACK-9022: keep Destroyed volumes for sometime 2015-11-30 20:43:13 +01:00
Wei Zhou
ccf770636c CLOUDSTACK-9051: reprogram network as a part of vm nic ip update 2015-11-30 09:20:26 +01:00
Wei Zhou
c01c73e44d CLOUDSTACK-9051: add unit tests for UpdateVmNicIp 2015-11-30 09:20:26 +01:00
Wei Zhou
b79d338f29 CLOUDSTACK-9051: update nic IP address of stopped vm 2015-11-30 09:20:25 +01:00
Daan Hoogland
20dcc25884 Merge pull request #834 from maneesha-p/CLOUDSTACK-8866
CLOUDSTACK-8866 : restart.retry.interval is being used instead of migrate.retry.interval during host maintenanceThe frequency at which Cloudstack tries to migrate the VMs is currently controlled by the global parameter "restart.retry.interval" which has a default value of 600 seconds or 10 minutes.This has to be changed to use "migrate.retry.interval" which by default is 120 seconds or 2 minutes . Cloudstack uses restart.retry.interval for all operations-migrate,restart,stop,destroy.

* pr/834:
  CLOUDSTACK-8866 : restart.retry.interval is being used instead of migrate.retry.interval during host maintenance

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-11-30 07:45:55 +01:00
Harikrishna Patnala
c9cc2ccd6d CLOUDSTACK-9094: Multiple threads are being used to collect the stats from the same VR
Same thread is being intialised by two managers, VirtualNetworkApplianceManager and VpcVirtualNetworkApplianceManager
2015-11-30 12:14:15 +05:30
Remi Bergsma
7e64c12067 Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9020: UI enhancements from metrics view
  CLOUDSTACK-9064: The users should be able to create multiple Guest Shared Networks in same Vlan ID, same Physical Network and same network, just with a different IP ranges.
  CLOUDSTACK-9078: Gave scripts executable permissions.
  CLOUDSTACK-9076: Changed ownership of directory /var/lib/cloudstack to cloud.
  Cannot list vlanipranges by keyword
2015-11-29 22:00:13 +01:00
Remi Bergsma
17eb420af7 Merge pull request #1085 from ustcweizhou/list-vlanipranges-by-keyword
[4.6] Cannot list vlanipranges by keywordBefore change:

cloudmonkey> list vlanipranges  keyword=118
: Caught: com.mysql.jdbc.JDBC4PreparedStatement@18f36b6e: SELECT vlan.id, vlan.vlan_id, vlan.vlan_gateway, vlan.vlan_netmask, vlan.ip6_gateway, vlan.ip6_cidr, vlan.data_center_id, vlan.description, vlan.ip6_range, vlan.network_id, vlan.physical_network_id, vlan.vlan_type, vlan.uuid, vlan.removed, vlan.created FROM vlan WHERE  ( OR vlan.description LIKE ** NOT SPECIFIED ** )  AND vlan.removed IS NULL  ORDER BY vlan.id ASC  LIMIT 0, 500

After change:

cloudmonkey> list vlanipranges  keyword='118'
count = 1
vlaniprange:
id = 0d80fd9c-cd6b-4f99-96c6-261420e75f58
account = system
domain = ROOT
domainid = 2044762d-c4a5-11e3-8379-005056ac4490
......

* pr/1085:
  Cannot list vlanipranges by keyword

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-29 19:28:01 +01:00
Remi Bergsma
a1d2c531f6 Merge pull request #1007 from ustcweizhou/dedicated-ip-for-domain
[4.7] CLOUDSTACK-8958: add dedicated ips to domain (account for now)For now, we dedicate ip pool to account, however, other accounts in the same domain cannot fetch the ip from this ip pool.
By dedicating ip pool to domain, accounts in the domain can fetch the public ip from same ip pool.

* pr/1007:
  CLOUDSTACK-8958: throw an exception if project account cannot be found
  CLOUDSTACK-8958: add dedicated ips to domain (account for now)

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-29 09:39:25 +01:00
Remi Bergsma
9710046fb9 Merge pull request #1100 from rafaelweingartner/master-lrg-cs-hackday-005
Removal of DefaultUserAuthenticator empty class.The DefaultUserAuthenticator is an empty class, extending from the
AdapterBase and implementing the UserAuthenticator interface. The class
is not being used as a marker and it's sole use is to be extended by
other UserAuthenticators. Noticing that the class had no purpose, I
removed it and made it's children extend from it's superclass and
implement it's interface instead. Also, I removed the @Local tags from
those classes, since EJB is not used anymore.

* pr/1100:
  Removal of DefaultUserAuthenticator empty class

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-29 09:15:50 +01:00
Daan Hoogland
8a5fc16f32 rats 2015-11-28 21:20:07 +01:00
weingartner
49f5a6b02e fixed references in async-job-component.xml for storage allocators 2015-11-28 14:35:21 -02:00
Remi Bergsma
2ae3e0c961 Merge release branch 4.6 to master
* 4.6:
  Fix event UUIDS missing on event bus
  Add select template dropdown when reinstall VM
  CLOUDSTACK-9068: Listing Port Forwarding Rules take too much time to load
2015-11-28 15:12:49 +01:00
weingartner
98594b709b Removal of DefaultUserAuthenticator empty class
The DefaultUserAuthenticator is an empty class, extending the
AdapterBase and implementing the UserAuthenticator interface. The class
is only being used as a marker and it's sole use is to be extended by
other UserAuthenticators. Noticing that the class had no purpose, I
removed it and made it's children extend from it's superclass and
implement it's interface instead. Also, I removed the @Local tags from
those classes, since EJB is not used anymore.
2015-11-27 21:29:50 -02:00
Patrick Dube
c76d317150 CLOUDSTACK-6276 Fixing affinity groups for projects 2015-11-27 14:43:02 -05:00
Rohit Yadav
a15187a57a CLOUDSTACK-4787: Allow users to select disk controller for VM/template
- Adds new controller types in the UI, for selecting root disk controller while
  registering templates
- Fixes bug to not override disk controller type if provided in the details (either
  vm details or from template details)

(cherry picked from commit c7d67628b3ff86802a1ac3b58e0bc05d54afd543)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-11-27 18:52:02 +05:30
Sateesh Chodapuneedi
6a9956e0f5 CLOUDSTACK-4787 Allow selection of scsi controller type in vSphere
commit #7
    So far only 1 controller (scsi or ide) is supported in Cloudstack for ide or
    scsi, this is existing limitation. Added support for 2nd IDE controller. Support adding IDE
    virtual disk to VM. Also added check if VM is running as IDE virtual disk cannot be attached
    to VM if VM is runnning.If user detaches a virtual disk on lower unit number of controller,
    then subsequent attach operation should find free unit number on the controller and attach
    the virtual disk there.

    commit #6
    Let the controllers of existing VMs continue without flip, current busInfo retrieved from
    chain_info field of volume record from database would be preferred over
    controller settings from all configuration settings.

    commit #5
    Editing global configuration param vmware.root.disk.controller osdefault value results
    in loss of previous root disk controller type. Hence root disk's controller type for legacy
    VMs is unknow post that modificaiton by user. If VM is stop/start then we could get this
    infromation from bus info of existing volume. But if user resets VM and then try to start VM.
    The existing bus info would be lost. Hence existing disk info is not available to depend on.
    Using lsilogic or generic scsi controller for ROOT disk of legacy VMs if reset.

    commit #4
    Avoid adding additional (>1) scsi controllers to system vms. While attaching volume to legacy VM
    don't use osdefault optoin which applicable only for VM created with the option enabled, use
    legacy data disk controller type (lsilogic)

    commit #3
    If root disk's controller type is scsi and data disk controller type condenses
    to any of scsi sub-types then data disk controller type would fall back to root disk controller itself. This
    ensures data volumes would be accessible in all cases as controller of root volume would be reliable
    and it means VM has the supported controller. It also avoids mix of scsi controller sub-types in a user instance.
    Also translating disk controller type scsi to lsilogic.

    commit #2
    Support auto detection of recommended virtual disk controller type for specific guest OS.

    commit #1
    Support granual controller types. Add support for controller types in template registration as well.

    Fix white spaces.
    Removed stale HEAD merge lines
    Removed tail of merge lines
    Fixed VmwareResource, removing storage commands that moved to VmwareStorageProcessor.
    removed stale code of controller that is present in processor
    Fixed check style errors.
    Fixed injection.
    Tested with Linux and windows templates. Unable to run iso based tests due to few bugs in register iso area.

    Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>

(cherry picked from commit a4cc987a6f66f20c434942956fffe5951df09e43)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-11-27 18:39:41 +05:30
jeff
7d44e90c8d Fix event UUIDS missing on event bus
The fixing of CLOUDSTACK-8816 introduced a regression that removed the
first class entities in the event bus description property. This is
because everything was changed to use the Class as a key... Everything
but the populateFirstClassEntities method in ActionEventUtils.
2015-11-26 11:19:57 +00:00
Rajani Karuturi
256263492f CLOUDSTACK-9080: Resource limits for Primary arent respected during attach.
primary store resource limit check is not performed while attaching a
volume to a vm. Added them same.
Also added a marvin test case to verify the same.
2015-11-24 11:59:31 +05:30
Remi Bergsma
a2a72887d2 Merge pull request #1021 from koushik-das/CLOUDSTACK-8485
CLOUDSTACK-8485: listAPIs are taking too long to return results- Removed regex. based search/replace of sensitive data on API response introduced as part of commit b0c6d4734724358df97b6fa4d8c5beb0f447745e
- Added new response serializer to skip sensitive data from getting logged based on annotation present in resposne object fields
- Added annotation (@LogLevel(Log4jLevel.Off)) to sensitive response object fields

Ran the following tests on simulator:

test_vm_life_cycle.py

Test advanced zone virtual router ... === TestName: test_advZoneVirtualRouter | Status : SUCCESS ===
ok
Test Deploy Virtual Machine ... === TestName: test_deploy_vm | Status : SUCCESS ===
ok
Test Multiple Deploy Virtual Machine ... === TestName: test_deploy_vm_multiple | Status : SUCCESS ===
ok
Test Stop Virtual Machine ... === TestName: test_01_stop_vm | Status : SUCCESS ===
ok
Test Start Virtual Machine ... === TestName: test_02_start_vm | Status : SUCCESS ===
ok
Test Reboot Virtual Machine ... === TestName: test_03_reboot_vm | Status : SUCCESS ===
ok
Test destroy Virtual Machine ... === TestName: test_06_destroy_vm | Status : SUCCESS ===
ok
Test recover Virtual Machine ... === TestName: test_07_restore_vm | Status : SUCCESS ===
ok
Test migrate VM ... === TestName: test_08_migrate_vm | Status : SUCCESS ===
ok
Test destroy(expunge) Virtual Machine ... === TestName: test_09_expunge_vm | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 10 tests in 306.429s

OK

test_volumes.py

Download a Volume attached to a VM ... === TestName: test_03_download_attached_volume | Status : SUCCESS ===
ok
Delete a Volume attached to a VM ... === TestName: test_04_delete_attached_volume | Status : SUCCESS ===
ok
Detach a Volume attached to a VM ... === TestName: test_05_detach_volume | Status : SUCCESS ===
ok
Delete a Volume unattached to an VM ... === TestName: test_09_delete_detached_volume | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 4 tests in 184.132s

OK

test_network.py

Test for delete account ... === TestName: test_delete_account | Status : SUCCESS ===
ok
Test for Associate/Disassociate public IP address for admin account ... === TestName: test_public_ip_admin_account | Status : SUCCESS ===
ok
Test for Associate/Disassociate public IP address for user account ... === TestName: test_public_ip_user_account | Status : SUCCESS ===
ok
Test for release public IP address ... === TestName: test_releaseIP | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 4 tests in 783.726s

OK

test_routers.py

Test router internal advanced zone ... SKIP: Marvin configuration has no host credentials                            to check router services
Test restart network ... === TestName: test_03_restart_network_cleanup | Status : SUCCESS ===
ok
Test router basic setup ... === TestName: test_05_router_basic | Status : SUCCESS ===
ok
Test router advanced setup ... === TestName: test_06_router_advanced | Status : SUCCESS ===
ok
Test stop router ... === TestName: test_07_stop_router | Status : SUCCESS ===
ok
Test start router ... === TestName: test_08_start_router | Status : SUCCESS ===
ok
Test reboot router ... === TestName: test_09_reboot_router | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 7 tests in 42.958s

OK (SKIP=1)

test_global_settings.py

test update configuration setting at zone level scope ... === TestName: test_UpdateConfigParamWithScope | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 1 test in 0.127s

OK

test_resource_detail.py

Test volume detail ... === TestName: test_01_updatevolumedetail | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 1 test in 11.492s

OK

* pr/1021:
  CLOUDSTACK-8485: listAPIs are taking too long to return results - Removed regex. based search/replace of sensitive data on API response introduced as part of commit b0c6d4734724358df97b6fa4d8c5beb0f447745e - Added new response serializer to skip sensitive data from getting logged based on annotation present in resposne object fields - Added new parameter 'isSensitive' to @Param for marking a field as sensitive in response objects

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-23 12:56:25 +01:00
Remi Bergsma
36d0bfdecf Merge pull request #1018 from DaanHoogland/CID-1338016
CID 1338016: multi catch instead of pokemon

* pr/1018:
  CID 1338016: multi catch instead of pokemon

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-23 11:34:24 +01:00
Remi Bergsma
a6b6f4104d Merge pull request #1102 from rafaelweingartner/master-lrg-cs-hackday-006
Removed unnecessary @Local annotations and their respective importsFollowing @rafaelweingartner 's findings in PR #714 that many spring beans contained an @Local annotation, we've decided to remove said annotations and their imports from the ComponentLifecycleBase class and its subclasses seeking a reduction of a few hundred lines of useless code.

I had already opened a pull request for this (#853) but at some point my commit disappeared from the PR entirely, showing no new changes in code, which caused it to be merged automatically (with no changes).

* pr/1102:
  Removed unnecessary @Local annotations and their respective imports from the ComponentLifecycleBase class and its subclasses.

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-23 11:25:43 +01:00
Remi Bergsma
3f6d7796f1 Merge pull request #929 from karuturi/CLOUDSTACK-8951
[4.7] CLOUDSTACK-8951: validation for config param "remote.access.vpn.psk.length"throwing error for value < 8 and value > 256
right now, 8, 256 are hardcoded in the code. They should be moved to a
constant and has to be reused everywhere.

will update with test cases/testing later.

* pr/929:
  CLOUDSTACK-8951: validation for "remote.access.vpn.psk.length"

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-23 11:22:42 +01:00