mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 09:39:58 -06:00
Merge pull request #1750 from SimonFair/WebUI
Create WebUI option in VM Template.
This commit is contained in:
@@ -2765,4 +2765,30 @@ function qemu_log($vm,$m) {
|
||||
file_put_contents("/var/log/libvirt/qemu/$vm.log",$m."\n",FILE_APPEND);
|
||||
}
|
||||
|
||||
function get_vm_ip($dom) {
|
||||
global $lv;
|
||||
$myIP=null;
|
||||
$gastate = getgastate($dom);
|
||||
if ($gastate == "connected") {
|
||||
$ip = $lv->domain_interface_addresses($dom, 1);
|
||||
$gastate = getgastate($dom);
|
||||
if ($gastate == "connected") {
|
||||
$ip = $lv->domain_interface_addresses($dom, 1);
|
||||
if ($ip != false) {
|
||||
foreach ($ip as $arrIP) {
|
||||
$ipname = $arrIP["name"];
|
||||
if (preg_match('/^(lo|Loopback)/',$ipname)) continue; // omit loopback interface
|
||||
$iplist = $arrIP["addrs"];
|
||||
foreach ($iplist as $arraddr) {
|
||||
$myIP= $arraddr["addr"];
|
||||
if (preg_match('/^f[c-f]/',$myIP)) continue; // omit ipv6 private addresses
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $myIP;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user