Commit Graph

629 Commits

Author SHA1 Message Date
Abhishek Kumar 895c617592 remove unused method
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-22 18:33:39 +05:30
Abhishek Kumar aae3a0a0b8 refactor to retrieve host count and cpu sockets in single query
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-20 19:58:43 +05:30
Abhishek Kumar 0ca8722c38 Merge remote-tracking branch 'apple/scalability-improvements' into scalability-improvements-fixes 2024-09-23 14:47:25 +05:30
Abhishek Kumar 1d0b90f984 Merge remote-tracking branch 'apple/apple-base418' into scalability-improvements 2024-09-23 14:45:21 +05:30
Abhishek Kumar 0728e9ffdb Merge branch 'scalability-improvements' into scalability-improvements-fixes 2024-09-17 16:35:10 +05:30
Abhishek Kumar 1176763755 fix unused imports
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-17 11:46:45 +05:30
Abhishek Kumar 0dd0934483 backport https://github.com/apache/cloudstack/pull/9518
Allows specifying connection pooling library. Default is HikariCP
2024-09-17 11:44:35 +05:30
Abhishek Kumar e1a5bd9ef2 improve agentlb sort when host list not needed
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-13 10:25:31 +05:30
Abhishek Kumar af53644a0b utils: add wrapper for the loading cache
Follow up for #9628
Creates a utility class LazyCache which currently wraps Caffeine library Cache class.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-05 13:29:22 +05:30
Abhishek Kumar 8ee5e6a99a refactor transitioning vm process report
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-04 18:35:23 +05:30
Abhishek Kumar 4400e02a1b
framework/config,server: configkey caching (#472)
Added caching for ConfigKey value retrievals based on the Caffeine
in-memory caching library.
https://github.com/ben-manes/caffeine
Currently, expire time for a cache is 1 minute and each update of the
config key invalidates the cache.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-03 15:53:08 +05:30
mprokopchuk e0d6066935 Bumped pom version to 4.18.1.2 (to add migration SQL script) 2024-08-15 17:55:00 -07:00
Abhishek Kumar 5e98405b38 Merge remote-tracking branch 'apple/apple-base418' into scalability-improvements 2024-07-22 16:12:19 +05:30
Suresh Kumar Anaparti 5c682677fc
Support resource name / displaytext with unicode / emoji chars, and SQL exception msg improvements (#460)
* Don't send sql exception/query from dao to upper layer, log it and send only the error message

* Updated charset to utf8mb4, for display_name column/user_vm table and job_result column/async_job table to support unicode chars & emojis

* Added API arg validator for RFC compliance domain name, to validate VM's host name

* Updated user resources name / display name column's charset to utf8mb4

* Check and update char set for affinity group name to utf8mb4, from the data migration in upgrade path

* Updated backup offering name column charset to utf8mb4

* Added unit tests for vm host/domain name validation

* Added smoke test to check resource name for vm, volume, service & disk offering, template, iso, account(first/lastname)

* Updated resource annotation charset to utf8mb4

* Updated some resources description charset to utf8mb4
2024-07-19 09:35:18 +05:30
Rohit Yadav b46e4d4bbf
framework/cluster: improve cluster service and integration API service (#465)
- mTLS implementation for cluster service communication
- Listen only on the specified cluster node IP address instead of all interfaces
- Validate incoming cluster service requests are from peer management servers based on the server's certificate dns name which can be through global config - ca.framework.cert.management.custom.san
- Hardening of KVM command wrapper script execution
- Improve API server integration port check
- cloudstack-management.default: don't have JMX configuration if not needed. JMX is used for instrumentation; users who need to use it should enable it explicitly

Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Wei Zhou <weizhou@apache.org>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
(cherry picked from commit 4f5561937c)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-07-09 09:03:40 +05:30
Abhishek Kumar 8f88103a29
FR72 - api,server: purge expunged resources (#405)
This PR introduces the functionality of purging removed DB entries for CloudStack entities (currently only for VirtualMachine).
There would be three mechanisms for purging removed resources:
- Background task - CloudStack will run a background task which runs at a defined interval. Other parameters for this task can be controlled with new global settings.
- API - New API `purgeExpungedResources`. It will allow passing the following parameters - resourcetype, batchsize, startdate, enddate
- Config for service offering. Service offerings can be created with purgeresources parameter which would allow purging resources immediately on expunge.

Following new global settings have been added:
- `expunged.resources.purge.enabled`: Default: false. Whether to run a background task to purge the DB records of the expunged resources.
- `expunged.resources.purge.resources`: Default: (empty). A comma-separated list of resource types that will be considered by the background task to purge the DB records of the expunged resources. Currently only VirtualMachine is supported. An empty value will result in considering all resource types for purging.
- `expunged.resources.purge.interval`: Default: 86400. Interval (in seconds) for the background task to purge the DB records of the expunged resources.
- `expunged.resources.purge.delay`: Default: 300. Initial delay (in seconds) to start the background task to purge the DB records of the expunged resources task.
- `expunged.resources.purge.batch.size`: Default: 50. Batch size to be used during purging of the DB records of the expunged resources.
- `expunged.resources.purge.start.time`: Default: (empty). Start time to be used by the background task to purge the DB records of the expunged resources. Use format `yyyy-MM-dd` or `yyyy-MM-dd HH:mm:ss`.
- `expunged.resources.purge.keep.past.days`: Default: 30. The number of days in the past from the execution time of the background task to purge the DB records of the expunged resources for which the expunged resources must not be purged. To enable purging DB records of the expunged resource till the execution of the background task, set the value to zero.
- `expunged.resource.purge.job.delay`: Default: 180. Delay (in seconds) to execute the purging of the DB records of an expunged resource initiated by the configuration in the offering. Minimum value should be 180 seconds and if a lower value is set then the minimum value will be used.

Upstream PRs:
https://github.com/apache/cloudstack/pull/8999
https://github.com/apache/cloudstack-documentation/pull/397

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
2024-06-19 12:59:50 +05:30
Rohit Yadav b03d1382e6 fix unit tests failures
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-23 10:23:32 +05:30
Rohit Yadav c3867a941f more fixmes and todos
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav 7a7f1e2b6e FIXME/TODO: CPU and DB hotspot found
Found these CPU and DB hotspot that handle agent ping commands, this
adds idle load when there are high number of hosts. By design, there
isn't any quick win here. However, the power sync report/handling could
be improved, so it doesn't need to kick-in for every ping command
received.

Few more areas marked in the codebase.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav 8a320b807d engine/schema: cluster dao method query optimisation
Replace list.size() by doing getCount() instead.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav 696927455f framework/db: use HikariCP instead of dbcp2
Replaces dbcp2 connection pool library with more performant HikariCP.
With this unit tests are failing but build is passing.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav f21a00b2de framework/db: use lightweight-ping
As per the docs, the connector-j can use /* ping */ before calling
SELECT 1 to have light weight application pings to the server:
https://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-j2ee-concepts-connection-pooling.html

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav 1c02166d29 framework/db: dont' use validation query as connector is JDBC4 compliant
Per docs, if the mysql connector is JDBC2 compliant then it should use
the Connection.isValid API to test a connection.
(https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#isValid-int-)

This would significantly reduce query lags and API throughput, as for
every SQL query one or two SELECT 1 are performed everytime a Connection
is given to application logic.

This should only be accepted when the driver is JDBC4 complaint.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav 47163df2ff
framework/config: make logic in ::value() defensive (#449)
This adds a NPE check on the s_depot.global() which can cause NPE in
case of unit tests, where s_depot is not null but the underlying config
dao is null (not mocked or initialised) via `s_depot.global()` becomes
null.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:20:37 +05:30
Marcus Sorensen 3a058f3a18
Introduce scheduled executor wrapper with dynamic interval (#424)
* Introduce scheduled executor wrapper with dynamic interval

* Resolve comments

* Add validations

* Add validation for configkey

---------

Co-authored-by: Marcus Sorensen <mls@apple.com>
Co-authored-by: Vishesh <vishesh92@gmail.com>
2024-04-17 14:24:31 +05:30
Vishesh 26c1741af5
Fix listStoragePoolsMetricsCmd (#419) 2024-04-16 15:51:53 +05:30
Marcus Sorensen f896586925
Update version to 4.18.1.1 (#417)
* Update version to 4.18.1.1

* Update changelog

* Update changelog

* Update changelog

---------

Co-authored-by: Marcus Sorensen <mls@apple.com>
2024-04-08 09:27:57 -06:00
Rohit Yadav 0c23820c7c
Merge pull request #414 from shapeblue/security-backport418
Backport upstream security fixes to apple-base418
2024-04-03 19:58:28 +05:30
Vishesh 5137c196c2
HypervisorType as a class (#393)
* HypervisorType as a class

* Fixup

* fixup

* Add missing annotation

* Resolve comments

* Handle parallels typo
2024-04-02 17:35:16 +05:30
Abhishek Kumar 996ae9a959 engine-storage: control download redirection
Add a global setting to control whether redirection is allowed while
downloading templates and volumes

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-04-01 09:23:17 +05:30
dahn cfaac2a67e api: client verification in servlet
This introduces new global settings to handle how client address checks
are handled by the API layer:

proxy.header.verify: enables/disables checking of ipaddresses from a
                     proxy set header
proxy.header.names: a list of names to check for allowed ipaddresses
                    from a proxy set header.
proxy.cidr: a list of cidrs for which \"proxy.header.names\" are
            honoured if the \"Remote_Addr\" is in this list.

(cherry picked from commit b65546636d)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-03-31 22:03:04 +05:30
Marcus Sorensen 6a28cb33ff
update mysql dependency version (#394)
* update mysql dependency version

* Enable scrollTolerantForwardOnly property in the DB connection, to preserve the legacy behavior of Connector - tolerating backward and absolute cursor movements on result sets of type ResultSet.TYPE_FORWARD_ONLY

References:
https://dev.mysql.com/doc/relnotes/connector-j/en/news-8-0-24.html
https://dev.mysql.com/doc/connector-j/en/connector-j-connp-props-result-sets.html#cj-conn-prop_scrollTolerantForwardOnly

---------

Co-authored-by: Marcus Sorensen <mls@apple.com>
Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
2024-03-21 18:08:53 +05:30
Vishesh 4c6c8216d5
Use join instead of views (#365)
* Use join instead of views for filtering volumes

* Use join instead of views for filtering events

* Use join instead of views for filtering accounts

* Use join instead of views for filtering domains

* Use join instead of views for filtering hosts

* Use join instead of views for filtering storage pools

* Use join instead of views for filtering service offerings

* Use join instead of views for filtering disk offerings

* Remove unused code

* Fix unit test

* Use disk_offering instead of disk_offering_view in service_offering_view

* Fixup

* Fix listing of diskoffering & serviceoffering

* Use constants instead of strings

* Make changes to prevent sql injection

* Remove commented code

* Prevent n+1 queries for template's response

* remove unused import

* refactor some code

* Add missing check for service offering's join with disk offering

* Fix n+1 queries for stoage pool metrics

* Remove n+1 queries from list accounts

* Remove unused imports

* remove todo

* Remove unused import

* Fixup query generation for nested joins

* Fixups

* Fix DB exception on ClientPreparedStatement

* events,alerts: Add missing indexes (#366)

* Fixup
2024-03-14 17:49:35 +05:30
Marcus Sorensen 40dd867198
Apple base418 storagepooltype as class (#351)
* StoragePoolType as a class

* Fix agent side StoragePoolType enum to class

* Handle StoragePoolType for StoragePoolJoinVO

* Since StoragePoolType is a class, it cannot be converted by @Enumerated annotation.
Implemented conveter class and logic to utilize @Convert annotation.

* Fix UserVMJoinVO for StoragePoolType

* fixed missing imports

* Since StoragePoolType is a class, it cannot be converted by @Enumerated annotation.
Implemented conveter class and logic to utilize @Convert annotation.

* Fixed equals for the enum.

* removed not needed try/catch for prepareAttribute

* Added license to the file.

* Implemented "supportsPhysicalDiskCopy" for storage adaptor. (#352)

Co-authored-by: mprokopchuk <mprokopchuk@apple.com>

* Add javadoc to StoragePoolType class

* Add unit test for StoragePoolType comparisons

* StoragePoolType "==" and ".equals()" fix.

* Fix for abstract storage adaptor set up issue

* review comments

---------

Co-authored-by: Marcus Sorensen <mls@apple.com>
Co-authored-by: mprokopchuk <mprokopchuk@apple.com>
Co-authored-by: mprokopchuk <mprokopchuk@gmail.com>
Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
2024-01-25 14:58:44 +05:30
kishankavala 99939d22a7
CleanUp Async Jobs after mgmt server maintenance (#356)
* Cleanup Volume AsyncJob after mgmt server stop

* Clean Up Vm async job resources during mggmt server stop

* Use State.isTransitional method to identify trnsition states

* Add cleanup for Network Async Job

* Add license

* Added RevertSnapshotting to volume transition state. Fixed spacing code style

* Added transitional flag in Volume state

* Updated network event for failed job, (re)added cleanup for volumes created from snapshots, and some code improvements

* Added java doc for volume state constructor

* Fixed cleanup SNAPSHOT_ID entry in volume details for failed volumes created from snapshots

---------

Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
2024-01-09 17:54:26 +05:30
Vishesh 63a4efa4c9
Use UserVmDao for listVirtualMachines API to increase performance (#343) 2023-11-10 13:08:30 +05:30
Nicolas Vazquez fe3cf81739 Fix #303: Run recalculation recurrent task only in the longest running management server (#335)
* Run recalculation recurrent task only in the longest running management server

* Fix timeout and recalculation when no child domains

(cherry picked from commit 3f35e3a6ef24017d2f63613ca4362521b1ee78b6)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2023-10-11 20:52:57 +05:30
Marcus Sorensen 5604638b84 Apple base416 passphrase enc (#240)
* Move PassphraseVO to use String instead of byte[] to support Encrypt annotation

* Check for unencrypted passphrases before migrating passphrase table

---------

Co-authored-by: Marcus Sorensen <mls@apple.com>

Fixes #239

This PR moves PassphraseVO passphrase to String type. Since the
GenericDaoBase manipulates encrypted fields as Strings we don't improve
anything by handling as byte arrays. We still use byte arrays to pass
these values down to the agents and we can get some security gains
there.

This PR also handles cases where the passphrase field may be previously
unencrypted, and upgrades them to encrypted fields using the old
encryption during cloudstack-migrate-databases. Then the process can
upgrade to new encryption normally.
2023-09-27 13:24:13 +05:30
Wei Zhou 4bdff06acd Updating pom.xml version numbers for release 4.18.1.0
Signed-off-by: Wei Zhou <weizhou@apache.org>
2023-09-07 08:50:50 +02:00
dahn 73a269e3b3
guarantee MAC uniqueness (#7634)
Co-authored-by: Bryan Lima <42067040+BryanMLima@users.noreply.github.com>
2023-07-19 10:25:01 +02:00
Vishesh 594c70dde0
Sync precommit config from main (#7732)
Co-authored-by: John Bampton <jbampton@users.noreply.github.com>
Co-authored-by: dahn <daan@onecht.net>
2023-07-07 11:18:16 +02:00
Abhishek Kumar 5885045873
refactor: delete unsed serviceoffering classes in quota module (#7439)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2023-04-20 15:18:17 +05:30
Abhishek Kumar afccde5cfc
server,engine-schema: fix listing service offering for vm scale (#7398)
Fixes #7389

Fixes listing of service offerings for VM scale when the current offering has  `disk_offering_strictness=true`

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2023-04-17 14:19:20 +05:30
Daan Hoogland 05cda2729f Updating pom.xml version numbers for release 4.18.1.0-SNAPSHOT
Signed-off-by: Daan Hoogland <daan@onecht.net>
2023-03-15 19:38:14 +01:00
Daan Hoogland 0574087284 Updating pom.xml version numbers for release 4.18.0.0
Signed-off-by: Daan Hoogland <daan@onecht.net>
2023-03-11 09:35:41 +01:00
Bryan Lima 5c20e7844c
Quota VM_DISK tariff calculation (#7152)
Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
2023-02-03 08:43:05 +01:00
Wei Zhou 62e342c1bc
utils,framework/db: Introduce new database encryption cipher based on AesGcmJce (#7003) 2023-02-02 16:25:49 +01:00
Suresh Kumar Anaparti d8c7e34b38
Improve global settings UI to be more intuitive/logical (#5797)
Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
Co-authored-by: nvazquez <nicovazquez90@gmail.com>
Co-authored-by: davidjumani <dj.davidjumani1994@gmail.com>
Co-authored-by: dahn <daan.hoogland@gmail.com>
Co-authored-by: dahn <daan@onecht.net>
2023-01-31 11:23:43 +01:00
John Bampton 52c321a0c6
Fix spelling (#7087) 2023-01-16 10:56:07 +01:00
Daniel Augusto Veronezi Salvador b8b66b7a3d
Fix typos and improve javadocs on ByteScaleUtils (#6877)
Co-authored-by: GutoVeronezi <daniel@scclouds.com.br>
2022-11-10 10:14:24 +01:00