문서의 이전 판입니다!


sushy-tools (redfish-vbmc) 설정하기

이강우 2025/04/23 03:12

가상머신(KVM)에 BMC 기능을 이용하기위해 보통 vbmc를 사용하는데 일반적으로 vbmcIPMI로만 지원이 된다.
최신 오픈스택등의 클라우드/컨테이너 환경에서는 새로운 표준 BMC 프로토콜인 Redfish를 권장하기 때문에 이 프로토콜로 구성해야 하는 경우가 있다.
IPMI의 단점을 극복하고 더 현대적인 웹 기술(HTTPS, REST, JSON)을 기반으로 안전하고 확장 가능하며 자동화 친화적인 관리 인터페이스를 제공하기 위해 Redfish 표준이 개발되었습니다.

아래 환경은 RedHat RHEL/Rocky Linux 9 버전에서 진행되었습니다.

  • KVM은 미리 구성되어있다고 가정합니다.
  • Python/pip 가 설치되어있어야 합니다.
$ pip install sushy-tools

설치가 완료되면 systemd script를 생성한다.
/etc/systemd/system/sushy-emulator.service

# /etc/systemd/system/sushy-emulator.service
[Unit]
Description=Sushy Libvirt emulator
After=syslog.target

[Service]
Type=simple
ExecStart=/usr/local/bin/sushy-emulator --port 8000 --libvirt-uri "qemu:///system"
#ExecStart=/usr/local/bin/sushy-emulator --config /etc/sushy/sushy-emulator.conf --libvirt-uri "qemu:///system"
StandardOutput=syslog
StandardError=syslog
Restart=always

[Install]
WantedBy=multi-user.target

따로 설정파일 없이 기동할 수 있다.
설정파일 /etc/sushy/sushy-emulator.conf 을 이용하면 주석처리된 부분처럼 변경하면 된다.

sushy-tools에 인증을 적용하려면 설정파일의 SUSHY_EMULATOR_AUTH_FILE 지시자를 설정 한다.
SUSHY_EMULATOR_AUTH_FILE = '/etc/sushy/sushy-authfile'

인증정보를 htpasswd형식 파일로 생성한다. 이때 주의해야할 점은 htpasswd는 기본적으로 MD5 Hash를 이용하는데 sushy-tools에서는 반드시 bcrypt함수를 이용해서 암호문자열을 생성해야 한다. 따라서 htpasswd 사용시 -B 옵션을 이용해야 한다.
/etc/sushy/sushy-authfile

# 예: /etc/sushy/sushy_authfile 파일에 'admin' 사용자 추가
sudo mkdir -p /etc/sushy
sudo htpasswd -B -c /etc/sushy/sushy-authfile admin
# New password: <비밀번호 입력>
# Re-type new password: <비밀번호 다시 입력>

/etc/sushy/sushy-emulator.conf

# sushy emulator configuration file built on top of Flask application
# configuration infrastructure: http://flask.pocoo.org/docs/config/

# Listen on all local IP interfaces
SUSHY_EMULATOR_LISTEN_IP = '0.0.0.0'

# Bind to TCP port 8000
SUSHY_EMULATOR_LISTEN_PORT = 8000

# If authentication is desired, set this to an htpasswd file.
SUSHY_EMULATOR_AUTH_FILE = '/etc/sushy/sushy-authfile'

# The libvirt URI to use. This option enables libvirt driver.
SUSHY_EMULATOR_LIBVIRT_URI = u'qemu:///system'
curl -u "admin:admin" http://localhost:8000/redfish/v1/Systems

[root@kvm33 sushy]# curl -u "admin:admin" http://localhost:8000/redfish/v1/Systems
{
    "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
    "Name": "Computer System Collection",
    "Members@odata.count": 3,
    "Members": [

            {
                "@odata.id": "/redfish/v1/Systems/96cc2716-4670-4b0b-ae66-5a68febc9525"
            },

            {
                "@odata.id": "/redfish/v1/Systems/02a6ecfe-cf95-4138-9467-545e9f380a45"
            },

            {
                "@odata.id": "/redfish/v1/Systems/92241405-6e50-4c44-af0b-864e52bd6d45"
            }

    ],
    "@odata.context": "/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection",
    "@odata.id": "/redfish/v1/Systems",
    "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
curl -k -u "{username}:{password}" http://localhost:8000/redfish/v1/Systems/{vm_uuid} | jq .
# ex)
curl -k -u "admin:admin" http://localhost:8000/redfish/v1/Systems/ee5cb7b7-84d0-4e62-9a42-5a8b9282d8fa
curl -k -u "{username}:{password}" http://localhost:8000/redfish/v1/Systems/{vm_uuid} | jq '.PowerState'
curl -k -u "{username}:{password}" \
     -X POST \
     -H "Content-Type: application/json" \
     -d '{"ResetType": "On"}' \
     http://localhost:8000/redfish/v1/Systems/{vm_uuid}/Actions/ComputerSystem.Reset

# ex)
curl -k -u "admin:admin" \
     -X POST \
     -H "Content-Type: application/json" \
     -d '{"ResetType": "On"}' \
     http://localhost:8000/redfish/v1/Systems/ee5cb7b7-84d0-4e62-9a42-5a8b9282d8fa/Actions/ComputerSystem.Reset
  • 강제 종료
curl -k -u "{username}:{password}" \
     -X POST \
     -H "Content-Type: application/json" \
     -d '{"ResetType": "ForceOff"}' \
     http://localhost:8000/redfish/v1/Systems/{vm_uuid}/Actions/ComputerSystem.Reset
  • 정상 종료
curl -k -u "{username}:{password}" \
     -X POST \
     -H "Content-Type: application/json" \
     -d '{"ResetType": "GracefulShutdown"}' \
     http://localhost:8000/redfish/v1/Systems/{vm_uuid}/Actions/ComputerSystem.Reset
  • sushy-tools_redfish-vbmc_설정하기.1745393802.txt.gz
  • 마지막으로 수정됨: 2025/04/23 07:36
  • 저자 koov