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

Customize VMWare Guest Info Service to get data from "guestinfo.ovfenv" #127

Open
roct37 opened this issue Nov 9, 2023 · 5 comments
Open

Comments

@roct37
Copy link

roct37 commented Nov 9, 2023

Hello,

Cloudinit gets userdatas and metadatas from the extra config key "guestinfo.ovfenv" on the vm properties which is built from ovf environment properties but cloudbase-init seems to only look for "guestinfo.userdata" and "guestinfo.metada". I use a terraform provider which doesnt allow me to add any vmware extra config properties, only vapp properties can be set.

Is it possible to customize cloudbase-init to look in "guestinfo.ovfenv" ?

Thanks in advance for every answers.

@ader1990
Copy link
Member

Hello, maybe OvfService might be a better option in your case?

Thank you.

@roct37
Copy link
Author

roct37 commented Nov 13, 2023

Hello,
I also cant use ovfservice as the configuration for the ovftransport is always override from ISO image to VMWare tools when i deploy using this provider (i also have an opened issue for this on the provider repo). I can make cloud-init work with linux os because this key "guestinfo.ovfenv" is used, maybe cloudbase-init should use the same ?

@ader1990
Copy link
Member

Hello, I also cant use ovfservice as the configuration for the ovftransport is always override from ISO image to VMWare tools when i deploy using this provider (i also have an opened issue for this on the provider repo). I can make cloud-init work with linux os because this key "guestinfo.ovfenv" is used, maybe cloudbase-init should use the same ?

Hello, I think we can use the same approach, if it s already standard. Is it possible to provide us the cloud-init metadata service configuration that works on Linux?

@roct37
Copy link
Author

roct37 commented Nov 13, 2023

Thank you for your answers. With Linux, I use OVF Datasource with vmware guestinfo seed to retrieve the customization datas which are defined in "guestinfo.ovfenv" built from the vapp properties i configured when deploying.

With cloudbase-init, if possible, i'd like to be able to do the same, use OVF as Datasource which will retreive the datas from guestinfo.ovfenv using vmware tools.

@Tom-0
Copy link

Tom-0 commented Feb 12, 2024

Hi Team,

@ader1990 do you know is it planned to implement "guestinfo.ovfEnv" datasource as per above? It would be a great thing to have.

As @roct37 mentioned, the good thing is, this method is very similar to already implemented in cloudbase-init "VMware GuestInfo" service. But all data is present into single "guestinfo.ovfEnv" property. In practice, this property contains the same "ovf-env.xml" as present for "regular" ISO transport method. Which for example is:

<Environment
     xmlns="http://schemas.dmtf.org/ovf/environment/1"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:oe="http://schemas.dmtf.org/ovf/environment/1"
     xmlns:ve="http://www.vmware.com/schema/ovfenv"
     oe:id=""
     ve:vCenterId=".....">
   <PlatformSection>
      <Kind>VMware ESXi</Kind>
      <Version>......</Version>
      <Vendor>VMware, Inc.</Vendor>
      <Locale>en</Locale>
   </PlatformSection>
   <PropertySection>
         <Property oe:key="user-data" oe:value=" BASE64 ENCODED user-data HERE "/>
   </PropertySection>
   <ve:EthernetAdapterSection>
      <ve:Adapter ve:mac="......" ve:network="......" ve:unitNumber="......"/>
   </ve:EthernetAdapterSection>
</Environment>

So the same as rpctool queries guestinfo here:
https://github.com/cloudbase/cloudbase-init/blob/master/cloudbaseinit/metadata/services/vmwareguestinfoservice.py#L57
... it can query "guestinfo.ovfEnv" and further also use base64 decoding.

It is all a bit confusing, TBH I was struggling to get my head around it, especially if cloud-init's documentation for OVF datasource is pretty short:
https://cloudinit.readthedocs.io/en/latest/reference/datasources/ovf.html

But reading these two:
https://kb.vmware.com/s/article/91809
canonical/cloud-init#1573
... and checking how it is implemented in cloud-init, finally helped me to understand:
https://github.com/canonical/cloud-init/blob/main/cloudinit/sources/DataSourceOVF.py#L302

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

No branches or pull requests

3 participants