diff --git a/emhttp/plugins/dynamix.vm.manager/VMMachines.page b/emhttp/plugins/dynamix.vm.manager/VMMachines.page index 62178a30e..3cfef97f2 100644 --- a/emhttp/plugins/dynamix.vm.manager/VMMachines.page +++ b/emhttp/plugins/dynamix.vm.manager/VMMachines.page @@ -486,7 +486,7 @@ $(function() { - + diff --git a/emhttp/plugins/dynamix.vm.manager/VMTemplates.page b/emhttp/plugins/dynamix.vm.manager/VMTemplates.page index 3ef5bf021..ce12319e6 100644 --- a/emhttp/plugins/dynamix.vm.manager/VMTemplates.page +++ b/emhttp/plugins/dynamix.vm.manager/VMTemplates.page @@ -38,6 +38,16 @@ Markdown="false" if (strpos($strName,"User-") === false) $user = ""; else $user = ' class="user"'; ?> + +"> +"> +"> + + + + + +
> @@ -46,7 +56,9 @@ Markdown="false"

-
+
+ +

\ No newline at end of file +i.export{display:none;font-size:1.8rem;position:left;margin-left:1px} + + +
+
+ +
+
+
_(Save File Name)_:
+
+
_(Save Path)_:
+
+
+
+ +
+
+
_(File for import)_:
+
+
+
+ + + 0) { $wsport = $lv->domain_get_ws_port($res); $vmrcprotocol = $lv->domain_get_vmrc_protocol($res); if ($vmrcprotocol == "vnc") $vmrcscale = "&resize=scale"; else $vmrcscale = ""; $vmrcurl = autov('/plugins/dynamix.vm.manager/'.$vmrcprotocol.'.html',true).$vmrcscale.'&autoconnect=true&host='._var($_SERVER,'HTTP_HOST'); if ($vmrcprotocol == "spice") $vmrcurl .= '&vmname='. urlencode($vm) .'&port=/wsproxy/'.$vmrcport.'/'; else $vmrcurl .= '&port=&path=/wsproxy/'.$wsport.'/'; - $graphics = strtoupper($vmrcprotocol).":".$vmrcport."\n"; + $graphics = strtoupper($vmrcprotocol).':'._($auto)."$vrtdriver\n"; $virtual = true ; } elseif ($vmrcport == -1 || $autoport) { $vmrcprotocol = $lv->domain_get_vmrc_protocol($res); if ($autoport == "yes") $auto = "auto"; else $auto="manual"; - $graphics = strtoupper($vmrcprotocol).':'._($auto)."\n"; + $graphics = strtoupper($vmrcprotocol).':'._($auto)."$vrtdriver\n"; $virtual = true ; } if (!empty($arrConfig['gpu'])) { diff --git a/emhttp/plugins/dynamix.vm.manager/include/VMajax.php b/emhttp/plugins/dynamix.vm.manager/include/VMajax.php index 934cd9e20..20061e53f 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/VMajax.php +++ b/emhttp/plugins/dynamix.vm.manager/include/VMajax.php @@ -872,6 +872,50 @@ case 'vm-template-remove': $arrResponse = ['success' => true]; break; +case 'vm-template-save': + $template = $_REQUEST['template']; + $name = $_REQUEST['name']; + $replace = $_REQUEST['replace']; + + if (is_file($name) && $replace == "no"){ + $arrResponse = ['success' => false, 'error' => _("File exists.")]; + } else { + $error = file_put_contents($name,json_encode($template)); + if ($error !== false) $arrResponse = ['success' => true]; + else { + $arrResponse = ['success' => false, 'error' => _("File write failed.")]; + } + } + break; + +case 'vm-template-import': + $template = $_REQUEST['template']; + $name = $_REQUEST['name']; + $replace = $_REQUEST['replace']; + $templateslocation = "/boot/config/plugins/dynamix.vm.manager/savedtemplates.json"; + + if ($template==="*file") { + $template=json_decode(file_get_contents($name)); + } + + $namepathinfo = pathinfo($name); + $template_name = $namepathinfo['filename']; + + if (is_file($templateslocation)){ + $ut = json_decode(file_get_contents($templateslocation),true) ; + if (isset($ut[$template_name]) && $replace == "no"){ + $arrResponse = ['success' => false, 'error' => _("Template exists.")]; + } else { + $ut[$template_name] = $template; + $error = file_put_contents($templateslocation,json_encode($ut,JSON_PRETTY_PRINT));; + if ($error !== false) $arrResponse = ['success' => true]; + else { + $arrResponse = ['success' => false, 'error' => _("Tempalte file write failed.")]; + } + } + } + break; + default: $arrResponse = ['error' => _('Unknown action')." '$action'"]; break; diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index 042a17ae0..c4401447b 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -55,6 +55,22 @@ return ($tmp) ? $tmp : $this->_set_last_error(); } + function get_domain_capabilities($emulatorbin, $arch, $machine, $virttype, $xpath) { + + #@conn [resource]: resource for connection + #@emulatorbin [string]: optional path to emulator + #@arch [string]: optional domain architecture + #@machine [string]: optional machine type + #@virttype [string]: optional virtualization type + #@flags [int] : extra flags; not used yet, so callers should always pass 0 + #@xpath [string]: optional xPath query to be applied on the result + #Returns: : domain capabilities XML from the connection or FALSE for error + + $tmp = libvirt_connect_get_domain_capabilities($this->conn, $emulatorbin, $arch, $machine, $virttype, 0, $xpath); + return ($tmp) ? $tmp : $this->_set_last_error(); + } + + function get_machine_types($arch = 'x86_64' /* or 'i686' */) { $tmp = libvirt_connect_get_machine_types($this->conn); @@ -383,6 +399,10 @@ $cpucache = ''; $cpufeatures = ''; $cpumigrate = ''; + $cpucheck = ''; + $cpumatch = '' ; + $cpucustom = '' ; + $cpufallback = '' ; if (!empty($domain['cpumode']) && $domain['cpumode'] == 'host-passthrough') { $cpumode .= "mode='host-passthrough'"; $cpucache = ""; @@ -406,6 +426,8 @@ if (!empty($domain['cpumigrate'])) $cpumigrate = " migratable='".$domain['cpumigrate']."'" ; } + # + #Skylake-Client-noTSX-IBRS $cpustr = " @@ -847,6 +869,25 @@ if (($gpu['copypaste'] == "yes") && ($strProtocol == "spice")) $vmrcmousemode = "" ; else $vmrcmousemode = "" ; if ($strProtocol == "spice") $virtualaudio = "spice" ; else $virtualaudio = "none" ; + $strEGLHeadless = ""; + $strAccel3d =""; + if ($strModelType == "virtio3d") { + $strModelType = "virtio"; + if (!isset($gpu['render'])) $gpu['render'] = "auto"; + if ($gpu['render'] == "auto") { + $strEGLHeadless = ''; + $strAccel3d = ""; + } else { + $strEGLHeadless = ''; + $strAccel3d =""; + }} + + $strDisplayOptions = ""; + if ($strModelType == "qxl") { + if (empty($gpu['DisplayOptions'])) $gpu['DisplayOptions'] ="ram='65536' vram='16384' vgamem='16384' heads='1' primary='yes'"; + $strDisplayOptions = $gpu['DisplayOptions']; + } + $vmrc = " @@ -854,8 +895,11 @@ $vmrcmousemode + $strEGLHeadless