Firstly, cloning a VM on KVM can be done using virt-manager or with virt-clone (or even manually, see http://rwmj.wordpress.com/2010/09/24/tip-my-procedure-for-cloning-a-fedora-vm). Choosing the virt-manager method, however, for a SL 63.1 VM that also acts as an ISCSI client, I got the following error message:
Error setting clone parameters: Could not use path '/dev/disk/by-path/ip-192.168.100.2:3260-iscsi-iqn.2012-09.com.skyrac:t1-lun-15-clone' for cloning: iSCSI volume creation is not supported.
Fortunately, the error can be circumvented by temporarily stopping the iSCSI pool. Virt-manager complains about the respective disks not existing, but will perform the clone correctly.
This just as an aside – regarding our topic of network interfaces, by default, virt-manager will automatically choose new MAC addresses for the interfaces.
Now after cloning, restart the iSCSI pool and boot the VM in runlevel 1. Prior to any changes,
ip link show
will show a list of interfaces
eth<n+2> etc., where
eth<n> is the highest number interface name from the clone source.
Checking for udev rules, it turns out
still has the clone source’s MAC addresses (which don’t exist on clone target), but there is a file
that creates the aforementioned
<n+1> etc. interfaces.
Now it is sufficient to simply edit the
/etc/udev/rules.d/70-persistent-net.rules, entering the new MAC addresses, and remove the
/dev/.udev/tmp-rules--70-persistent-net.rules temporary file. On reboot, interfaces will have the expected
eth0 - eth<n> interface names.
Of course, on Scientific Linux or other Red Hat like systems, it is also neccessary to edit the
/etc/sysconfig/network-scripts/ifcfg-eth<n> configuration files for hardware and IP addresses, and
/etc/sysconfig/network for the hostname. And that’s it!