Skip to content

schema,server,api: events improvement#5997

Merged
nvazquez merged 54 commits intoapache:mainfrom
shapeblue:events-improvement
Apr 25, 2022
Merged

schema,server,api: events improvement#5997
nvazquez merged 54 commits intoapache:mainfrom
shapeblue:events-improvement

Conversation

@shwstppr
Copy link
Copy Markdown
Contributor

@shwstppr shwstppr commented Feb 15, 2022

Description

Add resource ID and resource type to event.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

Screenshot from 2022-03-24 14-21-27

How Has This Been Tested?

Add resource ID and resource type to event.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@nvazquez
Copy link
Copy Markdown
Contributor

Hi @shwstppr can you please fix the conflicts?

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2630

Comment on lines +73 to +144
switch (type) {
case VirtualMachine:
return VirtualMachine.class;
case DomainRouter:
case InternalLbVm:
return VirtualRouter.class;
case Volume:
return com.cloud.storage.Volume.class;
case ConsoleProxy:
return com.cloud.vm.ConsoleProxy.class;
case Snapshot:
return com.cloud.storage.Snapshot.class;
case Backup:
return org.apache.cloudstack.backup.Backup.class;
case Template:
case Iso:
return VirtualMachineTemplate.class;
case SystemVm:
return com.cloud.vm.SystemVm.class;
case Host:
return com.cloud.host.Host.class;
case StoragePool:
return com.cloud.storage.StoragePool.class;
case ImageStore:
return com.cloud.storage.ImageStore.class;
case IpAddress:
return com.cloud.network.IpAddress.class;
case PortableIpAddress:
return PortableIp.class;
case SecurityGroup:
return com.cloud.network.security.SecurityGroup.class;
case PhysicalNetwork:
return com.cloud.network.PhysicalNetwork.class;
case TrafficType:
return Networks.TrafficType.class;
case PhysicalNetworkServiceProvider:
return com.cloud.network.PhysicalNetworkServiceProvider.class;
case FirewallRule:
return com.cloud.network.rules.FirewallRule.class;
case Account:
return com.cloud.user.Account.class;
case User:
return com.cloud.user.User.class;
case PrivateGateway:
return com.cloud.network.vpc.PrivateGateway.class;
case StaticRoute:
return com.cloud.network.vpc.StaticRoute.class;
case Counter:
return com.cloud.network.as.Counter.class;
case Condition:
return com.cloud.network.as.Condition.class;
case AutoScalePolicy:
return com.cloud.network.as.AutoScalePolicy.class;
case AutoScaleVmProfile:
return com.cloud.network.as.AutoScaleVmProfile.class;
case AutoScaleVmGroup:
return com.cloud.network.as.AutoScaleVmGroup.class;
case GlobalLoadBalancerRule:
return com.cloud.region.ha.GlobalLoadBalancerRule.class;
case LoadBalancerRule:
return LoadBalancingRule.class;
case AffinityGroup:
return org.apache.cloudstack.affinity.AffinityGroup.class;
case DedicatedGuestVlanRange:
return GuestVlan.class;
case GuestOs:
return GuestOS.class;
case GuestOsMapping:
return GuestOSHypervisor.class;
case Network:
return com.cloud.network.Network.class;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could create a static Map<ApiCommandJobType, Class<?>> instead of a long switch-case. It would increase the readability and facilitate unit tests.

Comment on lines +20 to +24
import javax.inject.Inject;

import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reordering necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeps them grouped and alphabetically ordered, improves readability


Long resourceId = event.getResourceId();
Class<?> clazz = ApiCommandJobType.getTypeClass(event.getResourceType());
if (resourceId != null && clazz != null ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use ObjectUtils#allNotNull here.

Comment on lines +20 to +26
import java.util.List;

import javax.inject.Inject;

import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.log4j.Logger;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reordering necessary?

Comment on lines +19 to +47
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import javax.inject.Inject;
import javax.naming.ConfigurationException;

import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.response.OutOfBandManagementResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
import org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverChangePasswordCommand;
import org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverPowerCommand;
import org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverResponse;
import org.apache.cloudstack.poll.BackgroundPollManager;
import org.apache.cloudstack.poll.BackgroundPollTask;
import org.apache.cloudstack.utils.identity.ManagementServerNode;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reordering necessary?

Comment on lines +64 to +67
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reordering necessary?

Comment on lines +19 to +40
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import javax.inject.Inject;
import javax.naming.ConfigurationException;

import org.apache.cloudstack.affinity.AffinityGroupProcessor;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.command.admin.cluster.UpdateClusterCmd;
import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
import org.apache.cloudstack.api.command.admin.resource.StartRollingMaintenanceCmd;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reordering necessary?

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2718

shwstppr added 5 commits March 2, 2022 10:37
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@blueorangutan
Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2757

shwstppr added 4 commits March 4, 2022 10:28
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@apache apache deleted a comment from blueorangutan Mar 8, 2022
@apache apache deleted a comment from blueorangutan Mar 8, 2022
@apache apache deleted a comment from blueorangutan Mar 8, 2022
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@apache apache deleted a comment from blueorangutan Mar 9, 2022
@apache apache deleted a comment from blueorangutan Mar 9, 2022
@apache apache deleted a comment from blueorangutan Mar 9, 2022
@blueorangutan
Copy link
Copy Markdown

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

UI build: ✔️
Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/5997 (SL-JID-1422)

@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@acs-robot
Copy link
Copy Markdown

PR Coverage Report

CLASS INSTRUCTION MISSED INSTRUCTION COVERED BRANCH MISSED BRANCH COVERED LINE MISSED LINE COVERED
EventVO 140 0 0 0 58 0
CreateKubernetesClusterCmd 215 0 18 0 61 0
BigSwitchBcfGuestNetworkGuru 662 0 62 0 145 0
CreateServiceInstanceCmd 201 0 16 0 45 0
StopNetScalerVMCmd 114 0 12 0 26 0
OvsGuestNetworkGuru 409 0 48 0 90 0
VxlanGuestNetworkGuru 89 180 11 21 16 39
LinkAccountToLdapCmd 77 105 6 4 18 23
ListAndSwitchSAMLAccountCmd 182 205 30 22 38 34
ApiAsyncJobDispatcher 212 0 12 0 53 0
ApiDBUtils 2367 0 210 0 590 0
ApiDispatcher 231 0 42 0 55 0
ApiServer 2868 112 346 0 672 14
ParamProcessWorker 1050 0 155 0 241 0
QueryManagerImpl 14325 0 1264 0 2419 0
AsyncJobJoinVO 86 0 0 0 31 0
EventJoinVO 100 0 0 0 35 0
ConfigurationManagerImpl 18122 0 3032 0 3573 0
ActionEventInterceptor 398 19 44 2 90 7
ActionEventUtils 929 0 90 0 198 0
EventJoinDaoImpl 329 0 18 0 58 0
IpAddressManagerImpl 4049 0 461 0 807 0
NetworkServiceImpl 13390 0 1866 0 2554 0
FirewallManagerImpl 2522 0 391 0 455 0
ExternalGuestNetworkGuru 810 0 78 0 148 0
GuestNetworkGuru 632 298 98 34 125 64
VirtualNetworkApplianceManagerImpl 7579 0 778 0 1517 0
NetworkACLManagerImpl 841 0 114 0 176 0
VpcManagerImpl 6880 0 758 0 1313 0
Site2SiteVpnManagerImpl 2298 0 214 0 468 0
ResourceManagerImpl 8524 0 982 0 1659 0
RollingMaintenanceManagerImpl 2041 0 192 0 363 0
ResourceIconManagerImpl 328 0 36 0 70 0
ManagementServerImpl 11857 0 1052 0 2361 0
VolumeApiServiceImpl 10851 0 1500 0 2035 0
SnapshotManagerImpl 4195 0 410 0 753 0
SnapshotSchedulerImpl 871 0 81 0 197 0
ResourceManagerUtilImpl 356 0 24 0 71 0
TemplateManagerImpl 5011 0 696 0 1045 0
AccountManagerImpl 6460 0 906 0 1352 0
UserVmManagerImpl 20798 0 2566 0 3869 0
VMSnapshotManagerImpl 3151 0 296 0 628 0
RoleManagerImpl 737 0 114 0 147 0
AffinityGroupServiceImpl 791 0 112 0 172 0
AnnotationManagerImpl 1401 0 167 0 284 0
BackupManagerImpl 2779 0 224 0 489 0
DirectDownloadManagerImpl 1684 0 186 0 361 0
HAManagerImpl 1391 0 194 0 231 0
OutOfBandManagementServiceImpl 1182 0 130 0 237 0
PowerOperationTask 109 0 0 0 17 0

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3258

@vladimirpetrov
Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@vladimirpetrov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@github-actions
Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@nvazquez
Copy link
Copy Markdown
Contributor

@shwstppr can you please fix the conflicts?

@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✖️ el7 ✔️ el8 ✖️ debian ✖️ suse15. SL-JID 3270

@acs-robot
Copy link
Copy Markdown

PR Coverage Report

CLASS INSTRUCTION MISSED INSTRUCTION COVERED BRANCH MISSED BRANCH COVERED LINE MISSED LINE COVERED
VirtualMachineGuru 12 0 2 0 4 0
NetworkOrchestrationService 0 101 0 0 0 10
VirtualMachineManagerImpl 15610 0 1498 0 3072 0
NetworkOrchestrator 9722 0 1198 0 1914 0
SystemVmTemplateRegistration 1773 0 86 0 376 0
DomainRouterVO 109 50 0 0 38 14
ConsoleProxyDaoImpl 635 0 20 0 144 0
DomainRouterDaoImpl 1604 0 22 0 228 0
LibvirtComputingResource 8927 1961 1096 140 1992 444
LibvirtStartCommandWrapper 35 276 15 21 8 68
VmwareResource 20060 0 2242 0 4330 0
CitrixResourceBase 14566 557 1452 34 3160 122
CitrixCheckSshCommandWrapper 15 50 3 3 3 14
CitrixNetworkElementCommandWrapper 0 10 0 0 0 3
CitrixRebootRouterCommandWrapper 27 25 3 1 5 7
CitrixStartCommandWrapper 585 62 71 1 96 16
KubernetesClusterManagerImpl 4724 0 480 0 760 0
KubernetesClusterActionWorker 1540 0 114 0 281 0
KubernetesClusterResourceModifierActionWorker 1843 0 140 0 325 0
DomainChecker 1131 0 282 0 226 0
ResponseObjectTypeAdapter 150 8 12 0 35 2
QueryManagerImpl 14325 0 1264 0 2419 0
DomainRouterJoinDaoImpl 761 0 72 0 184 0
DomainRouterJoinVO 234 0 0 0 79 0
ConsoleProxyManagerImpl 3667 0 423 0 720 0
LibvirtServerDiscoverer 988 0 116 0 218 0
NetworkServiceImpl 13390 0 1866 0 2554 0
NetworkHelperImpl 2019 0 264 0 428 0
VirtualNetworkApplianceManagerImpl 7579 0 778 0 1517 0
VpcManagerImpl 6880 0 758 0 1313 0
ConfigurationServerImpl 2075 0 178 0 499 0
ManagementServerImpl 11857 0 1052 0 2361 0
UserVmManagerImpl 20798 0 2566 0 3869 0
CAManagerImpl 611 0 72 0 125 0
MockNetworkManagerImpl 485 0 22 0 83 0
SecondaryStorageManagerImpl 3494 149 343 11 623 32

@github-actions
Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@nvazquez
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@nvazquez a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3276

@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3292

@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-4006)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 43145 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5997-t4006-kvm-centos7.zip
Smoke tests completed. 97 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Apr 25, 2022

@shwstppr can you check and rekick Travis failure (some issue with db upgrade path)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

9 participants