Skip to content

Commit 757ba65

Browse files
authored
Merge pull request #2946 from stgraber/main
incusd/instance/qemu: Force a real reboot after applying templates
2 parents c63980c + 7df3e45 commit 757ba65

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

internal/server/instance/drivers/driver_qemu.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ func (d *qemu) start(stateful bool, op *operationlock.InstanceOperation) error {
14381438
}
14391439

14401440
// Generate the config drive.
1441-
err = d.generateConfigShare()
1441+
err = d.generateConfigShare(volatileSet)
14421442
if err != nil {
14431443
op.Done(err)
14441444
return err
@@ -3096,7 +3096,7 @@ func (d *qemu) spiceCmdlineConfig() string {
30963096
// a 9P share. Due to the unknown size of templates inside the images this directory is created
30973097
// inside the VM's config volume so that it can be restricted by quota.
30983098
// Requires the instance be mounted before calling this function.
3099-
func (d *qemu) generateConfigShare() error {
3099+
func (d *qemu) generateConfigShare(volatileSet map[string]string) error {
31003100
configDrivePath := filepath.Join(d.Path(), "config")
31013101

31023102
// Create config drive dir if doesn't exist, if it does exist, leave it around so we don't regenerate all
@@ -3367,13 +3367,9 @@ func (d *qemu) generateConfigShare() error {
33673367
return err
33683368
}
33693369

3370-
err := d.state.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
3371-
// Remove the volatile key from the DB.
3372-
return tx.DeleteInstanceConfigKey(ctx, int64(d.id), key)
3373-
})
3374-
if err != nil {
3375-
return err
3376-
}
3370+
// Record that the instance devices got modified and a full reset will be needed to get a consistent state.
3371+
volatileSet[key] = ""
3372+
volatileSet["volatile.vm.needs_reset"] = "true"
33773373
}
33783374

33793375
err = d.templateApplyNow("start", templateFilesPath)

0 commit comments

Comments
 (0)