From Fedora Project Wiki

No edit summary
(redirect page to new infra-docs)
Line 1: Line 1:
{{header|infra}}
{{header|infra}}


This page is intended to guide you through the process of renaming a virtual node.


== Introduction ==
This SOP has moved to the fedora Infrastructure SOP git repo. Please see the current document at: http://infrastructure.fedoraproject.org/infra/docs/infra-hostrename.txt


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.
For changes, questions or comments, please contact anyone in the Fedora Infrastructure team.  
 
If this process is being followed so that a temporary-named host can replace a production host, please be sure to follow the [[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 puppet01, and run:
 
<pre>grep $oldhostname /var/log/virthost-lists.out</pre>
 
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`.
 
We can also remove old puppet SSL certs, because they will need to be re-generated. On $oldhostname:
 
<pre>find /var/lib/puppet/ssl -type f -print | xargs rm -v</pre>
 
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:
 
<pre>virsh destroy $oldhostname</pre>
 
== Renaming the Logical Volume ==
 
Find out the name of the logical volume (on $vmhost):
 
<pre>virsh dumpxml $oldhostname | grep 'source dev'</pre>
 
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:
 
<pre>virsh dumpxml $oldhostname > $newhostname.xml</pre>
 
Open up $newhostname.xml, and change all instances of $oldhostname to $newhostname.
 
Save the file and run:
 
<pre>virsh define $newhostname.xml</pre>
 
If there are no errors above, you can undefine $oldhostname:
 
<pre>virsh undefine $oldhostname</pre>
 
Power on $newhostname, with:
 
<pre>virsh start $newhostname</pre>
 
And remember to set it to autostart:
 
<pre>virsh autostart $newhostname</pre>
 
== Telling Puppet about the new host ==
 
We cleared out the old puppet certifications on $oldhostname before we shut it down, but we need generate new certifications on it, and tell puppetmaster about them.
 
First off, rename any node files in puppet/manifests/nodes/$oldhostname*, and change the `node $oldhostname {` to `node $newhostname {` in this file.
 
Then, on puppet01:
 
<pre>/usr/sbin/puppetca --revoke --clean $oldhostname</pre>
 
On $newhostname:
 
<pre>/usr/sbin/puppetd -t</pre>
 
On puppet01:
 
<pre>
/usr/sbin/puppetca --list # to get the full hostname
/usr/sbin/puppetca --sign # the hostname found on the previous command.
</pre>
 
Re-run puppet on $newhostname, and fix errors as they arise.
 
<pre>/usr/sbin/puppetd -t</pre>
 
== VPN Stuff ==
 
TODO




[[Category:Infrastructure SOPs]]
[[Category:Infrastructure SOPs]]

Revision as of 18:20, 19 December 2011


This SOP has moved to the fedora Infrastructure SOP git repo. Please see the current document at: http://infrastructure.fedoraproject.org/infra/docs/infra-hostrename.txt

For changes, questions or comments, please contact anyone in the Fedora Infrastructure team.