102 Commits

Author SHA1 Message Date
John Bampton
7ba43e447c
Enable flake8 rule W292 No newline at end of file (#6274)
https://www.flake8rules.com/rules/W292.html
2022-06-30 12:08:27 +05:30
dahn
b363fd49f7 Vmware offline migration (#2848)
* - Offline VM and Volume migration on Vmware hypervisor hosts
- Also add VM disk consolidation call on successful VM migrations

* Fix indentation of marvin test file and reformat against PEP8

* * Fix few comment typos
* Refactor debug messages to use String.format() when debug log level is enabled.

* Send list of commands returned by hypervisor Guru instead of explicitly selecting the first one

* Fix unhandled NPE during VM migration

* Revert back to distinct event descriptions for VM to host or storage pool migration

* Reformat test_primary_storage file against PEP-8 and Remove unused imports

* Revert back the deprecation messages in the custom StringUtils class to favour the use of the ApacheUtils
2019-01-25 10:05:13 -02:00
Rohit Yadav
b88681de18 Merge branch '4.11' 2018-02-10 18:32:46 +01:00
Dingane Hlaluku
38ccbfb79c CLOUDSTACK-9663: updateRole cmd to return updated role as JSON (#2406)
This fixes updateRole to return a role response, like other update APIs.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2018-02-10 18:25:25 +01:00
Marc-Aurèle Brothier
893a88d225 CLOUDSTACK-10105: Use maven standard project structure in all projects (#2283)
Remove maven standard module (which only a few were using) and get ride of maven customization for the projects structure.

- moved all directories to src/main/java, src/main/resources, src/main/scripts, src/test/java, src/test/resources
- grep scan to search for src/com and src/org left over
- grep for <project>/scripts to fix pom.xml configuration
- remove custom <build> configuration in pom.xml

Signed-off-by: Marc-Aurèle Brothier <m@brothier.org>
2018-01-20 03:19:27 +05:30
Wido den Hollander
885f561791 CLOUDSTACK-8313: Support overprovisioning for local storage (#2356)
This used to work in earlier version but was broken during a earlier
refactor.

This commit restores the functionality, but is also adds a boolean
per storage pool type if it supports overprovisioning.

This removes the nasty if which hard codes it.

UnitTests are also added to this commit to verify this functionality
remains stable in future releases.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2017-12-12 20:57:21 +05:30
Rohit Yadav
41fdb88970 CLOUDSTACK-10047: DVSwitch fixes and improvements (#2293)
Allow security policies to apply on port groups:
- Accepts security policies while creating network offering
- Deployed network will have security policies from the network offering
  applied on the port group (in vmware environment)
- Global settings as fallback when security policies are not defined for a network
  offering
- Default promiscuous mode security policy set to REJECT as it's the default
  for standard/default vswitch

Portgroup vlan-trunking options for dvswitch: This allows admins to define
a network with comma separated vlan id and vlan
range such as vlan://200-400,21,30-50 and use the provided vlan range to
configure vlan-trunking for a portgroup in dvswitch based environment.

VLAN overlap checks are performed for:
- isolated network against existing shared and isolated networks
- dedicated vlan ranges for the physical/public network for the zone
- shared network against existing isolated network

Allow shared networks to bypass vlan overlap checks: This allows admins
to create shared networks with a `bypassvlanoverlapcheck` API flag
which when set to 'true' will create a shared network without
performing vlan overlap checks against isolated network and against
the vlans allocated to the datacenter's physical network (vlan ranges).

Notes:
- No vlan-range overlap checks are performed when creating shared networks
- Multiple vlan id/ranges should include the vlan:// scheme prefix

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-10-25 15:14:42 +05:30
dahn
285fd77674 CLOUDSTACK-9957 test fix (#2297)
* tyopos in test
* unittest to prove interface
* test logic flaw fixed
2017-10-19 08:57:47 +02:00
Harika Punna
6bb0ca2f85 This feature separates the snapshot creation on primary and its backing up on secondary.
As part of this, a new parameter, which is optional, is added to CreateSnapshotCmd, which seperates the creation and backup.

More details in the FS-
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Separate+creation+and+backup+operations+for+a+volume+snapshot
2017-10-04 14:39:03 +05:30
dahn
597df24b53 CLOUDSTACK-10007: Isolation methods (#2193)
Change isolation methods from an enum to a registry based construct to enhance pluggability
2017-08-03 12:20:37 +02:00
rashmidixit
49a862b223 CLOUDSTACK-9700: Allow user to Register/Copy templates to multiple zones at the same time 2017-05-15 14:07:22 +05:30
Syed
f46651e672 Support Backup of Snapshots for Managed Storage
This PR adds an ability to Pass a new parameter, locationType,
    to the “createSnapshot” API command. Depending on the locationType,
    we decide where the snapshot should go in case of managed storage.

    There are two possible values for the locationType param

    1) `Standard`: The standard operation for managed storage is to
    keep the snapshot on the device. For non-managed storage, this will
    be to upload it to secondary storage. This option will be the
    default.

    2) `Archive`: Applicable only to managed storage. This will
    keep the snapshot on the secondary storage. For non-managed
    storage, this will result in an error.

    The reason for implementing this feature is to avoid a single
    point of failure for primary storage. Right now in case of managed
    storage, if the primary storage goes down, there is no easy way
    to recover data as all snapshots are also stored on the primary.
    This features allows us to mitigate that risk.
2016-10-30 23:19:58 -06:00
Rohit Yadav
4347776ac6 CLOUDSTACK-8562: DB-Backed Dynamic Role Based API Access Checker
This feature allows root administrators to define new roles and associate API
permissions to them.

A limited form of role-based access control for the CloudStack management server
API is provided through a properties file, commands.properties, embedded in the
WAR distribution. Therefore, customizing API permissions requires unpacking the
distribution and modifying this file consistently on all servers. The old system
also does not permit the specification of additional roles.

FS:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Role+Based+API+Access+Checker+for+CloudStack

DB-Backed Dynamic Role Based API Access Checker for CloudStack brings following
changes, features and use-cases:
- Moves the API access definitions from commands.properties to the mgmt server DB
- Allows defining custom roles (such as a read-only ROOT admin) beyond the
  current set of four (4) roles
- All roles will resolve to one of the four known roles types (Admin, Resource
  Admin, Domain Admin and User) which maintains this association by requiring
  all new defined roles to specify a role type.
- Allows changes to roles and API permissions per role at runtime including additions or
  removal of roles and/or modifications of permissions, without the need
  of restarting management server(s)

Upgrade/installation notes:
- The feature will be enabled by default for new installations, existing
  deployments will continue to use the older static role based api access checker
  with an option to enable this feature
- During fresh installation or upgrade, the upgrade paths will add four default
  roles based on the four default role types
- For ease of migration, at the time of upgrade commands.properties will be used
  to add existing set of permissions to the default roles. cloud.account
  will have a new role_id column which will be populated based on default roles
  as well

Dynamic-roles migration tool: scripts/util/migrate-dynamicroles.py
- Allows admins to migrate to the dynamic role based checker at a future date
- Performs a harder one-way migrate and update
- Migrates rules from existing commands.properties file into db and deprecates it
- Enables an internal hidden switch to enable dynamic role based checker feature

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-11 09:45:19 +05:30
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
Wei Zhou
c01c73e44d CLOUDSTACK-9051: add unit tests for UpdateVmNicIp 2015-11-30 09:20:26 +01:00
Rajani Karuturi
863931a992 CLOUDSTACK-8816: some of the events do not have resource uuids
the key for an entity is sometimes an object a String with value
object.toString() due to serialization and deserialization of them.
Addressed this in the getter of CallContext to check for key.toString
if an object is not found with key.
2015-10-26 09:15:31 +05:30
Rajani Karuturi
1865433e69 unittests to verify empty password is not allowed during account create 2015-09-11 15:52:38 +05:30
John Burwell
ef44c7d305 CLOUDSTACK-8566: Strips the username and password credentials from host details
... map returned by the following API calls by filtering these fields from the
details attribute in the HostResponse class:

  * listHosts
  * addHost
  * cancelHostMaintenance
  * listHosts
  * prepareHostForMaintenance
  * reconnectHost
  * updateHost

This fix addresses CVE 2015-3251.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 3a48171bd8a70c6012afce32c7636afffc1d2f7d)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-14 10:49:40 +05:30
Daan Hoogland
520e0c8de0 CLOUDSTACK-8656: code in comment removed 2015-07-30 15:52:17 +02:00
wilderrodrigues
984fafce77 CLOUDSTACK-8641 - Adding unit tests
- Making sure that the boolean value is false and also that the updateHostPassword() method gets called.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #596
2015-07-16 18:28:27 +05:30
Daan Hoogland
4bba499412 rats: licenses missing 2015-07-06 17:04:26 +02:00
Daan Hoogland
a71c985223 findbugs: added test for getServiceProvider of CreateVpcOffering api
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #538
2015-07-06 16:22:19 +02:00
Pierre-Luc Dion
ed6016cf8e CreateSecondaryStagingStoreCmdTest.java: add license header 2014-11-30 23:15:15 -05:00
Laszlo Hornyak
b838436e58 cleanup around seemingly impossible cast
- changed type parameters on details map in CreateSecondaryStagingStoreCmd - <String, String> was misleading since it can not work with a string value and it is never a string
- introducing the type parameters allowed some simplifications in getDetails()
- added unit test

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Signed-off-by: Pierre-Luc Dion <pdion891@apache.org>
2014-11-30 23:11:14 -05:00
Santhosh Edukulla
ef6ec7b276 Fixed few coverity issues like invalid boxing unboxing issues, resource leaks, null dereferences 2014-11-13 17:26:24 +05:30
Harikrishna Patnala
edf1047a20 CLOUDSTACK-7706: Coverity defects
Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
2014-11-11 20:58:45 +05:30
SrikanteswaraRao Talluri
0e223d6787 Merge branch 'master' into marvin
Conflicts:
	test/integration/component/test_base_image_updation.py
	test/integration/component/test_cpu_domain_limits.py
	test/integration/component/test_cpu_limits.py
	test/integration/component/test_cpu_project_limits.py
	test/integration/component/test_ip_reservation.py
	test/integration/component/test_memory_limits.py
	test/integration/component/test_mm_domain_limits.py
	test/integration/component/test_mm_project_limits.py
	test/integration/component/test_persistent_networks.py
	test/integration/component/test_portable_ip.py
	test/integration/component/test_routers.py
	test/integration/smoke/test_deploy_vm.py
	test/integration/smoke/test_deploy_vm_with_userdata.py
	test/integration/smoke/test_internal_lb.py
	test/integration/smoke/test_vm_life_cycle.py
	test/integration/smoke/test_volumes.py
	tools/marvin/marvin/codes.py
	tools/marvin/marvin/configGenerator.py
	tools/marvin/marvin/lib/base.py
	tools/marvin/marvin/lib/common.py
	tools/marvin/marvin/lib/utils.py
2014-04-08 17:53:37 +05:30
Min Chen
99bdc8d875 Merge branch 'master' into rbac. 2014-03-13 11:05:03 -07:00
Antonio Fornie
c211f0bbbe Dispatcher corrections, refactoring and tests
Corrects problems from previous attempt. Fixes based on help comments from
the community and conflict resolution

Signed-off-by: Daan Hoogland <daan@onecht.net>
2014-03-07 19:12:07 +01:00
Santhosh Edukulla
bf72441d13 CLOUDSTACK-6006: Remove integration folder and lib 2014-02-04 12:01:58 +05:30
Min Chen
929fbabaa2 Merge branch 'master' into rbac. 2014-01-17 14:37:08 -08:00
Min Chen
649d9d927f CLOUDSTACK-5840:Migration from NFS to S3 should be done in one API
(updateCloudToUseObjectStore) instead of two APIs.
2014-01-08 17:25:13 -08:00
Alena Prokharchyk
b15431e574 CLOUDSTACK-5810: addSecondaryIp to vm's nic - derive the ip owner from the vm instance account, not from the caller 2014-01-06 17:09:14 -08:00
Daan Hoogland
6d0dbf5968 check for BroadcastDomainTypes on sourceNatIp 2014-01-06 22:13:51 +01:00
Alex Huang
be5e5cc641 All Checkstyle problems corrected 2013-12-12 12:26:07 -08:00
Min Chen
d252d95c26 Separate all vm related user APIs to have two different views. 2013-12-09 17:30:57 -08:00
Alex Huang
d620df2bdd Reformatted all of the code. 2013-11-21 06:15:26 -08:00
Alex Huang
224f479974 Removed trailing spaces 2013-11-21 04:08:01 -08:00
Alex Huang
8d62744681 Reformat all source code. Added checkstyle to check the source code 2013-11-20 07:26:53 -08:00
Alena Prokharchyk
78b1ac4126 CLOUDSTACK-3868: fixed "count" param in listUsageRecords API to return the actual number of records matching the search criteria. Used to return the wrong value - the number of records per page
Conflicts:
	server/src/com/cloud/usage/UsageServiceImpl.java
	utils/src/com/cloud/utils/db/GenericDaoBase.java
2013-10-31 15:25:57 -07:00
Daan Hoogland
2614b00c51 sdn hosted vpc gateways (using lswitch) 2013-09-18 16:56:56 +02:00
Alex Huang
b8e79c30a8 Compile complete 2013-09-06 15:40:37 -07:00
Daan Hoogland
53d09c6f18 uri code per broadcast/isolation type , default is to accept anything as uri , vlan and lswitch need some extra tlc
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
2013-08-15 14:26:26 +02:00
Alex Huang
5495f10bce Revert "Reverting the range of commits that broke the build"
This reverts commit b59e3aaefced03d40d5b4b63c421c69743bcd387.
2013-08-08 15:02:40 -07:00
Prasanna Santhanam
b59e3aaefc Reverting the range of commits that broke the build
This reverts commits 30c33415..f6a2c817bc

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-08-08 14:46:56 +05:30
Alex Huang
f6a2c817bc Unit test successful. Had to comment out a timing test from Amogh 2013-08-07 16:41:06 -07:00
Alex Huang
5287f4c9ec Got everything running through testing 2013-08-07 16:41:06 -07:00
Min Chen
151a7ee497 CLOUDSTACK-3861 and CLOUDSTACK-3862: Deprecate old S3/Swift classes. 2013-08-02 18:16:46 -07:00
Alex Huang
f5e5b39c9b Moved the DB layer code into framework-db and change only the necessary projects to refer to it. Cut down on the dependencies introduced with all the code in utils. 2013-07-26 15:02:10 -07:00
Alex Huang
555211a080 Moved Configuration from api to utils and moved the package. This was done by eclipse so I only ran the unit test to verify everything is fine 2013-07-25 03:57:12 -07:00