Comment 0 for bug 1982484

Revision history for this message
greg (gsperry) wrote :

I am running MAAS: `3.1.0`

I want to start this out by saying that i'm not 100% sure that this is a bug, but after the troubleshooting i've done, I believe it is one. For completeness, I opened this yesterday https://discourse.maas.io/t/vcenter-registration-variable-question/6222 and was told to open a bug report.

The issue I am having is that my esxi deployments are not being joined to vcenter. They are successfully completing deployments in MAAS, but fail to join vcenter even though I have vcenter hostname and creds specified in the MAAS settings which I believe *should* cause the metadata script `vendor_data.py` to write a vcenter.yaml file to `/altbookbank/maas/vcenter.yaml` which is NOT being created for me so I dug in to find out why.

I added some additional logging to the `vendor_data.py` script and confirmed that the `vcenter_registration` variable is `None` which is why the vcenter.yaml file isn't being created. This bit of code is what i'm referring to: https://github.com/maas/maas/blob/master/src/metadataserver/vendor_data.py#L352

*NOTE:* The additional debug logging statements I added are printing to stdout which seems to print out in the regiond logs. Any statement I added will be prefaced with `GSPTEST` - Here is an example from regiond (these are in the tar.gz logs i'm uploading as well):
```
2022-07-20 15:18:05 stdout: [info] GSPTEST: Starting generate_vcenter_config
2022-07-20 15:18:05 stdout: [info] GSPTEST: confirmed we are admin
2022-07-20 15:18:05 stdout: [info] GSPTEST: vcenter_registration is: None
```

In the code it looks like the `vcenter_registration` variable is something that should be specified on each nodes metadata, the problem is that I can't figure out how to add that via the GUI or CLI to the node. I could not find anything online about needing to specify this metadata manually per node so that is why I believe this to be a bug.

As an additional bit of info, when searching around before opening this bug I discovered this issue which seems to have the same behavior I am experiencing. If vcenter.yaml fails to get created (and creds aren't hard coded into the `vcenter` script built into the image), the `vcenter` script will fail as it has no config file to get certain arguments such as `vc_server`, `vc_username`, `vc_password` and fail completely with `vcenter: error: the following fields are missing: vc_server, vc_username, vc_password` - https://discourse.maas.io/t/esxi-autoregistration-doesnt-work/4600/2

I will continue do some more testing and report back any findings. I don't want to permanently rip out the `vcenter_registration` check but am going to workaround it so i can produce a vcenter.yaml and see if things work as expected. After that I plan to dig through the code to find the source of how this metadata is supposed to get populated (I'm guessing it should be automatic when an operating system of ESXI is chosen). If I find a fix i'll make a PR!