Enhance auto-start logic to differentiate between remote and local instances

This commit is contained in:
2025-10-09 18:56:23 +02:00
parent 8d9b0c0621
commit e281708b20

View File

@@ -345,10 +345,20 @@ func (im *instanceManager) autoStartInstances() {
log.Printf("Auto-starting instance %s", inst.Name) log.Printf("Auto-starting instance %s", inst.Name)
// Reset running state before starting (since Start() expects stopped instance) // Reset running state before starting (since Start() expects stopped instance)
inst.SetStatus(instance.Stopped) inst.SetStatus(instance.Stopped)
// Check if this is a remote instance
if node := im.getNodeForInstance(inst); node != nil {
// Remote instance - use StartRemoteInstance
if _, err := im.StartRemoteInstance(node, inst.Name); err != nil {
log.Printf("Failed to auto-start remote instance %s: %v", inst.Name, err)
}
} else {
// Local instance - call Start() directly
if err := inst.Start(); err != nil { if err := inst.Start(); err != nil {
log.Printf("Failed to auto-start instance %s: %v", inst.Name, err) log.Printf("Failed to auto-start instance %s: %v", inst.Name, err)
} }
} }
}
} }
func (im *instanceManager) onStatusChange(name string, oldStatus, newStatus instance.InstanceStatus) { func (im *instanceManager) onStatusChange(name string, oldStatus, newStatus instance.InstanceStatus) {