Bug 1571324 - virt-sysprep net-hostname is only removing HOSTNAME from ifcfg file
Summary: virt-sysprep net-hostname is only removing HOSTNAME from ifcfg file
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.4
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-24 14:07 UTC by nijin ashok
Modified: 2018-05-23 17:03 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-23 17:03:49 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description nijin ashok 2018-04-24 14:07:09 UTC
Description of problem:

Currently, virt-sysprep net-hostname is only removing hostname from ifcfg files which is not adequate for clearing the hostname from the VM. We also have to remove it from /etc/sysconfig/network and /etc/hostname so that it would make sure that the hostname is properly removed from the VM.


Version-Release number of selected component (if applicable):

libguestfs-1.36.10

How reproducible:

100%

Steps to Reproduce:

1. Run virt-sysprep on an image. The hostname is not correctly removed from the VM. 


Actual results:

virt-sysprep is not removing hostname correctly.

Expected results:

virt-sysprep should remove hostname correctly.


Additional info:

Comment 3 Pino Toscano 2018-05-02 11:58:37 UTC
A guest always has an hostname, be it "vm01.intranet.corp.com" or simply "localhost.localdomain". You cannot "clear" the hostname from an OS.

If you want to use the same template as a base for creating multiple VMs, then the best way is to use e.g. virt-customize/virt-sysrep --hostname (offline), cloud-init (at runtime), or any other solution to set the hostname.

Comment 4 Pino Toscano 2018-05-23 17:03:49 UTC
Closing this bug, as virt-sysprep works as intended, and --hostname must be used to change the hostname.


Note You need to log in before you can comment on or make changes to this bug.