vdombrovski opened a new issue, #7322:
URL: https://github.com/apache/cloudstack/issues/7322
<!--
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release and main branch are affected too.
Always add information AFTER of these HTML comments, but no need to delete
the comments.
-->
##### ISSUE TYPE
<!-- Pick one below and delete the rest -->
* Bug Report
##### COMPONENT NAME
<!--
Categorize the issue, e.g. API, VR, VPN, UI, etc.
-->
~~~
API
~~~
##### CLOUDSTACK VERSION
<!--
New line separated list of affected versions, commit ID for issues on main
branch.
-->
~~~
4.17.2 (also affects older versions)
~~~
##### CONFIGURATION
<!--
Information about the configuration if relevant, e.g. basic network,
advanced networking, etc. N/A otherwise
-->
1 Advanced Zone
1 POD
1 Cluster
Zero hosts added
##### OS / ENVIRONMENT
<!--
Information about the environment if relevant, N/A otherwise
-->
N/A
##### SUMMARY
<!-- Explain the problem/feature briefly -->
Adding a primary storage (of type Ceph in this case) fails with the
following error when no hosts have been added yet
```
com.cloud.utils.exception.CloudRuntimeException: Failed to create storage
pool as it is not accessible to hosts.
```
##### STEPS TO REPRODUCE
<!--
For bugs, show exactly how to reproduce the problem, using a minimal
test-case. Use Screenshots if accurate.
For new features, show how the feature would be used.
-->
Start with a clean install of the manager, add a Zone,Pod,Cluster then try
adding Primary Storage
<!-- Paste example playbooks or commands between quotes below -->
~~~
# Using cmk
cmk create storagepool name=CEPH-CHI
url="rbd://cloudstack:[CEPH_AUTH]@ceph:6789/cloudstack" zoneid=[ZONE_ID]
provider=DefaultPrimary scope=zone hypervisor=KVM
~~~
<!-- You can also paste gist.github.com links for larger files -->
##### EXPECTED RESULTS
<!-- What did you expect to happen when running the steps above? -->
The storage pool gets created
##### ACTUAL RESULTS
<!-- What actually happened? -->
<!-- Paste verbatim command output between quotes below -->
~~~
Failed to add data store: Failed to create storage pool as it is not
accessible to hosts.
com.cloud.utils.exception.CloudRuntimeException: Failed to create storage
pool as it is not accessible to hosts.
at
org.apache.cloudstack.storage.datastore.lifecycle.CloudStackPrimaryDataStoreLifeCycleImpl.attachZone(CloudStackPrimaryDataStoreLifeCycleImpl.java:492)
at
com.cloud.storage.StorageManagerImpl.createPool(StorageManagerImpl.java:826)
at
com.cloud.storage.StorageManagerImpl.createPool(StorageManagerImpl.java:237)
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)
[...]
~~~
Looking here:
https://github.com/apache/cloudstack/blob/main/plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java#L470
The command returns all hosts that are enabled and up, then connects it to
the shared pool in our case. However, when the list is empty, then `if
(poolHosts.isEmpty()) ` condition gets triggered, failing the creation.
As this connection is done anyway when adding a new host, I don't see why
one couldn't add a new primary storage without having any hosts during
deployment.
**Note:** we are deploying Cloudstack using Ansible, so we're not following
the order provider by the UI wizard.
--
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]