When a VM host is added to MAAS one of the first operations performed is refreshing the VM hosts information. This happens even when MAAS itself is deploying the VM host. In LP:1923685 I deployed an LXD VM host which fails to refresh due to GH:LXC/LXD:8477[1]. This sets 50-maas-01-commissioning to failed and the failure is captured in regiond.log. However the machine is still marked as deployed and an LXD VM host is still added. If I try to compose a VM on this machine I get over commitment errors as 50-maas-01-commissioning wasn't able to process.
1. If the initial refresh fails when adding a VM host it shouldn't be added.
2. If the initial refresh fails when adding a VM host during a deployment the deployment should be marked as failed deployment.
[1] https://github.com/lxc/lxd/issues/8477
Do you get a traceback in that case in regiond.log?
I had a similar case when testing deployment of a machine as VM host where it would fail to register the host, but in that case I did get the deployment marked as failed, as the PodForm should fail on save() if discover_ and_refresh_ pod fails.
I'm not exactly sure of what's the path you're hitting that masks the failure