Bug 1427529 - virt-sysprep should remove DHCP_HOSTNAME
Summary: virt-sysprep should remove DHCP_HOSTNAME
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-28 14:07 UTC by Marko Myllynen
Modified: 2017-08-01 22:11 UTC (History)
3 users (show)

Fixed In Version: libguestfs-1.36.2-2.el7
Doc Type: Enhancement
Doc Text:
Feature: remove also DHCP_HOSTNAME keys from /etc/sysconfig/network-scripts/ifcfg-* files Reason: DHCP_HOSTNAME in those files may contain another reference to the hostname of the guest, and thus needs to be removed when cleaning up a guest with virt-sysprep Result: the net-hostname operation of virt-sysprep removes also the DHCP_HOSTNAME keys in /etc/sysconfig/network-scripts/ifcfg-* files, in addition to the HOSTNAME keys
Clone Of:
Environment:
Last Closed: 2017-08-01 22:11:26 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2023 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2017-08-01 19:32:01 UTC

Description Marko Myllynen 2017-02-28 14:07:15 UTC
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.

Comment 2 Richard W.M. Jones 2017-02-28 15:49:21 UTC
Posted:
https://www.redhat.com/archives/libguestfs/2017-February/msg00299.html

Comment 3 Richard W.M. Jones 2017-02-28 22:14:55 UTC
Upstream in libguestfs 1.37.1:
https://github.com/libguestfs/libguestfs/commit/0f99537cb69c88f7ceb6c69a9d9ae10baaaa3623

Yup, it missed 1.36 by a whisker.

Comment 4 Richard W.M. Jones 2017-03-08 14:35:44 UTC
Reopening so we can track inclusion of the fix in RHEL 7.4.

Comment 5 Richard W.M. Jones 2017-03-08 14:37:45 UTC
xchen - can you QA ack this one please?

Comment 7 Xianghua Chen 2017-03-24 06:43:16 UTC
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.

Comment 8 errata-xmlrpc 2017-08-01 22:11:26 UTC
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


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