차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
sushy-tools_redfish-vbmc_설정하기 [2025/04/23 03:00] – 만듦 koovsushy-tools_redfish-vbmc_설정하기 [2025/04/23 10:11] (현재) – [인증] koov
줄 1: 줄 1:
 ====== sushy-tools (redfish-vbmc) 설정하기 ====== ====== sushy-tools (redfish-vbmc) 설정하기 ======
 + --- //[[koovis@gmail.com|이강우]] 2025/04/23 03:12//
 +
 +가상머신(KVM)에 ''BMC'' 기능을 이용하기위해 보통 ''vbmc''를 사용하는데 일반적으로 ''vbmc''는 ''IPMI''로만 지원이 된다.
 +최신 오픈스택등의 클라우드/컨테이너 환경에서는 새로운 표준 ''BMC'' 프로토콜인 ''Redfish''를 권장하기 때문에 이 프로토콜로 구성해야 하는 경우가 있다.
 +''IPMI''의 단점을 극복하고 더 현대적인 웹 기술(''HTTPS'', ''REST'', ''JSON'')을 기반으로 안전하고 확장 가능하며 자동화 친화적인 관리 인터페이스를 제공하기 위해 ''Redfish'' 표준이 개발되었습니다.
 +
 +===== 설치 =====
 +아래 환경은 RedHat RHEL/Rocky Linux 9 버전에서 진행되었습니다.
 +
 +  * ''KVM''은 미리 구성되어있다고 가정합니다.
 +  * ''Python/pip'' 가 설치되어있어야 합니다.
 +
 +
 +<WRAP prewrap>
 +<code bash>
 +$ pip install sushy-tools
 +</code>
 +</WRAP>
 +
 +설치가 완료되면 ''systemd script''를 생성한다.
 +''/etc/systemd/system/sushy-emulator.service''
 +<WRAP prewrap>
 +<code vim /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
 +</code>
 +</WRAP>
 +
 +따로 설정파일 없이 기동할 수 있다.
 +설정파일 ''/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''
 +<WRAP prewrap>
 +<code vim /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: <비밀번호 다시 입력>
 +</code>
 +</WRAP>
 +
 +===== 설정파일 예제 =====
 +
 +''/etc/sushy/sushy-emulator.conf''
 +<WRAP prewrap>
 +<code vim /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'
 +</code>
 +</WRAP>
 +
 +<WRAP prewrap>
 +<code bash>
 +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."
 +</code>
 +</WRAP>
 +
 +==== 서버 정보 조회 ====
 +<WRAP prewrap>
 +<code bash>
 +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
 +</code>
 +</WRAP>
 +
 +==== 전원 상태 확인 ====
 +<WRAP prewrap>
 +<code bash>
 +curl -k -u "{username}:{password}" http://localhost:8000/redfish/v1/Systems/{vm_uuid} | jq '.PowerState'
 +</code>
 +</WRAP>
 +
 +==== 전원 켜기 ====
 +<WRAP prewrap>
 +<code bash>
 +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
 +</code>
 +</WRAP>
 +     
 +==== 전원 끄기 ====
 +  * 강제 종료
 +<WRAP prewrap>
 +<code bash>
 +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
 +</code>
 +</WRAP>
 +
 +  * 정상 종료
 +<WRAP prewrap>
 +<code bash>
 +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
 +</code>
 +</WRAP>
 +
 +===== 참조링크 =====
 +  * https://docs.openstack.org/sushy-tools/latest/
 +
  
  • sushy-tools_redfish-vbmc_설정하기.1745377247.txt.gz
  • 마지막으로 수정됨: 2025/04/23 03:00
  • 저자 koov