server: fix url check for storages without a valid url#8353
server: fix url check for storages without a valid url#8353shwstppr merged 6 commits intoapache:mainfrom
Conversation
Fixes apache#8352 Some managed storages may not need a valid URL to be passed. We can skip check and extraction of host or path from url of such storages Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
| private Map<String,String> extractUriParamsAsMap(String url){ | ||
| protected Map<String,String> extractUriParamsAsMap(String url, boolean managed) { | ||
| Map<String,String> uriParams = new HashMap<>(); | ||
| UriUtils.UriInfo uriInfo = UriUtils.getUriInfo(url); |
There was a problem hiding this comment.
@shwstppr, it will fail here if the URL is not valid. Also, the Storpool plugin doesn't use the managed tag
There was a problem hiding this comment.
May check the first characters of url instead of the managed parameter
There was a problem hiding this comment.
@slavkap @weizhouapache thanks for the pointers. I'll make the change
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #8353 +/- ##
============================================
+ Coverage 28.91% 30.74% +1.82%
- Complexity 31419 33884 +2465
============================================
Files 5329 5341 +12
Lines 373594 374775 +1181
Branches 54319 54515 +196
============================================
+ Hits 108027 115220 +7193
+ Misses 250807 244288 -6519
- Partials 14760 15267 +507
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
| public PrimaryDataStoreInfo createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException, ResourceUnavailableException { | ||
| String providerName = cmd.getStorageProviderName(); | ||
| Map<String,String> uriParams = extractUriParamsAsMap(cmd.getUrl()); | ||
| Map<String,String> uriParams = extractUriParamsAsMap(cmd.getUrl(), cmd.isManaged()); |
There was a problem hiding this comment.
@shwstppr, sorry github doesn't allow you to comment on lines without any changes. On lines 825 and 897 there will be null pointer if the uriParams is empty.
825 ScopeType scopeType = uriParams.get("scheme").toString().equals("file") ? ScopeType.HOST : ScopeType.CLUSTER;
897 if (params.get("scheme").toString().equals("file"))
|
@shwstppr ready for review and merge? |
@weizhouapache it should be ready now. Add some more changes to check for a possible NPE |
|
@blueorangutan package |
|
@shwstppr 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8048 |
|
@blueorangutan test |
|
@shwstppr a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-8585)
|
|
@blueorangutan package |
|
@shwstppr 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8065 |
Fixes apache#8352 Some managed storages may not need a valid URL to be passed. We can skip check and extraction of host or path from url of such storages.
Description
Fixes #8352
Some managed storages may not need a valid URL to be passed. We can skip check and extraction of host or path from url of such storages.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?