Skip to content

Commit 911c591

Browse files
committed
fix(vm): vm start happening twice.
Signed-off-by: Marco Attia <[email protected]>
1 parent 0c3e1ff commit 911c591

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

proxmoxtf/resource/vm/disk/disk.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ func Update(
625625
}
626626

627627
if disk.ImportFrom != nil && *disk.ImportFrom != "" {
628-
rebootRequired = true
629628
shutdownBeforeUpdate = true
630629
tmp.DatastoreID = disk.DatastoreID
631630
tmp.ImportFrom = disk.ImportFrom

proxmoxtf/resource/vm/vm.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,11 +5800,11 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
58005800
//nolint: nestif
58015801
if (d.HasChange(mkStarted) || stoppedBeforeUpdate) && !bool(template) {
58025802
started := d.Get(mkStarted).(bool)
5803-
if started && !stoppedBeforeUpdate {
5803+
if started {
58045804
if diags := vmStart(ctx, vmAPI, d); diags != nil {
58055805
return diags
58065806
}
5807-
} else {
5807+
} else if !stoppedBeforeUpdate {
58085808
if er := vmShutdown(ctx, vmAPI, d); er != nil {
58095809
return er
58105810
}
@@ -5813,14 +5813,6 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
58135813
}
58145814
}
58155815

5816-
if stoppedBeforeUpdate && d.Get(mkStarted).(bool) {
5817-
if diags := vmStart(ctx, vmAPI, d); diags != nil {
5818-
return diags
5819-
}
5820-
// The VM has been started, so a reboot is no longer required.
5821-
rebootRequired = false
5822-
}
5823-
58245816
if cloudInitRebuildRequired {
58255817
if er := vmAPI.RebuildCloudInitDisk(ctx); er != nil {
58265818
return diag.FromErr(err)

0 commit comments

Comments
 (0)