104 lines
2.8 KiB
Plaintext
104 lines
2.8 KiB
Plaintext
|
|
# VM Lifecycle Contracts
|
||
|
|
#
|
||
|
|
# Type definitions for VM persistence and lifecycle management.
|
||
|
|
|
||
|
|
{
|
||
|
|
PersistenceMode = [| 'permanent, 'temporary |],
|
||
|
|
RestartPolicy = [| 'no, 'always, 'on_failure |],
|
||
|
|
HostRebootAction = [| 'start, 'keep_stopped, 'destroy |],
|
||
|
|
HostShutdownAction = [| 'shutdown, 'save_state, 'destroy |],
|
||
|
|
ResourcePressureAction = [| 'suspend, 'kill, 'none |],
|
||
|
|
CleanupStatus = [| 'pending, 'in_progress, 'completed, 'failed |],
|
||
|
|
VmState = [| 'stopped, 'starting, 'running, 'stopping, 'paused, 'error |],
|
||
|
|
StartFailureAction = [| 'stop, 'retry, 'ignore |],
|
||
|
|
|
||
|
|
VmPersistence = {
|
||
|
|
mode | PersistenceMode,
|
||
|
|
auto_start | Bool,
|
||
|
|
restart_policy | RestartPolicy,
|
||
|
|
max_retries | Number,
|
||
|
|
ttl_hours | Number,
|
||
|
|
auto_cleanup | Bool,
|
||
|
|
force_cleanup | Bool,
|
||
|
|
cleanup_grace_period | Number,
|
||
|
|
created_at_unix | Number,
|
||
|
|
scheduled_cleanup | optional | Number,
|
||
|
|
last_state_change | optional | Number,
|
||
|
|
},
|
||
|
|
|
||
|
|
VmLifecyclePolicy = {
|
||
|
|
on_host_reboot | HostRebootAction,
|
||
|
|
on_host_shutdown | HostShutdownAction,
|
||
|
|
on_memory_pressure | ResourcePressureAction,
|
||
|
|
on_disk_full | ResourcePressureAction,
|
||
|
|
enforce_memory_limit | Bool,
|
||
|
|
enforce_cpu_limit | Bool,
|
||
|
|
enforce_disk_limit | Bool,
|
||
|
|
},
|
||
|
|
|
||
|
|
VmCleanupSchedule = {
|
||
|
|
vm_name | String,
|
||
|
|
vm_id | String,
|
||
|
|
mode | PersistenceMode,
|
||
|
|
created_at | String,
|
||
|
|
scheduled_cleanup_at | String,
|
||
|
|
ttl_hours | Number,
|
||
|
|
cleanup_status | CleanupStatus,
|
||
|
|
cleanup_attempts | Number,
|
||
|
|
last_cleanup_attempt | optional | String,
|
||
|
|
cleanup_error | optional | String,
|
||
|
|
},
|
||
|
|
|
||
|
|
VmRecoveryState = {
|
||
|
|
vm_name | String,
|
||
|
|
vm_id | String,
|
||
|
|
state_before_shutdown | VmState,
|
||
|
|
creation_timestamp | String,
|
||
|
|
last_checkpoint | String,
|
||
|
|
memory_snapshot | optional | String,
|
||
|
|
memory_size_mb | optional | Number,
|
||
|
|
config_snapshot,
|
||
|
|
},
|
||
|
|
|
||
|
|
VmAutoStartConfig = {
|
||
|
|
vm_name | String,
|
||
|
|
enabled | Bool,
|
||
|
|
start_order | Number,
|
||
|
|
start_delay_seconds | Number,
|
||
|
|
wait_for_ssh | Bool,
|
||
|
|
ssh_timeout_seconds | Number,
|
||
|
|
on_start_failure | StartFailureAction,
|
||
|
|
max_start_retries | Number,
|
||
|
|
depends_on,
|
||
|
|
},
|
||
|
|
|
||
|
|
VmCleanupPolicy = {
|
||
|
|
cleanup_enabled | Bool,
|
||
|
|
check_interval_minutes | Number,
|
||
|
|
cleanup_window_start | String,
|
||
|
|
cleanup_window_end | String,
|
||
|
|
cleanup_in_window_only | Bool,
|
||
|
|
max_concurrent_cleanups | Number,
|
||
|
|
cleanup_batch_size | Number,
|
||
|
|
require_confirmation | Bool,
|
||
|
|
dry_run_mode | Bool,
|
||
|
|
skip_on_low_resources | Bool,
|
||
|
|
log_cleanup_operations | Bool,
|
||
|
|
alert_on_cleanup_failure | Bool,
|
||
|
|
retention_days | Number,
|
||
|
|
},
|
||
|
|
|
||
|
|
VmStateSnapshot = {
|
||
|
|
vm_name | String,
|
||
|
|
snapshot_time | String,
|
||
|
|
vm_state | VmState,
|
||
|
|
cpu_usage_percent | Number,
|
||
|
|
memory_usage_mb | Number,
|
||
|
|
disk_usage_gb | Number,
|
||
|
|
ip_addresses,
|
||
|
|
mac_addresses,
|
||
|
|
uptime_seconds | Number,
|
||
|
|
restart_count | Number,
|
||
|
|
},
|
||
|
|
}
|