[CentOS] KVM Setup for Win7 Pro on CentOS 5.x

Thu Aug 16 18:10:38 UTC 2012
Theo Band <theo.band at greenpeak.com>

On 08/16/2012 06:36 PM, Bill Campbell wrote:
> I need to:
>     + Create the VM instance allowing for about 50GB total disk space which
>       will be either a single image partitioned into two Windows 'Drives'
>       for the OS and applications/data, or two images.
>> The default location for the hard disk image file is under /var/lib
>> path.    This can be changed to point to a different location if you
>> are planning many such large installation.   An alternate method could
>> be to define a file or a LVM and then tell virt-manager the location
>> of this file/LVM volume.
> Thanks for that info.  It looks like everything is under
> /var/lib/libvrt.
>
> I assume that I can replace /var/lib/libvirt/images with a
> symlink to another file system with adequate space.
>
> Would it be safe to symlink the entire /var/lib/libvrt directory
> to another file system?  I just tried 'lsof /var/lib/libvirt' on
> the system with no VMs and the libvrtd service running, and it
> doesn't show anything using it at idle.
Yes, as long as SeLinux is not enforced.
But why not simply mount a dedicated partition here? The actual path is 
stored in de VM definition. So existing machines need to be changed 
(virsh edit <VM>). I think the default path is only used as e default 
location. I have moved the images of several machines to a NFS path to 
make live migration work.
Do remember that /var/lib/libvirt/qemu/save is used to save system state 
when rebooting. Still needs several GB of space for that.
>     + Set up network bridging on the private LAN so that the Windows system
>       is accessible via OpenVPN connections from the outside world and by
>       users on the LAN to run a client/server accounting application.
>> I have done KVM VLANs but I am not sure if it can be done from the
>> virt-manager.   Experiment and see how far you can go.
> I will be digging into this later today.  So far I've found the
> file /var/lib/libvirt/network/default.xml and see a vibr0
> interface defined.
>
> The documentation I found yesterday described setting up briding,
> but hopefully virt-manager has a nicer way to do it.
This I find the most difficult part. I have done it a couple of time and 
made myself a HOWTO. You need to fill in some IP figures of course. I 
assume a fixed IP address, but DHCP should work as well. The setup 
creates a bridge and adds and existing interface (ifcfg-ethx) to that 
bridge. After that you can use the bridge for the VMs:

KVM
===
yum install kvm virt-manager qemu bridge-utils
#create bridge for virt-machine
cat > /etc/sysconfig/network-scripts/ifcfg-br0 << _END_
DEVICE=br0
TYPE=Bridge
IPADDR=192.168.48.X
NETMASK=255.255.255.0
GATEWAY=192.168.48.1
BOOTPROTO=none
ONBOOT=yes
DELAY=0
NOZEROCONF=true
NM_CONTROLLED=no
_END_

Edit /etc/sysconfig/network-scripts/ifcfg-ethx :
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no

service network restart