[ovirt-users] cloud init hostname from pools

Barak Korren bkorren at redhat.com
Tue Jun 20 07:46:59 UTC 2017


On 19 June 2017 at 17:16, Paul <paul at kenla.nl> wrote:
>
> I would like to automatically set the hostname of a VM to be the same as the
> ovirt machine name seen in the portal.
>
> This can be done by creating a template and activating cloud-init in the
> initial run tab.
>
> A new VM named “test” based in this template is created and the hostname is
> “test”, works perfect!
>
> But when I create a pool (i.e. “testpool”) based on this template I get
> machines with names “testpool-1”, “testpool-2”, etc. but the machine name is
> not present in the metadata and cannot be set as hostname. This is probably
> due to the fact that the machine names are auto generated by the oVirt Pool.
>
> Is this expected/desired behavior for cloud-init from pools?
>
> If so, what would be the best way to retrieve the machine name (as seen in
> the portal) and manually set it to be hostname via cloud-init (i.e. runcmd –
> hostnamectl set-hostname $(hostname))


I've opened a bug about this a while ago:
https://bugzilla.redhat.com/show_bug.cgi?id=1298232

Maybe go ahead and write your use case there to get some attention to it...

An alternative is to not care about the VM names in engine and use DNS/DHCP
to set VM host names. But then you`ll hit:
https://bugzilla.redhat.com/show_bug.cgi?id=1298235

Our current solution is to just assign names and addresses randomly to POOL
VMs and make them report their existence to a central system before use.

-- 
Barak Korren
RHV DevOps team , RHCE, RHCi
Red Hat EMEA
redhat.com | TRIED. TESTED. TRUSTED. | redhat.com/trusted


More information about the Users mailing list