Menu="OtherSettings" Title="VM Manager" Icon="icon-virtualization" Tag="columns" --- "._('Your hardware does not have Intel VT-x or AMD-V capability').". "._('This is required to create VMs in KVM').". "._('Please disable the VM function').". "; echo " "._('View the Docs for more information')."
"; } function scan($area, $text) { return strpos($area, $text) !== false; } function detect(&$bootcfg, $bootenv, $key) { if ($bootenv === 'syslinux') { $size = count($bootcfg); $menu = $i = 0; $value = ''; // find the default section while ($i < $size) { if (scan($bootcfg[$i], 'label ')) { $n = $i + 1; // find the current requested setting while (!scan($bootcfg[$n], 'label ') && $n < $size) { if (scan($bootcfg[$n], 'menu default')) { $menu = 1; } if (scan($bootcfg[$n], 'append')) { foreach (explode(' ', $bootcfg[$n]) as $cmd) { if (scan($cmd, $key)) { $value = explode('=', $cmd)[1]; break; } } } $n++; } if ($menu) { break; } else { $i = $n - 1; } } $i++; } } elseif ($bootenv === 'grub') { $menu_entries = []; // find the current boot entry foreach ($bootcfg as $line) { if (preg_match('/set default=(\d+)/', $line, $match)) { $bootentry = (int)$match[1]; break; } } // split boot entries foreach ($bootcfg as $line) { if (strpos($line, 'menuentry ') === 0) { $in_menuentry = true; $current_entry = $line . "\n"; } elseif ($in_menuentry) { $current_entry .= $line . "\n"; if (trim($line) === "}") { $menu_entries[] = $current_entry; $in_menuentry = false; } } } // search in selected menuentry $menuentry = explode("\n", $menu_entries[$bootentry]); foreach (explode(' ', $menu_entries[$bootentry]) as $cmd) { if (scan($cmd, $key)) { $value = explode('=', $cmd)[1]; break; } } } return trim($value); } if (is_file('/boot/syslinux/syslinux.cfg')) { $bootcfg = file('/boot/syslinux/syslinux.cfg', FILE_IGNORE_NEW_LINES + FILE_SKIP_EMPTY_LINES); $bootenv = 'syslinux'; } elseif (is_file('/boot/grub/grub.cfg')) { $bootcfg = file('/boot/grub/grub.cfg', FILE_IGNORE_NEW_LINES + FILE_SKIP_EMPTY_LINES); $bootenv = 'grub'; } $arrValidNetworks = getValidNetworks(); $pcie_acs_override = detect($bootcfg, $bootenv, 'pcie_acs_override'); $vfio_allow_unsafe = detect($bootcfg, $bootenv, 'allow_unsafe_interrupts'); $bgcolor = $themeHelper->isLightTheme() ? '#f2f2f2' : '#1c1c1c'; // $themeHelper set in DefaultPageLayout.php $started = $var['fsState'] == 'Started'; $libvirt_up = $libvirt_running == 'yes'; $libvirt_log = file_exists("/var/log/libvirt/libvirtd.log"); ?> : :vms_libvirt_log_help:".shell_exec("btrfs filesystem show /etc/libvirt").""?>