diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index 33e224e98..042a17ae0 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -910,9 +910,9 @@ } if ($gpu['multi'] == "on"){ - $newgpu_bus= 0x10; + $newgpu_bus= 0x07; if (!isset($multibus[$newgpu_bus])) { - $multibus[$newgpu_bus] = 0x10; + $multibus[$newgpu_bus] = 0x07; } else { #Get next bus $newgpu_bus = end($multibus) + 0x01; @@ -2004,8 +2004,17 @@ if (is_file($cfg)) unlink($cfg); if (is_file($xml)) unlink($xml); if (is_dir($dir) && $this->is_dir_empty($dir)) { - $error = my_rmdir($dir); - qemu_log("$domain","delete empty $dir $error"); + $result= my_rmdir($dir); + if ($result['type'] == "zfs") { + qemu_log("$domain","delete empty zfs $dir {$result['rtncode']}"); + if (isset($result['dataset'])) qemu_log("$domain","dataset {$result['dataset']} "); + if (isset($result['cmd'])) qemu_log("$domain","Command {$result['cmd']} "); + if (isset($result['output'])) { + $outputlogs = implode(" ",$result['output']); + qemu_log("$domain","Output $outputlogs end"); + } + } + else qemu_log("$domain","delete empty $dir {$result['rtncode']}"); } } diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 58452f19e..54c0e3c15 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -317,6 +317,18 @@ } if ($usertemplate == 1) unset($arrConfig['domain']['uuid']); $xml2 = build_xml_templates($strXML); + #disable rename if snapshots exist + $snapshots = getvmsnapshots($arrConfig['domain']['name']) ; + if ($snapshots != null && count($snapshots) && !$boolNew) + { + $snaprenamehidden = ""; + $namedisable = "disabled"; + $snapcount = count($snapshots); + } else { + $snaprenamehidden = "hidden"; + $namedisable = ""; + $snapcount = "0"; + }; ?> @@ -336,10 +348,12 @@ - + - +
+ id="snap-rename" class="orange-text"> _(Rename disabled, snapshot(s) exists.)_ +
_(Name)_: type="text" name="domain[name]" id="domain_name" oninput="checkName(this.value)" class="textTemplate" title="_(Name of virtual machine)_" placeholder="_(e.g.)_ _(My Workstation)_" value="" required />
diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index d91e48566..f64ba2f2d 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -345,27 +345,46 @@ function my_mkdir($dirname,$permissions = 0777,$recursive = false,$own = "nobody return($rtncode); } function my_rmdir($dirname) { - if (!is_dir($dirname)) return(false); + if (!is_dir("$dirname")) { + $return = [ + 'rtncode' => "false", + 'type' => "NoDir", + ]; + return($return); + } if (strpos($dirname,'/mnt/user/')===0) { $realdisk = trim(shell_exec("getfattr --absolute-names --only-values -n system.LOCATION ".escapeshellarg($dirname)." 2>/dev/null")); if (!empty($realdisk)) { - $dirname = str_replace('/mnt/user/', "/mnt/$realdisk/", $dirname); + $dirname = str_replace('/mnt/user/', "/mnt/$realdisk/", "$dirname"); } } - $fstype = trim(shell_exec(" stat -f -c '%T' $dirname")); + $fstype = trim(shell_exec(" stat -f -c '%T' ".escapeshellarg($dirname))); $rtncode = false; switch ($fstype) { case "zfs": $zfsoutput = array(); - $zfsdataset = trim(shell_exec("zfs list -H -o name \"$dirname\"")) ; - exec("zfs destroy \"$zfsdataset\"",$zfsoutput,$rtncode); + $zfsdataset = trim(shell_exec("zfs list -H -o name ".escapeshellarg($dirname))) ; + $cmdstr = "zfs destroy \"$zfsdataset\" 2>&1 "; + $error = exec($cmdstr,$zfsoutput,$rtncode); + $return = [ + 'rtncode' => $rtncode, + 'output' => $zfsoutput, + 'dataset' => $zfsdataset, + 'type' => $fstype, + 'cmd' => $cmdstr, + 'error' => $error, + ]; break; case "btrfs": default: $rtncode = rmdir($dirname); + $return = [ + 'rtncode' => $rtncode, + 'type' => $fstype, + ]; break; } - return($rtncode); + return($return); } function get_realvolume($path) { if (strpos($path,"/mnt/user/",0) === 0)