This is an old revision of the document!
Ok, virtualization again. Trying this approach on a Dell PowerEdge 2950.
Starting with the latter.
When you get the SElinux policy, create the *.te file then
[root@petaltail ~]# vi lxc.te [root@petaltail ~]# semodule -l | grep lxc [root@petaltail ~]# checkmodule -M -m -o lxc.mod lxc.te checkmodule: loading policy configuration from lxc.te checkmodule: policy configuration loaded checkmodule: writing binary representation (version 10) to lxc.mod [root@petaltail ~]# semodule_package -o lxc.pp -m lxc.mod [root@petaltail ~]# semodule -i lxc.pp [root@petaltail ~]# semodule -l | grep ^lx lxc 1.0
Ah, I'm simply going to CentOS7 because LXC is fully integrated
Ah, no. Took a look at v7 and it's very different with the over engineering part of system control. Will learn later, back to v6.5. I also want to preserve the ability to run different OS flavors which is not possible under LXC containers.
virt-manager
worked we followed this doc a bit setting up bridges etcFirst I build my v1 clone the way I wanted it from ISO and then customized it manually. Added second bridge (br1, public) later via virt-manager GUI (view the details of vm and then select Add Hardware). Power this clone up, add to a test queue, and sbumit some jobs to make it all works. Then clone.
virt-install --connect=qemu:///system -n v1 -r 1024 --vcpus=1 \ --disk path=/var/lib/libvirt/images/v1.img,size=8 \ -c /var/lib/libvirt/images/CentOS-6.5-x86_64-bin-DVD1.iso \ --vnc --noautoconsole --os-type linux --os-variant rhel6 --accelerate \ --network=bridge:br0 --hvm
Here are the steps for cloning vm v1 to v5. You'll need guestfish' part of the libguestfs programs
* yum install libguestfs-tools-c
Next we'll create the v5.img block device, dump the v1 config into v5.xml and then edit that file. UUID and Mac Address we'll edit and the last 2 characters to '05'. Name becomes v5 from v1 and we'll similarly adjust the block device location-filename. Then we define this v5 vm.
Launch
guesfish' and make the same edits to Mac Address in files listed below. The boot the vm.
# cd /var/lib/libvirt/images # dd if=v1.img of=v5.img bs=1M # virsh dumpxml v1 > /tmp/v5.xml # vi /tmp/v5.xml (change name, uuid, file location, mac address(es)) # virsh define /tmp/v5.xml Domain v5 defined from /tmp/v5.xml # guestfish -i -d v5 Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Operating system: CentOS release 6.5 (Final) /dev/vg_v1/lv_root mounted on / /dev/sda1 mounted on /boot ><fs> edit /etc/sysconfig/network (change hostname) ><fs> edit /etc/sysconfig/network-scripts/ifcfg-eth0 ><fs> edit /etc/sysconfig/network-scripts/ifcfg-eth1 (for nics comment out any UUID lines, change hardmare address, change IP) ><fs> edit /etc/udev/rules.d/70-persistent-net.rules (change hardware address) ><fs> exit # virsh start v5 Domain v5 started
<code>
2 4 6 8 10 12 14 16 556 560 588 625 760 936 1122 1300 (linear) 781 938 1094 1250 (n35:load 32) 726
<code>