apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.11k stars 1.11k forks source link

Exception is thrown when adding Swift as a secondary storage #9789

Open kiranchavala opened 1 month ago

kiranchavala commented 1 month ago

ISSUE TYPE

Bug

COMPONENT NAME

Component: Bug

CLOUDSTACK VERSION

Cloudstack version 4.19.1

SUMMARY

A exception is thrown when adding Swift as a secondary storage

Steps to reproduce the behaviour

  1. Create a swift secondary storage setup

The easiest way is a deploy a docker image of swift storage

https://hub.docker.com/r/openstackswift/saio

  1. Test the swift commands are working

sudo apt-get install python-swiftclient

swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat

swift -A http://127.0.0.1:8080/v1.0 -U test:tester -K testing stat -v

  1. Navigate Infrastructure > secondary storage >

Make sure there are no secondary storage available

Add secondary storage by selecting the provider as Swift

Example

add imagestore provider=Swift name=gh details[0].key=account details[0].value=AUTH_test details[1].key=username details[1].value=test:tester details[2].key=key details[2].value=testing url=http://192.168.55.226:8080

Exception is thrown and the swift storage details is added in the database

2024-10-10 11:17:40,852 DEBUG [c.c.s.StorageManagerImpl] (qtp341748265-13:ctx-eef90b8d ctx-bd63844d) (logid:c7281383) Failed to add data store: DB Exception on: com.mysql.cj.jdbc.ClientPreparedStatement: INSERT INTO image_store_details (image_store_details.store_id, image_store_details.name, image_store_details.value, image_store_details.display) VALUES (10, x'73746f72616765706f6c696379', NULL, 1)
com.cloud.utils.exception.CloudRuntimeException: DB Exception on: com.mysql.cj.jdbc.ClientPreparedStatement: INSERT INTO image_store_details (image_store_details.store_id, image_store_details.name, image_store_details.value, image_store_details.display) VALUES (10, x'73746f72616765706f6c696379', NULL, 1)
        at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1563)
        at jdk.internal.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.sql.SQLIntegrityConstraintViolationException: Column 'value' cannot be null
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916)
        ... 81 more
 mysql> select * from image_store_details \G;
*************************** 1. row ***************************
      id: 26
store_id: 10
    name: account
   value: AUTH_test
 display: 1
*************************** 2. row ***************************
      id: 27
store_id: 10
    name: key
   value: 03ngekRU7XiPeocp5iqsiI30d6qidlPZBLtEpJIOnuOMWWM=
 display: 1
*************************** 3. row ***************************
      id: 28
store_id: 10
    name: username
   value: test:tester
 display: 1       

Actual Behaviour

Exception is thrown

Expected Behaviour

There should be no exception thrown by cloudstack during the adding of swift storage