apache / cloudstack

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

The Problem about using cloudstack to manager the Baremetal Server #8124

Open xuanyuanaosheng opened 10 months ago

xuanyuanaosheng commented 10 months ago

We want using cloudstack to manager the Baremetal Server to achieve to deploy the OS on pysical 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. The 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
    1. Add the above Baremetal Server to the cluster:

image

The error on web UI:

Error 530
Unable to add the host: Cannot find the server resources at http://10.25.30.242`
  1. The cloudstack manager error log is:
2023-10-20 11:41:05,292 INFO  [c.c.r.ResourceManagerImpl] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Trying to add a new host at http://10.25.30.242 in data center 16
2023-10-20 11:41:05,302 DEBUG [c.c.u.s.Script] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Looking for scripts/util/ipmi.py in the classpath
2023-10-20 11:41:05,303 DEBUG [c.c.u.s.Script] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) System resource: file:/usr/share/cloudstack-common/scripts/util/ipmi.py
2023-10-20 11:41:05,303 DEBUG [c.c.u.s.Script] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Absolute path =  /usr/share/cloudstack-common/scripts/util/ipmi.py
2023-10-20 11:41:05,303 DEBUG [c.c.b.m.BareMetalDiscoverer] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Executing: /usr/share/cloudstack-common/scripts/util/ipmi.py ping hostname=10.25.30.242 usrname=ux ****** 
2023-10-20 11:41:05,304 DEBUG [c.c.b.m.BareMetalDiscoverer] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Executing while with timeout : 3600000
.........................
2023-10-20 11:41:13,383 WARN  [c.c.b.m.BareMetalDiscoverer] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Can not set up ipmi connection(ip=10.25.30.242, username=ux, password=******, args) because Get Session Challenge command failedError: Unable to establish LAN sessionError: Unable to establish IPMI v1.5 / RMCP session
2023-10-20 11:41:13,383 WARN  [c.c.r.ResourceManagerImpl] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Cannot find the server resources at http://10.25.30.242
2023-10-20 11:41:13,383 INFO  [c.c.u.e.CSExceptionErrorCode] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Could not find exception: com.cloud.exception.DiscoveryException in error code list for exceptions
2023-10-20 11:41:13,383 WARN  [o.a.c.a.c.a.h.AddHostCmd] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Exception: 
com.cloud.exception.DiscoveryException: Unable to add the host: Cannot find the server resources at http://10.25.30.242
        at com.cloud.resource.ResourceManagerImpl.discoverHostsFull(ResourceManagerImpl.java:880)
        at com.cloud.resource.ResourceManagerImpl.discoverHosts(ResourceManagerImpl.java:644)
        at jdk.internal.reflect.GeneratedMethodAccessor5110.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 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.$Proxy199.discoverHosts(Unknown Source)
        at org.apache.cloudstack.api.command.admin.host.AddHostCmd.execute(AddHostCmd.java:136)
        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.doPost(ApiServlet.java:110)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
        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)
2023-10-20 11:41:13,385 INFO  [c.c.a.ApiServer] (qtp1955920234-35132:ctx-668d920b ctx-00851472) (logid:eaf1e42a) Unable to add the host: Cannot find the server
 resources at http://10.25.30.242

I have do some test:

# /usr/bin/ipmitool -I lanplus  -R 1 -v -H 10.25.30.242 -p 623 -U ux -P XXXXXXXX chassis power status
Chassis Power is on

# /usr/bin/ipmitool   -R 1 -v -H 10.25.30.242 -p 623 -U ux -P XXXXXXXX chassis power status
Authentication type NONE not supported
Error: Unable to establish LAN session
Error: Unable to establish IPMI v1.5 / RMCP session

# /usr/share/cloudstack-common/scripts/util/ipmi.py ping hostname=10.25.30.242 usrname=ux password=XXXXXXXX
Get Session Challenge command failed
Error: Unable to establish LAN session
Error: Unable to establish IPMI v1.5 / RMCP session
EXPECTED RESULTS

Add Baremetal Server

ACTUAL RESULTS

Can not add Baremetal Server

How to hadle this problem?


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
Suggestion:
  1. Please consider a project: https://github.com/cobbler/cobbler/ when intergrated the Baremetal Management.

I think it is a /usr/share/cloudstack-common/scripts/util/ipmi.py problem @weizhouapache @hooklee2000 Any idears?

hooklee2000 commented 10 months ago

Configure and make sure to start IPMI in baremetal node, check the IPMI web page with curl http://10.25.30.242 in cs management node. When add baremetal host, input the host 、username、password of BMC ipmi. On the other side, as Host MAC pls use the right nic which is not ipmi nic and can install os system using pxe. check the right version of ipmi to communicate with ipmi server, maybe upgrade to version 1.8 or 2.0 ? Error: Unable to establish LAN session Error: Unable to establish IPMI v1.5 / RMCP session

xuanyuanaosheng commented 10 months ago

I have check all as you metioned.

  1. The IPMI in baremetal node has been configed.

image

WXWorkCapture_16981183836843
  1. The result in cs management node:

# ipmitool -V
ipmitool version 1.8.18

# /usr/bin/ipmitool -I lanplus  -R 1 -v -H 10.25.30.242 -p 623 -U ux -P XXXXXXXX chassis power status
Chassis Power is on

# /usr/bin/ipmitool   -R 1 -v -H 10.25.30.242 -p 623 -U ux -P XXXXXXXX chassis power status
Authentication type NONE not supported
Error: Unable to establish LAN session
Error: Unable to establish IPMI v1.5 / RMCP session

# /usr/share/cloudstack-common/scripts/util/ipmi.py ping hostname=10.25.30.242 usrname=ux password=XXXXXXXX
Get Session Challenge command failed
Error: Unable to establish LAN session
Error: Unable to establish IPMI v1.5 / RMCP session

# curl http://10.25.30.242
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://10.25.30.242:443/restgui/start.html">here</a>.</p>
</body></html>

 curl -k https://10.25.30.242
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://10.25.30.242/restgui/start.html">here</a>.</p>
</body></html>

# yum install OpenIPMI  ipmitool
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirrors.tuna.tsinghua.edu.cn
Package OpenIPMI-2.0.27-1.el7.x86_64 already installed and latest version
Package ipmitool-1.8.18-10.el7_9.x86_64 already installed and latest version
Nothing to do

# /usr/bin/ipmitool  -R 1 -vvv -H 10.25.30.242 -p 623 -U ux -P XXXXXXXX chassis power status
Sending IPMI/RMCP presence ping packet
send_packet (12 bytes)
 06 00 ff 06 00 00 11 be 80 00 00 00
recv_packet (28 bytes)
 06 00 ff 06 00 00 11 be 40 00 00 10 00 00 8e 71
 00 00 00 00 81 00 00 00 00 00 00 00
Received IPMI/RMCP response packet: 
  IPMI Supported
  ASF Version 1.0
  RMCP Version 1.0
  RMCP Sequence 255
  IANA Enterprise 140217797348977

ipmi_lan_send_cmd:opened=[1], open=[-1478683600]
>> IPMI Request Session Header (level 0)
>>   Authtype   : NONE
>>   Sequence   : 0x00000000
>>   Session ID : 0x00000000
>> IPMI Request Message Header
>>   Rs Addr    : 20
>>   NetFn      : 06
>>   Rs LUN     : 0
>>   Rq Addr    : 81
>>   Rq Seq     : 01
>>   Rq Lun     : 0
>>   Command    : 38
send_packet (23 bytes)
 06 00 ff 07 00 00 00 00 00 00 00 00 00 09 20 18
 c8 81 04 38 0e 04 31
recv_packet (30 bytes)
 06 00 ff 07 00 00 00 00 00 00 00 00 00 10 81 1c
 63 20 04 38 00 01 04 1c 00 00 00 00 00 83
ipmi message header (30 bytes)
 06 00 ff 07 00 00 00 00 00 00 00 00 00 10 81 1c
 63 20 04 38 00 01 04 1c 00 00 00 00 00 83
<< IPMI Response Session Header
<<   Authtype   : NONE
<<   Sequence   : 0x00000000
<<   Session ID : 0x00000000
<< IPMI Response Message Header
<<   Rq Addr    : 81
<<   NetFn      : 07
<<   Rq LUN     : 0
<<   Rs Addr    : 20
<<   Rq Seq     : 01
<<   Rs Lun     : 0
<<   Command    : 38
<<   Compl Code : 0x00
get_auth_capabilities (8 bytes)
 01 04 1c 00 00 00 00 00
Channel 01 Authentication Capabilities:
  Privilege Level : ADMINISTRATOR
  Auth Types      : MD5 
  Per-msg auth    : disabled
  User level auth : disabled
  Non-null users  : enabled
  Null users      : disabled
  Anonymous login : disabled

Proceeding with AuthType MD5
ipmi_lan_send_cmd:opened=[1], open=[-1478683600]
>> IPMI Request Session Header (level 0)
>>   Authtype   : MD5
>>   Sequence   : 0x00000000
>>   Session ID : 0x00000000
>> IPMI Request Message Header
>>   Rs Addr    : 20
>>   NetFn      : 06
>>   Rs LUN     : 0
>>   Rq Addr    : 81
>>   Rq Seq     : 02
>>   Rq Lun     : 0
>>   Command    : 39
send_packet (38 bytes)
 06 00 ff 07 00 00 00 00 00 00 00 00 00 18 20 18
 c8 81 08 39 02 75 78 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 4f
  No response from remote controller
Get Session Challenge command failed
Error: Unable to establish LAN session
Error: Unable to establish IPMI v1.5 / RMCP session

# /usr/bin/ipmitool -I lanplus  -R 1 -v -H 10.25.30.242 -p 623 -U ux -P XXXXXX mc info
Device ID                 : 32
Device Revision           : 1
Firmware Revision         : 7.00
IPMI Version              : 2.0
Manufacturer ID           : 674
Manufacturer Name         : DELL Inc
Product ID                : 256 (0x0100)
Product Name              : Unknown (0x100)
Device Available          : yes
Provides Device SDRs      : yes
Additional Device Support :
    Sensor Device
    SDR Repository Device
    SEL Device
    FRU Inventory Device
    IPMB Event Receiver
    Bridge
    Chassis Device
Aux Firmware Rev Info     : 
    0x00
    0x35
    0x00
    0x00

@hooklee2000

Any idears?

xuanyuanaosheng commented 9 months ago

I have changed the file /usr/share/cloudstack-common/scripts/util/ipmi.py and now the baremetal node can be add to the zone.

#!/usr/bin/python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

import sys, os, subprocess, errno, re
from os.path import exists

TOOl_PATH = "/usr/bin/ipmitool"

try:
    from subprocess import check_call
    from subprocess import CalledProcessError
except ImportError:
    def check_call(*popenargs, **kwargs):
        import subprocess
        retcode = subprocess.call(*popenargs, **kwargs)
        cmd = kwargs.get("args")
        if cmd is None: cmd = popenargs[0]
        if retcode: raise CalledProcessError(retcode, cmd)
        return retcode

    class CalledProcessError(Exception):
        def __init__(self, returncode, cmd):
            self.returncode = returncode ; self.cmd = cmd
        def __str__(self): return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)

class Command:
    def __init__(self,name,parent=None):
        self.__name = name
        self.__parent = parent
    def __getattr__(self,name):
        if name == "_print": name = "print"
        return Command(name,self)
    def __call__(self,*args):
        class CommandOutput:
            def __init__(self,ret,stdout,stderr):
                self.stdout = stdout
                self.stderr = stderr
                self.ret = ret

        cmd = self.__get_recursive_name() + list(args)
        #print "    ",cmd
        popen = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        m = popen.communicate()
        ret = popen.wait()
        return CommandOutput(ret,*m)
    def __get_recursive_name(self,sep=None):
        m = self
        l = []
        while m is not None:
            l.append(m.__name)
            m = m.__parent
        l.reverse()
        if sep: return sep.join(l)
        else: return l
    def __str__(self):
        return '<Command %r>'%self.__get_recursive_name(sep=" ")

    def __repr__(self): return self.__str__()

ipmitool = Command("ipmitool")

def check_tool():
    if exists(TOOl_PATH) == False:
        print "Can not find ipmitool"
        return False

def ping(args):
    hostname = args.get("hostname")
    usrname = args.get("usrname")
    password = args.get("password")

    if hostname == None:
        print "No hostname"
        return 1

    o = ipmitool("-I", "lanplus", "-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "status")
    if o.ret:
        print o.stderr
        return 1
    else:
        print o.stdout
        return 0

def boot_dev(args):
    hostname = args.get("hostname")
    usrname = args.get("usrname")
    password = args.get("password")
    dev = args.get("dev")

    if hostname == None:
        print "No hostname"
        return 1

    if dev == None:
        print "No boot device specified"
        return 1

    o = ipmitool("-I", "lanplus", "-H", hostname, "-U", usrname, "-P", password, "chassis", "bootdev", dev)
    if o.ret:
        print o.stderr
        return 1
    else:
        return 0

def reboot(args):
    hostname = args.get("hostname")
    usrname = args.get("usrname")
    password = args.get("password")

    if hostname == None:
        print "No hostname"
        return 1

    o = ipmitool("-I", "lanplus", "-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "status")
    if o.ret:
        print o.stderr
        return 1

    if "is on" in o.stdout:
        o = ipmitool("-I", "lanplus", "-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "cycle")
    else:
        o = ipmitool("-I", "lanplus", "-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "reset")

    if o.ret:
        print o.stderr
        return 1
    else:
        return 0

def power(args):
    hostname = args.get("hostname")
    usrname = args.get("usrname")
    password = args.get("password")
    action = args.get("action")

    if hostname == None:
        print "No hostname"
        return 1

    o = ipmitool("-I", "lanplus", "-H", hostname, "-U", usrname, "-P", password, "chassis", "power", action)
    if o.ret:
        print o.stderr
        return 1
    else:
        return 0

def boot_or_reboot(args):
    hostname = args.get("hostname")
    usrname = args.get("usrname")
    password = args.get("password")
    o = ipmitool("-I", "lanplus", "-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "status")
    if o.ret:
        print o.stderr
        return 1

    if "is on" in o.stdout:
        return reboot(args)
    elif "is off" in o.stdout:
        args["action"] = "on"
        return power(args)
    else:
        print "unknown power status:" + o.stdout
        return 1

call_table = {"ping":ping, "boot_dev":boot_dev, "reboot":reboot, "power":power, "boot_or_reboot":boot_or_reboot}
def dispatch(args):
    cmd = args[1]
    params = args[2:]
    func_params = {}

    if call_table.has_key(cmd) == False:
        print "No function %s" % cmd
        return 1

    for p in params:
        pairs = p.split("=")
        if len(pairs) != 2:
            print "Invalid parameter %s" % p
            return 1
        func_params[pairs[0]] = pairs[1]

    func = call_table[cmd]
    return func(func_params)

if __name__ == "__main__":
    if check_tool() == False:
        sys.exit(1)
    if len(sys.argv) < 2:
        print "Not enough arguments, at least one"
        sys.exit(1)
    sys.exit(dispatch(sys.argv))
xuanyuanaosheng commented 9 months ago

Now when Create a Baremetal Template, It can not add it

The error 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

@hooklee2000 Any idears?

hooklee2000 commented 9 months ago

check #8162, you select "all zone'.
listStoresByZoneId can'nt find secondary storage in the right "all zone". Maybe create a secondary storage in your zone csbm , and choose the zone csbm .

xuanyuanaosheng commented 9 months ago

@hooklee2000 Add a Baremetal Template only in the Baremetal zone and it added successfully.

But after adding a compute offering using below:

image

It has errors: image

The cloudstack managerment error is:

2023-11-01 11:52:11,611 WARN  [o.a.c.a.ProjectRoleBasedApiAccessChecker] (qtp1955920234-21:ctx-6316c47a ctx-d191f040) (logid:8b62d839) Project is null, ProjectRoleBasedApiAccessChecker only applies to projects, returning API [deployVirtualMachine] for user [User {"username":"admin","uuid":"5be40e54-0958-11ec-8fc1-005056b6a63a"}.] as allowed.
2023-11-01 11:52:11,613 DEBUG [o.a.c.a.StaticRoleBasedAPIAccessChecker] (qtp1955920234-21:ctx-6316c47a ctx-d191f040) (logid:8b62d839) RoleService is enabled. We will use it instead of StaticRoleBasedAPIAccessChecker.
2023-11-01 11:52:11,614 DEBUG [o.a.c.r.ApiRateLimitServiceImpl] (qtp1955920234-21:ctx-6316c47a ctx-d191f040) (logid:8b62d839) API rate limiting is disabled. We will not use ApiRateLimitService.
2023-11-01 11:52:11,642 DEBUG [c.c.u.AccountManagerImpl] (qtp1955920234-21:ctx-6316c47a ctx-d191f040) (logid:8b62d839) Access granted to Account [{"accountName":"admin","id":2,"uuid":"5be302d9-0958-11ec-8fc1-005056b6a63a"}] to org.apache.cloudstack.quota.vo.ServiceOfferingVO$$EnhancerByCGLIB$$46ce7255@3e0fe605 by AffinityGroupAccessChecker
2023-11-01 11:52:11,643 DEBUG [c.c.u.AccountManagerImpl] (qtp1955920234-21:ctx-6316c47a ctx-d191f040) (logid:8b62d839) Access granted to Account [{"accountName":"admin","id":2,"uuid":"5be302d9-0958-11ec-8fc1-005056b6a63a"}] to null by AffinityGroupAccessChecker
2023-11-01 11:52:11,658 INFO  [c.c.a.ApiServer] (qtp1955920234-21:ctx-6316c47a ctx-d191f040) (logid:8b62d839) Hypervisor BareMetal does not support rootdisksize override
2023-11-01 11:52:11,659 DEBUG [c.c.a.ApiServlet] (qtp1955920234-21:ctx-6316c47a ctx-d191f040) (logid:8b62d839) ===END===  10.64.94.63 -- GET  zoneid=f84ce38e-19a1-406c-b084-77fe9f2e0938&podid=89c04114-3d16-42a0-8b94-545d03d75574&clusterid=a26a640e-8196-436a-93a1-b4a6f8a1700f&hostid=651f88a7-7289-47b5-b546-ef082d3a469e&boottype=BIOS&bootmode=LEGACY&templateid=20886ce1-de64-4bcb-8b18-a46c5c0f1711&startvm=true&serviceofferingid=8625dc84-75b5-423f-b496-22dd266c8f71&affinitygroupids=&keypairs=&name=test001&displayname=test001&command=deployVirtualMachine&response=json

I don't know why the web UI using command=deployVirtualMachine to create a Baremetal Instance. Could you please take a look at this problem?

Luskan777 commented 3 months ago

HI @xuanyuanaosheng @rohityadavcloud ,

I'm having the same problem here, is there any update?

I would like to help in some way. I can provide access to my infrastructure if necessary