Fix SCSI controller update

Add Method to snapshots.
This commit is contained in:
SimonFair
2023-12-27 14:05:44 +00:00
parent 1403262cfe
commit a373e316a3
2 changed files with 6 additions and 4 deletions

View File

@@ -267,7 +267,7 @@ foreach ($vms as $vm) {
if ($snap['parent'] == "" || $snap['parent'] == "Base") $j++;
$steps[$j] .= $snap['name'].';';
}
echo "<thead class='child' child-id='$i'><tr><th><i class='fa fa-clone'></i> <b>",_('Snapshots'),"</b></th><th></th><th>",_('Date/Time'),"</th><th>",_('Type'),"</th><th>",_('Parent'),"</th><th>",_('Memory'),"</th></tr></thead>";
echo "<thead class='child' child-id='$i'><tr><th><i class='fa fa-clone'></i> <b>",_('Snapshots'),"</b></th><th></th><th>",_('Date/Time'),"</th><th>",_('Type (Method)'),"</th><th>",_('Parent'),"</th><th>",_('Memory'),"</th></tr></thead>";
echo "<tbody class='child'child-id='$i'>";
foreach ($steps as $stepsline) {
$snapshotlist = explode(";",$stepsline);
@@ -275,7 +275,7 @@ foreach ($vms as $vm) {
foreach ($snapshotlist as $snapshotitem) {
if ($snapshotitem == "") continue;
$snapshot = $snapshots[$snapshotitem] ;
$snapshotstate = _(ucfirst($snapshot["state"]));
$snapshotstate = _(ucfirst($snapshot["state"]))." ({$snapshot["method"]})";
$snapshotdesc = $snapshot["desc"];
$snapshotmemory = _(ucfirst($snapshot["memory"]["@attributes"]["snapshot"]));
$snapshotparent = $snapshot["parent"] ? $snapshot["parent"] : "None";

View File

@@ -1409,10 +1409,11 @@ private static $encoding = 'UTF-8';
if ($p2['bus'] && $p2['slot'] && $p2['function'] && $p2['bus']==$pci['bus'] && $p2['slot']==$pci['slot'] && $p2['function']==$function) unset($old['devices']['hostdev'][$k]);
}
}
// remove and rebuild usb controllers
// remove and rebuild usb + scsi controllers
$devices = $old['devices']['controller'];
foreach ($devices as $key => $controller) {
if ($controller['@attributes']['type']=='usb') unset($old['devices']['controller'][$key]);
if ($controller['@attributes']['type']=='scsi') unset($old['devices']['controller'][$key]);
}
// preserve existing disk driver settings
foreach ($new['devices']['disk'] as $key => $disk) {
@@ -1731,7 +1732,7 @@ private static $encoding = 'UTF-8';
return $snaps ;
}
function write_snapshots_database($vm,$name) {
function write_snapshots_database($vm,$name,$method="QEMU") {
global $lv ;
$dbpath = "/etc/libvirt/qemu/snapshot/$vm" ;
if (!is_dir($dbpath)) mkdir($dbpath) ;
@@ -1749,6 +1750,7 @@ private static $encoding = 'UTF-8';
$snaps[$vmsnap]["desc"]= $b["description"];
$snaps[$vmsnap]["memory"]= $b["memory"];
$snaps[$vmsnap]["creationtime"]= $b["creationTime"];
$snaps[$vmsnap]["method"]= $method;
$disks =$lv->get_disk_stats($vm) ;
foreach($disks as $disk) {