Damans227 opened a new issue, #14880:
URL: https://github.com/apache/cloudstack/issues/14880

   ### problem
   
   Registering a FlashArray (or Primera) primary storage pool fails with a raw 
database error when the API URL has no port:
   
   ```
   Error: (HTTP 530, error code 9999) Failed to add data store: Unable to 
persist on DB,
   due to: Data truncation: Out of range value for column 'port' at row 1
   ```
   
   AdaptiveDataStoreLifeCycleImpl.initialize() saves uri.getPort() as the pool 
port. java.net.URL returns -1 when there is no port in the URL, and 
storage_pool.port cannot hold -1, so the insert fails and the registration 
rolls back. A URL like `https://array/api?pod=...` is the natural thing to 
write. The FlashArray adapter itself already falls back to 443 for the same 
URL, only the saved pool row is wrong.
   
   ### versions
   
   ACS 4.22.1.1, FlashArray over FibreChannel, Purity//FA 6.10.6. Same on 4.22 
and main.
   
   ### The steps to reproduce the bug
   
   1. Register a FlashArray pool with no port in the URL: 
`url='https://<user>:<pass>@<array>/api?pod=<pod>&api_skiptlsvalidation=true'`
   2. It fails with the error above. management-server.log shows the insert 
with -1:
   
   ```
   ERROR [o.a.c.s.d.d.PrimaryDataStoreDaoImpl] DB Exception on: ... INSERT INTO 
storage_pool (..., storage_pool.port, ...) VALUES (..., -1, ...)
   com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Out of 
range value for column 'port' at row 1
     at 
o.a.c.s.d.l.AdaptiveDataStoreLifeCycleImpl.initialize(AdaptiveDataStoreLifeCycleImpl.java:239)
   ```
   
   3. Add `:443` to the URL and the same command works.
   
   ### What to do about it?
   
   When the URL has no port, save the scheme's default port (443 for https, 80 
for http).
   


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to