From 3e37b4a27de595ea6836fc361bdbc4c06127688f Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Mon, 20 May 2024 17:20:14 +0100 Subject: [PATCH] Fix for snapshot removal if active volume and vm has spaces in name. --- .../plugins/dynamix.vm.manager/include/libvirt_helpers.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index fa03a7356..8718cc6e3 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -1647,7 +1647,9 @@ private static $encoding = 'UTF-8'; If option to edit, show VMUpdate */ $snaps = getvmsnapshots($vm); - if (count($snaps) ) {write("addLog\0".htmlspecialchars(_("Clone of VM not currently supported if it has snapshots"))); $arrResponse = ['error' => _("Clone of VM not currently supported if it has snapshots")]; return false ;} + if (is_array($snaps)) { + if (count($snaps) ) {write("addLog\0".htmlspecialchars(_("Clone of VM not currently supported if it has snapshots"))); $arrResponse = ['error' => _("Clone of VM not currently supported if it has snapshots")]; return false ;} + } $uuid = $lv->domain_get_uuid($clone) ; write("addLog\0".htmlspecialchars(_("Checking if clone exists"))); if ($uuid) { $arrResponse = ['error' => _("Clone VM name already inuse")]; return false ;} @@ -2251,7 +2253,7 @@ private static $encoding = 'UTF-8'; foreach($disks as $disk) { $file = $disk["file"] ; $output = array() ; - exec("qemu-img info --backing-chain -U $file | grep image:",$output) ; + exec("qemu-img info --backing-chain -U \"$file\" | grep image:",$output) ; foreach($output as $key => $line) { $line=str_replace("image: ","",$line) ; $output[$key] = $line ;