Files
vmmngr/gui/vmmngr_config.php
T

119 lines
5.7 KiB
PHP

<?php
/*
* vmmngr_config.php - environment and provider self-check (preview 0.1.0)
*/
require_once 'vmmngr-boot.inc';
$pgtitle = [gettext('Extensions'), gettext('VM Manager'), gettext('Configuration')];
$sc = vmm_selfcheck();
$conf = vmm_config();
include 'fbegin.inc';
?>
<?php vmm_css();
vmm_nav('config'); ?>
<form action="vmmngr_config.php" method="post" name="iform" id="iform"><table id="area_data"><tbody><tr><td id="area_data_frame">
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
<colgroup>
<col class="area_data_settings_col_tag">
<col class="area_data_settings_col_data">
</colgroup>
<thead>
<?php html_separator2(); html_titleline2(gettext('Environment'), 2); ?>
</thead>
<tbody>
<tr><td class="celltag"><?=gettext('Platform');?></td><td class="celldata"><?=vmm_h($sc['platform']);?> · <?=vmm_h($sc['product']);?> · <?=vmm_h($sc['os']);?></td></tr>
<tr><td class="celltag">PHP</td><td class="celldata"><?=vmm_h($sc['php']);?></td></tr>
<tr><td class="celltag"><?=gettext('Extension root');?></td><td class="celldata vmm-mono"><?=vmm_h($sc['root']);?></td></tr>
<tr><td class="celltag">vm_dir</td><td class="celldata vmm-mono"><?=vmm_h($sc['vm_dir']);?></td></tr>
<tr><td class="celltag"><?=gettext('Kernel modules');?></td><td class="celldata">
vmm: <span class="<?=$sc['kld']['vmm'] === 'loaded' ? 'vmm-ok' : 'vmm-miss';?>"><?=vmm_h($sc['kld']['vmm']);?></span> ·
nmdm: <span class="<?=$sc['kld']['nmdm'] === 'loaded' ? 'vmm-ok' : 'vmm-miss';?>"><?=vmm_h($sc['kld']['nmdm']);?></span>
</td></tr>
<tr><td class="celltag"><?=gettext('Virtual machines');?></td><td class="celldata"><?=$sc['vm_count'];?> <?=gettext('total');?>, <?=$sc['vm_running'];?> <?=gettext('running');?></td></tr>
<?php $b = vmm_ram_budget(); ?>
<tr><td class="celltag"><?=gettext('RAM budget');?></td><td class="celldata"><?=vmm_human_bytes(vmm_ram_used());?> <?=gettext('in use');?> · <?=gettext('limit');?> <?=vmm_human_bytes($b['limit']);?> (<?=$b['pct'];?>% <?=gettext('of');?> <?=vmm_human_bytes($b['total']);?>)</td></tr>
</tbody>
</table>
<br />
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
<colgroup>
<col class="area_data_settings_col_tag">
<col class="area_data_settings_col_data">
</colgroup>
<thead>
<?php html_separator2(); html_titleline2(gettext('Components and provider'), 2); ?>
</thead>
<tbody>
<?php
$rows = [
'vm' => gettext('vm-bhyve'),
'grub' => gettext('grub-bhyve'),
'firmware' => gettext('UEFI firmware'),
'ttyd' => gettext('Web terminal (ttyd)'),
];
foreach ($rows as $key => $label):
$p = $sc[$key];
$ok = !empty($p['available']);
?>
<tr>
<td class="celltag"><?=$label;?></td>
<td class="celldata">
<span class="<?=$ok ? 'vmm-ok' : 'vmm-miss';?>"><?=$ok ? gettext('available') : gettext('missing');?></span>
· <?=gettext('source');?>: <strong><?=vmm_h((string)$p['source']);?></strong>
<div class="vmm-mono"><?=vmm_h((string)$p['path']);?></div>
<?php if ($key === 'vm' && !empty($sc['vm']['version']['version'])): ?>
<div class="vmm-mono"><?=vmm_h((string)$sc['vm']['version']['version']);?> (rev <?=vmm_h((string)($sc['vm']['version']['rev'] ?? '?'));?>)</div>
<?php endif; ?>
<?php if ($key === 'firmware' && !empty($sc['firmware']['mtime'])): ?>
<div class="vmm-mono"><?=vmm_h((string)$sc['firmware']['mtime']);?> · <?=vmm_h(vmm_human_bytes((int)$sc['firmware']['size']));?></div>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<tr><td class="celltag"><?=gettext('Update policy');?></td><td class="celldata"><span class="vmm-mono">vm_source = <?=vmm_h((string)$conf['vm_source']);?></span> — <?=gettext('the system installation always wins; the bundle only fills gaps.');?></td></tr>
</tbody>
</table>
<br />
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
<colgroup>
<col class="area_data_settings_col_tag">
<col class="area_data_settings_col_data">
</colgroup>
<thead>
<?php html_separator2(); html_titleline2(gettext('Datastores and switches'), 2); ?>
</thead>
<tbody>
<?php foreach (($sc['datastores'] ?? []) as $ds): ?>
<tr>
<td class="celltag"><?=gettext('Datastore');?></td>
<td class="celldata vmm-mono"><?=vmm_h(implode(' · ', array_map('strval', $ds)));?></td>
</tr>
<?php endforeach; ?>
<?php if (($sc['datastores'] ?? []) === []): ?>
<tr><td class="celltag"><?=gettext('Datastore');?></td><td class="celldata"><?=gettext('none reported');?></td></tr>
<?php endif; ?>
<?php foreach (($sc['switches'] ?? []) as $sw): ?>
<tr>
<td class="celltag"><?=gettext('Switch');?></td>
<td class="celldata vmm-mono"><?=vmm_h(implode(' · ', array_map('strval', $sw)));?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<details style="margin-top:12px;">
<summary style="cursor:pointer;padding:6px 0;"><?=gettext('Raw self-check (JSON)');?></summary>
<pre class="vmm-raw vmm-mono"><?=vmm_h(json_encode($sc, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));?></pre>
</details>
</td></tr></tbody></table><?php include 'formend.inc'; ?></form>
<?php include 'fend.inc'; ?>