Wednesday, October 7, 2009

Basic virt-install command for installing Paravirtual DomU with KS file

Basic virt-install command for installing Paravirtual DomU with KS file

#This is basic virt-install command for installing Paravirtual DomU with KS file, this command is very picky so just c/p don't mess around

virt-install --paravirt --name vFC6-3 --ram 512 --file /var/lib/xen/images/vFC6-3.img --file-size 10 --nographics --location ftp://192.168.1.13/xen --extra-args="console=xvc0
ip=192.168.1.215 netmask=255.255.255.128 gateway=192.168.1.129
dns=192.165.149.1 ks=http://192.168.1.13/catt_fc6.ks.cfg"

Basic Paravirtual Virtual DomU XML Configuration

Basic ParaVirtual DomU XML Configuration

#This is a basic Paravirtual DomU XML
<domain type='xen'>
<name>vA2E-0</name>
<uuid>a6469aa9-c50c-339a-f68d-3888cbc54ebc</uuid>
<memory>4188160</memory>
<currentMemory>4188160</currentMemory>
<vcpu>2</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/var/lib/xen/images/vA2E-0.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:36:4b:07:d3'/>
<source bridge='xenbr0'/>
<script path='vif-bridge'/>
</interface>
<console type='pty'>
<target port='0'/>
</console>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
</devices>
</domain>

Basic Full Virtual DomU XML Configuration

This is a Full Virtual DomU XML Configuration file


#This is a Full Virtual DomU XML

<domain type='xen'>

<name>vA2E-0</name>

<uuid>971402c5-6275-0005-c2a2-fb9142f7adf9</uuid>

<memory>4188160</memory>

<currentMemory>4188160</currentMemory>

<vcpu>2</vcpu>

<os>

<type arch='x86_64' machine='xenfv'>hvm</type>

<loader>/usr/lib/xen/boot/hvmloader</loader>

<boot dev='hd'/>

</os>

<features>

<acpi/>

<apic/>

<pae/>

</features>

<clock offset='utc'/>

<on_poweroff>destroy</on_poweroff>

<on_reboot>restart</on_reboot>

<on_crash>restart</on_crash>

<devices>

<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>

<disk type='file' device='disk'>

<driver name='file'/>

<source file='/var/lib/xen/images/vA2E-0.img'/>

<target dev='hda' bus='ide'/>

</disk>

<disk type='block' device='cdrom'>

<driver name='phy'/>

<target dev='hdc' bus='ide'/>

<readonly/>

</disk>

<interface type='bridge'>

<mac address='00:16:36:0c:7a:c2'/>

<source bridge='xenbr0'/>

<script path='vif-bridge'/>

</interface>

<serial type='pty'>

<target port='0'/>

</serial>

<console type='pty'>

<target port='0'/>

</console>

<input type='mouse' bus='ps2'/>

<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>

</devices>

</domain>

Basic virt-p2v Configuration

After a successful P2V conversion with virt-p2v Live CD, you might need to re-define your new Virtual Machine, to do that, copy one of the XML config file below and define your img with "virsh define config.cfg"


#virt-p2v quiet usefull program but its cfg file needs to be fixed

#This is for Physical to Full Virtualization

<domain type='xen' id='5'>

<name>Deneme1</name>

<uuid>78f732b0-320a-b9bd-749d-053b37968512</uuid>

<memory>1048576</memory>

<currentMemory>1048576</currentMemory>

<vcpu>1</vcpu>

<os>

<type>hvm</type>

<loader>/usr/lib/xen/boot/hvmloader</loader>

<boot dev='hd'/>

</os>

<features>

<acpi/>

<apic/>

<pae/>

</features>

<clock offset='utc'/>

<on_poweroff>destroy</on_poweroff>

<on_reboot>restart</on_reboot>

<on_crash>restart</on_crash>

<devices>

<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>

<disk type='file' device='disk'>

<driver name='file'/>

<source file='/var/lib/xen/images/p2v-localhost_localdomain-200909291050-hda.img'/>

<target dev='hda' bus='ide'/>

</disk>

<disk type='file' device='cdrom'>

<target dev='hdc' bus='ide'/>

<readonly/>

</disk>

<interface type='bridge'>

<mac address='00:16:3e:80:bd:48'/>

<source bridge='xenbr0'/>

<script path='vif-bridge'/>

<target dev='vif5.0'/>

</interface>

<serial type='pty'>

<source path='/dev/pts/1'/>

<target port='0'/>

</serial>

<console type='pty' tty='/dev/pts/3'>

<source path='/dev/pts/3'/>

<target port='0'/>

</console>

<input type='mouse' bus='ps2'/>

<graphics type='vnc' port='5905' autoport='yes' keymap='en-us'/>

</devices>

</domain>

#This is for Physical to ParaVirtualization, Physical server should be set as Xen Kernel-ed before convertion

<domain type='xen'>

<name>vA2E-0</name>

<uuid>99f969f4-1023-e1ee-8d0f-0b016fd2b166</uuid>

<memory>4194304</memory>

<currentMemory>4194304</currentMemory>

<vcpu>2</vcpu>

<bootloader>/usr/bin/pygrub</bootloader>

<os>

<type arch='x86_64' machine='xenpv'>linux</type>

<kernel>/var/lib/xen/boot_kernel.CpFtTy</kernel>

<initrd>/var/lib/xen/boot_ramdisk.QOTH_r</initrd>

<cmdline>ro root=/dev/VolGroup00/LogVol00 console=xvc0 rhgb quiet</cmdline>

</os>

<clock offset='utc'/>

<on_poweroff>destroy</on_poweroff>

<on_reboot>restart</on_reboot>

<on_crash>restart</on_crash>

<devices>

<disk type='file' device='disk'>

<driver name='tap' type='aio'/>

<source file='/var/lib/xen/images/vA2E-0.img'/>

<target dev='xvda' bus='xen'/>

</disk>

<interface type='bridge'>

<mac address='00:16:36:4b:d5:d0'/>

<source bridge='xenbr0'/>

<script path='vif-bridge'/>

<target dev='vif49.0'/>

</interface>

<serial type='pty'>

<source path='/dev/pts/1'/>

<target port='0'/>

</serial>

<console type='pty'>

<target port='0'/>

</console>

<input type='mouse' bus='ps2'/>

<graphics type='vnc' port='5905' autoport='yes' keymap='en-us'/>

</devices>

</domain>


I hope you find it useful

Typhoon Master

Xen on RHEL 5.4

XEN on RHEL

When i was messing with Virtualization with Xen Kernel on RHEL 5.4, i took some notes myself, i'd like to share with you maybe it will be useful for you as well. I've googled thousands of webpages to get answers for my questions and i bind them all in couple of scripts.

Here you go,

#Installing Xen kernel in a non-Xen-awared OS, OS can be operated as Hypervisor/Dom0 after this step
yum install xen kernel-xen
#Install recommended virtualization packages (you need a GUI for VMM, so if you have one, please install with yum groupinstall "X Window System" "GNOME Desktop Environment")
yum install virt-manager libvirt libvirt-python python-virtinst
#You need to edit grub.conf for making Xen Kernel the default kernel
vim /etc/grub.conf
#Reboot with new Xen Kernel
reboot
#Ok we need Vnc access so, edit xstartup file and add "gnome-session &"
vim /root/.vnc/xstartup


#Other "need to know" stuff here
#Your local FTP directory should be like D:\ftp\xen\xen\images, ISO should be exracted in D:\ftp\xen\xen\ directory, you need to set all permissions in you FTP Server
#You need to point your FTP Server as ftp://192.168.1.13/xen
#VMM is a good GUI program but what if you don't want to use GUI, so virt-install and virsh will be the best option for you
#Some basic command examples,
#virt-install --prompt |for basic installation, if VMM stuck and doesn't install your OS, try this one
#virt-install \
--paravirt \
--name demo \
--ram 500 \
--file /var/lib/xen/images/demo.img \
--file-size 6 \
--nographics \
--location ftp://192.168.1.13/xen
#This is basic virt-install command for installing Paravirtual DomU with KS file
virt-install \
--paravirt \
--name demo \
--ram 512 \
--file /var/lib/xen/images/demo.img \
--file-size 6 \
--nographics \
--location ftp://192.168.1.13/xen \
--extra-args="console=xvc0 ip=192.168.1.215 netmask=255.255.255.128 gateway=192.168.1.129 dns=192.165.149.1 ks=ftp://192.168.1.13/catt_fc6.ks.cfg"
#virsh list
#virsh console DomU
#virsh autostart DomU
#virsh define DomUXML.cfg
#Basic Full Virtual DomU XML
<domain type='xen'>
<name>vA2E-0</name>
<uuid>971402c5-6275-0005-c2a2-fb9142f7adf9</uuid>
<memory>4188160</memory>
<currentMemory>4188160</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='xenfv'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<driver name='file'/>
<source file='/var/lib/xen/images/vA2E-0.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='phy'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='00:16:36:0c:7a:c2'/>
<source bridge='xenbr0'/>
<script path='vif-bridge'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
</devices>
</domain>
#Basic Paravirtual DomU XML
<domain type='xen'>
<name>vA2E-0</name>
<uuid>a6469aa9-c50c-339a-f68d-3888cbc54ebc</uuid>
<memory>4188160</memory>
<currentMemory>4188160</currentMemory>
<vcpu>2</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/var/lib/xen/images/vA2E-0.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:36:4b:07:d3'/>
<source bridge='xenbr0'/>
<script path='vif-bridge'/>
</interface>
<console type='pty'>
<target port='0'/>
</console>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
</devices>
</domain>


I hope you find it usefull

Typhoon