Feature Request: Add keep_volume option to preserve boot volume artifacts in OpenStack builder

Aperta
#151 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
go

Direzione di ricerca

Inizia tracciando la gestione di use_blockstorage_volume da parte dell'OpenStack builder e il percorso di cleanup che elimina il volume creato. Esamina la documentazione del Packer plugin e i casi keep_volume richiesti, quindi verifica che il cleanup predefinito rimanga invariato, che i volumi conservati sopravvivano ai build completati con successo e che le istanze compute vengano ancora eliminate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

When use_blockstorage_volume = true, Packer always deletes the created volume during cleanup. There is no way to retain it.

I use Platform9 Managed OpenStack, which supports creating VMs directly from volumes, not just from images. This is a common pattern in environments where volumes are preferred over images for provisioning, because it enables storage locality, faster cloning, and immutable golden volume workflows.

The problem is that Packer does all the hard work, it creates a volume, boots a VM from it, and runs provisioners, but then DELETES the VOLUME at the end. The only artifact it can produce today is a Glance image. If you want a retained volume as your build output, Packer gives you no option.

The workaround right now is to use Terraform or Ansible after a Packer run to re-create the volume from the image. That is an unnecessary extra step. Packer already creates the volume internally ( because we use use_blockstorage_volume =true), but it just always destroys as part of its cleanup process.

I would like to request an optional keep_volume flag (default false) so the volume Packer creates is preserved after a successful build. Existing behavior stays completely unchanged when the flag is not set.

Current behavior (use_blockstorage_volume = true, skip_create_image = false):
get source image --> create volume --> provision VM --> cleanup deletes volume --> Glance image created

Requested behavior (use_blockstorage_volume = true, skip_create_image = true, keep_volume = true):
get source image --> create volume --> provision VM --> cleanup skips volume deletion --> volume retained (no image created)

Requested behavior (use_blockstorage_volume = true, keep_volume = true, skip_create_image = false):
get source image --> create volume --> provision VM --> cleanup skips volume deletion --> volume retained + Glance image created

I have implemented this in a fork and it works correctly. Happy to open a PR.

Use Case(s)

Use Case(s)

  1. Golden volume workflows : Build and harden a boot volume once. Keep it as a reusable template source for VM creation.
  2. VM provisioning from volume clones: Clone VMs from preserved golden volumes instead of re-importing images. Keeps storage locality within the same volume type.
  3. Immutable artifact lifecycle : Produce versioned, retained build artifacts. Avoid mutating existing template volumes in place.
  4. Operational safety: Prevent accidental loss of the build output that today's default cleanup causes. Retain the volume for inspection and controlled rollout.
Potential configuration
packer {
  required_plugins {
    openstack = {
      source  = "github.com/hashicorp/openstack"
      version = ">= 1.1.3"
    }
  }
}

source "openstack" "golden_volume" {
  source_image            = "<source-image-id>"
  flavor                  = "<flavor-name>"
  image_name              = "golden-linux-2026-04-13"

  use_blockstorage_volume = true
  volume_size             = 100
  volume_name             = "golden-linux-volume-2026-04-13"
  volume_type             = "<myvolumetype>"

  skip_create_image = true  # skip Glance image, volume is the target artifact
  keep_volume       = true  # retain created volume after build
}

keep_volume = false (default): existing cleanup behavior, no breaking change
keep_volume = true: created volume is retained, compute instance is still deleted

Potential References

OpenStack Cinder docs: https://docs.openstack.org/cinder/latest/
Packer plugin docs: https://developer.hashicorp.com/packer/docs/plugins
OpenStack plugin repo: https://github.com/hashicorp/packer-plugin-openstack

Lingua principale
Go
Stelle
29
Fork
27
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hashicorp/packer-plugin-openstack

Tutte le issue di hashicorp/packer-plugin-openstack

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.