首页
openstack 开启串口控制台

OpenStack从J版本开始提供了串口的显示方式

ansible的配置上可以通过变量enable_nova_serialconsole_proxy: "yes"来开启

手动部署

控制节点

部署nova-serialproxy服务

nova-serialproxy服务的nova.conf`配置文件增加如下配置

[serial_console]
enabled = true
base_url = ws://192.168.113.179:6083/
serialproxy_host = 192.168.113.173
serialproxy_port = 6083
proxyclient_address = 192.168.113.173

config.json配置如下

{
    "command": "nova-serialproxy",
    "config_files": [
        {
            "source": "/var/lib/kolla/config_files/nova.conf",
            "dest": "/etc/nova/nova.conf",
            "owner": "nova",
            "perm": "0600"
        }
    ],
    "permissions": [
        {
            "path": "/var/log/kolla/nova",
            "owner": "nova:nova",
            "recurse": true
        }
    ]
}

启动容器

docker run \
    --name=/nova_serialproxy \
    --env="KOLLA_CONFIG_STRATEGY=COPY_ALWAYS" \
    --env="KOLLA_SERVICE_NAME=nova-serialproxy" \
    --env="PATH=/var/lib/kolla/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
    --env="LANG=en_US.UTF-8" \
    --env="KOLLA_BASE_DISTRO=ubuntu" \
    --env="KOLLA_DISTRO_PYTHON_VERSION=3.10" \
    --env="KOLLA_BASE_ARCH=x86_64" \
    --env="PS1=$(tput bold)($(printenv KOLLA_SERVICE_NAME))$(tput sgr0)[$(id -un)@$(hostname -s) $(pwd)]$ " \
    --env="DEBIAN_FRONTEND=noninteractive" \
    --env="PIP_INDEX_URL=" \
    --env="PIP_TRUSTED_HOST=" \
    --env="PIP_EXTRA_INDEX_URL=" \
    --network "host" \
    --volume="/etc/kolla/nova-serialproxy/:/var/lib/kolla/config_files/:ro" \
    --volume="/etc/localtime:/etc/localtime:ro" \
    --volume="/etc/timezone:/etc/timezone:ro" \
    --volume="kolla_logs:/var/log/kolla/:rw" \
    --label "build-date"="20230926" \
    --label "kolla_version"="15.2.1" \
    --label "maintainer"="Kolla Project (https://launchpad.net/kolla)" \
    --label "name"="nova-serialproxy" \
    --label "org.opencontainers.image.ref.name"="ubuntu" \
    --label "org.opencontainers.image.version"="22.04" \
    --log-driver="json-file" \
    --restart="unless-stopped" \
    --detach=true \
    --ipc="private"\
    "kolla/centos-binary-nova-serialproxy:4.2.0-rc1" \
    "kolla_start"

haproxy配置

backend serialconsole_db33c132-4eb4-4c91-8ab6-84037422b85f
  balance source
  reqrep ^([^\ :]*)\ /serialconsole/db33c132-4eb4-4c91-8ab6-84037422b85f/(.*)  \1\ /\2

  server db33c132-4eb4-4c91-8ab6-84037422b85f 192.168.113.179:6083 check inter 10s fastinter 2s downinter 3s rise 3 fall 3


listen nova_consolproxy
  bind 192.168.113.179:6083
  server node173 192.168.113.173:6083 check inter 2000 rise 2 fall 5

frontend portalserver_console

....

    acl serialconsole_db33c132-4eb4-4c91-8ab6-84037422b85f path_beg /serialconsole/db33c132-4eb4-4c91-8ab6-84037422b85f
    use_backend serialconsole_db33c132-4eb4-4c91-8ab6-84037422b85f if serialconsole_db33c132-4eb4-4c91-8ab6-84037422b85f


    default_backend httpserver

计算节点

nova-compute服务的nova.conf配置文件增加如下配置

[serial_console]
enabled = true
base_url = ws://192.168.113.179:6083/
serialproxy_host = 192.168.113.173
serialproxy_port = 6083
proxyclient_address = 192.168.113.173

获取访问地址

nova get-serial-console ccb6b552-fcd7-43b4-aace-109a2e542c82