On 27. 3. 2020 17:23, john doe wrote:
On 3/27/2020 5:13 PM, Michal Prívozník wrote:
> On 27. 3. 2020 16:48, Michal Prívozník wrote:
>> On 27. 3. 2020 14:57, john doe wrote:
>>> Hi,
>>>
>>> I would like to set the hostname when installing a guest, with the below
>>> command the hostname is not set to 'try06' in the guest:
>>>
>>> virt-install --name=try06 --graphic none --pxe --network bridge=virbr0
>>
>> This is the name of the guest registered in libvirt. I don't think that
>> virt-install has wired up setting hostname, but it looks like it can do
>> it. I mean, use --name for both libvirt name and guest hostname.
>
> On the other hand, users might want to set it to something else. So we
> really should have a separate argument for that. Anyway, I've reported
> it to virt-install developers:
>
>
https://github.com/virt-manager/virt-manager/issues/94
>
Many thanks for your answer and for passing it along.
I agree, an option to trigger this behavior is best.
After executing the above command and before the hostname step, the
following workaround seems to work:
$ virsh net-dhcp-leases default
Expiry Time MAC address Protocol IP address
Hostname Client ID or DUID
-----------------------------------------------------------------------------------------------------------------------------------------------
2020-03-27 18:03:36 52:54:00:9d:d1:e7 ipv4 192.168.122.45/24
- ff:00:9d:d1:e7:00:01:00:01:26:10:e0:58:52:54:00:9d:d1:e7
$ virsh net-update default add ip-dhcp-host "<host
mac='52:54:00:9d:d1:e7' name='try06'
ip='192.168.122.45'/>"
What I am not sure about is how to predetermine the MAC address of the
guest before starting the installer?
You can switch the steps and generate a MAC address yourself, then
update the network and then specify it on virt-install cmd line.
Or even better, do not bother with any of this and use libvirt-nss plugin: