diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index eaa144ef7..7652564ad 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -1944,6 +1944,20 @@ return $var; } + function domain_get_vnc_password($domain) { + $domain_name = $this->domain_get_name($domain) ; + $password = shell_exec("cat /etc/libvirt/qemu/'{$domain_name}.xml' | grep 'passwd'") ; + + if (!$password) + return ''; + + $strpos = strpos($password, "passwd=") +8 ; + $endpos = strpos($password, "'",$strpos) ; + $password = substr($password,$strpos, $endpos-$strpos) ; + + return $password ; + } + function domain_get_ws_port($domain) { $tmp = $this->get_xpath($domain, '//domain/devices/graphics/@websocket', false); $var = (int)$tmp[0]; diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index 7bf82d5cd..5d9193c3e 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -1149,6 +1149,7 @@ private static $encoding = 'UTF-8'; 'protocol' => $lv->domain_get_vmrc_protocol($res), 'model' => $lv->domain_get_vnc_model($res), 'keymap' => $lv->domain_get_vnc_keymap($res), + 'password' => $lv->domain_get_vnc_password($res), 'port' => $vmrcport, 'wsport' => $lv->domain_get_ws_port($res), 'autoport' => $autoport, diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 011d82724..d5fa2369a 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -1044,7 +1044,7 @@ _(VM Console Password)_: - + _(VM Console Keyboard)_: