Merge pull request #1546 from bergware/master

Fixes and enhancements
This commit is contained in:
tom mortensen
2023-12-13 09:25:56 -08:00
committed by GitHub
11 changed files with 74 additions and 49 deletions

View File

@@ -48,9 +48,12 @@ $port = file_exists('/sys/class/net/br0') ? 'BR0' : (file_exists('/sys/class/net
// Docker configuration file - guaranteed to exist
$docker_cfgfile = '/boot/config/docker.cfg';
if (file_exists($docker_cfgfile) && exec("grep -Pom1 '_{$port}(_[0-9]+)?=' $docker_cfgfile")=='') {
# interface has changed, update configuration
exec("sed -ri 's/_(BR0|BOND0|ETH0)(_[0-9]+)?=/_{$port}\\2=/' $docker_cfgfile");
if (file_exists($docker_cfgfile)) {
exec("grep -Pom2 '_SUBNET_|_{$port}(_[0-9]+)?=' $docker_cfgfile",$cfg);
if (isset($cfg[0]) && $cfg[0]=='_SUBNET_' && empty($cfg[1])) {
# interface has changed, update configuration
exec("sed -ri 's/_(BR0|BOND0|ETH0)(_[0-9]+)?=/_{$port}\\2=/' $docker_cfgfile");
}
}
$defaults = (array)@parse_ini_file("$docroot/plugins/dynamix.docker.manager/default.cfg");

View File

@@ -151,12 +151,8 @@ _(Default Windows VirtIO driver ISO)_ (_(optional)_):
_(Default network source)_:
: <select id="network" name="BRNAME">
<?foreach (array_keys($arrValidNetworks) as $key) {
echo mk_option("", $key, "- "._($key)." -", "disabled");
foreach ($arrValidNetworks[$key] as $strNetwork) {
echo mk_option($domain_cfg['BRNAME'], $strNetwork, $strNetwork);
}
foreach ($arrValidNetworks[$key] as $strNetwork) echo mk_option($domain_cfg['BRNAME'], $strNetwork, $strNetwork);
}?>
</select>
@@ -211,6 +207,8 @@ _(VFIO allow unsafe interrupts)_:
<?else:?>
&nbsp;
<?endif;?>
<?else:?>
&nbsp;
<?endif;?>
: <input type="button" id="applyBtn" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
</form>

View File

@@ -789,6 +789,7 @@ function sanitizeMultiCookie(cookieName, delimiter, removeDuplicates = false) {
}
}
var colors = ['<?=$c0?>','<?=$c1?>','<?=$c2?>','<?=$c3?>'];
var ports = [<?=implode(',',array_map('escapestring',$ports))?>];
var cpu = [];
var rxd = [];
@@ -1502,20 +1503,29 @@ dashboard.on('message',function(msg,meta) {
$('.sys'+k).text(v[0]).css({'color':fontColor(load,<?=$display['critical']?>,<?=$display['warning']?>)});
$('.var'+k).text(v[1]);
if (k == 0) {
$('#used').text(v[4]);
$('#used').text(v[5]);
<?if ($libvirtd):?>
$('#vmsize').text(v[5]);
$('#vmsize').text(v[7]);
<?endif;?>
<?if ($zfs):?>
$('#zfs').text(v[6]);
$('#zfs').text(v[9]);
<?endif;?>
$('#free').text(v[7]);
$('#free').text(v[3]);
var color = setColor(load,<?=$display['critical']?>,<?=$display['warning']?>);
$('.sys0_').text(v[0]);
$('#sys0_').finish().animate({width:v[0]},{step:function(){$('#sys0_').css('overflow','visible').removeClass().addClass(color);}});
$('#sys0').css({'background':'conic-gradient(<?=$c1?> 0% '+v[2]+',<?=$c2?> '+v[2]+' '+v[3]+',<?=$c3?> '+v[3]+' '+v[0]+',<?=$c0?> '+v[0]+' 100%'});
var start = 0;
var end = parseInt(v[4]);
var ring = [colors[1]+' '+start+'% '+end+'%']
for (var i=6; i < v.length; i=i+2) {
start = end;
end += parseInt(v[i]);
ring.push(colors[(i-2)/2]+' '+start+'% '+end+'%');
}
ring.push(colors[0]+' '+v[0]+' 100%');
$('#sys0').css({'background':'conic-gradient('+ring.join(',')+')'});
} else {
$('#sys'+k).css({'background':'conic-gradient(<?=$c1?> 0% '+v[0]+',<?=$c0?> '+v[0]+' 100%'});
$('#sys'+k).css({'background':'conic-gradient('+colors[1]+' 0% '+v[0]+','+colors[0]+' '+v[0]+' 100%)'});
}
});
<?if ($fans):?>

View File

@@ -35,14 +35,16 @@ while (true) {
[$total,$free] = $memory;
$used = $total-$free;
$services = $used-$vmsize-$zfs;
$meminfo[] = round(100*$used/$total)."%";
$meminfo[] = round(100*$used/$total).'%';
$meminfo[] = my_scale($used,$unit,null,-1,1024)." $unit";
$meminfo[] = round(100*$services/$total)."%";
$meminfo[] = round(100*($used-$zfs)/$total)."%";
$meminfo[] = round(100*($free)/$total);
$meminfo[] = my_scale($free,$unit,null,-1,1024)." $unit";
$meminfo[] = round(100*$services/$total);
$meminfo[] = my_scale($services,$unit,null,-1,1024)." $unit";
$meminfo[] = round(100*($vmsize)/$total);
$meminfo[] = my_scale($vmsize,$unit,null,-1,1024)." $unit";
$meminfo[] = my_scale($zfs,$unit,null,-1,1024)." $unit";
$meminfo[] = my_scale($free,$unit,null,-1,1024)." $unit\0";
$meminfo[] = round(100*($zfs)/$total);
$meminfo[] = my_scale($zfs,$unit,null,-1,1024)." $unit\0";
foreach ($df as $data) {
[$pcent,$used] = explode(' ',$data);
$sysinfo[] = $pcent.';'.my_scale($used,$unit,null,-1,1024)." $unit";

View File

@@ -133,7 +133,7 @@ table.disk_status tbody tr{border-bottom:1px solid #f3f0f4}
table.array_status{table-layout:fixed}
table.array_status tr>td{padding-left:8px}
table.array_status tr>td:nth-child(1){width:30%}
table.array_status tr>td:nth-child(2){width:20%}
table.array_status tr>td:nth-child(2){width:22%}
table.array_status.noshift{margin-top:0}
table.array_status td.line{border-top:1px solid #f3f0f4}
table.share_status{table-layout:fixed;margin-top:12px}

View File

@@ -131,7 +131,7 @@ table.disk_status tbody tr.tr_last{line-height:3rem;height:3rem;background-color
table.array_status{table-layout:fixed}
table.array_status tr>td{padding-left:8px}
table.array_status tr>td:nth-child(1){width:30%}
table.array_status tr>td:nth-child(2){width:20%}
table.array_status tr>td:nth-child(2){width:22%}
table.array_status.noshift{margin-top:0}
table.array_status td.line{border-top:1px solid #2b2b2b}
table.share_status{table-layout:fixed}

View File

@@ -87,6 +87,19 @@
.icon-temp:before{content:'\e926'}
.icon-template:before{content:'\e972'}
.icon-themes:before{content:'\e973'}
.icon-update:before{content:'\e927'}
.icon-ups:before{content:'\e916'}
.icon-usb:before{content:'\e92b'}
.icon-user:before{content:'\e917'}
.icon-users:before{content:'\e945'}
.icon-vars:before{content:'\e928'}
.icon-video:before{content:'\e94e'}
.icon-virtualization:before{content:'\e918'}
.icon-vpn:before{content:'\e95c'}
.icon-warning:before{content:'\e97d'}
.icon-windows:before{content:'\e919'}
.icon-wireguard:before{content:'\e95d'}
.icon-zip:before{content:'\e974'}
.icon-u-arrow-down:before{content:'\e95e'}
.icon-u-arrow-left:before{content:'\e95f'}
.icon-u-arrow-right:before{content:'\e960'}
@@ -139,16 +152,3 @@
.icon-u-thumbs-up:before{content:'\e96b'}
.icon-u-triangle:before{content:'\e941'}
.icon-u-two-thirds:before{content:'\e96c'}
.icon-update:before{content:'\e927'}
.icon-ups:before{content:'\e916'}
.icon-usb:before{content:'\e92b'}
.icon-user:before{content:'\e917'}
.icon-users:before{content:'\e945'}
.icon-vars:before{content:'\e928'}
.icon-video:before{content:'\e94e'}
.icon-virtualization:before{content:'\e918'}
.icon-vpn:before{content:'\e95c'}
.icon-warning:before{content:'\e97d'}
.icon-windows:before{content:'\e919'}
.icon-wireguard:before{content:'\e95d'}
.icon-zip:before{content:'\e974'}

View File

@@ -133,7 +133,7 @@ table.disk_status tbody tr{border-bottom:1px solid #0c0f0b}
table.array_status{table-layout:fixed}
table.array_status tr>td{padding-left:8px}
table.array_status tr>td:nth-child(1){width:30%}
table.array_status tr>td:nth-child(2){width:20%}
table.array_status tr>td:nth-child(2){width:22%}
table.array_status.noshift{margin-top:0}
table.array_status td.line{border-top:1px solid #0c0f0b}
table.share_status{table-layout:fixed;margin-top:12px}

View File

@@ -131,7 +131,7 @@ table.disk_status tbody tr.tr_last{line-height:3rem;height:3rem;background-color
table.array_status{table-layout:fixed}
table.array_status tr>td{padding-left:8px}
table.array_status tr>td:nth-child(1){width:30%}
table.array_status tr>td:nth-child(2){width:20%}
table.array_status tr>td:nth-child(2){width:22%}
table.array_status.noshift{margin-top:0}
table.array_status td.line{border-top:1px solid #e3e3e3}
table.share_status{table-layout:fixed}

View File

@@ -47,7 +47,8 @@ if [[ -f $DOCKER_CFG ]]; then
elif [[ -e $SYSTEM/${NIC/eth/bond} ]]; then
NIC=${NIC/eth/bond}
fi
if ! grep -qPm1 "_${NIC^^}(_[0-9]+)?=" $DOCKER_CFG; then
CFG=($(grep -Pom2 "_SUBNET_|_${NIC^^}(_[0-9]+)?=" $DOCKER_CFG))
if [[ ${CFG[0]} == _SUBNET_ && -z ${CFG[1]} ]]; then
# interface has changed, update configuration
X=${NIC//[^0-9]/}
sed -ri "s/_(BR|BOND|ETH)$X(_[0-9]+)?=/_${NIC^^}\2=/; s/(br|bond|eth)$X(\.[0-9]+)? /$NIC\2 /g" $DOCKER_CFG

View File

@@ -180,16 +180,23 @@ libvirtd_start(){
log "$DAEMON... Already started."
return 1
fi
# convert libvirt 1.3.1 w/ eric's hyperv vendor id patch to how libvirt does it in libvirt 1.3.3+
sed -ri "s/<vendor id='none'\/>/<vendor_id state='on' value='none'\/>/g" /etc/libvirt/qemu/*.xml 2>/dev/null
# remove <locked/> from xml because libvirt + virlogd + virlockd has an issue with locked
sed -ri "/<locked\/>/d" /etc/libvirt/qemu/*.xml 2>/dev/null
# Remove "<watchdog model='itco' action='reset'/>" if reverting from later release.
. /etc/unraid-version
[[ $(version $version) -le $(version "6.12") ]] && sed -ri "/<watchdog model='itco' action='reset'\/>/d" /etc/libvirt/qemu/*.xml 2>/dev/null
[[ $(version $version) -le $(version "6.12") ]] && LEGACY=1 || LEGACY=
# update interface section((s) of VM configuration files
for XML in /etc/libvirt/qemu/*.xml; do
[[ -f "$XML" ]] || continue
if grep -qm1 "<vendor_id='none'/>" "$XML"; then
# convert libvirt 1.3.1 w/ eric's hyperv vendor id patch to how libvirt does it in libvirt 1.3.3+
sed -ri "s/<vendor id='none'\/>/<vendor_id state='on' value='none'\/>/g" "$XML"
fi
if grep -qm1 "<locked/>" "$XML"; then
# remove <locked/> from xml because libvirt + virlogd + virlockd has an issue with locked
sed -ri "/<locked\/>/d" "$file"
fi
if [[ -n $LEGACY ]] && grep -qm1 "<watchdog model='itco' action='reset'/>" "$XML"; then
# Remove "<watchdog model='itco' action='reset'/>" if reverting from later release.
sed -ri "/<watchdog model='itco' action='reset'\/>/d" "$XML"
fi
# get all interface sections
ROW=($(grep -nhP '<interface type=' "$XML" | grep -Pom1 '^[0-9]+'))
# get all source sections
@@ -200,13 +207,17 @@ libvirtd_start(){
if [[ ! -e $SYSTEM/$DEV ]]; then
NAME=${DEV//[0-9.]/}
if [[ $NAME == br ]]; then
# change to macvtap
log "change $DEV to macvtap in $XML"
sed -ri "${ROW[$i]} s/<interface type='bridge'>/<interface type='direct' trustGuestRxFilters='yes'>/; $ROW2 s/<source bridge='$DEV'\/>/<source dev='${DEV/$NAME/vhost}' mode='bridge'\/>/" "$XML"
if grep -qm1 "<interface type='bridge'>" "$XML"; then
# change to macvtap
log "change $DEV to macvtap in $XML"
sed -ri "${ROW[$i]} s/<interface type='bridge'>/<interface type='direct' trustGuestRxFilters='yes'>/; $ROW2 s/<source bridge='$DEV'\/>/<source dev='${DEV/$NAME/vhost}' mode='bridge'\/>/" "$XML"
fi
else
# change to bridge
log "change $DEV to bridge in $XML"
sed -ri "${ROW[$i]} s/<interface type='direct'( trustGuestRxFilters='yes')?>/<interface type='bridge'>/; $ROW2 s/<source dev='$DEV' mode='bridge'\/>/<source bridge='${DEV/$NAME/br}'\/>/" "$XML"
if grep -qm1 "<interface type='direct'" "$XML"; then
# change to bridge
log "change $DEV to bridge in $XML"
sed -ri "${ROW[$i]} s/<interface type='direct'( trustGuestRxFilters='yes')?>/<interface type='bridge'>/; $ROW2 s/<source dev='$DEV' mode='bridge'\/>/<source bridge='${DEV/$NAME/br}'\/>/" "$XML"
fi
fi
fi
done