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

Create vApp config with OVF Environment transport? #574

Closed
bradfitz opened this issue Aug 31, 2016 · 5 comments
Closed

Create vApp config with OVF Environment transport? #574

bradfitz opened this issue Aug 31, 2016 · 5 comments

Comments

@bradfitz
Copy link
Contributor

If I create a VM using the web UI, I'm able to enable the vApp Config option "OVF Environment", with the ISO transport, making the VM have access to metadata from the host on a fake CD-ROM.

govc vm.info -json on such a VM shows:

        "VAppConfig": {
...
          "OvfSection": null,
          "OvfEnvironmentTransport": [
            "iso"
          ],
        },

I'm not seeing a way to enable that option using govc, or at least not seeing anything that would make that API call. I see only the auto-generated code:

gopher@godns:~/src/github.com/vmware/govmomi$ git grep OvfEnvironmentTransport
vim25/types/types.go:   SupportedOvfEnvironmentTransport []string                 `xml:"supportedOvfEnvironmentTransport,omitempty"`
vim25/types/types.go:   OvfEnvironmentTransport []string             `xml:"ovfEnvironmentTransport,omitempty"`
vim25/types/types.go:   OvfEnvironmentTransport []string              `xml:"ovfEnvironmentTransport,omitempty"`

I see other bugs open about OVF but they appear to be unrelated, if I understand them correctly.

Or maybe I should be writing a OVA/OFV file and using import.ova/import.ovf subcommands instead?

I was looking for something in govc vm.change.

Thanks!

@dougm
Copy link
Member

dougm commented Sep 1, 2016

I'll have to look into the transport option, didn't realize there was an option aside from guestinfo.

Have you tried using guestinfo for injecting metadata? vApp is not required in that case. For example:

View:

$ govc vm.info -e $vm_name

Update:

$ govc vm.change -e guestinfo.foo=bar -vm $vm_name

You'll see the value here now:

$ govc vm.info -e $vm_name | grep foo
    guestinfo.foo:                      bar

And read from within the guest:

$ ssh $(govc vm.ip $vm_name) vmware-rpctool "'info-get guestinfo.foo'"                                                                                                                                                  
bar

You can also use rpctool to read the guestinfo injected by an ovf. If you were looking at using an iso to avoid the tools/rpctool requirement, it is possible to read that data using Go too: https://github.com/vmware/vic/tree/master/cmd/rpctool

@bradfitz
Copy link
Contributor Author

bradfitz commented Sep 1, 2016

No, I haven't tried guestinfo. I have the VMWare Tools installed in the guest, but I had no command line tools available. I guess that's a separate package. I can try that.

You got me excited about the Go-based rpctool but I followed it down to find its magic and ended up at https://github.com/vmware/vmw-guestinfo/blob/master/bridge/bridge.go and was a little sad to see the cgo. I need to cross-compile these binaries for a number of operating systems, so pure Go would be ideal. How tricky is the protocol? Is it even publicly documented or available in public source code?

In any case, feel free to close this bug report if it's misguided. I'll research guestinfo and rpc calls more. Thanks!

@dougm
Copy link
Member

dougm commented Sep 1, 2016

rpctool should be included, but may not end up in your PATH, for example:

$ find / -name vmware-rpctool 2>/dev/null
/usr/lib/vmware-tools/sbin32/vmware-rpctool
/usr/lib/vmware-tools/sbin64/vmware-rpctool
...

The go version currently requires cgo for asm. I had started to look at porting to go asm a while back, first with this: https://github.com/sigma/bdoor/blob/master/check.go#L26-L32
But haven't had a chance to look into this further:

asm: invalid instruction: 00029 (.../main_amd64.s:8)  INL     DX, AX
asm: assembly of ./main_amd64.s failed

But if we can get the asm there and in bridge/backdoor_amd64.c ported to go asm, it would be possible to port the remaining message.c to Go. Any doc is in the source code there and vmware/open-vm-tools from which it is derived. I am planning to look at this again as we want to avoid cgo in vmware/vic too. So, happy to spend more time on this esp. if you can help with the go asm bits.

In the meantime, another option, generate / upload / attach an iso yourself:
https://github.com/vmware/vic/blob/master/pkg/vsphere/toolbox/toolbox-test.sh#L108-L110
That example requires linux or osx:

% brew install cdrtools
% ln -s /usr/local/bin/mkisofs /usr/local/bin/genisoimage

Also have a floppy example using pure Go to generate the floppy (via github.com/mitchellh/go-fs/fat), would just need to dig it out of some internal code.

@caglar10ur
Copy link
Contributor

Following up for the go rpc tool part; https://github.com/vmware/vmw-guestinfo is now pure go and Apache 2.0 licensed thanks to @fdawg4l

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

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

No branches or pull requests

3 participants