cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

UI: Host already in the database when adding host

Open levindecaro opened this issue 1 year ago • 11 comments

ISSUE TYPE
  • Bug Report
COMPONENT NAME
API
CLOUDSTACK VERSION
4.17.1 to 4.18.1
CONFIGURATION

Advanced Networking KVM

OS / ENVIRONMENT

CentOS 7 Oracle Linux 9

SUMMARY

Error message shown when adding new host, but the host was added actually even with error message. This error happen since 4.17.1, likely there are some DB record influence the process and the API can't handle.

STEPS TO REPRODUCE
Add a new host into cluster

EXPECTED RESULTS
Host added without error.
ACTUAL RESULTS
Hosted added but with error.
2024-02-02 13:43:05,541 DEBUG [c.c.a.ApiServer] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) CIDRs from which account 'Account [{"accountName":"admin","id":2,"uuid":"9189844c-0005-11eb-92dc-52540044e551"}]' is allowed to perform API calls: 0.0.0.0/0,::/0
2024-02-02 13:43:05,543 INFO  [o.a.c.a.DynamicRoleBasedAPIAccessChecker] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Account [Account [{"accountName":"admin","id":2,"uuid":"9189844c-0005-11eb-92dc-52540044e551"}]] is Root Admin or Domain Admin, all APIs are allowed.
2024-02-02 13:43:05,545 INFO  [o.a.c.a.ProjectRoleBasedApiAccessChecker] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Account [admin] is Root Admin or Domain Admin, all APIs are allowed.
2024-02-02 13:43:05,546 DEBUG [o.a.c.a.StaticRoleBasedAPIAccessChecker] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) RoleService is enabled. We will use it instead of StaticRoleBasedAPIAccessChecker.
2024-02-02 13:43:05,547 INFO  [o.a.c.r.ApiRateLimitServiceImpl] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Account [{"accountName":"admin","uuid":"9189844c-0005-11eb-92dc-52540044e551"}] is Root Admin, in this case, API limit does not apply.
2024-02-02 13:43:05,550 WARN  [c.c.a.d.ParamGenericValidationWorker] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Received unknown parameters for command addHost. Unknown parameters : clustertype projectid
2024-02-02 13:43:05,552 INFO  [c.c.r.ResourceManagerImpl] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Trying to add a new host at http://compute-2.apac-1b.example.com in data center 14
2024-02-02 13:43:05,555 DEBUG [c.c.h.k.d.LibvirtServerDiscoverer] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7
2024-02-02 13:43:05,555 WARN  [c.c.h.k.d.LibvirtServerDiscoverer] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00)  can't setup agent, due to com.cloud.utils.exception.CloudRuntimeException: Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7 - Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7
2024-02-02 13:43:05,555 DEBUG [c.c.h.k.d.LibvirtServerDiscoverer] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00)  can't setup agent, due to com.cloud.utils.exception.CloudRuntimeException: Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7 - Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7
2024-02-02 13:43:05,556 DEBUG [c.c.r.ResourceManagerImpl] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Could not add host at [http://compute-2.apac-1b.example.com] with zone [14], pod [14] and cluster [11] due to: [ can't setup agent, due to com.cloud.utils.exception.CloudRuntimeException: Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7 - Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7].
2024-02-02 13:43:05,556 INFO  [c.c.u.e.CSExceptionErrorCode] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Could not find exception: com.cloud.exception.DiscoveryException in error code list for exceptions
2024-02-02 13:43:05,556 WARN  [o.a.c.a.c.a.h.AddHostCmd] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Exception: 
2024-02-02 13:43:05,558 INFO  [c.c.a.ApiServer] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) Could not add host at [http://compute-2.apac-1b.example.com] with zone [14], pod [14] and cluster [11] due to: [ can't setup agent, due to com.cloud.utils.exception.CloudRuntimeException: Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7 - Skipping host 172.17.0.22 because 3f752e3a-b121-34d7-b98e-efa49c276445 is already in the database for resource 3f752e3a-b121-34d7-b98e-efa49c276445-LibvirtComputingResource with ID 350274d9-d7b1-4cdd-a2e6-fe5f6ee76ec7].
2024-02-02 13:43:05,558 DEBUG [c.c.a.ApiServlet] (qtp1437654187-1615:ctx-e10e9666 ctx-5839d082) (logid:e1b7ea00) ===END===  0:0:0:0:0:0:0:1 -- POST  command=addHost&response=json&projectid=e61c599d-76fb-4cbc-9179-a47b381f49a2

levindecaro avatar Feb 02 '24 06:02 levindecaro

@levindecaro is the issue with a specific host ? then check the 'host' for any existing records.

rajujith avatar Feb 02 '24 11:02 rajujith

@levindecaro can you check if there is another host with same Ip "172.17.0.22" ?

weizhouapache avatar Feb 02 '24 12:02 weizhouapache

the hostname and IP are new, and checked host db table did not contain duplicate records.

levindecaro avatar Feb 03 '24 09:02 levindecaro

the hostname and IP are new, and checked host db table did not contain duplicate records.

I recall there was a similar issue in the past. it seems to be a ui bug. Can you try with 4.19.0rc4?

weizhouapache avatar Feb 03 '24 09:02 weizhouapache

Hi, I am trying to set up a POC of 4.19 on my local workstation with 1x management server + 1x hypervisor VPS, and I am encountering the same error with Core/Advanced with security groups in the initial setup wizard.

With Core/Basic setup with security groups, the setup is successful.

I have tried several times and even reinstalled both VPS to be sure. As an OS, I used the standard installation of Ubuntu 22.04.4.

In the management-server.log, I can see that the first "Adding of the host" is successful (in the initial setup wizard) and then it continues through primary storage setup, secondary, and then after secondary storage, it will try to add the same host again, which obviously fails and as a result, the setup wizard fails too.

Here is a log https://gist.github.com/ShiroDN/7f84e6736b2a0db34f812ec93745c460 starting before zone creation up to the service stop. You can see "Adding of the host..." on lines L425 and L1098.

ShiroDN avatar Feb 29 '24 16:02 ShiroDN

Hi, I am trying to set up a POC of 4.19 on my local workstation with 1x management server + 1x hypervisor VPS, and I am encountering the same error with Core/Advanced with security groups in the initial setup wizard.

With Core/Basic setup with security groups, the setup is successful.

I have tried several times and even reinstalled both VPS to be sure. As an OS, I used the standard installation of Ubuntu 22.04.4.

In the management-server.log, I can see that the first "Adding of the host" is successful (in the initial setup wizard) and then it continues through primary storage setup, secondary, and then after secondary storage, it will try to add the same host again, which obviously fails and as a result, the setup wizard fails too.

Here is a log https://gist.github.com/ShiroDN/7f84e6736b2a0db34f812ec93745c460 starting before zone creation up to the service stop. You can see "Adding of the host..." on lines L425 and L1098.

@ShiroDN this seems to be a UI issue with zone creation wizard.

However, the zone should have been created successfully without any issue. can you check if the zone/cluster/pod/hosts/primary storage/secondary storage are all created ? if yes, and zone is still disabled, you can enable the zone.

weizhouapache avatar Feb 29 '24 16:02 weizhouapache

@weizhouapache Yes, you are right. After enabling a zone, it comes up; zone/cluster/pod/hosts/primary storage/secondary storage were created. Should I create a new issue for this UI bug, or is it enough here?

ShiroDN avatar Feb 29 '24 18:02 ShiroDN

@weizhouapache Yes, you are right. After enabling a zone, it comes up; zone/cluster/pod/hosts/primary storage/secondary storage were created. Should I create a new issue for this UI bug, or is it enough here?

thanks for the update @ShiroDN we can use this ticket for followup, no need to create an new issue

weizhouapache avatar Feb 29 '24 18:02 weizhouapache

@weizhouapache @levindecaro is the bug here that UI is trying to add same host twice during zone deployment and the whole operation is failing leaving the zone in disabled state??

shwstppr avatar May 09 '24 06:05 shwstppr

@shwstppr Yes, that's right. It fails to deploy advanced zones with security groups enabled. You need to enable the zone manually, then it works fine.

ShiroDN avatar May 09 '24 07:05 ShiroDN

@shwstppr my case is even adding a fresh new host into a healthy zone, however it just an UI error, the host was added successfully underneath

levindecaro avatar May 09 '24 22:05 levindecaro

Fixed in #9231

sureshanaparti avatar Jun 26 '24 07:06 sureshanaparti