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

Ovftool import #8

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

Ovftool import #8

wants to merge 28 commits into from

Conversation

daxgames
Copy link

@daxgames daxgames commented Dec 4, 2015

This is a big change, not sure you ever looked it it based on my last email to you. I never saw a response so I never did a pull request until now.

This uses OVFTool to do the import. No clone required, No wait required, results in a more ESXi compatible VM Template that uses a managed vmdk type like seSparse, eagerZeroedThick, thin, or
thick when using the resulting artifact in ESXi as a template. Will require some changes to Packer Templates.

@lamdor
Copy link
Contributor

lamdor commented Dec 7, 2015

@daxgames This looks like a great update on first glance. I'm going to run it against our internal packer build script to make sure it all works well and if so, I'll merge it in.

Thanks for the PR!

@daxgames
Copy link
Author

daxgames commented Dec 8, 2015

Hopefully it works for you. It works well here.

@lamdor
Copy link
Contributor

lamdor commented Jan 4, 2016

I really tried to make this work (merge in progress at https://github.com/Banno/packer-post-processor-vsphere-ova/tree/merge-daxgames-ovftool_import), but I unfortunately kept getting Transfer Failed, Error: Lost connection to target when it was using ovftool to upload. 😞

I'm going to take a look and see if it works with the master branch so we can determine if it's a problem with our vSphere and not ovftool.

@daxgames
Copy link
Author

daxgames commented Jan 4, 2016

Interesting. Could it be certificate related? Are you using trusted or self signed certs in vsphere?

@daxgames
Copy link
Author

daxgames commented Jan 4, 2016

If self-signed you may need to add "insecure": "true" to your packer template post-processor section. Not sure if this was in the readme changes, we could add it if not.

@daxgames
Copy link
Author

daxgames commented Jan 4, 2016

This still uses SSL it just disabled certificate verification.

@daxgames
Copy link
Author

daxgames commented Jan 4, 2016

I also noticed that my pull request changes your tabs from a 4 char tab to 2 spaces. I can fix that if you like, just let me know. It is our best practice to use 2 spaces vs tabs so my editor does that automatically.

@daxgames daxgames force-pushed the ovftool_import branch 3 times, most recently from a1823e2 to 869a024 Compare January 5, 2016 00:54
@daxgames daxgames force-pushed the ovftool_import branch 3 times, most recently from 0030f19 to a3f5cf0 Compare January 5, 2016 01:08
@lamdor
Copy link
Contributor

lamdor commented Jan 5, 2016

@daxgames Yeah, it's getting pass SSL for sure. It goes for about 30 seconds and then just stops. I can actually see the uploade vmx and vmdk within the datastore for a short while until it fails.

Re the formatting, I've used used gofmt to always reformat the file on save. Whether it's a tab of 2 spaces, I'm not terrible concerned. Just consistency is good for me.

@daxgames
Copy link
Author

I am not sure I can even test it now. Let me see what I can do and I will let you know.

Fixed output type stuff in README.md
@daxgames
Copy link
Author

@rubbish, @vikas027 got this to work, see issue: #10

Can you both provide the anonymized relevant portion of your packer json template? So we can try and discover why it works for one of you but not both.

@vikas027
Copy link

@rubbish Here is my post-processor built from here.

  "post-processors": [
    {
      "type": "vsphere-ova",
      "host": "{{ user `vcenter_host` }}",
      "username": "{{ user `vcenter_user` }}",
      "password": "{{ user `vcenter_password` }}",
      "datacenter": "MyDC",
      "datastore": "datastore01",
      "vm_folder": "packer-templates",
      "vm_network": "VM Network",
      "virtual_hardware_version": "8",
      "remove_floppy": true,
      "remove_optical_drive": false,
      "disk_mode": "thin",
      "cluster": "MyCluster",
      "output_artifact_type": "template",
    }
  ]

@daxgames I also have two feature requests for your code.

  • Ask the user for the OS Type, so that can be changed in the VM Template. As of now, it takes Other (32-bit) by default for all OS, which is not good.
  • Add CDROM in the resultant template

Obviously, second one is not critical but first one is. I can use shell-local using this script and do the same, but it would be great to have everything packaged together. I am not well versed with go, otherwise I would have done this myself.

@daxgames
Copy link
Author

@vikas027, Regarding your requests.

I hate to make the process interactive. What if you could add it to the post-processor definition in the json file. Not sure my code is what is doing this and not saying I can do it but I will look.

@vikas027
Copy link

@daxgames yeah, I meant an addition in Json template. Sorry, I wasn't clear. I too do not like user interactive things in my automation framework.

@vikas027
Copy link

vikas027 commented Apr 2, 2016

@daxgames I have one more request for you to make your work production ready :), and this I believe would be an easy one.

For now, we cannot choose the ESXi host where we want to put the resultant template as the ovftool command ends with

vi://<vcenter_user>:<vcenter_password>@<vcenter_host>/<datacenter>/host/<cluster>

It would be great if there is an option to choose among multiple ESXi hosts as well. To make that happen, the packer post-processor would have to append the ESXi host at the end

vi://<vcenter_user>:<vcenter_password>@<vcenter_host>/<datacenter>/host/<cluster>/<esxi_host>

To sum up, I have three requests for you in order of priority

  1. Option to choose the ESXi host (as explained above)
  2. Option to choose OS Type, so that it can be changed in the VM Template. As of now, it takes Other (32-bit) by default for all OS, which is not good
  3. Add CDROM in the resultant template (not important at all)

Thank you in advance for you work on this.

@rubbish Not sure, why this didn't worked for you, I have checked this PR in four different environments, and it worked fine in all of them. I do not no Golang, but I would be happy to help in whatever way I can. Thanks.

@jmahowald
Copy link

Just giving a +1 in the sense that with this branch I was finally able to make a template in vcenter.

@lamdor
Copy link
Contributor

lamdor commented Apr 5, 2016

I'll come back to this and retry it here in a bit. Not exactly sure what the problem I was running into.

@daxgames
Copy link
Author

I made some changes to this today to fix some bugs. Only fixes, no enhancements yet.

@daxgames
Copy link
Author

Still working on it.

@mrjcleaver
Copy link

Still still? :)

@daxgames
Copy link
Author

@mrjcleaver ???

@mrjcleaver
Copy link

Are you still working on it?

I'm wondering if / when this will get get merged.

@daxgames
Copy link
Author

daxgames commented Sep 10, 2016

@mrjcleaver I am not working on it. As far as I am concerned it is complete.

There are things people have asked for but I have no way to implement/test at this point.

As for merge that is up to those that maintain this repo.

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

Successfully merging this pull request may close these issues.

5 participants