Skip to content

Commit

Permalink
actuator: cleanup cloudinit and ignition volume on error
Browse files Browse the repository at this point in the history
  • Loading branch information
rphillips committed Jun 18, 2021
1 parent 2b56adc commit 54ecd7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cloud/libvirt/actuators/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ func (a *Actuator) createVolumeAndDomain(ctx context.Context, machine *machinev1
if err := client.DeleteVolume(domainName); err != nil {
glog.Errorf("Error cleaning up volume: %v", err)
}
if err := client.DeleteVolume(cloudInitVolumeName(domainName)); err != nil {
glog.Errorf("Error cleaning up cloud-init volume: %v", err)
}
if err := client.DeleteVolume(ignitionVolumeName(domainName)); err != nil {
glog.Errorf("Error cleaning up ignition volume: %v", err)
}

return nil, a.handleMachineError(machine, apierrors.CreateMachine("error creating domain %v", err), createEventAction)
}
Expand Down

0 comments on commit 54ecd7f

Please sign in to comment.