260 Commits

Author SHA1 Message Date
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
Koushik Das
a4dc271253 CLOUDSTACK-9105: Logging enhancement: Handle/reference to track API calls end to end in the MS logs
Added logid to logging framework, now all API call logs can be tracked with this id end to end
2015-12-04 12:45:57 +05:30
cirstofolini
1a64c247ad Removed unnecessary @Local annotations and their respective imports from the ComponentLifecycleBase class and its subclasses. 2015-11-21 18:31:11 -02:00
Remi Bergsma
1f53f2a93e Updating pom.xml version numbers for release 4.7.0-SNAPSHOT
Signed-off-by: Remi Bergsma <github@remi.nl>
2015-11-15 18:54:13 +01:00
Wido den Hollander
f44a5c79b3 CLOUDSTACK-8840: Systemd service for the Usage Server
There already was a uncompleted systemd service file for the Usage
Server.

This new one replaces sysvinit and the old systemd service file.
2015-09-14 13:30:32 +02:00
Rajani Karuturi
8bc0294014 Revert "Merge pull request #714 from rafaelweingartner/master-lrg-cs-hackday-003"
This reverts commit cd7218e241a8ac93df7a73f938320487aa526de6, reversing
changes made to f5a7395cc2ec37364a2e210eac60720e9b327451.

Reason for Revert:

noredist build failed with the below error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project cloud-plugin-hypervisor-vmware: Compilation failure
[ERROR] /home/jenkins/acs/workspace/build-master-noredist/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java:[484,12] error: non-static variable logger cannot be referenced from a static context
[ERROR] -> [Help 1]

even the normal build is broken as reported by @koushik-das on dev list
http://markmail.org/message/nngimssuzkj5gpbz
2015-08-31 11:27:57 +05:30
Rafael Weingartner
3818257a68 Solved jira ticket: CLOUDSTACK-8750 2015-08-28 22:35:08 -03:00
Daan Hoogland
afcdbc42ab CLOUDSTACK-8656: log initialisation logging 2015-08-04 11:29:27 +02:00
Abhinandan Prateek
60b6dc1368 CLOUDSTACK-8467: set version to unknown instead of null 2015-05-13 12:28:50 +05:30
Abhinandan Prateek
bcb33b3815 adding simple logging for java version dependency 2015-05-13 10:57:37 +05:30
Abhinandan Prateek
8a1ec9d0f6 adding mysql dependency for usage 2015-05-13 10:11:22 +05:30
Rohit Yadav
069aa4e5f3 CLOUDSTACK-8433: remove awsapi db usage and add upgrade cleanup path
- Removes awsapi db properties usage across codebase
- Removes references from spring xmls, test cases and TransactionLegacy
- Adds sql command to drop database cloudbridge in schema-451to460-cleanup.sql

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-05-06 15:22:04 +02:00
Kishan Kavala
30ab4d3d66 For Vm snapshot delete event, check for null size and set it as zero 2015-01-07 14:15:59 +05:30
Kishan Kavala
84c25f7025 Skip older records which generate negative duration usage 2015-01-07 11:49:50 +05:30
Rohit Yadav
1e0880cbab CLOUDSTACK-7903: Fix build regression from previous fix
The previous fix tried to access StatsCollector from UsageManagerImpl
which is not possible due to dependency cycle.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-12-01 16:35:23 +05:30
Ilia Shakitko
9b907902d2 CLOUDSTACK-7903: Decreased minimal usage aggregation range value
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-12-01 15:52:00 +05:30
Hugo Trippaers
fe0168f6d2 CID-1116546 Fix resource leak 2014-11-18 14:30:55 +01:00
Hugo Trippaers
4ebaf0a583 Bump master version to 4.6.0-SNAPSHOT after branching 4.5.0-SNAPSHOT 2014-10-29 14:54:23 +01:00
Vincent Bernat
2401eb927b CLOUDSTACK-7633: fix "Provides" in most LSB headers
In init.d scripts, the LSB header may specify what kind of service is
provided by an init script. If spaces are used, this means the init
script is providing several boot facilities. We fix that by using an
hyphen.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-25 16:56:53 +02:00
Rohit Yadav
91fd8d7cd5 CLOUDSTACK-7528: More verbose logging when sending alert fails
When sendAlert is called on an AlertManager impl, if it fails it logs that
something was wrong but does not log the body of the issue/error. This means
we tell the user/admin that there was an issue but don't share the "issue"
with them at all as the email alert fail (or that they were not initialized).

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 885c02dbd8b40d654f4a84fca8474ff88bc7ca5e)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	server/src/com/cloud/alert/AlertManagerImpl.java
	usage/src/com/cloud/usage/UsageAlertManagerImpl.java
2014-09-10 11:38:47 +02:00
Hugo Trippaers
dc3f0cbc63 Improve the handling of the findbug exclude files 2014-09-03 10:41:22 +02:00
Anthony Xu
90fe6d8087 removed trailing space 2014-08-13 11:09:38 -07:00
Hugo Trippaers
676b2d1569 Fix overflow before widening issues reported by Coverity 2014-07-24 13:22:14 +02:00
Kishan Kavala
421d6029db Remove cloud-server dependency for cloud-usage project 2014-07-02 15:28:42 +05:30
Santhosh Edukulla
1c80185170 Fixed Resource Leaks, null dereferences, invalid value comparisons, invalid result set loop
Signed-off-by: Daan Hoogland <daan@onecht.net>
2014-06-21 12:38:46 +02:00
Olivier Lemasle
a5902f1db4 CLOUDSTACK-6850: Return cpu cores, cpu speed and memory in listUsageRecords
Signed-off-by: Sebastien Goasguen <runseb@gmail.com>
2014-06-10 03:11:35 -04:00
Olivier Lemasle
303e6ffc1e CLOUDSTACK-6669: Fix support resize in usage server
Signed-off-by: Sebastien Goasguen <runseb@gmail.com>
2014-06-07 04:45:44 -04:00
Hugo Trippaers
703febc64b Fix CID-1147052 Use try-with-resources to fix the leak 2014-06-03 17:20:16 +02:00
Rajani Karuturi
bdde5335f9 FIXED CLOUDSTACK-6669 Support volume resize in usage server 2014-05-30 15:03:02 +05:30
Harikrishna Patnala
14f1b96b51 CLOUDSTACK-6466: cpu and ram is not getting updated correctly in usage_vm_instance table for usage type 2 2014-05-05 11:50:48 +05:30
Daan Hoogland
8b62b2cb92 findbugs: exclude known spiffy hacks a.k.a. false positives 2014-03-28 14:28:10 +01:00
Hugo Trippaers
4402685e11 Update master to 4.5.0-SNAPSHOT 2014-03-14 14:55:26 +01:00
Hugo Trippaers
ac00ab0087 Cleanup all mysql dependencies and set all to provided. 2014-02-21 14:55:11 +01:00
Alex Huang
ae8560b195 Moved security out into its own jar. Will be adding more to it. Fixed a few white space issues brought up by checkstyle in eclipse. 2014-01-09 16:12:25 -08:00
Harikrishna Patnala
95fa931ff2 CLOUDSTACK-5515: #cpu ,cpuspeed and ram is set to NULL in usage db(usage_vm_instance table) after vm stop and start Fixed populating usage event details in usage db on vm start/upgrade/dynamic_scale 2013-12-30 12:20:33 +05:30
Alex Huang
c2baed665b Moved the check-style.xml into the tools directory given that we're not using the project to reference the style any longer. Fixed problems with eclipse complaining about copy-dependencies 2013-12-20 17:21:34 -08:00
Daan Hoogland
2e91cbe1ae rats 2013-12-18 14:30:26 +01:00
Antonio Fornie
55a6df4501 Resources leaks, refactoring and testing
Removing resource leaks from UsageSanityChecker and
refactoring it (encapsulation, removal of copy and paste, constants...)

Modularize static method for closing Statments in TransactionLegacy
and reusing this new method from other classes (Upgrade2214to30)

Create Unit and Integration Tests for UsageSanityChecker

Add DBUnit cases and integration profile for nitegration tests as
a base for future DB tests
2013-12-18 10:55:04 +01:00
Alex Huang
be5e5cc641 All Checkstyle problems corrected 2013-12-12 12:26:07 -08:00
Alena Prokharchyk
bd6f706b72 CLOUDSTACK-5261: added support for Alert publishing via ROOT Admin API
Conflicts:
	engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
	engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
	engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
	engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
	engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
	plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
	plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
	plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
	server/src/com/cloud/alert/AlertManagerImpl.java
	server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
	server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
	server/src/com/cloud/configuration/ConfigurationManagerImpl.java
	server/src/com/cloud/ha/HighAvailabilityManagerExtImpl.java
	server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
	server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
	server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
	server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
	server/src/com/cloud/vm/UserVmManagerImpl.java
	usage/src/com/cloud/usage/UsageAlertManagerImpl.java
	usage/src/com/cloud/usage/UsageManagerImpl.java

listAlerts: introduced new parameter "name" to the alertResponse

Conflicts:
	api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
	server/src/com/cloud/alert/AlertManagerImpl.java
	usage/src/com/cloud/usage/UsageAlertManagerImpl.java

Added new Admin API - generateAlert. Available to ROOT admin only

Conflicts:
	api/src/org/apache/cloudstack/alert/AlertService.java
	api/src/org/apache/cloudstack/api/BaseCmd.java
	usage/src/com/cloud/usage/UsageAlertManagerImpl.java

listAlerts: implemented search by alert name

Conflicts:
	api/src/org/apache/cloudstack/alert/AlertService.java
	api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
	engine/schema/src/com/cloud/alert/AlertVO.java
2013-12-04 10:05:46 -08:00
Bharat Kumar
68406ba29d CLOUDSTACK-5161 enable scaling of a vm using custom offering
Signed-off-by: Koushik Das <koushik@apache.org>
2013-11-29 17:53:33 +05:30
Harikrishna Patnala
b2f0a0bce2 CLOUDSTACK-4737: handling usage events for dynamic compute offering
Signed-off-by: Koushik Das <koushik@apache.org>
2013-11-26 17:07:30 +05:30
Alex Huang
433a631916 Reformat of source code to set a stable base for the future. I couldn't get checkstyle enabled. There's still about a thousand errors from checkstyle. Most of it from length errors from comments and strings. Will attempt to remove those tonight. This change is so large I just want to get it in before any merge nightmares. The changes are fairly minor though and I did a full compile and start a server with the reformat code. 2013-11-21 07:56:47 -08:00
Hugo Trippaers
cf715ff491 Bump 4.3.0 to 4.4.0 in master 2013-11-21 16:01:15 +01: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
Hugo Trippaers
29aa4ae8da Get rid of some errors and warnings in the server and usage sources 2013-11-04 20:01:14 +01:00
Hugo Trippaers
9d2271d115 Revert "fixed m2eclipse error" because it breaks packaging
This reverts commit 5bcd8280fdd1e9039a6bf6c4c4fd43b8b49f938e.
2013-10-30 20:17:59 +01:00
Anthony Xu
5bcd8280fd fixed m2eclipse error 2013-10-29 15:20:49 -07:00