Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vsphere-iso: error creating vm: Invalid configuration for device '2'. #10430

Closed
mikemadeja opened this issue Dec 29, 2020 · 12 comments · Fixed by #10844
Closed

vsphere-iso: error creating vm: Invalid configuration for device '2'. #10430

mikemadeja opened this issue Dec 29, 2020 · 12 comments · Fixed by #10844

Comments

@mikemadeja
Copy link

Overview of the Issue

When trying to deploy more than one drive on the same controller with vsphere-iso, I get "vsphere-iso: error creating vm: Invalid configuration for device '2'."

The only way around this is declaring a new disk_controller_type for each hard drive. What I found out with this resolution is if I try to make a hard drive share the controller, the device 'x', increments by 1. Something seems off with how controllers are deployed. Is it even possible to have one controller but multiple disks with paravirtual?

Reproduction Steps

Declare "disk_controller_type": ["pvscsi"]

Then call for two hard drives under storage. They should be default use Index 0 if I read it correctly.

"storage": [
{
"disk_size": 102400,
"disk_thin_provisioned": true
},
{
"disk_size": 10240,
"disk_thin_provisioned": true
}
],

Steps to reproduce this issue

Packer version

From 1.6.6

Simplified Packer Buildfile

https://pastebin.ubuntu.com/p/sfWdcmVMKT/

Operating system and Environment details

Windows 10 Enterprise

Log Fragments and crash.log files

What I see is in VCenter is the same error
"Invalid configuration for device '2'."

@mikemadeja mikemadeja added the bug label Dec 29, 2020
@ghost
Copy link

ghost commented Dec 31, 2020

Yes also got this issue when i try to add a second disk to a 2019 server config with type lsilogic-sas

i suspect vmware needs to know the disk target 0:0 and 0:1 for the second disk but i'm just guessing

@ghost
Copy link

ghost commented Jan 2, 2021

tested again and in the hostd.log:
test_template/test_template.vmx opID=363a8603-01-d8-781f user=vpxuser:] Time to gather config: 2 (msecs)
test_template/test_template.vmx opID=363a8603-01-d8-781f user=vpxuser:] The specified controller slot is already occupied: (vim.vm.device.V

the config spec :

deviceChange = (vim.vm.device.VirtualDeviceSpec) [

(vim.vm.ConfigSpec) {
name = "test_template",
createDate = "2021-01-02T09:54:43.667919Z",
uuid = "42138837-71ca-bc49-6178-4150ec345744",
instanceUuid = "5013d7b1-5f20-a5d2-d6a9-025429181270",
guestId = "windows9Server64Guest",
files = (vim.vm.FileInfo) {
vmPathName = "[]/vmfs/volumes/5d3011db-09698fa6-1e74-94c691aef7f0/test_template/test_template.vmx",
snapshotDirectory = "[SSD]",
},
flags = (vim.vm.FlagInfo) {
diskUuidEnabled = true,
},
deviceChange = (vim.vm.device.VirtualDeviceSpec) [
(vim.vm.device.VirtualDeviceSpec) {
operation = "add",
device = (vim.vm.device.VirtualLsiLogicSASController) {
key = -201,
busNumber = 0,
sharedBus = "noSharing",
scsiCtlrUnitNumber = 7,
},
},
(vim.vm.device.VirtualDeviceSpec) {
operation = "add",
fileOperation = "create",
device = (vim.vm.device.VirtualDisk) {
key = -202,
backing = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) {
fileName = "[]/vmfs/volumes/5d3011db-09698fa6-1e74-94c691aef7f0/test_template/test_template.vmdk",
diskMode = "persistent",
thinProvisioned = true,
eagerlyScrub = false,
},
controllerKey = -201,
unitNumber = 0,
capacityInKB = 61440000,
},
profile = (vim.vm.ProfileSpec) [
(vim.vm.DefaultProfileSpec) {
}
],
},
(vim.vm.device.VirtualDeviceSpec) {
operation = "add",
fileOperation = "create",
device = (vim.vm.device.VirtualDisk) {
key = -202,
backing = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) {
fileName = "[]/vmfs/volumes/5d3011db-09698fa6-1e74-94c691aef7f0/test_template/test_template_1.vmdk",
diskMode = "persistent",
thinProvisioned = true,
eagerlyScrub = false,
},
controllerKey = -201,
unitNumber = 0,
capacityInKB = 40960000,
},
profile = (vim.vm.ProfileSpec) [
(vim.vm.EmptyProfileSpec) {
}
],
},
(vim.vm.device.VirtualDeviceSpec) {
operation = "add",
device = (vim.vm.device.VirtualVmxnet3) {
key = -1,
backing = (vim.vm.device.VirtualEthernetCard.NetworkBackingInfo) {
deviceName = "VM Network",
},
addressType = "Assigned",
macAddress = "00:50:56:93:06:6c",
},
}
],
extraConfig = (vim.option.OptionValue) [
(vim.option.OptionValue) {
key = "migrate.hostLog",
value = "test_template-78bf1223.hlog"
}
],
vmProfile = (vim.vm.ProfileSpec) [
(vim.vm.EmptyProfileSpec) {
}
],
}
And fault: [N3Vim5Fault17InvalidDeviceSpecE:0x00000076a5f74160]

@gowthamakanthan
Copy link

gowthamakanthan commented Feb 1, 2021

Is there any update on this issue? Am also getting the same error.


==> vsphere-iso: Creating VM...
Build 'vsphere-iso' errored after 38 seconds 920 milliseconds: error creating vm: Invalid configuration for device '2'.

==> Wait completed after 38 seconds 920 milliseconds

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso: error creating vm: Invalid configuration for device '2'.

@djpbessems
Copy link

djpbessems commented Feb 2, 2021

You can work around this issue for now:

"disk_controller_type": ["pvscsi","pvscsi"],
"storage": [
  {
    "disk_size": 102400,
    "disk_thin_provisioned": true,
    "disk_controller_index": 0
  },
  {
    "disk_size": 10240,
    "disk_thin_provisioned": true,
    "disk_controller_index": 1
  }
]

A happy side-effect to doing it this way, is that you increase multipath loadbalancing for most storagefabrics ;)

@mikemadeja
Copy link
Author

mikemadeja commented Feb 4, 2021

@djpbessems - I get that, but I'd still like to combine drives to controllers. I was planning on building a VM Template with multiple drives for MS SQL but it might have to be a day 2 operation or a VSphere API call.

@djpbessems
Copy link

For what it's worth, I think this is a regression. In a previous version of packer I could use 2 disks on one controller just fine, so you could try downgrading packer.

@joshcorr
Copy link

joshcorr commented Feb 5, 2021

I confirmed getting a successful build with the following config on version 1.6.5

...
            "disk_controller_type": [
                "pvscsi"
            ],
            "storage": [
                {
                    "disk_size": 6000,
                    "disk_controller_index": 0
                },
                {
                    "disk_size": 1000,
                    "disk_controller_index": 0
                }
            ],
 ...

looking at the diff between 1.6.5 and 1.6.6 the files that seem suspect in the vsphere setup are:

builder/vsphere/driver/disk.go
builder/vsphere/common/storage_config.go

If I knew golang a bit more I would try and take a hack at fixing it.

@SwampDragons SwampDragons added this to the 1.7.0 milestone Feb 5, 2021
@mikemadeja
Copy link
Author

I confirmed getting a successful build with the following config on version 1.6.5

...
            "disk_controller_type": [
                "pvscsi"
            ],
            "storage": [
                {
                    "disk_size": 6000,
                    "disk_controller_index": 0
                },
                {
                    "disk_size": 1000,
                    "disk_controller_index": 0
                }
            ],
 ...

looking at the diff between 1.6.5 and 1.6.6 the files that seem suspect in the vsphere setup are:

builder/vsphere/driver/disk.go
builder/vsphere/common/storage_config.go

If I knew golang a bit more I would try and take a hack at fixing it.

I confirmed as well that I am able to work with 1.6.5! Thanks for that pointer. Another thing I did notice with 1.6.6 in regards to Windows 2019 installations. If I did setup more than one drive and each drive had its own controllers. The Windows installation would randomly pick a drive instead of using the first one. I only had Disk 0 exposed in unattended.xml. Since I have reverted to 1.6.5, this issue has gone away as well but I am only using one controller now.

@Arderos
Copy link

Arderos commented Mar 30, 2021

I confirm this behavior with both 1.6.6 and 1.7. The way the docs is suggesting to handle multiple disks is not working:

     "disk_controller_type": "pvscsi",
     "storage": [
        {
          "disk_size": 3072,
          "disk_thin_provisioned": true,
          "disk_controller_index": 0
        },
        {
          "disk_size": 20480,
          "disk_thin_provisioned": true,
          "disk_controller_index": 0
        }

Throws
Invalid configuration for device '2'

@sylviamoss
Copy link
Contributor

Hey @Arderos, could you try out these binaries and let me know if it fixes the error, please?
https://app.circleci.com/pipelines/github/hashicorp/packer/9852/workflows/8dfc429f-ad36-4f8b-b8e5-e3e3af5e0632/jobs/118654/artifacts

@joshcorr
Copy link

joshcorr commented Apr 1, 2021

I confirmed getting a successful build with the following config on version 1.6.5


...

            "disk_controller_type": [

                "pvscsi"

            ],

            "storage": [

                {

                    "disk_size": 6000,

                    "disk_controller_index": 0

                },

                {

                    "disk_size": 1000,

                    "disk_controller_index": 0

                }

            ],

 ...

looking at the diff between 1.6.5 and 1.6.6 the files that seem suspect in the vsphere setup are:

builder/vsphere/driver/disk.go

builder/vsphere/common/storage_config.go

If I knew golang a bit more I would try and take a hack at fixing it.

Confirmed working in 1.7.1

@ghost
Copy link

ghost commented Apr 30, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants