update oci manager

This commit is contained in:
MacRimi
2026-03-12 22:13:56 +01:00
parent b4a2e5ee11
commit 6d4006fd93
4 changed files with 226 additions and 73 deletions

View File

@@ -1125,40 +1125,6 @@ class HealthMonitor:
except Exception:
pass
# Check disk_observations for active (non-dismissed) warnings
# This ensures disks with persistent observations appear in Health Monitor
# even if the error is not currently in the logs
try:
all_observations = health_persistence.get_disk_observations()
for obs in all_observations:
device_name = obs.get('device_name', '').replace('/dev/', '')
if not device_name:
continue
severity = (obs.get('severity') or 'warning').upper()
if severity in ('WARNING', 'CRITICAL') and not obs.get('dismissed'):
# Add to issues if not already present
obs_reason = obs.get('raw_message', f'{device_name}: Disk observation recorded')
obs_key = f'/dev/{device_name}'
if obs_key not in storage_details:
issues.append(obs_reason)
storage_details[obs_key] = {
'status': severity,
'reason': obs_reason,
'dismissable': True,
}
# Ensure disk is in disk_errors_by_device for consolidation
if device_name not in disk_errors_by_device:
disk_errors_by_device[device_name] = {
'status': severity,
'reason': obs_reason,
'error_type': obs.get('error_type', 'disk_observation'),
'serial': obs.get('serial', ''),
'model': obs.get('model', ''),
'dismissable': True,
}
except Exception:
pass
# Build checks dict from storage_details
# We consolidate disk error entries (like /Dev/Sda) into physical disk entries
# and only show disks with problems (not healthy ones).
@@ -1252,6 +1218,39 @@ class HealthMonitor:
except Exception:
pass
# Check disk_observations for active (non-dismissed) warnings
# This ensures disks with persistent observations appear in Health Monitor
# even if the error is not currently in the logs
try:
all_observations = health_persistence.get_disk_observations()
for obs in all_observations:
device_name = obs.get('device_name', '').replace('/dev/', '')
if not device_name:
continue
severity = (obs.get('severity') or 'warning').upper()
# Only include if WARNING/CRITICAL and not already dismissed
if severity in ('WARNING', 'CRITICAL') and not obs.get('dismissed'):
# Check if there's a corresponding acknowledged error in the errors table
# If so, skip this observation (it was dismissed via Health Monitor)
error_key = f"disk_smart_{device_name}"
error_record = health_persistence.get_error_by_key(error_key)
if error_record and error_record.get('acknowledged'):
continue # Skip - this was dismissed
# Add to disk_errors_by_device if not already present
if device_name not in disk_errors_by_device:
obs_reason = obs.get('raw_message', f'{device_name}: Disk observation recorded')
disk_errors_by_device[device_name] = {
'status': severity,
'reason': obs_reason,
'error_type': obs.get('error_type', 'disk_observation'),
'serial': obs.get('serial', ''),
'model': obs.get('model', ''),
'dismissable': True,
}
except Exception:
pass
# Add consolidated disk entries (only for disks with errors)
for device_name, error_info in disk_errors_by_device.items():
# Try to find this disk in physical_disks for enriched info