networking: use new macvtap network instead of macvlan

Minor fixes
This commit is contained in:
bergware
2023-08-09 23:26:21 +02:00
parent 11d5212210
commit 4f61f11879
4 changed files with 15 additions and 15 deletions
@@ -661,11 +661,11 @@
$netmodel = $nic['model'] ?: 'virtio-net';
$net_res =$this->libvirt_get_net_res($this->conn, $nic['network']);
$vhost = file_exists("/boot/config/network.cfg") && exec("grep -Po '^BRNICS\[0\]=\"\K[^\"]+' /boot/config/network.cfg")=='';
$vhost = file_exists("/boot/config/network.cfg") && exec("grep -Po '^BRNICS\\[0\\]=\"\\K[^\"]+' /boot/config/network.cfg")=='';
if ($vhost) {
exec("ip -br a|grep -Po '^vhost[0-9][^@]*'",$br);
} else {
exec("brctl show | cut -f1| awk NF | sed -n '1!p'", $br);
exec("brctl show|grep -Po '^(vir)?br[0-9]+(\.[0-9]+)?'", $br);
}
if ($nic["boot"] != NULL) $nicboot = "<boot order='".$nic["boot"]."'/>" ; else $nicboot = "" ;
if($net_res) {
@@ -1066,10 +1066,10 @@ private static $encoding = 'UTF-8';
function getValidNetworks() {
global $lv;
$arrValidNetworks = [];
if (file_exists("/boot/config/network.cfg") && exec("grep -Po '^BRNICS\[0\]=\"\K[^\"]+' /boot/config/network.cfg")=='') {
if (file_exists("/boot/config/network.cfg") && exec("grep -Pom1 '^BRNICS\\[0\\]=\"\\K[^\"]+' /boot/config/network.cfg")=='') {
exec("ip -br a|grep -Po '^(virbr|vhost)[0-9][^@ ]*'",$arrBridges);
} else {
exec("brctl show|grep -Po '^(vir)?br\d\S*'", $arrBridges);
exec("brctl show|grep -Po '^(vir)?br[0-9]+(\.[0-9]+)?'", $arrBridges);
}
if (!is_array($arrBridges)) {
$arrBridges = [];