Description of problem: In some cases there's DHCP_HOSTNAME set in ifcfg-* files, virt-sysprep should probably remove that. For reference, see https://bugzilla.redhat.com/show_bug.cgi?id=1414332.
Posted: https://www.redhat.com/archives/libguestfs/2017-February/msg00299.html
Upstream in libguestfs 1.37.1: https://github.com/libguestfs/libguestfs/commit/0f99537cb69c88f7ceb6c69a9d9ae10baaaa3623 Yup, it missed 1.36 by a whisker.
Reopening so we can track inclusion of the fix in RHEL 7.4.
xchen - can you QA ack this one please?
Verified with package: libguestfs-1.36.2-3.el7.x86_64 Steps: 1. Prepare an RHEL7 guest image, create a back file for it: # qemu-img create -f qcow2 -o backing_file=RHEL-Server-7.3-64-hvm.raw,backing_fmt=raw tmp.qcow2 2. Add HOSTNAME & DHCP_HOSTNAME to the ifcfg file as following: # virt-edit -a tmp.qcow2 /etc/sysconfig/network-scripts/ifcfg-eth0 ... ... HOSTNAME=my_hostname DHCP_HOSTNAME=my_dhcp_hostname 3. # virt-sysprep --operations net-hostname -a tmp.qcow2 [ 0.0] Examining the guest ... [ 3.0] Performing "net-hostname" ... # virt-cat -a tmp.qcow2 /etc/sysconfig/network-scripts/ifcfg-eth0 # Generated by parse-kickstart DEVICE="eth0" IPV6INIT="yes" BOOTPROTO="dhcp" UUID="5b751b21-2987-4284-b260-8fbeee6f23a1" ONBOOT="yes" # Generated by parse-kickstart BOOTPROTO=dhcp DEVICE=eth0 ONBOOT=yes The HOSTNAME & DHCP_HOSTNAME lines have been deleted. So verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:2023