schema,server,api: events improvement#5997
Conversation
Add resource ID and resource type to event. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
Hi @shwstppr can you please fix the conflicts? |
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
@blueorangutan package |
|
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2630 |
| 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; | ||
| } |
There was a problem hiding this comment.
We could create a static Map<ApiCommandJobType, Class<?>> instead of a long switch-case. It would increase the readability and facilitate unit tests.
| import javax.inject.Inject; | ||
|
|
||
| import org.apache.cloudstack.context.CallContext; | ||
| import org.apache.log4j.Logger; | ||
| import org.springframework.stereotype.Component; |
There was a problem hiding this comment.
Is this reordering necessary?
There was a problem hiding this comment.
Keeps them grouped and alphabetically ordered, improves readability
|
|
||
| Long resourceId = event.getResourceId(); | ||
| Class<?> clazz = ApiCommandJobType.getTypeClass(event.getResourceType()); | ||
| if (resourceId != null && clazz != null ) { |
There was a problem hiding this comment.
We can use ObjectUtils#allNotNull here.
| 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; |
There was a problem hiding this comment.
Is this reordering necessary?
| 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; |
There was a problem hiding this comment.
Is this reordering necessary?
| 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; |
There was a problem hiding this comment.
Is this reordering necessary?
| 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; |
There was a problem hiding this comment.
Is this reordering necessary?
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2718 |
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2757 |
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
UI build: ✔️ |
|
@blueorangutan package |
|
@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. |
PR Coverage Report
|
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3258 |
|
@blueorangutan test |
|
@vladimirpetrov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@shwstppr can you please fix the conflicts? |
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
@blueorangutan package |
|
@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. |
|
Packaging result: ✖️ el7 ✔️ el8 ✖️ debian ✖️ suse15. SL-JID 3270 |
PR Coverage Report
|
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@blueorangutan package |
|
@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. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3276 |
|
@blueorangutan package |
|
@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. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3292 |
|
@blueorangutan test |
|
@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-4006)
|
|
@shwstppr can you check and rekick Travis failure (some issue with db upgrade path)? |
Description
Add resource ID and resource type to event.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?