You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/static/index.html

267 lines
33 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#101d2c" />
<title>VirtPilot · 虚拟机管理</title>
<link rel="stylesheet" href="/static/styles.css?v=reinstall-1" />
<script type="module" src="/static/app.js?v=reinstall-1"></script>
</head>
<body>
<div id="boot-screen" class="boot-screen" role="status" aria-live="polite">
<span class="brand-mark" aria-hidden="true"><span></span></span>
<span>正在连接控制面板…</span>
</div>
<main id="setup-view" class="setup-layout" hidden>
<div class="setup-intro">
<div class="setup-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<span class="eyebrow light">FIRST RUN SETUP</span>
<h1>欢迎使用<br />VirtPilot</h1>
<p>只需完成两步,即可从面板管理远端 libvirt 宿主机。启动前无需填写配置文件。</p>
<div class="setup-steps"><span class="current">01 · 创建管理员</span><span>02 · 连接宿主机</span></div>
</div>
<div class="setup-form-side">
<section class="setup-card" aria-labelledby="setup-title">
<span class="eyebrow">步骤 01 / 02</span>
<h2 id="setup-title">创建面板管理员</h2>
<p class="muted">使用面板首次启动时在终端输出的一次性初始化令牌。完成后令牌将失效。</p>
<p class="setup-security-note">安全检查:请先完成你自己的 HTTPS 反向代理,并确认浏览器连接的是你信任的证书和域名,再输入令牌、密码或宿主机私钥。</p>
<form id="setup-form" class="form-stack">
<label for="setup-token">初始化令牌</label>
<input id="setup-token" name="token" type="password" autocomplete="off" maxlength="256" required placeholder="粘贴启动终端输出中的令牌" />
<label for="setup-username">管理员用户名</label>
<input id="setup-username" name="username" type="text" autocomplete="username" minlength="3" maxlength="32" pattern="[A-Za-z][A-Za-z0-9._-]{2,31}" value="admin" required />
<label for="setup-password">管理员密码</label>
<input id="setup-password" name="password" type="password" autocomplete="new-password" minlength="12" maxlength="1024" required placeholder="至少 12 个字符" />
<label for="setup-password-confirm">确认密码</label>
<input id="setup-password-confirm" type="password" autocomplete="new-password" minlength="12" maxlength="1024" required placeholder="再次输入密码" />
<p id="setup-error" class="form-error" role="alert" hidden></p>
<button id="setup-submit" class="button button-primary setup-submit" type="submit">创建管理员并继续 <span aria-hidden="true">→</span></button>
</form>
<p class="setup-note">请通过启动终端输出获取令牌,不要向其他人提供。面板账号与宿主机 root 账号相互独立。</p>
</section>
</div>
</main>
<main id="login-view" class="login-layout" hidden>
<div class="login-art" aria-hidden="true">
<div class="login-art-grid"></div>
<div class="login-art-inner">
<div class="login-art-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<div class="login-art-copy">
<span class="eyebrow light">LIBVIRT CONTROL CENTER</span>
<h1>让每一台虚拟机<br />都尽在掌控。</h1>
<p>从一个安全、清晰的界面,管理远端宿主机上的虚拟机。</p>
</div>
<div class="login-art-footer"><span class="online-dot"></span> 远端 libvirt 管理面板</div>
</div>
<div class="art-orbit orbit-one"></div>
<div class="art-orbit orbit-two"></div>
<div class="art-core"><span></span><span></span><span></span></div>
</div>
<div class="login-form-side">
<div class="login-card">
<div class="login-mobile-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<span class="eyebrow">欢迎回来</span>
<h2>登录管理面板</h2>
<p class="muted">使用管理员账号访问虚拟机控制台。</p>
<form id="login-form" class="form-stack">
<label for="login-username">用户名</label>
<input id="login-username" name="username" type="text" autocomplete="username" maxlength="64" required autofocus placeholder="输入用户名" />
<label for="login-password">密码</label>
<input id="login-password" name="password" type="password" autocomplete="current-password" maxlength="1024" required placeholder="输入密码" />
<p id="login-error" class="form-error" role="alert" hidden></p>
<button id="login-submit" class="button button-primary login-submit" type="submit">登录面板 <span aria-hidden="true">→</span></button>
</form>
<p class="login-hint">通过 HTTPS 安全访问面板;虚拟机操作将在远端宿主机执行。</p>
</div>
</div>
</main>
<main id="host-view" class="host-layout" hidden>
<header class="host-topbar">
<div class="host-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<div class="host-topbar-actions"><span id="host-current-user" class="host-user"></span><button id="host-logout-button" class="button button-ghost small" type="button">退出登录</button></div>
</header>
<div class="host-content">
<div class="host-heading"><div><span id="host-step-label" class="eyebrow">步骤 02 / 02</span><h1 id="host-page-title">连接 libvirt 宿主机</h1><p>填入现有的 root SSH 信息,面板将通过 libvirt API 管理远端虚拟机。</p></div><button id="host-back-button" class="button button-outline" type="button" hidden>返回虚拟机</button></div>
<div class="host-columns">
<section class="host-card" aria-labelledby="host-form-title">
<div class="host-card-heading"><span class="host-card-number">1</span><div><h2 id="host-form-title">SSH 连接信息</h2><p>使用宿主机已有的 root 私钥,不创建额外的系统账号。</p></div></div>
<form id="host-form">
<div class="form-grid">
<div class="field"><label for="host-address">宿主机地址 <span>*</span></label><input id="host-address" name="host" type="text" required maxlength="253" autocomplete="off" placeholder="例如 192.0.2.10" /></div>
<div class="field"><label for="host-port">SSH 端口 <span>*</span></label><input id="host-port" name="port" type="number" min="1" max="65535" value="22" required /></div>
<div class="field"><label for="host-username">SSH 用户</label><input id="host-username" type="text" value="root" disabled /></div>
<div class="field"><label for="host-storage-pool">虚拟机磁盘目录或存储池名</label><input id="host-storage-pool" name="storage_pool" type="text" maxlength="4096" value="default" required autocomplete="off" placeholder="例如 /home/kvm 或 default" /><small>可直接填写宿主机上的绝对路径,如 /home/kvm;也兼容现有 libvirt 存储池名称。</small></div>
<div class="field"><label for="host-iso-pool">ISO 目录或存储池名</label><input id="host-iso-pool" name="iso_pool" type="text" maxlength="4096" value="iso" required autocomplete="off" placeholder="例如 /home/iso 或 iso" /><small>可直接填写宿主机上的绝对路径,如 /home/iso;不是面板服务器的路径。</small></div>
<div class="field"><label for="host-network">默认虚拟网络或网桥</label><input id="host-network" name="default_network" type="text" maxlength="128" value="default" required autocomplete="off" placeholder="例如 default 或 bridge:br0" /><small>libvirt 虚拟网络填名称;宿主机现有 Linux 网桥 br0 填 bridge:br0。</small></div>
<div class="field full"><label for="host-private-key">现有 SSH 私钥 <span id="host-key-required-mark">*</span></label><textarea id="host-private-key" name="private_key" rows="5" maxlength="65536" spellcheck="false" autocomplete="off" placeholder="粘贴 -----BEGIN OPENSSH PRIVATE KEY----- 开头的完整内容,或从下方选择文件"></textarea><small id="host-key-hint">仅通过 HTTPS 传输并保存在面板服务器。请确保这把密钥已在宿主机 root 账号上获得授权。</small></div>
<div class="field full"><label for="host-private-key-file">或从本机选择私钥文件</label><input id="host-private-key-file" type="file" /><small id="host-key-file-label">未选择文件;已保存的密钥不会在这里显示。</small></div>
<div class="field full"><label for="host-private-key-passphrase">SSH 私钥口令(如果设置了)</label><input id="host-private-key-passphrase" name="private_key_passphrase" type="password" maxlength="1024" autocomplete="off" spellcheck="false" placeholder="输入用于解锁私钥的口令" /><small>口令不会回显或写入浏览器存储;保存后仅在当前面板进程中用于连接。面板重启后需要重新输入解锁。</small></div>
</div>
</form>
</section>
<div class="host-side-stack">
<section class="host-card" aria-labelledby="host-fingerprint-title">
<div class="host-card-heading"><span class="host-card-number">2</span><div><h2 id="host-fingerprint-title">核对 SSH 主机指纹</h2><p>先扫描面板看到的公钥,再与宿主机控制台显示的指纹对比。</p></div></div>
<button id="host-scan-button" class="button button-outline" type="button">扫描主机指纹</button>
<div id="host-fingerprint-result" class="fingerprint-result" hidden><span>扫描到的指纹 · <span id="host-key-type"></span></span><code id="host-fingerprint"></code></div>
<p class="host-security-note">请在宿主机 B 的控制台执行 <code>ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub</code> 并逐字核对。当前仅支持 Ed25519 主机密钥;不要仅凭网页显示就信任该指纹。</p>
<label id="host-confirm-row" class="checkbox-row host-confirm" hidden><input id="host-fingerprint-confirm" type="checkbox" /><span><strong>我已通过宿主机控制台独立核对,指纹完全一致</strong><small>主机密钥变更时需要重新核对。</small></span></label>
</section>
<section class="host-card" aria-labelledby="host-connect-title">
<div class="host-card-heading"><span class="host-card-number">3</span><div><h2 id="host-connect-title">测试并保存</h2><p>测试 root SSH、libvirt、存储池和虚拟网络是否可用。</p></div></div>
<p id="host-test-status" class="host-test-status" role="status">尚未测试连接</p>
<p id="host-error" class="form-error" role="alert" hidden></p>
<div class="host-submit-actions"><button id="host-test-button" class="button button-outline" type="button">测试连接</button><button id="host-save-button" class="button button-primary" type="submit" form="host-form">保存并进入面板</button></div>
<p class="host-security-note">root 私钥拥有很高权限。请保护面板管理员密码,仅通过 HTTPS 访问面板,并限制能访问面板的网络范围。</p>
</section>
</div>
</div>
</div>
</main>
<main id="unlock-view" class="host-layout" hidden>
<header class="host-topbar">
<div class="host-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<div class="host-topbar-actions"><span id="unlock-current-user" class="host-user"></span><button id="unlock-logout-button" class="button button-ghost small" type="button">退出登录</button></div>
</header>
<div class="unlock-content">
<section class="host-card unlock-card" aria-labelledby="unlock-title">
<span class="eyebrow">HOST KEY LOCKED</span>
<h1 id="unlock-title">解锁宿主机 SSH 私钥</h1>
<p class="muted">宿主机 <strong id="unlock-host-label"></strong> 的私钥已加密。面板重启后需要重新输入私钥口令,才能管理虚拟机。</p>
<form id="unlock-form" class="form-stack">
<label for="unlock-passphrase">私钥口令</label>
<input id="unlock-passphrase" type="password" maxlength="1024" autocomplete="off" spellcheck="false" required autofocus placeholder="输入现有私钥口令" />
<p id="unlock-error" class="form-error" role="alert" hidden></p>
<button id="unlock-submit" class="button button-primary unlock-submit" type="submit">解锁并进入面板</button>
</form>
<p class="host-security-note">口令只用于当前运行中的面板进程,不保存到磁盘或浏览器。请通过 HTTPS 连接面板。</p>
<button id="unlock-settings-button" class="button button-ghost small unlock-settings-button" type="button">修改宿主机设置</button>
</section>
</div>
</main>
<div id="dashboard-view" class="dashboard" hidden>
<aside class="sidebar">
<div class="sidebar-brand"><span class="brand-mark"><span></span></span><span>VirtPilot<small>CONTROL PANEL</small></span></div>
<div class="sidebar-section-label">工作区</div>
<div class="sidebar-link active"><span class="nav-icon" aria-hidden="true">▦</span> 虚拟机 <span class="nav-arrow" aria-hidden="true">›</span></div>
<button id="host-settings-button" class="sidebar-link sidebar-button" type="button"><span class="nav-icon" aria-hidden="true">⌁</span> 宿主机设置 <span class="nav-arrow" aria-hidden="true">›</span></button>
<div class="sidebar-bottom">
<div class="host-panel"><div class="host-panel-icon" aria-hidden="true">⌁</div><div><strong>远端宿主机</strong><span id="host-connection-label">连接中…</span></div><span id="host-connection-dot" class="connection-dot"></span></div>
<div class="sidebar-caption">Powered by libvirt</div>
</div>
</aside>
<div class="main-area">
<header class="topbar">
<div class="breadcrumb">工作区 <span>/</span> <strong>虚拟机</strong></div>
<div class="topbar-right"><button id="host-settings-mobile-button" class="button button-ghost small host-settings-mobile" type="button">宿主机设置</button><span class="topbar-user"><span class="avatar" aria-hidden="true">A</span><span id="current-username">管理员</span></span><button id="logout-button" class="button button-ghost small" type="button">退出登录</button></div>
</header>
<main class="content">
<div class="page-heading"><div><span class="eyebrow">VIRTUAL MACHINES</span><h1>虚拟机管理</h1><p>查看状态、管理电源,并通过浏览器接入控制台。</p></div><div class="heading-actions"><button id="refresh-button" class="button button-outline" type="button"><span aria-hidden="true">↻</span> 刷新</button><button id="create-button" class="button button-primary" type="button"><span aria-hidden="true">+</span> 创建虚拟机</button></div></div>
<div id="resource-warning" class="resource-warning" role="alert" hidden></div>
<div class="overview-grid" aria-label="虚拟机概览">
<section class="stat-card"><div class="stat-top"><span>虚拟机总数</span><span class="stat-icon total" aria-hidden="true">▦</span></div><strong id="stat-total">—</strong><small>当前宿主机</small></section>
<section class="stat-card"><div class="stat-top"><span>运行中</span><span class="stat-icon running" aria-hidden="true">▶</span></div><strong id="stat-running">—</strong><small><span class="tiny-dot green"></span> 正在提供服务</small></section>
<section class="stat-card"><div class="stat-top"><span>已关机</span><span class="stat-icon stopped" aria-hidden="true">⏻</span></div><strong id="stat-stopped">—</strong><small>可随时启动</small></section>
</div>
<section class="inventory-panel" aria-labelledby="inventory-title">
<div class="panel-heading"><div><h2 id="inventory-title">虚拟机列表</h2><p id="inventory-count">正在加载…</p></div><div class="panel-tools"><label class="search-box"><span aria-hidden="true">⌕</span><span class="sr-only">搜索虚拟机</span><input id="search-input" type="search" placeholder="搜索名称或 UUID" /></label><select id="state-filter" aria-label="按状态筛选"><option value="all">全部状态</option><option value="running">运行中</option><option value="stopped">已关机</option><option value="other">其他状态</option></select></div></div>
<div class="table-scroll"><table><thead><tr><th>虚拟机</th><th>状态</th><th>规格</th><th>磁盘</th><th class="actions-heading">操作</th></tr></thead><tbody id="vm-table-body"></tbody></table></div>
<div id="empty-state" class="empty-state" hidden><div class="empty-icon" aria-hidden="true">▦</div><h3 id="empty-title">还没有虚拟机</h3><p id="empty-description">点击右上角“创建虚拟机”开始。</p></div>
</section>
<div class="footer-note">状态每 15 秒自动更新 · 操作会发送至远端 libvirt 宿主机</div>
</main>
</div>
</div>
<div id="create-modal" class="modal-backdrop" hidden>
<section class="modal create-modal" role="dialog" aria-modal="true" aria-labelledby="create-title">
<div class="modal-header"><div><span class="eyebrow">NEW VIRTUAL MACHINE</span><h2 id="create-title">创建虚拟机</h2><p>选择 ISO 安装,或从云镜像模板直接创建系统。</p></div><button class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div>
<form id="create-form">
<div class="modal-body">
<fieldset class="create-source-picker"><legend>系统来源</legend><label><input type="radio" name="source" value="iso" checked /><span><strong>ISO 安装</strong><small>通过 VNC 安装系统</small></span></label><label><input type="radio" name="source" value="cloud" /><span><strong>公网云镜像</strong><small>设置静态 IP 后直接开机</small></span></label></fieldset>
<div class="form-grid">
<div class="field full"><label for="vm-name">名称 <span>*</span></label><input id="vm-name" name="name" type="text" required minlength="1" maxlength="63" pattern="[a-zA-Z0-9][a-zA-Z0-9._-]*" autocomplete="off" placeholder="例如 web-prod-01" /><small>使用英文字母、数字、点、下划线或连字符。</small></div>
<div class="field"><label for="vm-vcpu">vCPU <span>*</span></label><div class="input-suffix"><input id="vm-vcpu" name="vcpu" type="number" min="1" max="64" value="2" required /><span>核</span></div></div>
<div class="field"><label for="vm-memory">内存 <span>*</span></label><div class="input-suffix"><input id="vm-memory" name="memory_mib" type="number" min="512" max="262144" step="1" value="2048" required /><span>MiB</span></div></div>
<div class="field"><label for="vm-disk">系统盘 <span>*</span></label><div class="input-suffix"><input id="vm-disk" name="disk_gib" type="number" min="1" max="4096" value="20" required /><span>GiB</span></div></div>
<div class="field"><label for="vm-network">虚拟网络或网桥 <span>*</span></label><select id="vm-network" name="network" required><option value="">正在加载网络…</option></select></div>
<div class="field full" id="vm-iso-field"><label for="vm-iso">安装 ISO <span>*</span></label><select id="vm-iso" name="iso" required><option value="">正在加载镜像…</option></select><small>镜像来自宿主机允许使用的 ISO 目录。</small></div>
<div class="field full" id="vm-template-field" hidden><label for="vm-template">系统模板 <span>*</span></label><select id="vm-template" name="template_id" disabled><option value="">选择云镜像模板</option></select><small>模板需支持 cloud-init;不会再次进入 ISO 安装界面。</small>
<details id="template-import" class="template-import"><summary>导入新的云镜像模板</summary><div class="template-import-fields">
<div class="field"><label for="template-name">模板名称</label><input id="template-name" type="text" maxlength="64" autocomplete="off" placeholder="例如 AlmaLinux 10 Cloud" /></div>
<div class="field"><label for="template-url">云镜像下载地址</label><input id="template-url" type="text" inputmode="url" maxlength="2048" autocomplete="off" placeholder="粘贴 AlmaLinux 10 官方 GenericCloud qcow2 完整 HTTPS 地址" /><small>目前仅支持 repo.almalinux.org 的 AlmaLinux 10 x86_64 GenericCloud qcow2 镜像。</small></div>
<div class="field"><label for="template-sha256">镜像 SHA-256 校验值</label><input id="template-sha256" type="text" maxlength="64" spellcheck="false" autocomplete="off" placeholder="64 位十六进制校验值" /><small>从镜像发布方核对;面板下载后会校验文件。</small></div>
<p id="template-import-status" class="template-import-status" role="status" hidden></p><p id="template-import-error" class="form-error" role="alert" hidden></p><button id="template-import-button" class="button button-outline small" type="button">导入模板</button>
</div></details>
</div>
<div class="cloud-fields full" id="vm-cloud-fields" hidden>
<div class="cloud-fields-heading"><strong>公网网络配置</strong><small>仅支持已配置的 Linux 网桥,例如 bridge:br0。IP 必须已分配给你,网关必须在同一网段,上游网络还需允许虚拟机的 MAC 地址。</small></div>
<div class="form-grid">
<div class="field"><label for="vm-public-ip-cidr">公网 IPv4/CIDR <span>*</span></label><input id="vm-public-ip-cidr" name="public_ip_cidr" type="text" maxlength="18" inputmode="decimal" autocomplete="off" placeholder="填写服务商分配的公网 IP/28" disabled /><small>填写具体 IP 和前缀长度,不是网段地址。</small></div>
<div class="field"><label for="vm-gateway">同网段网关 IPv4 <span>*</span></label><input id="vm-gateway" name="gateway" type="text" maxlength="15" inputmode="decimal" autocomplete="off" placeholder="填写服务商提供的网关" disabled /></div>
<div class="field full"><label for="vm-dns">DNS IPv4 <span>*</span></label><input id="vm-dns" name="dns_servers" type="text" maxlength="128" autocomplete="off" placeholder="例如 1.1.1.1, 8.8.8.8" disabled /><small>多个地址用逗号或空格分隔。</small></div>
<div class="field full"><label for="vm-guest-ssh-public-key">root SSH 公钥(可选)</label><textarea id="vm-guest-ssh-public-key" name="guest_ssh_public_key" rows="3" maxlength="8192" spellcheck="false" autocomplete="off" autocapitalize="off" placeholder="粘贴 ssh-ed25519 AAAA… 开头的公钥;不要粘贴私钥" disabled></textarea><small>填写后导入 root 用户,使用对应私钥登录;此时无需设置 root 密码,也不开放密码登录。留空则必须设置下方的初始密码。</small></div>
<div class="field full" id="vm-root-password-field" hidden><label for="vm-root-password">初始 root 密码 <span>*</span></label><input id="vm-root-password" name="root_password" type="password" minlength="12" maxlength="128" autocomplete="new-password" spellcheck="false" placeholder="公钥留空时填写,至少 12 个字符" disabled /><small>仅在未填写公钥时启用,用于首次 root 登录。公网密码登录风险较高,请通过 HTTPS 使用面板并设置高强度密码。</small></div>
</div>
</div>
</div><div id="create-iso-tip" class="form-tip"><span aria-hidden="true">ⓘ</span><p>创建后会自动开机,可通过 VNC 安装系统。安装程序首次重启时虚拟机会先停机;之后在面板点“开机”,将从硬盘启动且不再挂载 ISO。</p></div><div id="create-cloud-tip" class="form-tip" hidden><span aria-hidden="true">ⓘ</span><p>云镜像首次启动由 cloud-init 写入静态 IP、DNS 和 root 登录凭据,无需 VNC 安装。填写公钥时用 <code>root</code> 和对应私钥登录;不填写公钥时用初始 root 密码登录。请确认网络配置正确并妥善保存凭据。</p></div><p id="create-error" class="form-error" role="alert" hidden></p></div>
<div class="modal-footer"><button class="button button-outline" type="button" data-close-modal>取消</button><button id="create-submit" class="button button-primary" type="submit">创建并启动</button></div>
</form>
</section>
</div>
<div id="delete-modal" class="modal-backdrop" hidden>
<section class="modal narrow-modal" role="dialog" aria-modal="true" aria-labelledby="delete-title">
<div class="modal-header"><div><span class="eyebrow danger-text">DESTRUCTIVE ACTION</span><h2 id="delete-title">删除虚拟机</h2></div><button class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div>
<form id="delete-form"><div class="modal-body"><p class="delete-copy">确定删除 <strong id="delete-vm-name"></strong> 吗?虚拟机定义将被移除,此操作不可撤销。</p><label class="checkbox-row"><input id="delete-disks" type="checkbox" /><span><strong>同时删除虚拟磁盘</strong><small>勾选后,磁盘数据也会永久删除。</small></span></label><p id="delete-error" class="form-error" role="alert" hidden></p></div><div class="modal-footer"><button class="button button-outline" type="button" data-close-modal>取消</button><button id="delete-submit" class="button button-danger" type="submit">确认删除</button></div></form>
</section>
</div>
<div id="reinstall-modal" class="modal-backdrop" hidden>
<section class="modal create-modal" role="dialog" aria-modal="true" aria-labelledby="reinstall-title">
<div class="modal-header"><div><span class="eyebrow danger-text">REINSTALL SYSTEM</span><h2 id="reinstall-title">重装云镜像系统</h2><p id="reinstall-subtitle">保留原有公网网络参数,重新创建系统盘。</p></div><button id="reinstall-close-top" class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div>
<form id="reinstall-form">
<div class="modal-body">
<div id="reinstall-fields">
<p class="reinstall-warning"><strong>重装将永久清除原系统盘中的全部数据。</strong>面板会先请求虚拟机正常关机;若关机超时,重装会停止,不会强制断电。libvirt/QEMU 报告虚拟机已从新盘启动后,原系统盘将自动删除。这个“启动”不保证客户机系统、网络或 SSH 已经可用,请确认模板和网络配置。</p>
<p class="reinstall-network">沿用首次创建的公网网络信息:<strong id="reinstall-public-ip"></strong>。网桥、MAC、网关和 DNS 也会保持原配置。</p>
<div class="form-grid">
<div class="field full"><label for="reinstall-template">重装模板 <span>*</span></label><select id="reinstall-template" name="template_id" required><option value="">正在加载模板…</option></select><small>仅显示当前宿主机已经导入的云镜像模板;模板必须支持 cloud-init。</small></div>
<div class="field full"><label for="reinstall-ssh-public-key">root SSH 公钥(可选)</label><textarea id="reinstall-ssh-public-key" name="ssh_public_key" rows="3" maxlength="8192" spellcheck="false" autocomplete="off" autocapitalize="off" placeholder="粘贴 ssh-ed25519 AAAA… 开头的公钥;不要粘贴私钥"></textarea><small>填写公钥后使用 root 和对应私钥登录,不开放密码登录。</small></div>
<div class="field full"><label for="reinstall-root-password">初始 root 密码(可选)</label><input id="reinstall-root-password" name="root_password" type="password" minlength="12" maxlength="128" autocomplete="new-password" spellcheck="false" placeholder="至少 12 个字符;留空可自动生成" /><small>公钥和密码只能选择一种;两项都留空时会自动生成强密码,并仅在本次操作完成后显示一次。</small></div>
<div class="field full"><label for="reinstall-confirm-name">输入虚拟机名称以确认删除旧系统盘 <span>*</span></label><input id="reinstall-confirm-name" name="confirmation_name" type="text" required autocomplete="off" spellcheck="false" placeholder="请输入完整的虚拟机名称" /><small id="reinstall-confirm-hint"></small></div>
</div>
</div>
<div id="reinstall-progress" class="reinstall-progress" role="status" aria-live="polite" hidden><span class="console-spinner" aria-hidden="true"></span><div><strong>正在重装,请保持此页面打开</strong><p id="reinstall-phase">准备重装任务…</p><small>刷新此标签页后会自动恢复任务;若面板进程重启,未确认的自动密码会丢失。</small></div></div>
<div id="reinstall-result" class="reinstall-result" role="status" aria-live="polite" hidden><h3 id="reinstall-result-title"></h3><p id="reinstall-result-message"></p><div id="reinstall-password-box" class="reinstall-password-box" hidden><span>新系统的 root 初始密码</span><div><code id="reinstall-generated-password"></code><button id="reinstall-copy-password" class="button button-outline small" type="button">复制</button></div><small>请先保存到安全位置,再点击“已保存密码,完成”。确认后面板会从内存中清除密码,之后无法再次查看;确认前刷新此标签页可恢复任务。</small></div><p id="reinstall-result-warning" class="reinstall-result-warning" hidden></p></div>
<p id="reinstall-error" class="form-error" role="alert" hidden></p>
</div>
<div class="modal-footer"><button id="reinstall-cancel" class="button button-outline" type="button" data-close-modal>取消</button><button id="reinstall-submit" class="button button-danger" type="submit">确认重装并删除旧盘</button><button id="reinstall-forget" class="button button-outline" type="button" hidden>放弃恢复任务</button><button id="reinstall-retry" class="button button-outline" type="button" hidden>重新查询任务</button><button id="reinstall-done" class="button button-primary" type="button" hidden>完成</button></div>
</form>
</section>
</div>
<div id="confirm-modal" class="modal-backdrop" hidden>
<section class="modal narrow-modal" role="dialog" aria-modal="true" aria-labelledby="confirm-title"><div class="modal-header"><div><span class="eyebrow danger-text">POWER ACTION</span><h2 id="confirm-title">确认操作</h2></div><button class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div><div class="modal-body"><p id="confirm-message" class="delete-copy"></p><p id="confirm-error" class="form-error" role="alert" hidden></p></div><div class="modal-footer"><button class="button button-outline" type="button" data-close-modal>取消</button><button id="confirm-submit" class="button button-danger" type="button">确认操作</button></div></section>
</div>
<div id="console-modal" class="modal-backdrop console-backdrop" hidden>
<section class="modal console-modal" role="dialog" aria-modal="true" aria-labelledby="console-title"><div class="console-toolbar"><div><span class="eyebrow">VNC CONSOLE</span><h2 id="console-title">虚拟机控制台</h2><p id="console-status">正在连接…</p></div><div class="console-tools"><button id="console-cad" class="button button-outline small" type="button" disabled>发送 Ctrl+Alt+Del</button><button id="console-fullscreen" class="button button-outline small" type="button">全屏</button><button class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div></div><div id="console-stage" class="console-stage"><div id="console-placeholder" class="console-placeholder"><span class="console-spinner" aria-hidden="true"></span><span>正在连接到虚拟机画面…</span></div></div><form id="console-password-form" class="console-password" hidden><label for="console-password">VNC 密码</label><input id="console-password" type="password" autocomplete="off" required /><button class="button button-primary small" type="submit">连接</button></form></section>
</div>
<div id="toast-region" class="toast-region" aria-live="polite"></div>
</body>
</html>