infra-docs-fpo/modules/sysadmin_guide/pages/infra-hostrename.adoc
Michal Konečný 8d66f2e477 Review infra-hostrename SOP
Signed-off-by: Michal Konečný <mkonecny@redhat.com>
2021-09-02 15:06:41 +02:00

113 lines
2.7 KiB
Text

= Infrastructure Host Rename SOP
This page is intended to guide you through the process of renaming a
virtual node.
== Contents
* <<_introduction>>
* <<_finding_out_where_the_host_is>>
* <<_preparation>>
* <<_renaming_the_logical_volume>>
* <<_doing_the_actual_rename>>
* <<_vpn_stuff>>
== Introduction
Throughout this SOP, we will refer to the old hostname as $oldhostname
and the new hostname as $newhostname. We will refer to the Dom0 host
that the vm resides on as `$vmhost`.
If this process is being followed so that a temporary-named host can
replace a production host, please be sure to follow the
xref:infra-retiremachine.adoc[Infrastructure retire machine SOP] to properly
decommission the old host before continuing.
== Finding out where the host is
In order to rename the host, you must have access to the _Dom0_ (host) on
which the virtual server resides. To find out which host that is, log in
to _batcave01_, and run:
....
grep $oldhostname /var/log/virthost-lists.out
....
The first column of the output will be the Dom0 of the virtual node.
== Preparation
SSH to `$oldhostname`. If the new name is replacing a production box,
change the IP Address that it binds to, in
`/etc/sysconfig/network-scripts/ifcfg-eth0`.
Also change the hostname in `/etc/sysconfig/network`.
At this point, you can `sudo poweroff` `$oldhostname`.
Open an ssh session to `$vmhost`, and make sure that the node is listed as
`shut off`. If it is not, you can force it off with:
....
virsh destroy $oldhostname
....
== Renaming the Logical Volume
Find out the name of the logical volume (on `$vmhost`):
....
virsh dumpxml $oldhostname | grep 'source dev'
....
This will give you a line that looks like
`<source dev='/dev/VolGroup00/$oldhostname'/>` which tells you that
`/dev/VolGroup00/$oldhostname` is the path to the logical volume.
Run `/usr/sbin/lvrename` (the path that you found above) (the path that
you found above, with `$newhostname` at the end instead of `$oldhostname`)`
For example::
`/usr/sbin/lvrename /dev/VolGroup00/noc03-tmp /dev/VolGroup00/noc01`
== Doing the actual rename
Now that the logical volume has been renamed, we can rename the host in
libvirt.
Dump the configuration of `$oldhostname` into an xml file, by running:
....
virsh dumpxml $oldhostname > $newhostname.xml
....
Open up `$newhostname.xml`, and change all instances of `$oldhostname` to
`$newhostname`.
Save the file and run:
....
virsh define $newhostname.xml
....
If there are no errors above, you can undefine `$oldhostname`:
....
virsh undefine $oldhostname
....
Power on $newhostname, with:
....
virsh start $newhostname
....
And remember to set it to autostart:
....
virsh autostart $newhostname
....
== VPN Stuff
TODO