packer-post-processor-vhd icon indicating copy to clipboard operation
packer-post-processor-vhd copied to clipboard

Allow specifying --variant on the clonehd command!

Open jwformat opened this issue 7 years ago • 2 comments

Would love to see an option to pass in additional options on clonehd... specifically looking for a --variant Fixed, but opening it up to allow any additional options would be awesome!

Failing that, any instructions for compiling this so I can put the change together myself?

jwformat avatar Nov 12 '18 15:11 jwformat

Would love to see an option to pass in additional options on clonehd... specifically looking for a --variant Fixed, but opening it up to allow any additional options would be awesome!

Good suggestion. The VBoxManage command is hard-coded for now:

https://github.com/benwebber/packer-post-processor-vhd/blob/a3b8ea558acd39b9bb2ec971b0fa3f2441fbc02b/vhd/virtualbox.go#L77-L82

It should be possible to make that configurable, and use Go template strings to represent the path to VMDK and output path. Something like this:

{
  "post-processors": [
    {
      "type": "vhd",
      "only": ["virtualbox-iso"],
      "vboxmanage_command": ["clonehd", "--format", "VHD", "--variant", "Fixed", "{{ vmdkPath }}", "{{ outputPath }}"]
    }
  ]
}

I'm afraid I won't be able to implement that change, or something like it, for a little while.

Failing that, any instructions for compiling this so I can put the change together myself?

Yep, it's very easy:

  1. Install Go
  2. Clone this repo
  3. Add new arguments to the command above
  4. Run make dist.

This project is basically complete, so I haven't touched it in a while. You might get some compilation errors. Happy to help you work through them.

benwebber avatar Nov 16 '18 11:11 benwebber

Since I had a hard requirement for fixed size (when using VHD's), I grabbed the source, and was able to recompile with the hardcoded change in there. Just added an extra line into packer-post-process-vhd/vhd/virtualbox.go! Thanks for the suggestion, and the project!

jwformat avatar Nov 16 '18 12:11 jwformat