fix: state on launch

This commit is contained in:
Julian Sommer
2026-02-02 08:14:40 +10:00
parent d1d6e6d004
commit 7f39da8718
+6 -12
View File
@@ -493,6 +493,12 @@ func (d *Daemon) Start() error {
}
}
// Create services before loading/launching instances, since LaunchInstance depends on them
d.instanceService = handlers_ec2_instance.NewInstanceServiceImpl(d.config, d.resourceMgr.instanceTypes, d.natsConn, &d.Instances)
d.keyService = handlers_ec2_key.NewKeyServiceImpl(d.config)
d.imageService = handlers_ec2_image.NewImageServiceImpl(d.config)
d.volumeService = handlers_ec2_volume.NewVolumeServiceImpl(d.config)
// Load existing state for VMs from JetStream or disk
err = d.LoadState()
if err != nil {
@@ -541,18 +547,6 @@ func (d *Daemon) Start() error {
}
// Create instance service for handling EC2 instance operations
d.instanceService = handlers_ec2_instance.NewInstanceServiceImpl(d.config, d.resourceMgr.instanceTypes, d.natsConn, &d.Instances)
// Create key service for handling EC2 key pair operations
d.keyService = handlers_ec2_key.NewKeyServiceImpl(d.config)
// Create image service for handling EC2 AMI operations
d.imageService = handlers_ec2_image.NewImageServiceImpl(d.config)
// Create volume service for handling EC2 EBS volume operations
d.volumeService = handlers_ec2_volume.NewVolumeServiceImpl(d.config)
log.Printf("Subscribing to subject pattern: %s", "ec2.launch")
// Subscribe to EC2 events with queue group (legacy topic for backward compatibility)