hashicorp / hashicorp/packer-plugin-hyperv

Inconsistent output for hyper-v builds

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
bug builder/hyperv track-internal
Dominant language
Go
Stars
27
Forks
28
PR merge metrics
No merged PRs in 30d

Description

_This issue was originally opened by @yetisir as hashicorp/packer#11041. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._


#### Overview of the Issue

When building a Hyper-V machine from iso vs. from vmcx, the output directory of the exported VM is inconsistent. For the 'hyperv-iso' source, the resultant vm is exported to as expected, however for the 'hyperv-vmcx' source, the resultant VM is exported to /. Not critical, but has been a bit confusing.

This means that when we're chaining builds together - the hyperv-vmcx output_directory != clone_from_vmcx_path input on the next stage.

#### Reproduction Steps

Build a hyper-v machine with 'hyperv-iso' source and with 'hyperv-vmcx' then compare output directories.

### Packer version

1.7.0

### Simplified Packer Buildfile

```
build {
source "hyperv-iso" {
vm_name = "Stage 1 From ISO"
output_directory = "${path.root}/.hyperv/stage1" // VM ends up in "${path.root}/.hyperv/stage1"
...
}
...
}

```
```
build {
source "hyperv-vmcx" {
vm_name = "Stage 2 From VMCX"
clone_from_vmcx_path = "${path.root}/.hyperv/stage1" // Here the input path is the same as the output from the iso build
output_directory = "${path.root}/.hyperv/stage2" // VM ends up in "${path.root}/.hyperv/stage2/Stage 2 From VMCX"
...
}
...
}
```

```
build {
source "hyperv-vmcx" {
vm_name = "Stage 3 From VMCX"
clone_from_vmcx_path = "${path.root}/.hyperv/stage2/Stage 2 From VMCX" // Here we need to add an additional level of nesting which seems a bit clunky and inconsistent.
output_directory = "${path.root}/.hyperv/stage3" // VM ends up in "${path.root}/.hyperv/stage3/Stage 3 From VMCX"
...
}
...
}
```

### Operating system and Environment details

Windows 10 on host and guest, Hyper-V Gen 2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.