Commit Graph

11683 Commits

Author SHA1 Message Date
Abhishek Kumar 0151f125aa improvement
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-23 20:04:34 +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
Cheng Cheng 9f3380c4be
Add Functionality Enum to HypervisorType (#481)
* Commit for PR https://github.com/shapeblue/cloudstack-apple/pull/471

This PR adds a flag (customType) to HypervisorType to differentiate if a hypervisor plugin is built-in or customized.
With the customType flag, we can isolate conditional checks for allow the customized hypervisor plugin to proceed.

* Add customType field to HypervisorType to differentiate if the plugin is a customized type

* Address @shwstppr's comments

* Define a enum in HypervisorType to indicate specific functionalities of a hypervisor plugin type

* Refactoring to define if the hypervisor supports the operation during
initialization of the HypervisorType.

* Remove ROOT_DISK_SIZE_OVERRIDE_SUPPORTING_HYPERVISORS

---------

Co-authored-by: Annie Li <ji_li@apple.com>
2024-09-18 16:46:06 +05:30
Abhishek Kumar 8941fa550c build fix
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-17 15:50:14 +05:30
Abhishek Kumar 35ed30bd51 continuation of 1d47e4d4ae
list host IDs instead of complete row where possible

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-16 18:03:06 +05:30
Abhishek Kumar 99115b9f09 server: cache cluster host type retrievals during connections
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-13 18:05:54 +05:30
Abhishek Kumar 1d47e4d4ae engine-schema,server,plugins: list host IDs instead whole row where
applicable

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-13 16:19:43 +05:30
Abhishek Kumar fe4ef05053 server,engine-schema: use single query to to list host capacities while
host capacity update

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-13 16:17:47 +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 ad275e7a36 remove dead code
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-12 17:21:00 +05:30
Abhishek Kumar eb74974685 more test fix
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-12 17:00:57 +05:30
Abhishek Kumar 9e5c99ef9e fix tests from a78a2508e9
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-12 16:58:18 +05:30
Suresh Kumar Anaparti 51fea012ef
NPE fix, for test_hostha_kvm_host_fencing (#479) 2024-09-12 16:45:19 +05:30
Abhishek Kumar a78a2508e9 server: refactor MS list retrieval for agent connect
During agent join and while changing configs - host and indirect.agent.lb.algorithm, optimize calling DB for zone's host list

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-12 16:00:17 +05:30
Abhishek Kumar 1d11605787 remove todo as configkey caching is implemented
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-11 13:27:17 +05:30
Abhishek Kumar df137fc387 refactor
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-10 10:22:59 +05:30
mprokopchuk 31229e770b
Merge pull request #476 from shapeblue/update_host_capacity_vm_update_time_fix
Host capacity calculation: use VM creation time if update time is null
2024-09-09 16:41:59 -07:00
mprokopchuk 2755e338d8
Merge pull request #477 from shapeblue/list_events_sql_error
List Events returns intermittent SQL exception.
2024-09-09 16:41:20 -07:00
mprokopchuk fc79a87050 Fixed code review comments 2024-09-09 15:56:15 -07:00
mprokopchuk 97b07dbaae Fixed code review comments 2024-09-09 15:54:44 -07:00
Abhishek Kumar 61764aba1f cache and executors refactoring
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-09 19:39:50 +05:30
mprokopchuk 8cabccdbae Fixed listEvents intermittent exception:
com.mysql.cj.jdbc.ClientPreparedStatement: SELECT event_view.id, event_view.uuid, event_view.type, event_view.state, event_view.description, event_view.created, event_view.user_id, event_view.user_name, event_view.level, event_view.start_id, event_view.start_uuid, event_view.parameters, event_view.account_id, event_view.account_uuid, event_view.account_name, event_view.account_type, event_view.domain_id, event_view.domain_uuid, event_view.domain_name, event_view.domain_path, event_view.resource_id, event_view.resource_type, event_view.project_id, event_view.project_uuid, event_view.project_name, event_view.archived, event_view.display FROM event_view WHERE event_view.id IN )
2024-09-04 22:44:04 -07:00
mprokopchuk b9946c28e7 CapacityManagementImpl.updateCapacityForHost(..) use VM update time in capacity calculation.
VM update time is nullable in DB and can cause NullPointerException if record in vm_instance has defined last_host_id and undefined update_time.
2024-09-04 21:21:43 -07:00
Abhishek Kumar 060a8ca623 fix
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-03 17:56:03 +05:30
Abhishek Kumar 4f1eeae9f7 server: DownloadListener - add caching for processConnect StartupCommand
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-03 16:25:28 +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
Rohit Yadav a794462da1
server, api: account and api entity access improvements (#470)
Backports CVE fix from upstream 4.18.2.3

https://cloudstack.apache.org/blog/security-release-advisory-4.19.1.1-4.18.2.3

(cherry picked from commit e7dce2bcce)

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com>
Co-authored-by: nvazquez <nicovazquez90@gmail.com>
2024-08-07 21:18:24 +05:30
Abhishek Kumar e676b80052 revert fc2e4ffd12
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-07-29 13:08:28 +05:30
Abhishek Kumar fc2e4ffd12 server: refactor listNetworks api database retrievals (#9184)
* server: refactor listNetworks api database retrievals

* fixes

* remove unused methods

* imports

* fix empty searchcriteria issue

* refactor

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-07-22 16:14:00 +05:30
Abhishek Kumar 5e98405b38 Merge remote-tracking branch 'apple/apple-base418' into scalability-improvements 2024-07-22 16:12:19 +05:30
Suresh Kumar Anaparti d1faa59677
Back port fixes from upstream 4.19 (#466)
* Fixed src datastore on copy check for PowerFlex/ScaleIO storage driver (#9310)

* Ignore non-managed pools for storage pool access preparation (#9376)
2024-07-19 09:38:11 +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
Vishesh c6d35b31ca
Log stdout to a file (#399)
* Log stdout to a file

* Add logrotation

* Fixup permissions in log file

* Remove info logs in stdout

* Change output file names

Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>

* Fix logrotate config

* Disable logging to stdout

---------

Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
2024-07-03 20:51:20 +05:30
Abhishek Kumar 08246e05ed
server,test: fix resourceid for VOLUME.DETROY in restore VM (#9032) (#454)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-06-28 12:01:55 +05:30
Suresh Kumar Anaparti be87b1a668
FR74: Mitigation for non-scalable ScaleIO clients (#447)
* Mitigation for non-scalable Powerflex/ScaleIO clients
- Added ScaleIOSDCManager to manage SDC connections, checks clients limit, prepare and unprepare SDC on the hosts.
- Added commands for prepare and unprepare storage clients to prepare/start and stop SDC service respectively on the hosts.
- Introduced config 'storage.pool.connected.clients.limit' at storage level for client limits, currently support for Powerflex only.

* tests issue fixed

* refactor / improvements

* lock with powerflex systemid while checking connections limit

* updated powerflex systemid lock to hold till sdc preparation

* Added custom stats support for storage pool, through listStoragePools API

* code improvements, and unit tests

* Update config 'storage.pool.connected.clients.limit' to dynamic, and some improvements

* Stop SDC on host after migration if no volumes mapped to host

* Wait for SDC to connect after scini service start, and some log improvements

* Do not throw exception (log it) when SDC is not connected while revoking access for the powerflex volume

* some log improvements
2024-06-27 18:47:50 +05:30
Vishesh 7ed43e3e43
Let network guru decide if ipv6 cidr size can't be equal to 64 (#462) 2024-06-27 12:20:49 +05:30
Vishesh 8be18e587f
FR75 Enforce strict host tag checking (#421)
* Enforce strict host tag checking

* Add e2e tests

* Add more information to error log

* Fix e2e test

* Update global settings descrption

* fixup

* Fix e2e test teardown
2024-06-25 14:38:59 +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
Suresh Kumar Anaparti 04091abc0d
User data content size validation, register managed user data using POST call from UI, and related code improvements (#361)
* Validate user data with actual length, and some code improvements

* Ignore if user data is not set (don't fail)

* Validate user data after finalizing it

* Updated registerUserData API using POST call from UI, to support user data upto 1048576 bytes

* Apply suggestions from code review

* Added logs for user data

* Addressed review comments

* Check user data length with base64 encoded data, and some code improvements
2024-06-19 12:54:32 +05:30
Abhishek Kumar 256051af1d
server: fix resource reservation leakage (#456)
* server: fix resource reservation leakage

Fixes #453

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* refactor

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* Fix resource reservation leftover entries (#455)

* Resolve comments

* Address comments

---------

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Vishesh <vishesh92@gmail.com>
2024-06-10 12:29:45 +05:30
Wei Zhou e065c93c3f
Apple FR76: Implicit host tags (#427)
* Merge two HostTagVO and HostTagDaoImpl

* Apple FR76: dynamic host tags

* Revert "Apple FR76: dynamic host tags"

This reverts commit 01b93a873f167018c4fafd0744c0de07ae4de4ed.

* Apple FR76: Implicit host tags

* Apple FR76: address Abhishek's comments

* Apple FR76: move updateImplicitTags

* Apple FR76: add since to other two responses

* Update 8929: add unit test in LibvirtComputingResourceTest

* Update variable names

* Update FR76: add explicithosttags in response

* Update FR76 UI: Update explicit host tags

* Update 8929: remove host tags and change labels on UI

* Update: ui polish for host tags

* fix since in responses

* Update 8929: fix UI error if no host tags
2024-05-30 17:20:37 +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 5603bf9c1a engine: optimise CPU and DB hotspot to return enabled hypervisors in the zone
This refactors a ResourceManager::listAvailHypervisorInZone method
that should return unique hypervisors for which existing hosts are Up
and processed. We can approximate this by assuming that those hosts
would have setup their hypervisor-specific systemvmtemplates. In a given
environment there wouldn't be thousands of systemvmtemplates, but can
have thousands of hosts. So, instead of scanning the entire cloud.host
table, we can make calculate guess by returning unique hypervisors of
systemvm templates which are ready. This method was used in
::processConnect() when an agent joins, to speed up its handling.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav 35462dc96d server: fix full table scanning for listHosts API
The type parameter isn't keyword, but a simple listHosts API call with
type=Routing, runs SELECT COUNT(*) FROM host WHERE host.type LIKE
'%Routing'  AND host.removed IS NULL; ... which causes an unnecessary
full table scan.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:38 +05:30
Rohit Yadav 5750e56be5 server: improve DB optimisation, indexing and reduce table scans
In this example commit, we look at:
- Adding missing indexes to speed up queries
- Reduce table scans by optimising sql query and using indexes
- Optimising sql queries to remove duplicate rows (use of distinct)
- Reduce CPU and DB load by using jprofiler to optimise both sql query
  and CPU hotspots

server: reduce CPU and DB load caused by systemvm ::isZoneReady()
For this case, the sql query was fetching large number of table scans
only to determine if zone has any available pool+host to launch
systemvms. Accodingly the code and sql queries along with indexes
optimisations were used to lower both DB scans and mgmt server CPU load.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:38 +05:30