Skip to content

Conversation

@shwstppr
Copy link
Contributor

Description

Fixes #9789

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)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Jul 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 15.18%. Comparing base (ca6d2dc) to head (fa6a770).
⚠️ Report is 9 commits behind head on 4.19.

Additional details and impacted files
@@            Coverage Diff            @@
##               4.19   #11315   +/-   ##
=========================================
  Coverage     15.17%   15.18%           
- Complexity    11362    11368    +6     
=========================================
  Files          5415     5415           
  Lines        476030   476032    +2     
  Branches      58115    58116    +1     
=========================================
+ Hits          72246    72263   +17     
+ Misses       395701   395683   -18     
- Partials       8083     8086    +3     
Flag Coverage Δ
uitests 4.28% <ø> (-0.01%) ⬇️
unittests 15.90% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sureshanaparti
Copy link
Contributor

@blueorangutan ui

@sureshanaparti sureshanaparti requested a review from Copilot July 29, 2025 04:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes a bug in the Swift storage configuration by adding validation before passing the storagepolicy parameter. The change prevents passing an empty or undefined storagepolicy value to the Swift store configuration.

  • Adds conditional validation for the storagepolicy parameter before including it in swiftParams
  • Prevents potential issues with empty or undefined storagepolicy values being sent to the backend

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

@kiranchavala
Copy link
Contributor

@blueorangutan pacakge

1 similar comment
@DaanHoogland
Copy link
Contributor

@blueorangutan pacakge

@sureshanaparti
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14472

Copy link
Contributor

@kiranchavala kiranchavala left a comment

Choose a reason for hiding this comment

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

@shwstppr not a UI issue i believe

When there is no zone id provided to

https://cloudstack.apache.org/api/apidocs-4.20/apis/addImageStore.html


add imagestore provider=Swift name=gh2 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://127.0.0.1:8081

🙈 Error: (HTTP 530, error code 9999) <nil>

Logs

2025-07-31 05:31:30,141 DEBUG [c.c.a.ApiServlet] (qtp146370526-19:ctx-25745abc) (logid:cfa196bb) ===START===  10.0.33.30 -- GET  apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=addImageStore&details[0].key=account&details[0].value=AUTH_test&details[1].key=username&details[1].value=test%3Atester&details[2].key=key&details[2].value=testing&name=gh2&provider=Swift&response=json&url=http%3A%2F%2F127.0.0.1%3A8081&signature=VUVzkNEKIHfBWnYEOM8ERNkdT%2FA%3D
2025-07-31 05:31:30,148 DEBUG [c.c.a.ApiServer] (qtp146370526-19:ctx-25745abc ctx-cadf6c05) (logid:cfa196bb) CIDRs from which account 'Account [{"accountName":"admin","id":2,"uuid":"12e6ae5d-6dba-11f0-8c3a-1e001e0001b1"}]' is allowed to perform API calls: 0.0.0.0/0,::/0
2025-07-31 05:31:30,154 DEBUG [o.a.c.a.StaticRoleBasedAPIAccessChecker] (qtp146370526-19:ctx-25745abc ctx-cadf6c05) (logid:cfa196bb) RoleService is enabled. We will use it instead of StaticRoleBasedAPIAccessChecker.
2025-07-31 05:31:30,156 DEBUG [o.a.c.r.ApiRateLimitServiceImpl] (qtp146370526-19:ctx-25745abc ctx-cadf6c05) (logid:cfa196bb) API rate limiting is disabled. We will not use ApiRateLimitService.
2025-07-31 05:31:30,158 INFO  [o.a.c.s.d.l.SwiftImageStoreLifeCycleImpl] (qtp146370526-19:ctx-25745abc ctx-cadf6c05 ctx-895fd978) (logid:cfa196bb) Trying to add a swift store at http://127.0.0.1:8081 in data center null
2025-07-31 05:31:30,197 DEBUG [o.a.c.s.i.TemplateDataFactoryImpl] (qtp146370526-19:ctx-25745abc ctx-cadf6c05 ctx-895fd978) (logid:cfa196bb) template 3 is already in store:6, type:Image
2025-07-31 05:31:30,207 DEBUG [o.a.c.s.c.a.StorageCacheRandomAllocator] (qtp146370526-19:ctx-25745abc ctx-cadf6c05 ctx-895fd978) (logid:cfa196bb) Can't find staging storage in zone: null
2025-07-31 05:31:30,211 ERROR [c.c.a.ApiServer] (qtp146370526-19:ctx-25745abc ctx-cadf6c05 ctx-895fd978) (logid:cfa196bb) unhandled exception executing api command: [Ljava.lang.String;@5b26c5a2
java.lang.NullPointerException
	at org.apache.cloudstack.storage.datastore.driver.SwiftImageStoreDriverImpl.createAsync(SwiftImageStoreDriverImpl.java:107)
	at org.apache.cloudstack.storage.image.TemplateServiceImpl.createTemplateAsync(TemplateServiceImpl.java:202)
	at org.apache.cloudstack.storage.image.TemplateServiceImpl.downloadBootstrapSysTemplate(TemplateServiceImpl.java:247)
	at com.cloud.storage.StorageManagerImpl.discoverImageStore(StorageManagerImpl.java:3399)
	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)

When there is zone id provided

(localcloud) 🐱 > add imagestore provider=Swift name=gh2 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://127.0.0.1:8081 zoneid=4e4b9342-fdb6-410f-bc8d-25a107d6a3f6


🙈 Error: (HTTP 431, error code 4350) Image store provider Swift does not support scope ZONE

https://cloudstack.apache.org/api/apidocs-4.20/apis/addSwift.html

(localcloud) 🐱 > add swift url=http://127.0.0.1:8081 username=test:tester account=AUTH_test key=testing
🙈 Error: (HTTP 530, error code 9999) <nil>

2025-07-31 05:33:41,290 DEBUG [c.c.a.ApiServlet] (qtp146370526-18:ctx-7deaced8) (logid:692bcccd) ===START===  10.0.33.30 -- GET  account=AUTH_test&apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=addSwift&key=testing&response=json&url=http%3A%2F%2F127.0.0.1%3A8081&username=test%3Atester&signature=98SLp9zuj9OL1WneGTib4S6w93o%3D
2025-07-31 05:33:41,295 DEBUG [c.c.a.ApiServer] (qtp146370526-18:ctx-7deaced8 ctx-df31b325) (logid:692bcccd) CIDRs from which account 'Account [{"accountName":"admin","id":2,"uuid":"12e6ae5d-6dba-11f0-8c3a-1e001e0001b1"}]' is allowed to perform API calls: 0.0.0.0/0,::/0
2025-07-31 05:33:41,300 DEBUG [o.a.c.a.StaticRoleBasedAPIAccessChecker] (qtp146370526-18:ctx-7deaced8 ctx-df31b325) (logid:692bcccd) RoleService is enabled. We will use it instead of StaticRoleBasedAPIAccessChecker.
2025-07-31 05:33:41,300 DEBUG [o.a.c.r.ApiRateLimitServiceImpl] (qtp146370526-18:ctx-7deaced8 ctx-df31b325) (logid:692bcccd) API rate limiting is disabled. We will not use ApiRateLimitService.
2025-07-31 05:33:41,314 INFO  [o.a.c.s.d.l.SwiftImageStoreLifeCycleImpl] (qtp146370526-18:ctx-7deaced8 ctx-df31b325 ctx-e43d5512) (logid:692bcccd) Trying to add a swift store at http://127.0.0.1:8081 in data center null
2025-07-31 05:33:41,344 DEBUG [o.a.c.s.i.TemplateDataFactoryImpl] (qtp146370526-18:ctx-7deaced8 ctx-df31b325 ctx-e43d5512) (logid:692bcccd) template 3 is already in store:6, type:Image
2025-07-31 05:33:41,356 DEBUG [o.a.c.s.i.TemplateDataFactoryImpl] (qtp146370526-18:ctx-7deaced8 ctx-df31b325 ctx-e43d5512) (logid:692bcccd) template 3 is already in store:7, type:Image
2025-07-31 05:33:41,369 DEBUG [o.a.c.s.c.a.StorageCacheRandomAllocator] (qtp146370526-18:ctx-7deaced8 ctx-df31b325 ctx-e43d5512) (logid:692bcccd) Can't find staging storage in zone: null
2025-07-31 05:33:41,375 ERROR [c.c.a.ApiServer] (qtp146370526-18:ctx-7deaced8 ctx-df31b325 ctx-e43d5512) (logid:692bcccd) unhandled exception executing api command: [Ljava.lang.String;@4d138f1d
java.lang.NullPointerException
	at org.apache.cloudstack.storage.datastore.driver.SwiftImageStoreDriverImpl.createAsync(SwiftImageStoreDriverImpl.java:107)
	at org.apache.cloudstack.storage.image.TemplateServiceImpl.createTemplateAsync(TemplateServiceImpl.java:202)
	at org.apache.cloudstack.storage.image.TemplateServiceImpl.downloadBootstrapSysTemplate(TemplateServiceImpl.java:247)
	at com.cloud.storage.StorageManagerImpl.discoverImageStore(StorageManagerImpl.java:3399)
	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 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.$Proxy108.discoverImageStore(Unknown Source)
	at org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd.execute(AddSwiftCm

shwstppr added a commit to shapeblue/cloudstack that referenced this pull request Aug 4, 2025
@shwstppr
Copy link
Contributor Author

shwstppr commented Aug 4, 2025

@kiranchavala The error logs shared suggest a different issue than the one originally reported.
From the code, I understand that the Swift secondary store requires an NFS cache store, which is causing the NPE. I couldn’t find much documentation on this.
I've created #11380 to handle the NPE, but in my testing, I wasn’t able to get the SSVM working — even after adding a cache store — as it required seeding the system VM template, which I was unable to do. Though I was able to add the store successfully.

@kiranchavala
Copy link
Contributor

@kiranchavala The error logs shared suggest a different issue than the one originally reported. From the code, I understand that the Swift secondary store requires an NFS cache store, which is causing the NPE. I couldn’t find much documentation on this. I've created #11380 to handle the NPE, but in my testing, I wasn’t able to get the SSVM working — even after adding a cache store — as it required seeding the system VM template, which I was unable to do. Though I was able to add the store successfully.

Thanks @shwstppr will test the fix

@sureshanaparti sureshanaparti added this to the 4.19.4 milestone Aug 4, 2025
kiranchavala
kiranchavala approved these changes Aug 4, 2025
@shwstppr shwstppr marked this pull request as ready for review August 4, 2025 10:40
sureshanaparti pushed a commit that referenced this pull request Aug 4, 2025
@sureshanaparti sureshanaparti merged commit a0fd37f into apache:4.19 Aug 4, 2025
25 checks passed
@sureshanaparti sureshanaparti deleted the ui-swiftstore-optionstoragepolicy branch August 4, 2025 10:56
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Aug 6, 2025
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Aug 6, 2025
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.

Exception is thrown when adding Swift as a secondary storage

5 participants