packer-builder-vsphere icon indicating copy to clipboard operation
packer-builder-vsphere copied to clipboard

Build 'vsphere-iso' errored: error creating vm: host '' not found

Open mashiutz opened this issue 5 years ago • 23 comments
trafficstars

Hello There :) Im trying to build a new Windows template (using latest version - 2.3). We have a Cluster with DRS Enabled, so im only specifying a Cluster in my Json. If im also specifying a Resource Pool, i'm getting the same error. Through vSphere web UI, i have made sure that the cluster do no reside in any folder. vSphere version is 6.7 Im using the following json file :

`{ "builders": [ { "type": "vsphere-iso",

    "vcenter_server":       "vcenter.domain.net",
    "insecure_connection":  "false",
    "username":             "[email protected]",
    "password":             "adminpass",
    "datacenter":           "Datacenter-IT",
    "Cluster":              "IT-256GB",
    "datastore":            "VMFS_ISO",
    
    "communicator":         "winrm",
    "winrm_username":       "theadmin",
    "winrm_password":       "theadminPass",

    "vm_name":              "TEMPLATE-2019",
    "folder":               "WinTemplate-IT",
    "convert_to_template":  "true",
    "cpus":                 "2",
    "cpu_cores":            "1",
    "ram":                  "4096",
    "network_card":         "vmxnet3",
    "disk_controller_type": "lsilogic-sas",
      "guest_os_type":        "windows9Server64Guest",
    "disk_thin_provisioned": false,
    "disk_size":            "71680",
      "iso_paths": [
      "[VMFS_ISO] Windows-ISO/SW_DVD9_Win_Server_STD_CORE_2019_1809.1_64Bit_English_DC_STD_MLF_X22-02970.ISO",
      "[VMFS_ISO] VM Tools 10.1.0/vmtools/VMTools 10.1.0-windows.iso"
    ],
    "floppy_files": [
      "floppy/autounattend.xml",
      "floppy/setup.ps1",
      "floppy/vmtools.cmd"
    ]
    
  }
]

}`

Many thanks!

mashiutz avatar Dec 15 '19 13:12 mashiutz

Can you confirm that [email protected] has a proper rights to create VMs on hosts within the cluster? Most people define cluster level permissions without propagate checkbox enabled.If you login to vsphere using [email protected] can you create VMs on IT-256GB cluster?

danonh avatar Dec 16 '19 09:12 danonh

Yep, i have just logged in with that user and created a VM in the cluster. Maybe there are some special permissions that are needed? The API logs on the VCenter server show nothing :(

mashiutz avatar Dec 16 '19 12:12 mashiutz

@mkuzmin please, maybe some input?

mashiutz avatar Dec 16 '19 14:12 mashiutz

@mkuzmin will not respond as he is not involved in vsphere packer builder project anymore. Try to change value for insecure_connection to true, also remove cpu_cores value for testing purposes.

danonh avatar Dec 17 '19 14:12 danonh

also if above will not solve your problem, could you try use builder from fallowing link? https://teamcity.jetbrains.com/viewLog.html?buildId=2529292&buildTypeId=PackerVSphere_Build&tab=artifacts

danonh avatar Dec 17 '19 14:12 danonh

Thank you very much! I'll update you. are you involved with the project now?

mashiutz avatar Dec 17 '19 20:12 mashiutz

I'm not involved with the project, but same as you I use vsphere-iso and vsphere-clones builders provided by jetbrains. I use it successfully on vSphere 6.7 although some updates for the builder would be advised. More info about @mkuzmin involvement into this project can be found here: https://github.com/hashicorp/packer/pull/7168

danonh avatar Dec 18 '19 08:12 danonh

First, thank you for your help :) I have tried your suggestions above, but I’m getting the same results. Hope someone has more input on this.

mashiutz avatar Dec 18 '19 08:12 mashiutz

Everything looks good with your template file. I would assume it's a vSphere permission issue, although you said you have checked that already. Can you give [email protected] full administrator rights to your vCenter server for testing purposes (if you work on production environment better don't do that)? If not, check permissions on WinTemplate-IT folder and on your vswitch/dvswitch, for [email protected]. I had similar problem yesterday when someone took my permissions off from my esxi host (I used it in non-clustered environment). Take a look here for permissions settings: https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97

danonh avatar Dec 18 '19 10:12 danonh

What gets people a lot times is when their cluster is in a folder structure. If it is then you need to provide the full path for example "FolderName/ClusterName". I use the same structure for the vm_folder field. Hope that helps.

lbonilla68 avatar Dec 24 '19 20:12 lbonilla68

@nslracer I've been running into this issue today. 2 node esxi cluster, and am running vcenter as a VM on one of the nodes. Still cant seem to get passed the issue (running DRS BTW). Driving me a bit mad. Could vcenter as VM on one of the nodes be an issue? SO close, but cant seem to figure out this same error:

This is specifying a resource pool:

`vsphere-iso output will be in this color.

==> vsphere-iso: Creating VM... Build 'vsphere-iso' errored: error creating vm: resource pool 'Arkham Asylum/Resources/deployments' not found

==> Some builds didn't complete successfully and had errors: --> vsphere-iso: error creating vm: resource pool 'Arkham Asylum/Resources/deployments' not found`

this is NOT specifying a resource pool:

`==> vsphere-iso: Creating VM... Build 'vsphere-iso' errored: error creating vm: resource pool 'Arkham Asylum/Resources/' not found

==> Some builds didn't complete successfully and had errors: --> vsphere-iso: error creating vm: resource pool 'Arkham Asylum/Resources/' not found

==> Builds finished but no artifacts were created. `

any ideas? thx

jasonwilliams14 avatar Dec 31 '19 21:12 jasonwilliams14

@jasonwilliams14 - I also run a 2 node ESXi cluster with vCenter as one of the VM's so I know for sure that's not your issue.

I believe the issue might be the space in your resource names. The builder just does not handle spaces well in the datacenter, cluster, folder and resource pool fields. If it's an option I would remove all spaces on your VMware object names (Cluster, Datacenter, folders, etc), update your code and try again.

lbonilla68 avatar Dec 31 '19 23:12 lbonilla68

@nslracer I will give that a shot. Thx

jasonwilliams14 avatar Jan 01 '20 22:01 jasonwilliams14

@jasonwilliams14 Any luck?

lbonilla68 avatar Jan 07 '20 06:01 lbonilla68

@nslracer heya...was going to respond today. I did get it working. i cleaned up the naming convention with no spaces and that seemed to be the issue. Now I can pull ubuntu/debian and centos images just fine now with my setup. Much appreciated!

jasonwilliams14 avatar Jan 07 '20 15:01 jasonwilliams14

@jasonwilliams14 Nice!!

lbonilla68 avatar Jan 07 '20 16:01 lbonilla68

Hi everyone Involved, I know its been a while... I'm still getting the same result: Build 'vsphere-iso' errored: error creating vm: host '' not found. My resource pool's does not have any spaces in their names, only dashes. I'm using the latest version of Packer which is currently 1.5.4. I know that the vsphere-iso builder was integrated into packer.exe. Still no luck. Any take on this? Should I file an issue on the official Packer GitHub? Thanks again :)

mashiutz avatar Feb 18 '20 11:02 mashiutz

I can also reproduce this issue with Packer 1.5.4 and vSphere 6.7 (having a cluster name containing a dash in the middle).

codefox42 avatar Feb 18 '20 11:02 codefox42

Can confirm on Packer 1.5.4 with a cluster name with 2 dashes

Yornik avatar Feb 18 '20 16:02 Yornik

Removing the dash from the cluster name did not change the behavior for our system:

Build 'vsphere-iso' errored: error creating vm: host '' not found

Probably some other aspect is causing this error.

codefox42 avatar Feb 18 '20 16:02 codefox42

Have anyone found a way around this issue? Do you know if this will get fixed in the next version? I'll open an issue on the official Packer GitHub as well

mashiutz avatar Mar 01 '20 16:03 mashiutz

See if the answer on this thread will help

https://github.com/jetbrains-infra/packer-builder-vsphere/issues/285#issuecomment-589819250

lbonilla68 avatar Mar 01 '20 16:03 lbonilla68

For future reference, if anyone here has a / in their network, you'll need to escape it with%2f ...semi-related

pisaniej avatar Feb 28 '22 17:02 pisaniej