Fix usb updates.

This commit is contained in:
SimonFair
2023-07-02 21:37:11 +01:00
parent a08452c59e
commit 2b3990922d
3 changed files with 6 additions and 7 deletions
@@ -468,9 +468,8 @@
if (isset($usbopt[$v]) && !$vmclone ) {
if (strpos($usbopt[$v], "#remove") == false) $startupPolicy = 'startupPolicy="optional"' ; else $startupPolicy = '' ;
}
if ($vmclone ) {
if (isset($v["startupPolicy"]) && $vmclone ) {
if ($v["startupPolicy"] == "optional" ) $startupPolicy = 'startupPolicy="optional"' ; else $startupPolicy = '' ;
#$startupPolicy = 'startupPolicy="optional"' ;
}
$usbstr .= "<hostdev mode='subsystem' type='usb'>
@@ -481,7 +480,7 @@
if (!empty($usbboot[$v]) && !$vmclone ) {
$usbstr .= "<boot order='".$usbboot[$v]."'/>" ;
}
if ($vmclone ) {
if (isset($v["usbboot"]) && $vmclone ) {
if ($v["usbboot"] != NULL) $usbstr .= "<boot order='".$v["usbboot"]."'/>" ;
}
$usbstr .= "</hostdev>";
@@ -1483,7 +1483,7 @@ private static $encoding = 'UTF-8';
*/
$uuid = $lv->domain_get_uuid($clone) ;
write("addLog\0".htmlspecialchars(_("Checking if clone exists")));
if ($uuid) { $arrResponse = ['error' => _("Clone VM name already inuse")]; return $arrResponse ;}
if ($uuid) { $arrResponse = ['error' => _("Clone VM name already inuse")]; return false ;}
#VM must be shutdown.
$res = $lv->get_domain_by_name($vm);
$dom = $lv->domain_get_info($res);
@@ -1530,7 +1530,7 @@ private static $encoding = 'UTF-8';
if ($usb["checked"] == "checked") continue ;
unset($usbs[$i]) ;
}
$config["domain"]["usb"] = $usbs ;
$config["usb"] = $usbs ;
$files_exist = false ;
$files_clone = array() ;