GabrielBrascher commented on pull request #4392:
URL: https://github.com/apache/cloudstack/pull/4392#issuecomment-724933702


   @DaanHoogland sorry, I did not provide all the details on the test.
   
   What happens is that the double slashes _break_ the input. For instance, I 
configured a RBD pool with a password of `1234//12334`, the user as _user_, 
rados monitor address of `10.2.3.4`, and pool named as `pool`; however, instead 
of having the expectedf `[email protected]/pool` the log presents a broken user 
with the second part of the password after "//": `[email protected]/pool`. Via the 
UI the error presented is the one that I pasted here. The INSERT (as far as I 
checked) due to null value that should not be null.
   
   From the management server side it is possible to check the API request as:
   
   ```
   zoneid=d3bcf0c7-4886-44d8-a6a1-5952c430e235
   scope=cluster
   name=test2
   provider=DefaultPrimary
   podid=9d3126c1-4309-4e32-b989-df7b11b7e020
   clusterid=27754861-5aeb-488a-b679-0133e1689186
   url=rbd:%2F%2Fuser:1234_%[email protected]%2Fpool
   command=createStoragePool
   response=json
   ```
   
   Note that the url had scaped one "/" (_%2F_) between _1234_ and _12334_ . 
URL: `rbd:%2F%2Fuser:1234_%[email protected]%2Fpool`.
   
   Full log:
   ```
   2020-11-10 13:53:57,682 DEBUG [c.c.a.ApiServlet] 
(qtp477376212-967:ctx-4a0a2d92) (logid:44629add) ===START===  127.0.0.1 -- GET  
scope=cluster&zoneid=d3bcf0c7-4886-44d8-a6a1-5952c430e235&name=test2&provider=DefaultPrimary&podid=9d3126c1-4309-4e32-b989-df7b11b7e020&clusterid=27754861-5aeb-488a-b679-0133e1689186&url=rbd:%2F%2Fuser:1234_%[email protected]%2Fpool&command=createStoragePool&response=json
   2020-11-10 13:53:57,702 DEBUG 
[o.a.c.s.d.l.CloudStackPrimaryDataStoreLifeCycleImpl] 
(qtp477376212-967:ctx-4a0a2d92 ctx-287b0e56) (logid:44629add) createPool Params 
@ scheme - rbd storageHost - null hostPath - /[email protected]/pool port - -1
   2020-11-10 13:53:57,707 DEBUG [c.c.u.d.T.Transaction] 
(qtp477376212-967:ctx-4a0a2d92 ctx-287b0e56) (logid:44629add) Rolling back the 
transaction: Time = 2 Name =  qtp477376212-967; called by 
-TransactionLegacy.rollback:888-TransactionLegacy.removeUpTo:831-TransactionLegacy.close:655-TransactionContextInterceptor.invoke:36-ReflectiveMethodInvocation.proceed:175-ExposeInvocationInterceptor.invoke:95-ReflectiveMethodInvocation.proceed:186-JdkDynamicAopProxy.invoke:212-$Proxy61.persist:-1-PrimaryDataStoreHelper.createPrimaryDataStore:135-CloudStackPrimaryDataStoreLifeCycleImpl.initialize:364-StorageManagerImpl.createPool:738
   2020-11-10 13:53:57,709 DEBUG [c.c.s.StorageManagerImpl] 
(qtp477376212-967:ctx-4a0a2d92 ctx-287b0e56) (logid:44629add) Failed to add 
data store: DB Exception on: com.mysql.cj.jdbc.ClientPreparedStatement: INSERT 
INTO storage_pool (storage_pool.id, storage_pool.name, storage_pool.uuid, 
storage_pool.pool_type, storage_pool.created, storage_pool.update_time, 
storage_pool.data_center_id, storage_pool.pod_id, storage_pool.used_bytes, 
storage_pool.capacity_bytes, storage_pool.status, 
storage_pool.storage_provider_name, storage_pool.host_address, 
storage_pool.path, storage_pool.port, storage_pool.user_info, 
storage_pool.cluster_id, storage_pool.scope, storage_pool.managed, 
storage_pool.capacity_iops, storage_pool.hypervisor, storage_pool.parent) 
VALUES (0, _binary'test2', _binary'e28b680f-cb21-3089-84e3-584bf549f062', 
'RBD', '2020-11-10 12:53:57', null, 1, 1, 0, 0, 'Initialized', 
_binary'DefaultPrimary', null, _binary'[email protected]/pool', 0, null, 1, null, 
0, null, null, 0)
   com.cloud.utils.exception.CloudRuntimeException: DB Exception on: 
com.mysql.cj.jdbc.ClientPreparedStatement: INSERT INTO storage_pool 
(storage_pool.id, storage_pool.name, storage_pool.uuid, storage_pool.pool_type, 
storage_pool.created, storage_pool.update_time, storage_pool.data_center_id, 
storage_pool.pod_id, storage_pool.used_bytes, storage_pool.capacity_bytes, 
storage_pool.status, storage_pool.storage_provider_name, 
storage_pool.host_address, storage_pool.path, storage_pool.port, 
storage_pool.user_info, storage_pool.cluster_id, storage_pool.scope, 
storage_pool.managed, storage_pool.capacity_iops, storage_pool.hypervisor, 
storage_pool.parent) VALUES (0, _binary'test2', 
_binary'e28b680f-cb21-3089-84e3-584bf549f062', 'RBD', '2020-11-10 12:53:57', 
null, 1, 1, 0, 0, 'Initialized', _binary'DefaultPrimary', null, 
_binary'[email protected]/pool', 0, null, 1, null, 0, null, null, 0)
           at 
com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1450)
           at 
org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl.persist(PrimaryDataStoreDaoImpl.java:273)
           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)
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to