-
Notifications
You must be signed in to change notification settings - Fork 108
vsphere-clone: unable to use disk_size when source image has multiple disks #303
Copy link
Copy link
Closed
Labels
builder/vsphere-cloneBuilder: vsphere-cloneBuilder: vsphere-clonedocumentationDocumentationDocumentation
Milestone
Description
When filing a bug please include the following headings, if possible.
Overview of the Issue
I'm using vsphere-clone image which has 1 primary and 2 extra disks.
When trying to use disk_size parameter, I'm getting an error:
2023-09-04T12:38:33Z: Build 'vsphere-clone.customise' errored after 1 second 229 milliseconds: failed to resize primary disk: VM has multiple disks
There is no mention in the docs that's not supported though.
Looking at the old implementation ticket jetbrains-infra/packer-builder-vsphere#68 (comment) it appears that the intention was to support resizing of existing disks with the storage stanza but all that does is add even more disks.
Reproduction Steps
packer build with an source VM/image containing more than 1 disk
Packer Version
# packer version
Packer v1.9.1
Your version of Packer is out of date! The latest version
is 1.9.4. You can update by downloading from www.packer.io/downloads
Plugin Version and Builders
# packer plugins installed
/root/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.0_x5.0_linux_amd64
/root/.config/packer/plugins/github.com/hashicorp/vsphere/packer-plugin-vsphere_v1.2.1_x5.0_linux_amd64
-
vsphere-iso -
vsphere-clone
VMware vSphere Version
Please provide the VMware vSphere version.
- 7.0.3
Guest Operating System
- Ubuntu 22.04 LTS x64
Simplified Packer Buildfile
locals {
vm_hostname = "foo-ubuntu"
folder = "appliance-builds"
build_ts = "${timestamp()}"
description = <<-EOT
Ubuntu ${var.ubuntu_version} based appliance.
EOT
}
source "vsphere-clone" "customise" {
communicator = "ssh"
ssh_username = "foouser"
ssh_password = "foopass"
vcenter_server = var.vsphere_server
username = var.vsphere_username
password = var.vsphere_password
CPUs = var.vsphere_cpu_cores
RAM = var.vsphere_ram_size
datacenter = var.vsphere_datacenter
cluster = var.vsphere_cluster
resource_pool = var.vsphere_resource_pool
datastore = var.vsphere_datastore
folder = local.folder
network = var.vsphere_network
template = var.source_template_name
vm_name = var.vm_name
notes = local.description
disk_size = 25 * 1024
configuration_parameters = {
"guestinfo.userdata" = base64encode(file("user-data"))
"guestinfo.metadata" = base64encode(templatefile(
"meta-data.tpl",
{ vm_name = var.vm_name, hostname = local.vm_hostname },
))
"guestinfo.userdata.encoding" = "base64"
"guestinfo.metadata.encoding" = "base64"
}
disk_controller_type = var.vsphere_disk_controller_type
}
build {
sources = [
"source.vsphere-clone.customise"
]
}
Operating System and Environment Details
Build within a Linux 22.04 Docker container
Log Fragments and crash.log Files
2023-09-04T12:38:33Z: Build 'vsphere-clone.customise' errored after 1 second 229 milliseconds: failed to resize primary disk: VM has multiple disks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
builder/vsphere-cloneBuilder: vsphere-cloneBuilder: vsphere-clonedocumentationDocumentationDocumentation