Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDSTACK-9315: Removed unused Classes #1448

Merged

Conversation

GabrielBrascher
Copy link
Member

Remove unused Classes:

  • com.cloud.agent.api.CheckStateAnswer
  • com.cloud.agent.api.StartupVMMAgentCommand
  • com.cloud.agent.api.routing.UserDataCommand
    • remove from description at
      com.cloud.configuration.Config.ExecuteInSequenceNetworkElementCommands
      enum
  • com.cloud.agent.api.storage.UpgradeDiskCommand
  • com.cloud.agent.api.storage.CreatePrivateTemplateCommand
  • com.cloud.agent.api.storage.DestroyAnswer
    • Note: there is just a line of //FIXME: Should have an DestroyAnswer at
      com.cloud.storage.resource.StoragePoolResource
  • com.cloud.agent.api.storage.UpgradeDiskAnswer
  • com.cloud.agent.api.storage.ManageVolumeAvailabilityAnswer
  • com.cloud.agent.api.storage.ManageVolumeAvailabilityCommand
  • com.cloud.exception.UsageServerException
  • com.cloud.info.SecStorageVmLoadInfo
  • com.cloud.serializer.SerializerHelper

@GabrielBrascher GabrielBrascher changed the title Removed unused Classes CLOUDSTACK-9315: Removed unused Classes Mar 20, 2016
@DaanHoogland
Copy link
Contributor

@GabrielBrascher removing unused code is good; less is more. These are API calls and related stuff however. A large test set should be run and I am surprised no test code would be touched by this change.

@GabrielBrascher
Copy link
Member Author

@DaanHoogland the lack of test in some classes indeed is a problem. However, these classes that I removed are not being used.

I used UCDetector (https://www.ucdetector.org/) as a plugin for Eclipse. With this tool, I discovered a lot of code without any reference (variables, methods and classes).

This pull request had the goal of removing some of these classes. To ensure that I wasn't missing anything I searched for any file that could reference some answer or API command. As I haven't found any way of these classes being used, I removed them.

Any of those API commands that I deleted are not using org.apache.cloudstack.api.APICommand (with @APICommand). Therefore, those commands are not exposed in the ACS API.

@DaanHoogland
Copy link
Contributor

Ok, that is somewhat comforting, however still a large integration test suite should be run on this.

@swill
Copy link
Contributor

swill commented Mar 21, 2016

With these major stripping out of unused code, we need to be very careful that we do not introduce integration test issues. Can you please validate that the integration test output does not change based on this code being removed?

@GabrielBrascher
Copy link
Member Author

@DaanHoogland @swill thank you for the concern. I agree with the need for executing integration/functional tests to keep the code stable. Unfortunately, our test environment is not set yet and it may take a while. As soon as we have it operational I will run the test.

@swill
Copy link
Contributor

swill commented Mar 21, 2016

Thank you @GabrielBrascher. I am also getting my CI setup so I can get tests running against these PRs, so I should be able to start validating this stuff as well. Thanks for the continued effort. :)

asfgit pushed a commit that referenced this pull request May 12, 2016
…asses2

Remove classes with no referencesI used UCDetector (https://www.ucdetector.org/) as a plugin for Eclipse.  With this tool, I discovered a lot of code without any reference (variables, methods and classes).

Following the work that was done at [#1448]; this pull request had the goal of removing some of these classes. To check if I wasn't missing anything I searched for any file that could reference some of those classes. As I haven't found any way of these classes being used, they were removed. Note that some of them I found other references, but references such as commented lines or tests, nothing that could indicate their use (as XML files configuring beans or another class instantiating an object with "new").

Waiting for tests. Please tell me if I am missing something.

Removed Classes:
- org.apache.cloudstack.framework.jobs.JobCancellationException (**Note:** removed
variable JobCancellationException in com.cloud.utils.SerialVersionUID)
- org.apache.cloudstack.ldap.NoSuchLdapUserException (**Note:** removed test file
/cloud-plugin-user-authenticator-ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy)
- com.cloud.agent.api.storage.CreateVolumeOVAAnswer
- com.cloud.exception.MissingParameterValueException
- org.apache.cloudstack.api.response.StatusResponse
- org.apache.cloudstack.api.response.VolumeDetailResponse
- org.apache.cloudstack.api.response.UpgradeVmResponse
- org.apache.cloudstack.api.response.AddIpToVmNicResponse
- org.apache.cloudstack.api.response.TemplateZoneResponse (**Note:** at
org.apache.cloudstack.api.response.TemplateResponse, there is this
comment "To avoid breaking backwards compatibility, we still treat a
template at different zones as different templates, so not embedding
template_zone information in this TemplateZoneResponse set. `private
Set<TemplateZoneResponse> zones;`" but right now it is not used)
- org.apache.cloudstack.api.response.NicDetailResponse

* pr/1453:
  Removed classes with no reference

Signed-off-by: Will Stevens <[email protected]>
@bvbharatk
Copy link
Contributor

ACS CI BVT Run

Sumarry:
Build Number 155
Hypervisor xenserver
NetworkType Advanced
Passed=68
Failed=5
Skipped=3

Link to logs Folder (search by build_no): https://www.dropbox.com/sh/yj3wnzbceo9uef2/AAB6u-Iap-xztdm6jHX9SjPja?dl=0

Failed tests:

  • test_vpc_vpn.py
    • ContextSuite context=TestRVPCSite2SiteVpn>:setup Failing since 14 runs
    • ContextSuite context=TestVpcRemoteAccessVpn>:setup Failing since 14 runs
    • ContextSuite context=TestVpcSite2SiteVpn>:setup Failing since 14 runs
  • test_volumes.py
    • test_06_download_detached_volume Failed
  • test_vm_life_cycle.py
    • test_10_attachAndDetach_iso Failed

Skipped tests:
test_vm_nic_adapter_vmxnet3
test_static_role_account_acls
test_deploy_vgpu_enabled_vm

Passed test suits:
test_deploy_vm_with_userdata.py
test_affinity_groups_projects.py
test_portable_publicip.py
test_over_provisioning.py
test_global_settings.py
test_scale_vm.py
test_service_offerings.py
test_routers_iptables_default_policy.py
test_routers.py
test_reset_vm_on_reboot.py
test_snapshots.py
test_deploy_vms_with_varied_deploymentplanners.py
test_login.py
test_list_ids_parameter.py
test_public_ip_range.py
test_multipleips_per_nic.py
test_regions.py
test_affinity_groups.py
test_network_acl.py
test_pvlan.py
test_nic.py
test_deploy_vm_root_resize.py
test_resource_detail.py
test_secondary_storage.py
test_disk_offerings.py

@rohityadavcloud
Copy link
Member

@GabrielBrascher can you rebase against latest master

@GabrielBrascher
Copy link
Member Author

Rebased against latest master. Thanks @rhtyd.

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1063

@GabrielBrascher
Copy link
Member Author

@rhtyd can you please run integration tests? Thanks ;)

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1112

"If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side."
+ " If set to false, these commands become asynchronous. Default value is false.",
null),
"If set to true, DhcpEntryCommand, SavePasswordCommand, VmDataCommand will be synchronized on the agent side."
Copy link
Member

Choose a reason for hiding this comment

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

@GabrielBrascher can you fix indentations changes in this class/file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks @rhtyd.

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

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

@GabrielBrascher GabrielBrascher force-pushed the brascher-removeUnusedClasses branch 3 times, most recently from 25e0c22 to b0e0cba Compare September 27, 2017 11:29
@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1413

@rafaelweingartner
Copy link
Member

@blueorangutan package

@rhtyd I took the liberty of getting this PR and fixing the conflicts. There were quite a few unused classes that we removed.

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2351

@@ -1836,9 +1836,9 @@
Boolean.class,
"execute.in.sequence.network.element.commands",
"false",
"If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side."
Copy link
Contributor

Choose a reason for hiding this comment

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

Also found some reference on the schema-410to420.sql file

Copy link
Member

Choose a reason for hiding this comment

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

Good catch. I will fix that, and create a script to update the database.

Copy link
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

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

LGTM. Verified that classes are unused, just left some minor comment

@nvazquez
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

…mmands' param

Update description of 'execute.in.sequence.network.element.commands'parameter to reflect an unused command that has been removed. The removed class command is 'UserDataCommand'.
@rafaelweingartner
Copy link
Member

@nvazquez do you know what happened with the tests?

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2354

@nvazquez
Copy link
Contributor

@rafaelweingartner was a failure downloading dependencies before environment has been built, let me start them again
@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-3085)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 22147 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr1448-t3085-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_multipleips_per_nic.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Smoke tests completed. 67 look OK, 2 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_nic_secondaryip_add_remove Error 22.09 test_multipleips_per_nic.py
test_04_rvpc_network_garbage_collector_nics Failure 469.24 test_vpc_redundant.py

@rafaelweingartner
Copy link
Member

@rhtyd can I consider these tests results as successful?


-- PR#1448 update description of 'execute.in.sequence.network.element.commands' parameter to reflect an unused command that has been removed. The removed class command is 'UserDataCommand'.
update configuration set description = 'If set to true, DhcpEntryCommand, SavePasswordCommand, VmDataCommand will be synchronized on the agent side. If set to false, these commands become asynchronous. Default value is false.' where name = 'execute.in.sequence.network.element.commands';
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to cloud configuration?

Copy link
Member

@rafaelweingartner rafaelweingartner Oct 28, 2018

Choose a reason for hiding this comment

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

I already did it (https://github.com/apache/cloudstack/pull/1448/files#diff-69537f9fb58dcc5d2b95bb427e8e47e5). I am only creating this script to update that values for environments that already have this entry in the database.

Copy link
Member

@rohityadavcloud rohityadavcloud Oct 29, 2018

Choose a reason for hiding this comment

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

@rafaelweingartner not the comment is to rewrite the update statement as:

UPDATE `cloud`.`configuration` SET ...;

Copy link
Member

Choose a reason for hiding this comment

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

Ah, sure the schema. Done!

@rohityadavcloud
Copy link
Member

Yes @rafaelweingartner test lgtm, the failure are introduced by something else on master. I've left a minor note.

@rafaelweingartner rafaelweingartner merged commit cdc6e6e into apache:master Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants