Commit Graph

1657 Commits

Author SHA1 Message Date
Abhishek Kumar d0fc91ab2a build fix
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-09 17:29:18 +05:30
Abhishek Kumar 5f86dad4cb improve cluster overcommit value cache
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-09 16:28:24 +05:30
Abhishek Kumar 1589cde4e4 check for empty ids
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-09 16:27:39 +05:30
Abhishek Kumar a3ea8603a9 during resource calculation directly return ids for service offering,
templates

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-08 14:28:26 +05:30
Abhishek Kumar a069e14cf9 directly return count for systemvms used in listInfra
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-08 14:25:25 +05:30
Abhishek Kumar c859f8ba80 changes in vm powerstate sync
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-07 16:25:14 +05:30
Abhishek Kumar a9661f4587 changes in statscollection
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-07 16:23:15 +05:30
Abhishek Kumar a5d02665b4 changes for host reqrieval from db
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-10-07 16:21:06 +05:30
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
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 33321f00ce template list fix
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-16 14:28:51 +05:30
Abhishek Kumar 97ddd17f94 fix related to 38d6c4e7e7
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-13 17:40:20 +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 98b27a409d engine-schema: fix get host type count searchcriteria
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-13 15:06:33 +05:30
Abhishek Kumar 38d6c4e7e7 optimize finding ready systemvm template for zone
Retrieving templates with inner join on host table was turning out to be
more expensive than finding distinct hypervisor types for a zone using
hsot table and then finding templates for those types

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-13 12:10:47 +05:30
Abhishek Kumar a1ee64344d address host/cluster dao listall
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-12 17:23:44 +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
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 68bab20d24 VMInstanceDao.updatePowerState refactor
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-12 15:47:00 +05:30
Abhishek Kumar 8f6c657159 optimize scanStalledVms procedure
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-09-06 14:27:56 +05:30
mprokopchuk cf8dd76d4c renamed created_exists to created_column_not_exists in sql migration script 2024-09-06 01:25:04 -07:00
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 1ec11a1482 removed insert of powerflex.connect.on.demand as it taken care by commit 0d553332 already 2024-08-30 11:24:04 -07:00
Abhishek Kumar 3f80cd3c66 optimize db list.size() cases
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
2024-08-27 13:06:25 +05:30
mprokopchuk e1c7492768 - added resource_reservation.mgmt_server_id
- added resource_reservation.created
to migration script
2024-08-22 14:12:49 -07:00
mprokopchuk 8136db637a Added configuration key powerflex.connect.on.demand to DB and resource_reservation DDL 2024-08-15 17:57:07 -07:00
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
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
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 07097849d4 add more missing indexes to lower table scans
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-23 18:55:17 +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 2f0f0e9ebc engine/schema: call initDB before creating app context bean
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav 3883dbe9a0 schema: force index on user_view_view
In env with large number of shared networks or ip addresses (10k+), this
causes millions of table scans in user_ip_address table. This causes
severe slowness in listVM APIs etc.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +05:30
Rohit Yadav f57f244863 schema: speed up network offering created table scans
Using function in view was causing too many scans, as many rows as
number of domains and zones. This reduces table scans where left joins
happen using sub-queries. The effect is seen in bit faster create
network API performance.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:39 +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 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 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 90afcf2f85 metrics: optimise code and query to get summed cpu sockets
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:38 +05:30
Rohit Yadav 076a712fbe schema: add indexes that save DB from too many scans
Speeds up several APIs, esp host and VM listing APIs and VM deployment

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:38 +05:30
Rohit Yadav 54accfdc0a schema: add missing index to reduce table scans
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
Rohit Yadav 807cd6a830 metrics: speed up list zones and cluster metrics APIs
Also add a flag to disable on-the-fly metrics computation when the
list metrics APIs for zones and clusters are called.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2024-05-22 20:22:38 +05:30
Rohit Yadav 5484d3c7e6 orchestartion: optimise vm list fetching excluding that reported
This optimises the sql query and iterator to simply return the VMs list
excluding those in the received report.

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