vsphere post processor issue

1,761 views
Skip to first unread message

dt_bski

unread,
May 20, 2014, 10:24:53 AM5/20/14
to packe...@googlegroups.com
Hey Everyone,

I'm running packer on Linux Mint 13, using Workstation 10, building locally with vmware-iso then pushing up to ESX via the vsphere post processor.

I'm getting these errors during the post processing:

==> vmware-iso: Running post-processor: vsphere
2014/05/20 08:47:19 ui: ==> vmware-iso: Running post-processor: vsphere
    vmware-iso (vsphere): Uploading output-vmware-iso/packer-vmware-iso.vmx to vSphere
2014/05/20 08:47:19 ui:     vmware-iso (vsphere): Uploading output-vmware-iso/packer-vmware-iso.vmx to vSphere
2014/05/20 08:47:24 /usr/local/packer/packer-command-build: 2014/05/20 08:47:24 Deleting original artifact for build 'vmware-iso'
Build 'vmware-iso' errored: 1 error(s) occurred:

* Post-processor failed: Failed: exit status 1
Stdout: Opening VMX source: output-vmware-iso/packer-vmware-iso.vmx
Error: Locator does not refer to an object: vi://ro...@192.168.48.71:443ha-datacenter/host/vm-host2-h./Resources/192.168.48.36/host/DTS2/Resources/
Completed with errors

2014/05/20 08:47:24 ui error: Build 'vmware-iso' errored: 1 error(s) occurred:

* Post-processor failed: Failed: exit status 1
Stdout: Opening VMX source: output-vmware-iso/packer-vmware-iso.vmx
Error: Locator does not refer to an object: vi://ro...@192.168.48.71:443ha-datacenter/host/vm-host2-h./Resources/192.168.48.36/host/DTS2/Resources/
Completed with errors

2014/05/20 08:47:24 /usr/local/packer/packer-command-build: 2014/05/20 08:47:24 Builds completed. Waiting on interrupt barrier...
2014/05/20 08:47:25 machine readable: error-count []string{"1"}

==> Some builds didn't complete successfully and had errors:
2014/05/20 08:47:25 ui error: 
==> Some builds didn't complete successfully and had errors:
2014/05/20 08:47:25 machine readable: vmware-iso,error []string{"1 error(s) occurred:\n\n* Post-processor failed: Failed: exit status 1\nStdout: Opening VMX source: output-vmware-iso/packer-vmware-iso.vmx\nError: Locator does not refer to an object: vi://ro...@192.168.48.71:443ha-datacenter/host/vm-host2-h./Resources/192.168.48.36/host/DTS2/Resources/\nCompleted with errors\n"}
--> vmware-iso: 1 error(s) occurred:

192.168.48.36 is the name of the Datacenter (I know, pretty strange).

Here is my configuration in the json file:

{
    "builders": [
        {
            "type": "vmware-iso",
            "iso_url": "/home/user/Documents/en_windows_server_2012_r2_x64_dvd_2707946.iso",
            "iso_checksum_type": "md5",
            "iso_checksum": "838fe19bd9af21801d4f919b48372699",
            "headless": true,
            "boot_wait": "2m",
            "ssh_username": "vagrant",
            "ssh_password": "vagrant",
            "ssh_wait_timeout": "2h",
            "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
            "guest_os_type": "windows8srv-64",
            "disk_size": 40000,
            "vnc_port_min": 5900,
            "vnc_port_max": 5980,
            "floppy_files": [
                "./scripts/Autounattend.xml",
                "./scripts/win-updates.ps1",
                "./scripts/openssh.ps1"
            ],
            "vmx_data": {
                "RemoteDisplay.vnc.enabled": "false",
                "RemoteDisplay.vnc.port": "5900",
                "memsize": "2048",
                "numvcpus": "2",
                "scsi0.virtualDev": "lsisas1068"
            }
        } 
    ],
    "provisioners": [
        {
            "type": "shell",
            "remote_path": "/tmp/script.bat",
            "execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
            "scripts": [
                "./scripts/vm-guest-tools.bat",
                "./scripts/chef.bat",
                "./scripts/vagrant-ssh.bat"
            ]
        }, 
        {
            "type": "shell", "inline": ["rm -rf /tmp/*"]
        }
    ],
    "post-processors": [
        {
            "type": "vsphere",
"host": "192.168.48.71",
"username": "root",
"password": "password",
"datacenter": "192.168.48.36",
"cluster": "DTS2",
"datastore": "Primary Datastore",
"vm_folder": "/",
"vm_name": "packer-dbtest",
"vm_network": "Development_Server",
"resource_pool": " ",
"disk_mode": "thin",
"insecure": "true"
        }
    ]
}

I've been searching on the "Locator does not refer to an object" error for a while and I cannot find anything other than people on VMware communities saying that syntax is wrong for ovftool and so forth. If that is the case there is nothing I could do since packer is initiating the syntax.

Any ideas of what may causing this? Could something security wise on the host be blocking this step from proceeding correctly? I am at a loss.

Thanks!

Don Ky

unread,
May 20, 2014, 5:45:31 PM5/20/14
to packe...@googlegroups.com
Looks like ovftool which is invoked by packer is not finding the resource destination you are trying to upload to in vsphere:

Try probing vsphere to figure out if your datastore location is correct


This path looks screwy:

vi://ro...@192.168.48.71:443ha-datacenter/host/vm-host2-h./Resources/192.168.48.36/host/DTS2/Resources/

This should allow you completely figure out proper path of where to upload the vmx file to.  

dt_bski

unread,
May 21, 2014, 7:51:11 AM5/21/14
to packe...@googlegroups.com
Hey Don, thanks for the input. 

Would us not having a Resource Pool configured in the vSphere environment cause this issue? Just manually hitting my host with the vi syntax I get "Error: Found wrong kind of object (ResourcePool)."

dt_bski

unread,
May 21, 2014, 10:11:56 AM5/21/14
to packe...@googlegroups.com
So, I created a Resource Pool, that made no difference. But, in vCenter, I clicked on the host i'm aiming at, went to configuration, and enabled the ssh client service. That got me further, now I'm getting:

Build 'vmware-iso' errored: 1 error(s) occurred:

* Post-processor failed: Failed: exit status 1
Stdout: Opening VMX source: output-vmware-iso/packer-vmware-iso.vmx
Error: File (/tmp/packer701443065) could not be found.
Completed with errors

I'm sure this is probably a rights issue, even though I am logging in as root. Perhaps root is trying to create this directory and not allowed. I'll search thorugh VMware documentation to find out ideas. If anyone has any ideas please let me know.

Don Ky

unread,
May 21, 2014, 10:53:59 PM5/21/14
to packe...@googlegroups.com
This is what I mean't by probing vsphere to see where you should upload your vmx file:

  2
  3 Error: Found wrong kind of object (Folder). Possible completions are:
  4   Sample-DC-LAB/
  5 user@ubuntulab ~ $
  7 Error: Found wrong kind of object (Datacenter). Possible completions are:
  8   vm/
  9   host/
 11 Error: Found wrong kind of object (Folder). Possible completions are:
 12   Sample-cluster/

This was run in my lab, as you can see you can see the datacenter then slowly probe in for host where to upload the file to.  The end path should be on a physical host.  You can see in my cluster I have 192.168.1.29 and that would be where my datastore location would be. 

I don't think SSH needs to be enabled since it uses https to upload the vmx file. 

Hope this helps. As to the new error you are getting unsure....

dt_bski

unread,
May 22, 2014, 9:21:07 AM5/22/14
to packe...@googlegroups.com
Ok, yeah I see what you mean now. I'm getting some weird behavior with this though. I think something in my vSphere environment is screwy. I am doing this in Powershell since ovftool on Linux is giving me weird issues... https://communities.vmware.com/thread/424573

Anyhow, PS seems to get me where I need to go for the time being. But here is what i'm getting:

PS C:\Windows\system32> ovftool vi://root:pass...@192.168.48.71:443
Error: Found wrong kind of object (ResourcePool). Possible completions are:
  devTestVM1
  Packer/

PS C:\Windows\system32> ovftool vi://root:pass...@192.168.48.71:443:Packer/
Error: Cannot parse locator: vi://root:pass...@192.168.48.71:443:Packer/

PS C:\Windows\system32> ovftool vi://root:pass...@192.168.48.71:443/devTestVM1
Error: Locator does not refer to an object: vi://ro...@192.168.48.71:443ha-datacenter/host/vm-host2-h./Resources/devTestVM1

I don't know where it's getting the "ha-datacenter" part from, nor understand why there isn't a forward slash separating it from the :443. It should be :443/ha-datacenter if anything. Just very weird. I'll update as I poke around on VMware side.

dt_bski

unread,
May 23, 2014, 1:39:55 PM5/23/14
to packe...@googlegroups.com
Alright so, I think I know what the problem is with this. The whole environment is IP based, were not using hostnames, which we should be, but the IBM machine we are using (blade center) has the OS labeled as vm-host2-h on the blade i'm hitting but it's only seen as 192.168.48.71. So basically this is hosed until I can get in there and fix this around. So ovftool just automatically brings back vm-host2-h from the query but that is not actually resolvable since that host isn't labeled that in the environment. Really weird.

Thanks for the help Don.

jfle...@ipipeline.com

unread,
Sep 9, 2016, 10:49:29 AM9/9/16
to Packer
Hi there,

I am experiencing the same issue with the random "ha-decenter" being interested into the command. 

I don't suppose you can recall what you did in the end? I am using hostnames rather than IP's so i'm not 100% sure what is going wrong. 
Reply all
Reply to author
Forward
0 new messages