Skip to content

post-processor: create disk image without a backing file #44

Description

@rgl

Description

When using a backing file like:

source "qemu" "packer-qemu-ansible-debian-example" {
  ...
  disk_image = true
  use_backing_file = true
  iso_url = "/home/rgl/.vagrant.d/boxes/debian-11-amd64/0/libvirt/box.img"
}

build {
  ...
  post-processor "vagrant" {
    output = "packer-qemu-ansible-debian-example.box"
  }
}

The disk image inside the generated vagrant box is using a backing file:

$ qemu-img info ~/.vagrant.d/boxes/packer-qemu-ansible-debian-example/0/libvirt/box.img 
image: /home/rgl/.vagrant.d/boxes/packer-qemu-ansible-debian-example/0/libvirt/box.img
file format: qcow2
virtual size: 60 GiB (64424509440 bytes)
disk size: 139 MiB
cluster_size: 65536
backing file: /home/rgl/.vagrant.d/boxes/debian-11-amd64/0/libvirt/box.img
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

This makes the box depend on that backing file, which is not what I would expect. I was expecting an stand-alone disk inside the box file.

Creating a stand-alone disk is a matter of executing qemu-img (instead of just copying the img) with something alike:

qemu-img convert -O qcow2 with-backing-file.img standalone.img

What do you think? Would a PR with this be acceptable?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions