Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

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

Open
mashiutz opened this issue Dec 15, 2019 · 23 comments
Open

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

mashiutz opened this issue Dec 15, 2019 · 23 comments

Comments

@mashiutz
Copy link

mashiutz commented Dec 15, 2019

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":             "superman@vsphere.local",
    "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!

@danonh
Copy link

danonh commented Dec 16, 2019

Can you confirm that superman@vsphere.local 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 superman@vsphere.local can you create VMs on IT-256GB cluster?

@mashiutz
Copy link
Author

mashiutz commented Dec 16, 2019

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
Copy link
Author

mashiutz commented Dec 16, 2019

@mkuzmin please, maybe some input?

@danonh
Copy link

danonh commented Dec 17, 2019

@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
Copy link

danonh commented Dec 17, 2019

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

@mashiutz
Copy link
Author

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

@danonh
Copy link

danonh commented Dec 18, 2019

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: hashicorp/packer#7168

@mashiutz
Copy link
Author

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.

@danonh
Copy link

danonh commented Dec 18, 2019

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 superman@vsphere.local 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 superman@vsphere.local. 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: #97

@lbonilla68
Copy link

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.

@jasonwilliams14
Copy link

jasonwilliams14 commented Dec 31, 2019

@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

@lbonilla68
Copy link

lbonilla68 commented Dec 31, 2019

@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.

@jasonwilliams14
Copy link

@nslracer I will give that a shot. Thx

@lbonilla68
Copy link

@jasonwilliams14 Any luck?

@jasonwilliams14
Copy link

@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!

@lbonilla68
Copy link

@jasonwilliams14 Nice!!

@mashiutz
Copy link
Author

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 :)

@codefox42
Copy link

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).

@Yornik
Copy link

Yornik commented Feb 18, 2020

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

@codefox42
Copy link

codefox42 commented Feb 18, 2020

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.

@mashiutz
Copy link
Author

mashiutz commented Mar 1, 2020

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

@lbonilla68
Copy link

See if the answer on this thread will help

#285 (comment)

@pisaniej
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

7 participants