alexandru-bagu opened a new pull request #4516:
URL: https://github.com/apache/cloudstack/pull/4516
### Description
This PR addresses an error that appears when you try to add a new host. I
don't even understand why there was a cast to String in the first place. I will
assume some classes send HypervisorType and some send either a string (empty or
otherwise). Shouldn't this be addressed to use the same types everywhere? With
this fix adding a new xenserver host works fine.
Here is the stack trace:
> WARN [c.c.s.StorageManagerImpl] (AgentTaskPool-6:ctx-90ed1f24)
(logid:77e97d5e) Unable to setup the local storage pool for Host[-4-Routing]
java.lang.ClassCastException: class
com.cloud.hypervisor.Hypervisor$HypervisorType cannot be cast to class
java.lang.String (com.cloud.hypervisor.Hypervisor$HypervisorType is in unnamed
module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3f69b166;
java.lang.String is
in module java.base of loader 'bootstrap')
at
org.apache.cloudstack.storage.datastore.lifecycle.CloudStackPrimaryDataStoreLifeCycleImpl.initialize(CloudStackPrimaryDataStoreLifeCycleImpl.java:135)
at
com.cloud.storage.StorageManagerImpl.createLocalStorage(StorageManagerImpl.java:627)
...
INFO [c.c.u.e.CSExceptionErrorCode] (AgentTaskPool-6:ctx-90ed1f24)
(logid:77e97d5e) Could not find exception:
com.cloud.exception.ConnectionException in error code list for exceptions
WARN [c.c.a.m.AgentManagerImpl] (AgentTaskPool-6:ctx-90ed1f24)
(logid:77e97d5e) Monitor LocalStoragePoolListener says there is an error in the
connect process for 4 due to Unable to setup the local storage pool for
Host[-4-Routing]
INFO [c.c.a.m.AgentManagerImpl] (AgentTaskPool-6:ctx-90ed1f24)
(logid:77e97d5e) Host 4 is disconnecting with event AgentDisconnected
WARN [c.c.r.ResourceManagerImpl] (AgentTaskPool-6:ctx-90ed1f24)
(logid:77e97d5e) Unable to connect due to
com.cloud.exception.ConnectionException: Unable to setup the local storage
pool for Host[-4-Routing]
at
com.cloud.storage.StorageManagerImpl.createLocalStorage(StorageManagerImpl.java:640)
...
Caused by: java.lang.ClassCastException: class
com.cloud.hypervisor.Hypervisor$HypervisorType cannot be cast to class
java.lang.String (com.cloud.hypervisor.Hypervisor$HypervisorType is in unnamed
module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3f69b166;
java.lang.String is in module java.base of loader 'bootstrap')
at
org.apache.cloudstack.storage.datastore.lifecycle.CloudStackPrimaryDataStoreLifeCycleImpl.initialize(CloudStackPrimaryDataStoreLifeCycleImpl.java:135)
at
com.cloud.storage.StorageManagerImpl.createLocalStorage(StorageManagerImpl.java:627)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
... 35 more
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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)
#### Bug Severity
- [ ] BLOCKER
- [x] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
### How Has This Been Tested?
Create a basic cloudstack development build (more or less following the
installation guide, no oss), try to add a new host (I assume any, but the code
itself is fishy. I imagine it worked fine for whoever added this bit when he
tested with VMware otherwise he would have not sent the patch) and you get this
error. I tested with xenserver.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]