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

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

Closed
mashiutz opened this issue Mar 1, 2020 · 12 comments · Fixed by #9361
Closed

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

mashiutz opened this issue Mar 1, 2020 · 12 comments · Fixed by #9361

Comments

@mashiutz
Copy link

mashiutz commented Mar 1, 2020

While trying to build a New Windows Template using vSphere-ISO, im getting an error:
Build 'vsphere-iso' errored: error creating vm: host '' not found

I have tried using a resource pool an also omitting, same results.

Packer Version 1.5.4.
happened on older versions as well, back when vSphere-ISO was on https://github.com/jetbrains-infra/packer-builder-vsphere

Sample of the JSON:

`{
"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"
    ]
    
  }
]

}`

OS is Windows 10 1909 (had this error in 1809 and 1903)
vSphere version is 6.7

relevant log entries:
2020/03/01 18:22:04 packer.exe plugin: Serving a plugin connection...
2020/03/01 18:22:04 ui: vsphere-iso: output will be in this color.
2020/03/01 18:22:04 ui:
2020/03/01 18:22:04 Build debug mode: false
2020/03/01 18:22:04 Force build: false
2020/03/01 18:22:04 On error:
2020/03/01 18:22:04 Preparing build: vsphere-iso
2020/03/01 18:22:04 Waiting on builds to complete...
2020/03/01 18:22:04 Starting build run: vsphere-iso
2020/03/01 18:22:04 Running builder: vsphere-iso
2020/03/01 18:22:04 [INFO] (telemetry) Starting builder vsphere-iso
2020/03/01 18:22:05 ui: ==> vsphere-iso: Creating VM...
2020/03/01 18:22:05 [INFO] (telemetry) ending vsphere-iso
2020/03/01 18:22:05 ui error: Build 'vsphere-iso' errored: error creating vm: host '' not found
2020/03/01 18:22:05 machine readable: error-count []string{"1"}
2020/03/01 18:22:05 ui error:
==> Some builds didn't complete successfully and had errors:
2020/03/01 18:22:05 machine readable: vsphere-iso,error []string{"error creating vm: host '' not found"}
2020/03/01 18:22:05 ui error: --> vsphere-iso: error creating vm: host '' not found
2020/03/01 18:22:05 ui:
==> Builds finished but no artifacts were created.
2020/03/01 18:22:05 [INFO] (telemetry) Finalizing.
2020/03/01 18:22:06 waiting for all plugin processes to complete...

A few people also reported this issue on the older GitHub:
jetbrains-infra/packer-builder-vsphere#295

Some has more input on this?
Thanks!

@nywilken
Copy link
Contributor

nywilken commented Mar 2, 2020

Thanks for bubbling this up. We will try to take a look when we get a chance.

@natepalm
Copy link

Has there by chance been any update to this issue? I too am trying to setup our environment to use Packer with VMware. Running 6.7u3 we are running in to this issue and our Clusters are not in a folder hierarchy, so that does not appear to be our issue.

@SwampDragons
Copy link
Contributor

No update yet, sorry.

@natepalm
Copy link

natepalm commented Apr 5, 2020

In my case the issue came down to the network adapter being chosen/specified not actually existing. I corrected that and the error went away and the build(s) are finishing successfully.

@mashiutz
Copy link
Author

mashiutz commented Jun 4, 2020

@natepalm,
Do you mean the network_card parameter in the JSON file?
What value have u supplied to that parameter? i have tried vmxnet3 lower and upper case, and still got that problem.

@sylviamoss sylviamoss self-assigned this Jun 4, 2020
@sylviamoss
Copy link
Contributor

hey @mashiutz, they meant the network config. It turns out that if network is not set Packer will look for the host to try to find a network. If both aren't set then the build fails.
I'm working on this to make explicit that either host or network must be set.

@mashiutz
Copy link
Author

mashiutz commented Jun 7, 2020

hey @mashiutz, they meant the network config. It turns out that if network is not set Packer will look for the host to try to find a network. If both aren't set then the build fails.
I'm working on this to make explicit that either host or network must be set.

Thank you @sylviamoss for the work you have put in.
I have tried to include the "network_adapters" configuration and still get the same exact "host '' not found' error:
"network_adapters" : [ { "network": "Vlan22", "network_card": "vmxnet3" } ]

@sylviamoss
Copy link
Contributor

@mashiutz hmm that's weird because Packer only tries to find the host when the network or datacenter is not set. Can you double-check, please?
You can use my PR binaries https://circleci.com/gh/hashicorp/packer/57303#artifacts/containers/0. With this, you might see a specific error message in case the network is not being set internally for some reason.

@mashiutz
Copy link
Author

mashiutz commented Jun 21, 2020

@sylviamoss Have yet to try your binaries,
but i saw that packer released version 1.6. i saw in the changelog that a few bugs related to vsphere-iso builder were fixed, but non address that issue - still happening in 1.6

@sylviamoss
Copy link
Contributor

This currently not identified as an issue since we only check for host when no network is provided. My PR added an explicit error message to help us debug this.
In order to Packer get to the point of returning the error message you're seeing, is because Packer couldn't find the network in your config. I tried reproducing this locally but Packer is able to find the network and then works for me.

Can you paste the complete output logs when running Packer with PACKER_LOG=1 set?

@mashiutz
Copy link
Author

So i used your binaries - no error was shown on the console.
This is the output logs:

2020/06/25 00:33:34 [WARN] Config file doesn't exist: C:\Users\user\AppData\Roaming\packer.config
2020/06/25 00:33:34 Setting cache directory: packer_cache
cannot determine if process is in background: Process background check error: not implemented yet
2020/06/25 00:33:34 Creating plugin client for path: packer.exe
2020/06/25 00:33:34 Starting plugin: packer.exe []string{"packer.exe", "plugin", "packer-builder-vsphere-iso"}
2020/06/25 00:33:34 Waiting for RPC address for: packer.exe
2020/06/25 00:33:34 packer.exe plugin: [INFO] Packer version: 1.6.0-dev (caf0d09) [go1.13.12 windows amd64]
2020/06/25 00:33:34 packer.exe plugin: Checking 'PACKER_CONFIG' for a config file path
2020/06/25 00:33:34 packer.exe plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/06/25 00:33:34 packer.exe plugin: Attempting to open config file: C:\Users\user\AppData\Roaming\packer.config
2020/06/25 00:33:34 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\user\AppData\Roaming\packer.config
2020/06/25 00:33:34 packer.exe plugin: Setting cache directory: packer_cache
2020/06/25 00:33:34 packer.exe plugin: args: []string{"packer-builder-vsphere-iso"}
2020/06/25 00:33:34 packer.exe plugin: Plugin port range: [10000,25000]
2020/06/25 00:33:34 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2020/06/25 00:33:34 packer.exe plugin: Waiting for connection...
2020/06/25 00:33:34 Received tcp RPC address for packer.exe: addr is 127.0.0.1:10000
2020/06/25 00:33:34 packer.exe plugin: Serving a plugin connection...
2020/06/25 00:33:34 Preparing build: vsphere-iso
2020/06/25 00:33:34 ui: vsphere-iso: output will be in this color.
2020/06/25 00:33:34 ui:
2020/06/25 00:33:34 Build debug mode: false
2020/06/25 00:33:34 Force build: false
2020/06/25 00:33:34 On error:
2020/06/25 00:33:34 Waiting on builds to complete...
2020/06/25 00:33:34 Starting build run: vsphere-iso
2020/06/25 00:33:34 Running builder: vsphere-iso
2020/06/25 00:33:34 [INFO] (telemetry) Starting builder vsphere-iso
2020/06/25 00:33:35 ui: ==> vsphere-iso: Creating VM...
2020/06/25 00:33:35 [INFO] (telemetry) ending vsphere-iso
2020/06/25 00:33:35 ui error: Build 'vsphere-iso' errored: error creating vm: host '' not found
2020/06/25 00:33:35 machine readable: error-count []string{"1"}
2020/06/25 00:33:35 ui error:
==> Some builds didn't complete successfully and had errors:
2020/06/25 00:33:35 machine readable: vsphere-iso,error []string{"error creating vm: host '' not found"}
2020/06/25 00:33:35 ui error: --> vsphere-iso: error creating vm: host '' not found
2020/06/25 00:33:35 ui:
==> Builds finished but no artifacts were created.
2020/06/25 00:33:35 [INFO] (telemetry) Finalizing.
2020/06/25 00:33:36 waiting for all plugin processes to complete...
2020/06/25 00:33:36 packer.exe: plugin process exited

@ghost
Copy link

ghost commented Jul 6, 2020

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 and limited conversation to collaborators Jul 6, 2020
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.

6 participants