apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.09k stars 1.11k forks source link

Can not add a Baremetal Template when using cloudstack to manager the Baremetal Server ? #8162

Closed xuanyuanaosheng closed 1 year ago

xuanyuanaosheng commented 1 year ago

We want using cloudstack to manager the Baremetal Server to achieve to deploy the OS on physical server.

ISSUE TYPE
COMPONENT NAME
CLOUDSTACK VERSION
CONFIGURATION

image

The Zone name is csbm using Basic (Network type). and the cluster Hypervisor is BareMetal

The config is as below:

image

image

STEPS TO REPRODUCE
  1. Create a basic Zone as above
  2. Add Baremetal Server info:
    ilo:   10.25.30.242
    Ilo Host MAC: f4:02:70:9c:a5:d0
    of CPU cores:  14
    CPU (in MHz): 1000
    Memory (in MB): 515240   (MemTotal:       527606672 kB)
    Host Net MAC: 34:80:0d:43:39:ec
  3. Add second storage
  4. Add the above Baremetal Server to the cluster
  5. The template is ks=http://10.26.20.11:8080/cloudstack_ks/CentOS-79-x86_64.ks;kernel=10.26.20.11:/var/lib/tftpboot/images/CentOS-7.9-x86_64/vmlinuz;initrd=10.26.20.11:/var/lib/tftpboot/images/CentOS-7.9-x86_64/initrd.img and add it to the zone:

image


The error on web UI:

Request failed. (530)
Request failed with status code 530

The cloudstack manager error log is:

2023-10-31 15:05:54,840 DEBUG [c.c.a.ApiServlet] (qtp1955920234-2168:ctx-e540fbe2) (logid:e416c2df) ===START===  10.64.94.63 -- GET  url=ks%3Dhttp:%2F%2F10.26.20.11:8080%2Fcloudstack_ks%2FCentOS-79-x86_64.ks%3Bkernel%3D10.26.20.11:%2Fvar%2Flib%2Ftftpboot%2Fimages%2FCentOS-7.9-x86_64%2Fvmlinuz%3Binitrd%3D10.26.20.11:%2Fvar%2Flib%2Ftftpboot%2Fimages%2FCentOS-7.9-x86_64%2Finitrd.img&name=HCC-BM-CentOS-79-x64&displaytext=HCC-BM-CentOS-79-x64&zoneids=f84ce38e-19a1-406c-b084-77fe9f2e0938,39c307e9-9977-4df3-be16-2740f86d20ee&hypervisor=BareMetal&format=BareMetal&ostypeid=4b9f72b1-0958-11ec-8fc1-005056b6a63a&requireshvm=false&command=registerTemplate&response=json
2023-10-31 15:05:54,840 DEBUG [c.c.a.ApiServlet] (qtp1955920234-2168:ctx-e540fbe2) (logid:e416c2df) Two factor authentication is already verified for the user 2, so skipping
2023-10-31 15:05:54,856 DEBUG [c.c.a.ApiServer] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) CIDRs from which account 'Account [{"accountName":"admin","id":2,"uuid":"5be302d9-0958-11ec-8fc1-005056b6a63a"}]' is allowed to perform API calls: 0.0.0.0/0,::/0
2023-10-31 15:05:54,862 INFO  [o.a.c.a.DynamicRoleBasedAPIAccessChecker] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) Account [Account [{"accountName":"admin","id":2,"uuid":"5be302d9-0958-11ec-8fc1-005056b6a63a"}]] is Root Admin or Domain Admin, all APIs are allowed.
2023-10-31 15:05:54,865 WARN  [o.a.c.a.ProjectRoleBasedApiAccessChecker] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) Project is null, ProjectRoleBasedApiAccessChecker only applies to projects, returning API [registerTemplate] for user [User {"username":"admin","uuid":"5be40e54-0958-11ec-8fc1-005056b6a63a"}.] as allowed.
2023-10-31 15:05:54,866 DEBUG [o.a.c.a.StaticRoleBasedAPIAccessChecker] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) RoleService is enabled. We will use it instead of StaticRoleBasedAPIAccessChecker.
2023-10-31 15:05:54,867 DEBUG [o.a.c.r.ApiRateLimitServiceImpl] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) API rate limiting is disabled. We will not use ApiRateLimitService.
2023-10-31 15:05:54,967 DEBUG [c.c.r.ResourceLimitManagerImpl] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) Updating resource Type = template count for Account = 2 Operation = increasing Amount = 1
2023-10-31 15:05:55,011 ERROR [c.c.a.ApiServer] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) unhandled exception executing api command: [Ljava.lang.String;@6270e47f
java.lang.NullPointerException
    at org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO.getDataStoreId(TemplateDataStoreVO.java:183)
    at com.cloud.api.query.dao.TemplateJoinDaoImpl.newTemplateResponse(TemplateJoinDaoImpl.java:178)
    at jdk.internal.reflect.GeneratedMethodAccessor1247.invoke(Unknown Source)
    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)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    at com.sun.proxy.$Proxy331.newTemplateResponse(Unknown Source)
    at com.cloud.api.ApiDBUtils.newTemplateResponse(ApiDBUtils.java:2080)
    at com.cloud.api.query.ViewResponseHelper.createTemplateResponse(ViewResponseHelper.java:585)
    at com.cloud.api.ApiResponseHelper.createTemplateResponses(ApiResponseHelper.java:1783)
    at org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd.execute(RegisterTemplateCmd.java:318)
    at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:163)
    at com.cloud.api.ApiServer.queueCommand(ApiServer.java:777)
    at com.cloud.api.ApiServer.handleRequest(ApiServer.java:601)
    at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:347)
    at com.cloud.api.ApiServlet$1.run(ApiServlet.java:154)
    at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
    at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
    at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
    at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:151)
    at com.cloud.api.ApiServlet.doGet(ApiServlet.java:105)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
    at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
    at java.base/java.lang.Thread.run(Thread.java:829)
2023-10-31 15:05:55,019 DEBUG [c.c.a.ApiServlet] (qtp1955920234-2168:ctx-e540fbe2 ctx-32c6fa37) (logid:e416c2df) ===END===  10.64.94.63 -- GET  url=ks%3Dhttp:%2F%2F10.26.20.11:8080%2Fcloudstack_ks%2FCentOS-79-x86_64.ks%3Bkernel%3D10.26.20.11:%2Fvar%2Flib%2Ftftpboot%2Fimages%2FCentOS-7.9-x86_64%2Fvmlinuz%3Binitrd%3D10.26.20.11:%2Fvar%2Flib%2Ftftpboot%2Fimages%2FCentOS-7.9-x86_64%2Finitrd.img&name=HCC-BM-CentOS-79-x64&displaytext=HCC-BM-CentOS-79-x64&zoneids=f84ce38e-19a1-406c-b084-77fe9f2e0938,39c307e9-9977-4df3-be16-2740f86d20ee&hypervisor=BareMetal&format=BareMetal&ostypeid=4b9f72b1-0958-11ec-8fc1-005056b6a63a&requireshvm=false&command=registerTemplate&response=json
2023-10-31 15:05:55,062 DEBUG [c.c.a.AlertManagerImpl] (HTTP-Dispatcher:null) (logid:) Done capacity updates for public ip and Vlans
EXPECTED RESULTS

Create a Baremetal Template successfully

ACTUAL RESULTS

Can not Create a Baremetal Template


Cloud you please help to handle this issue? If need other info, please add a comment.

I can not find some useful info on the official doc, I just find the belows:

Reference:
  1. http://events17.linuxfoundation.org/sites/events/files/slides/Baremetal-v4.1a.pdf
  2. https://github.com/apache/cloudstack/issues/5772
  3. https://cwiki.apache.org/confluence/display/CLOUDSTACK/Baremetal+KickStart
  4. https://download.cloudstack.org/centos/7/4.18/cloudstack-baremetal-agent-4.18.0.0-1.el7.x86_64.rpm
  5. https://github.com/apache/cloudstack/issues/8091
  6. https://docs.accelerite.com/app/cloudplatform/pdf/CloudPlatform_powered_by_Apache_CloudStack_Version_4.5.1_Getting_Started_Guide.pdf
xuanyuanaosheng commented 1 year ago

Only add a Baremetal Template in the Baremetal zone and it works.

I think it need to check related code to do someting to avoid this or add some comments on te web UI.