cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Bug: UI fails with 503 just after a successful install

Open tampler opened this issue 3 years ago • 63 comments

ISSUE TYPE
  • Bug Report
COMPONENT NAME
Setup, UI
CLOUDSTACK VERSION
4.19.0.0-snapshot.20231106
CONFIGURATION

Initial setup of management and KVM server on a single host

Possibly related to #7358

OS / ENVIRONMENT

Ubuntu 22.04.3 Java: openjdk 11.0.20.1 2023-08-24 MySQL: 8.0.35-0ubuntu0.22.04.1

SUMMARY

2023-11-10 13:45:27,306 ERROR [o.a.c.s.m.m.i.DefaultModuleDefinitionSet] (main:null) (logid:) Failed to load module [redfish] due to: [Error creating bean with name 'org.spr ingframework.beans.factory.config.PropertyPlaceholderConfigurer#0' defined in URL [jar:file:/usr/share/cloudstack-management/lib/cloudstack-4.19.0.0-snapshot.20231106.jar!/M ETA-INF/cloudstack/bootstrap/spring-bootstrap-context-inheritable.xml]: Cannot resolve reference to bean 'DefaultConfigResources' while setting bean property 'locations'; ne sted exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'DefaultConfigResources' available]. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' defined in URL [jar:file:/usr/share/cloudstack-management/lib/cloudstack-4.19.0.0-snapshot.20231106.jar!/META-INF/cloudstack/bootstrap/spring-bootstrap-context-inheritable.xml]: Cannot resolve reference to bean 'DefaultConfigResources' while setting bean property 'locations'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionExcept ion: No bean named 'DefaultConfigResources' available

STEPS TO REPRODUCE
1. Install management and agent servers on a local host
2. Validate systemctl services:

> systemctl status cloudstack-management.service
● cloudstack-management.service - CloudStack Management Server
     Loaded: loaded (/lib/systemd/system/cloudstack-management.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-11-10 13:44:10 UTC; 19min ago

> systemctl status cloudstack-agent.service
● cloudstack-agent.service - CloudStack Agent
     Loaded: loaded (/lib/systemd/system/cloudstack-agent.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-11-10 13:44:12 UTC; 19min ago

3. Check UI:
admin@acs:~$ curl -I localhost:8080/client/
HTTP/1.1 503 Service Unavailable
EXPECTED RESULTS
UI starts on the management server host
ACTUAL RESULTS
UI fails with 503 due to the bean error 

tampler avatar Nov 10 '23 14:11 tampler

Hola Daniel @GutoVeronezi The full log captured a point, where I had a DB down. I do have access to to DB and verified that. More info here #8240

tampler avatar Nov 17 '23 11:11 tampler

Now trying to have my own build. Figuring out how to compile and build debs on my own. I did that in the begging of 2023

> mvn --version                                                                                     
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: /opt/apache-maven-3.9.5
Java version: 21.0.1, vendor: Oracle Corporation, runtime: /opt/jdk-21.0.1
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-78-generic", arch: "amd64", family: "unix"

> java -version   
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment (build 21.0.1+12-29)
OpenJDK 64-Bit Server VM (build 21.0.1+12-29, mixed mode, sharing)

I checked out the latest main and run this: mvn -DskipTests -Pdeveloper,systemvm clean install Here's what I have:

[INFO] Apache CloudStack DevCloud-KVM ..................... SKIPPED
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE               
[INFO] ------------------------------------------------------------------------                                                                                              
[INFO] Total time:  01:23 min
[INFO] Finished at: 2023-11-17T14:36:37+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project cloud-api: Compilation failure: Compilation failure:
  
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[378,8] error: cannot find symbol
[ERROR]   symbol:   class DocumentBuilderFactory
[ERROR]   location: class OVFHelper
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[378,56] error: cannot find symbol
[ERROR]   symbol:   variable DocumentBuilderFactory
[ERROR]   location: class OVFHelper
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[380,12] error: cannot find symbol
[ERROR]   symbol:   class DocumentBuilder
[ERROR]   location: class OVFHelper
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[382,46] error: cannot find symbol
[ERROR]   symbol:   class ParserConfigurationException
[ERROR]   location: class OVFHelper
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

@tampler can you try with openjdk 11 or 14 ?

weizhouapache avatar Nov 17 '23 11:11 weizhouapache

Hola Daniel @GutoVeronezi The full log captured a point, where I had a DB down. I do have access to to DB and verified that. More info here #8240

I see; then, could you post the full MS bootstrap logs from your last try? (the logs posted in https://github.com/apache/cloudstack/issues/8218#issuecomment-1816160504 does not seem to contain the logs from the beginning of the bootstrap).

GutoVeronezi avatar Nov 17 '23 12:11 GutoVeronezi

@weizhouapache I still can't compile the latest main with both JDK11 and JDK14: :scream_cat:

> java --version
openjdk 11.0.20.1 2023-08-24
OpenJDK Runtime Environment (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)
> mvn -DskipTests -Pdeveloper,systemvm clean install
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  27.188 s
[INFO] Finished at: 2023-11-17T15:27:50+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project cloud-api: Compilation failure: Compilation failure: 
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[378,8] error: cannot find symbol
[ERROR]   symbol:   class DocumentBuilderFactory
[ERROR]   location: class OVFHelper
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[378,56] error: cannot find symbol
[ERROR]   symbol:   variable DocumentBuilderFactory
[ERROR]   location: class OVFHelper
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[380,12] error: cannot find symbol
[ERROR]   symbol:   class DocumentBuilder
[ERROR]   location: class OVFHelper
[ERROR] /hdd/cloud/acs/cloudstack/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java:[382,46] error: cannot find symbol
[ERROR]   symbol:   class ParserConfigurationException
[ERROR]   location: class OVFHelper
[ERROR] -> [Help 1]
commit adbb5520ca51572c2d840ff2a0782505ef82d972 (ups/main)
Author: Daniel Augusto Veronezi Salvador <[email protected]>
Date:   Fri Nov 17 06:27:53 2023 -0300

    Database VIEW management via separated files (#7417)
    
    Co-authored-by: Daniel Augusto Veronezi Salvador <[email protected]>

He-he... I'm the biggest trouble maker today :laughing:

tampler avatar Nov 17 '23 12:11 tampler

He-he... I'm the biggest trouble maker today 😆

you deserve a badge :grimacing:

DaanHoogland avatar Nov 17 '23 12:11 DaanHoogland

He-he... I'm the biggest trouble maker today 😆 you deserve a badge 😬

Sure I do! :bear: And a new alternative CI needs to be implemented outside ShapeBlue

tampler avatar Nov 17 '23 12:11 tampler

My VSCode reports errors at that place. How and were do you all compile this? :thinking: Here's what I have

tampler avatar Nov 17 '23 12:11 tampler

Sure I do! 🐻 And a new alternative CI needs to be implemented outside ShapeBlue

that is so true, our lab is overloaded and though logs are posted back, trouble shooting is not entirely community friendly. We do the best we can, but more options is better.

DaanHoogland avatar Nov 17 '23 13:11 DaanHoogland

My VSCode reports errors at that place. How and were do you all compile this? 🤔 Here's what I have

That is not the same OVFHelper.java that I have in my main branch. Mine does not (any longer) contain a method getDocumentFromFile. DocumentBuilderFactory is imported at several location in the code base though.

DaanHoogland avatar Nov 17 '23 13:11 DaanHoogland

@tampler javax.xml is part of openjdk-11-jdk

compilation should work if you use openjdk11

$ mvn -v
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.20.1, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.2.0-36-generic", arch: "amd64", family: "unix"

weizhouapache avatar Nov 17 '23 13:11 weizhouapache

That is not the same OVFHelper.java that I have in my main branch. Mine does not (any longer) contain a method getDocumentFromFile. DocumentBuilderFactory is imported at several location in the code base though.

@DaanHoogland @weizhouapache Good catch! I built my fork, which used a default merge strategy. As a result, my fork codebase became a complete mess :roll_eyes:. I dropped my old fork, created a new one and set a default rebase strategy for it. You should highlight this in documentation Now I can build the project with jdk14 :smiley: :fire:

tampler avatar Nov 17 '23 19:11 tampler

@GutoVeronezi One issue with ACS for Ubuntu 22.04 is uninstall. ACS doesn't clean after itself, leaving hanging services and configs after removing and purging binaries:

root@hyp0:~# systemctl status cloudstack-agent.service 
○ cloudstack-agent.service           
     Loaded: masked (Reason: Unit cloudstack-agent.service is masked.)
     Active: inactive (dead)                                                          
root@hyp0:~# systemctl status cloudstack-management.service 
○ cloudstack-management.service
     Loaded: masked (Reason: Unit cloudstack-management.service is masked.)
     Active: inactive (dead)

root@hyp0:~# find / -name "cloudstack*"                                                                                                                                      
/etc/systemd/system/cloudstack-management.service                                                                                                                            
/etc/systemd/system/multi-user.target.wants/cloudstack-management.service                                                                                                    
/etc/systemd/system/multi-user.target.wants/cloudstack-agent.service                                                                                                         
/etc/systemd/system/cloudstack-agent.service                                                                                                                                 
/etc/profile.d/cloudstack-agent-profile.sh                                                                                                                                   
/etc/security/limits.d/cloudstack-limits.conf                                                                                                                                
/etc/logrotate.d/cloudstack-agent                                                                                                                                            
/var/crash/cloudstack-management.0.crash
/var/lib/dpkg/info/cloudstack-ui.list
/var/lib/dpkg/info/cloudstack-agent.list
/var/lib/dpkg/info/cloudstack-management.postrm
/var/lib/dpkg/info/cloudstack-agent.postrm
/var/lib/dpkg/info/cloudstack-management.list
/var/lib/systemd/deb-systemd-helper-masked/cloudstack-management.service
/var/lib/systemd/deb-systemd-helper-masked/cloudstack-agent.service
/var/lib/systemd/deb-systemd-helper-enabled/cloudstack-agent.service.dsh-also
/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/cloudstack-management.service
/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/cloudstack-agent.service
/var/lib/systemd/deb-systemd-helper-enabled/cloudstack-management.service.dsh-also

tampler avatar Nov 18 '23 10:11 tampler

@GutoVeronezi The second issue is idempotence. If I try to reinstall ACS from binaries after uninstalling and removing the previous run, ACS management won't upload files to /etc/cloudstack/management and would fail on the post-install config. Example:

bku@hyp0:~/install/419$ python3 --version
Python 3.10.12
bku@hyp0:~/install/419$ ls
cloudstack-agent_4.19.0.0-snapshot.20231117~xenial_all.deb   cloudstack-management_4.19.0.0-snapshot.20231117~xenial_all.deb
cloudstack-common_4.19.0.0-snapshot.20231117~xenial_all.deb  cloudstack-ui_4.19.0.0-snapshot.20231117~xenial_all.deb
bku@hyp0:~/install/419$ sudo dpkg -i cloudstack-common_4.19.0.0-snapshot.20231117~xenial_all.deb cloudstack-ui_4.19.0.0-snapshot.20231117~xenial_all.deb cloudstack-management_4.19.0.0-snapshot.20231117~xenial_all.deb
Selecting previously unselected package cloudstack-common.
(Reading database ... 139508 files and directories currently installed.)
Preparing to unpack cloudstack-common_4.19.0.0-snapshot.20231117~xenial_all.deb ...

Compiling '/usr/lib/python3/dist-packages/cloudutils/utilities.py'...
Setting up cloudstack-ui (4.19.0.0-snapshot.20231117~xenial) ...
Setting up cloudstack-management (4.19.0.0-snapshot.20231117~xenial) ...
usermod: no changes
chmod: cannot access '/etc/cloudstack/management/db.properties': No such file or directory
dpkg: error processing package cloudstack-management (--install):
 installed cloudstack-management package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 cloudstack-management
bku@hyp0:~/install/419$ sudo apt install -f -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up cloudstack-management (4.19.0.0-snapshot.20231117~xenial) ...
usermod: no changes
chmod: cannot access '/etc/cloudstack/management/db.properties': No such file or directory
dpkg: error processing package cloudstack-management (--configure):
 installed cloudstack-management package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 cloudstack-management
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

So you can't seamlessly reinstall ACS from binaries

tampler avatar Nov 18 '23 11:11 tampler

@GutoVeronezi I found a solution for the first issue to clean ACS properly. The following cleans up all ACS files as expected:

> sudo dpkg -l | grep cloudstack
> sudo dpkg --purge cloudstack-common cloudstack-agent cloudstack-ui cloudstack-management

tampler avatar Nov 19 '23 10:11 tampler

Well, after fiddling out with my test setup, I discovered that it is a documentation/configuration issue. The problem is how to correctly resolve the mgmt server.

> cat /etc/cloudstack/management/db.properties
...
# CloudStack database settings
db.cloud.username=cloud
db.cloud.password=cloud
# db.cloud.host=hyp0 < --- won't work - wouldn't resolve my cloudbr1 PRIVATE IP, returns  503
# db.cloud.host=192.168.0.4 < --- won't work - db host is inaccessible and returns  503
db.cloud.host=localhost  < --- resolves to cloudbr0 PUBLIC IP, e.g 10.105.xxx.yyy returns 200 
db.cloud.driver=jdbc:mysql

As a result, agent uses a PUBLIC IP from a PRIVATE network and won't resolve cloubr1 IP=192.168.0.4 and won't enter a valid state - SSVM can't find a mgmt host

> cat /var/log/cloudstack/agent/agent.log
...
Nov 21 15:29:19 hyp0 java[83458]: INFO  [cloud.agent.Agent] (agentRequest-Handler-5:) (logid:9e0f385c) Processed new management server list: 10.105.xxx.yyy@static

agent status When I check the SSVM logs, I see it is trying to connect to cloubr0 - public IP instead of cloudbr1 - private IP

When I change the mgmt host to the proper value:

> cat /etc/cloudstack/agent/agent.properties
...
#host=192.168.0.4@static
host=192.168.0.4

After restarting agent it overwrites config with the public IP from cloudbr0 instead of what specified private IP = 192.168.0.4

tampler avatar Nov 21 '23 15:11 tampler

@tampler can we close the tickets then ?

weizhouapache avatar Nov 21 '23 16:11 weizhouapache

@tampler can we close the tickets then ?

No, you can't. My issue is not resolved and ACS won't deploy anyVM. I just found a root cause of it. The latest question is host to properly config the agent. Do you have any examples?

tampler avatar Nov 21 '23 16:11 tampler

Here's my network setup:

cloubr0 IP: 10.105.xxx.yyy
cloubr1 IP: 192.168.0.4

I run Mgmt, Agent and DB on the same host and OS. Zone setup:

"zone": [
    {
      "allocationstate": "Enabled",
      "allowuserspecifyvrmtu": false,
      "dhcpprovider": "VirtualRouter",
      "dns1": "10.105.xxx.qqq",
      "dns2": "10.105.xxx.ppp",
      "domain": "ec2.local",
      "guestcidraddress": "10.1.1.0/24",
      "hasannotations": false,
      "id": "03725601-a655-48d9-bd7f-65135f6a136e",
      "internaldns1": "192.168.0.1",
      "localstorageenabled": false,
      "name": "test-zone",
      "networktype": "Advanced",
      "routerprivateinterfacemaxmtu": 1500,
      "routerpublicinterfacemaxmtu": 1500,
      "securitygroupsenabled": false,
      "tags": [],
      "type": "Core",
      "zonetoken": "4b7911e0-de73-3e27-a6ea-1bb7b40e33b3"
    }
]

Here are my configs and logs. Any thoughts :thinking:

tampler avatar Nov 21 '23 16:11 tampler

@tampler You can change global setting "host" to 192.168.0.4, restart mgmt service and retry

weizhouapache avatar Nov 21 '23 18:11 weizhouapache

@tampler You can change global setting "host" to 192.168.0.4, restart mgmt service and retry

Hello @weizhouapache This was the most obvious change, but it didn't work for me since something was rewriting it back to host=10.105.xxx.yyy :smiling_face_with_tear:

However, I was able to fix this issue by bypassing SSVM at all :sunglasses: . When I create an iso, I check the Direct download knob. This forces to download an iso on each deploy and load it to the Primary storage, which is OK, since I host all my VMs locally in DC.

Moreover, SSVM seems more like a relict than a feature. NGINX, S3, Ceph, Gluster, Linstor are all candidates to substitute a NFS caching implemented by SSVM

Overall, after spending 2w on the initial config issue I feel like lucky to have resolve it relatively quick :smile: . Thanks everyone for your help! @weizhouapache @DaanHoogland I feel like I owe you to update ACS docs and cover my experience and all troubleshooting steps for Ubuntu 22.04 :smirk: :smirk: :smirk:

tampler avatar Nov 22 '23 14:11 tampler