Skip to content

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Sep 8, 2021

Description

With 87ddc76, value column in cloud.cluster_details has been made non-nullable.
While adding a cluster (especially VMware), addCluster API can be called without username password. Username and password are updated in cluster details entry later after successful discovery.
This PR stores an empty string instead of a null value when the initial cluster entry is made in the DB.

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

How Has This Been Tested?

Screenshot from 2021-09-08 16-59-12

Error in logs:

2021-09-08 11:26:26,300 DEBUG [c.c.a.ApiServlet] (qtp769798433-19:ctx-3ea4e9da) (logid:d2be3d41) ===START===  172.16.250.2 -- POST  command=addCluster&response=json
2021-09-08 11:26:26,304 DEBUG [c.c.a.ApiServer] (qtp769798433-19:ctx-3ea4e9da ctx-51d8fe53) (logid:d2be3d41) CIDRs from which account 'Acct[202665fc-0bda-11ec-a29c-1e0094000118-admin] -- Account {"id": 2, "name": "admin", "uuid": "202665fc-0bda-11ec-a29c-1e0094000118"}' is allowed to perform API calls: 0.0.0.0/0,::/0
2021-09-08 11:26:26,319 DEBUG [c.c.u.d.T.Transaction] (qtp769798433-19:ctx-3ea4e9da ctx-51d8fe53) (logid:d2be3d41) Rolling back the transaction: Time = 1 Name =  qtp769798433-19; called by -TransactionLegacy.rollback:888-TransactionLegacy.removeUpTo:831-TransactionLegacy.close:655-TransactionContextInterceptor.invoke:36-ReflectiveMethodInvocation.proceed:175-ExposeInvocationInterceptor.invoke:97-ReflectiveMethodInvocation.proceed:186-JdkDynamicAopProxy.invoke:215-$Proxy46.persist:-1-ResourceManagerImpl.discoverCluster:550-NativeMethodAccessorImpl.invoke0:-2-NativeMethodAccessorImpl.invoke:62
2021-09-08 11:26:26,320 ERROR [c.c.a.ApiServer] (qtp769798433-19:ctx-3ea4e9da ctx-51d8fe53) (logid:d2be3d41) unhandled exception executing api command: [Ljava.lang.String;@49908fbd
com.cloud.utils.exception.CloudRuntimeException: DB Exception on: com.mysql.cj.jdbc.ClientPreparedStatement: INSERT INTO cluster_details (cluster_details.cluster_id, cluster_details.name, cluster_details.value) VALUES (8, _binary'password', null)
	at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1450)
	at com.cloud.dc.ClusterDetailsDaoImpl.persist(ClusterDetailsDaoImpl.java:111)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
	at com.sun.proxy.$Proxy46.persist(Unknown Source)
	at com.cloud.resource.ResourceManagerImpl.discoverCluster(ResourceManagerImpl.java:550)

After change - addCluster successful:
Screenshot from 2021-09-08 17-36-57

Correct cluster details after successful addition:
Screenshot from 2021-09-08 17-40-32

With 87ddc76, value column in cloud.cluster_details has been made non-nullable.
While adding a cluster (especially VMware), addCluster API can be called without username password. Username and password are updated in cluster details entry later after successful discovery.
This PR stores an empty string instead of a null value when initial cluster entry is made in the DB.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr shwstppr added this to the 4.16.0.0 milestone Sep 8, 2021
@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 8, 2021

@blueorangutan package

@blueorangutan
Copy link

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

@rohityadavcloud
Copy link
Member

Does it affect 4.15 too @shwstppr or just main?

@blueorangutan
Copy link

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

@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 9, 2021

@rhtyd only main, as 87ddc76 from PR #5274 was merged in main

@shwstppr shwstppr closed this Sep 9, 2021
@shwstppr shwstppr reopened this Sep 9, 2021
@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 9, 2021

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-2005)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 38353 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5421-t2005-vmware-67u3.zip
Smoke tests completed. 89 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

@blueorangutan
Copy link

Trillian test result (tid-2000)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 40256 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5421-t2000-vmware-67u3.zip
Smoke tests completed. 89 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

@nvazquez
Copy link
Contributor

@blueorangutan test matrix

@blueorangutan
Copy link

@nvazquez a Trillian-Jenkins matrix job (centos7 mgmt + xs71, centos7 mgmt + vmware65, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@blueorangutan
Copy link

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

Test Result Time (s) Test File

@blueorangutan
Copy link

Trillian test result (tid-2020)
Environment: xenserver-71 (x2), Advanced Networking with Mgmt server 7
Total time taken: 43210 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5421-t2020-xenserver-71.zip
Smoke tests completed. 87 look OK, 2 have errors
Only failed tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestKubernetesCluster>:teardown Error 97.71 test_kubernetes_clusters.py
test_02_cancel_host_maintenace_with_migration_jobs Error 1787.82 test_host_maintenance.py
test_02_cancel_host_maintenace_with_migration_jobs Error 1787.87 test_host_maintenance.py

@blueorangutan
Copy link

Trillian test result (tid-2022)
Environment: vmware-65u2 (x2), Advanced Networking with Mgmt server 7
Total time taken: 42891 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5421-t2022-vmware-65u2.zip
Smoke tests completed. 88 look OK, 1 have errors
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_vpc_site2site_vpn Failure 329.24 test_vpc_vpn.py

@rohityadavcloud rohityadavcloud merged commit c85eb10 into apache:main Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants