Skip to content

vsphere-clone: Add support for multiple SCSI controllersΒ #84

@ghost

Description

This issue was originally opened by @mayankbatra123 as hashicorp/packer#11091. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

So vshpere-clone module of packer allows us to add storage configurations for adding multiple disks.
But it also add another scsi controller which is not required in all use cases.
Need an additional option to add multiple disk to default disk_controller rather than creating a new.
disk_controller = "scsi0" //example

Reproduction Steps

Add Storage configuration block to vshpere-clone module

Similar to this -

 disk_controller_type = ["pvscsi"]
  storage {
    disk_size             = var.secondary_storage.disk_size
    disk_thin_provisioned = var.secondary_storage.disk_thin_provisioned
    disk_eagerly_scrub    = var.secondary_storage.disk_eagerly_scrub
    disk_controller_index = var.secondary_storage.disk_controller_index
  }

Packer version

v1.7.2

Simplified Packer Buildfile

source "vsphere-clone" "vm-base" {
  vcenter_server      = "${var.vcenter_server}"
  datacenter          = "${var.vcenter_datacenter}"
  insecure_connection = "${var.vcenter_insecure_connection}"
  username            = "${var.vsphere_username}"
  password            = "${var.vsphere_password}"

  vm_name             = "${local.target_vm_tag}"
  template            = "${local.upstream_vm_tag}"
  folder              = "${var.target_vm_folder}"
  cluster             = "${var.target_vm_cluster}"
  datastore           = "${var.target_vm_datastore}"
  resource_pool       = "${var.target_vm_resource_pool}"
  
  **disk_controller_type = ["pvscsi"]**

  CPUs                = "${var.vm_cpus}"
  RAM                 = "${var.vm_ram_mb}"
  NestedHV            = true
  convert_to_template = "${var.vm_generate_template}"
  create_snapshot     = "${var.vm_create_snapshot}"
  linked_clone        = "${var.vm_linked_clone}"

  ssh_password        = "${var.ssh_password}"
  ssh_username        = "${var.ssh_username}"
  storage {
    disk_size             = var.secondary_storage.disk_size
    disk_thin_provisioned = var.secondary_storage.disk_thin_provisioned
    disk_eagerly_scrub    = var.secondary_storage.disk_eagerly_scrub
    disk_controller_index = var.secondary_storage.disk_controller_index
  }
}

Operating system and Environment details

Ubuntu- 20.4

The above configuration does create an additional disk along with another scsi controller.
If I remove the disk_controller_type from above configuration it throws an error.

It would be great to add an additional parameter to the configuration such as:
disk_controller = "scsi0" // just for example

This will allow the new disk to be mapped to default scsi controller rather than creating a new one.
Current--> 0:0, 1:0 -- Expected --> 0:0,0:1

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions