Pages

Monday, September 1, 2014

Creating Custom Windows Images for Openstack

Setting up the KVM environment to create the custom images.

yum install kvm qemu-kvm python-virtinst libvirt libvirt-python virt-manager libguestfs-tools

Once the packages are installed we need to get the ISO’s.

For example are getting windows7 from the http://www.w7forums.com/threads/official-windows-7-sp1-iso-image-downloads.12325/
wget http://msft.digitalrivercontent.net/win/X17-24395.iso

Now we need the Virtio Driver’s so that windows can detect unsigned devices like linux from http://alt.fedoraproject.org/pub/alt/virtio-win/latest/

wget http://alt.fedoraproject.org/pub/alt/virtio-win/latest/virtio-win-0.1-81.iso

First Create the Disk on which the OS need to be installed

qemu-img create -f qcow2 -o preallocation=metadata windows.qcow2 20G

Start the KVM installation
/usr/libexec/qemu-kvm -m 2048 -smp 2 -cdrom X17-24395.iso -drive file=virtio-win-0.1-81.iso,index=3,media=cdrom -drive file= windows.qcow2,if=virtio,boot=off -boot d -vga std -k en-us -vnc 10.1.17.42:1 -usbdevice tablet

Connect to Installation

Once the above step is done you will be able to connect to VNC using 10.1.17.42:1
You will be connected to VNC and you will be at the installations screen. Click Next to continue

Windows-install00

Select Install option to continue with installation.

Windows-install01

While secting the Installation driver we need to load the driver, Select the load driveroption and load the driver from the Virto ISO we have mounted

Windows-install02

Continue with the installation

Windows-install04

Once you are done download the Cloud init for windows from

https://github.com/cloudbase/cloudbase-init
Once installation is completed load the computer with virto NIC with following Command

/usr/libexec/qemu-kvm -m 2048 -smp 2 -drive file=virtio-win-0.1-81.iso,index=3,media=cdrom -drive file=windows-7.qcow2,if=virtio -boot d -vga std -k en-us -vnc 10.1.17.42:1 -usbdevice tablet -net nic,model=virtio
Connect to VNC and add the Virto NIC Driver From Device manager

Windows-install06

Now install the Cloud-init and initialize the Image

Windows-install10

Enable RDP for the access.

Now the Image is ready for Use .

You can get the windows password by

nova get-password <instance ID> <ssh-key>

 

 

Nova Rule

nova secgroup-add-rule default tcp 3389 3389 0.0.0.0/0

Thursday, August 28, 2014

Windows 8 and fedora 20 Dual boot in HP

Recently I have moved to fedora 20 and window 8 which showed that HP laptops have a special bios which only allows windows EFI to be loaded as default so even after installing both the OS and making the EFI partition of fedora default the system boots from Windows EFI directory. To get the grub to boot first I did the following steps.

My disk partition are as below. Device           Start          End   Size Type
/dev/sda1         2048       616447   300M Windows recovery environment
/dev/sda2       616448       821247   100M EFI System
/dev/sda3       821248      1083391   128M Microsoft reserved
/dev/sda4      1083392    122882047  58.1G Microsoft basic data
/dev/sda5    122882048    123291647   200M EFI System
/dev/sda6    123291648    124315647   500M Microsoft basic data
/dev/sda7    124315648    548470783 202.3G Linux LVM
/dev/sda8    548470784    976771071 204.2G Microsoft basic data

Here I have two EFI partition /dev/sda2 (Windows) and /dev/sda5 (Fedora). As the setting is embedded in HP bios we needed a work around.

So I mounted the partititons first .

mount /dev/sda5 fedora/
mount /dev/sda2 win/

Now we copy the Fedora EFI content to Windows partions as follows

cp -rp fedora/EFI/fedora win/EFI/

In the windows partion you can find a default HP EFI content . Just rename it to some thing else.

Now rename the windows boot loader

mv win/EFI/Microsoft/Boot/bootmgfw.efi  win/EFI/Microsoft/Boot/bootmgfwB.efi

Now copy the grubloader into the place of windows bootloader

cp win/EFI/fedora/grubx64.efi win/EFI/Microsoft/Boot/bootmgfw.efi

Now recreate the grub.cfg and place it in win/EFI/fedora

grub2-mkconfig -o win/EFI/fedora/grub.cfg

It should be done by now reboot the machine and check it .

 

 

kvm + Vnc + Mouse pointer sync issue

While we use the Vnc we could see that the mouse pointer in the Vnc Viewer is not sync with  the system Vnc.

This can be solved by adding the option -usbdevice tablet  along the kvm command

Example

$KVM -m 2048 -smp 2 -cdrom $ISO -drive file=$VIRTIO_ISO,index=3,media=cdrom  -drive file=$IMAGE,if=virtio,boot=off -boot d -vga std -k en-us -vnc 10.1.17.42:1 -usbdevice tablet