lost and found ( for me ? )

deploy puppet lab VM within KVM

Referred to http://puppetlabs.com/.

Here are trial and errors when deploying Puppet Lab VM within KVM.

# tail -1 /etc/lsb-release ;uname -ri
DISTRIB_DESCRIPTION="Ubuntu 13.04"
3.8.0-33-generic x86_64

# qemu-system-x86_64 --version
QEMU emulator version 1.4.0 (Debian 1.4.0+dfsg-1expubuntu4), Copyright (c) 2003-2008 Fabrice Bellard

[ deploy Puppet VM within KVM including trial and errors ]

I download learn_puppet_centos-6.4-pe-3.1.0-ovf-20131031.zip from Puppet Lab site.

unzip the file.
# unzip learn_puppet_centos-6.4-pe-3.1.0-ovf-20131031.zip
Archive:  learn_puppet_centos-6.4-pe-3.1.0-ovf-20131031.zip
 inflating: learn_puppet_centos-6.4-pe-3.1.0-disk1.vmdk
 inflating: learn_puppet_centos-6.4-pe-3.1.0.ovf

# file *.vmdk
learn_puppet_centos-6.4-pe-3.1.0-disk1.vmdk: VMware4 disk image

# file *.ovf
learn_puppet_centos-6.4-pe-3.1.0.ovf: XML document text

ovf is xml format file.
# less learn_puppet_centos-6.4-pe-3.1.0.ovf | head -10
<?xml version="1.0"?>
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
 <References>
   <File ovf:href="learn_puppet_centos-6.4-pe-3.1.0-disk1.vmdk" ovf:id="file1"/>


Supported image formats which KVM can load are..
# qemu-img -h | tail -1
Supported formats: vvfat vpc vmdk vdi sheepdog rbd raw host_cdrom host_floppy host_device file qed qcow2 qcow parallels nbd nbd nbd dmg tftp ftps ftp https http cow cloop bochs blkverify blkdebug

Can I convert ovf to virt-image?
try..
error..
# virt-convert -i ovf -o virt-image learn_puppet_centos-6.4-pe-3.1.0.ovf
ERROR    Couldn't import file "learn_puppet_centos-6.4-pe-3.1.0.ovf": Unknown storage path type /disk/vmdisk1.

Let’s try ovftool, because I have never used that..
download ovftool from VMware site which is free.

download ovftool.
# file VMware-ovftool-3.5.0-1274719-lin.x86_64.txt
VMware-ovftool-3.5.0-1274719-lin.x86_64.txt: data

md5sum VMware-ovftool-3.5.0-1274719-lin.x86_64.txt
5f38d0025f79dac8fc55554c5b620477  VMware-ovftool-3.5.0-1274719-lin.x86_64.txt

install ovftool
# chmod u+x VMware-ovftool-3.5.0-1274719-lin.x86_64.txt
# ./VMware-ovftool-3.5.0-1274719-lin.x86_64.txt
Extracting VMware Installer...done.
You must accept the VMware OVF Tool component for Linux End User
Installing VMware OVF Tool component for Linux 3.5.0
   Configuring...
[######################################################################] 100%
Installation was successful.

# which ovftool
/usr/bin/ovftool

# ovftool --version
VMware ovftool 3.5.0 (build-1274719)

try… error.
# mkdir VMX_files
root@ubuntu-2:Puppet_works# ovftool learn_puppet_centos-6.4-pe-3.1.0.ovf VMX_files/puppet.vmx
Opening OVF source: learn_puppet_centos-6.4-pe-3.1.0.ovf
Opening VMX target: VMX_files/puppet.vmx
Error: OVF Package is not supported by target:
- Line 25: Unsupported hardware family 'virtualbox-2.2'.
Warning:
- No manifest file found.
- Wrong file size specified in OVF descriptor for 'learn_puppet_centos-6.4-pe-3.1.0-disk1.vmdk' (specified: -1, actual 1666058240).
Completed with errors

give up..
I decided to convert vmdk to qcow2 with qemu-img command.
# qemu-img convert learn_puppet_cento*.vmdk puppet.qcow2

get things done.very easy.
# file puppet.qcow2
puppet.qcow2: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x10402, GRUB version 0.94; partition 1: ID=0x83, active, starthead 32, startsector 2048, 204800 sectors; partition 2: ID=0x8e, starthead 223, startsector 206848, 16570368 sectors, code offset 0x48
deploy this qcow2 from virt-manager.

By the way, OS is CentOS6.4… but,,, 32bit? or 64bit?
mount this image with guestfish to check that.
# apt-get install guestfish –y

error..
# guestfish --format=qcow2 --ro -a puppet.qcow2 -i cat /etc/centos-release
libguestfs: error: cannot find any suitable libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH (search path: /usr/lib/guestfs)

Googling this error, the solution is.. (http://libguestfs.org/guestfs-faq.1.html )
# apt-get install libguestfs-tools
# update-guestfs-appliance

try again.
it seems that this VM is CentOS 32bit ver.
# guestfish

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
     'man' to read the manual
     'quit' to quit the shell

><fs> add-ro puppet.qcow2
><fs> run
W: kvm binary is deprecated, please use qemu-system-x86_64 instead
><fs> list-filesystems
/dev/vda1: ext2
/dev/vg00/rootvol: ext3
/dev/vg00/swapvol: swap
><fs> mount /dev/vda1 /
><fs> cat /grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg00-rootvol
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-358.el6.i686)
       root (hd0,0)
       kernel /vmlinuz-2.6.32-358.el6.i686 ro root=/dev/mapper/vg00-rootvol rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg00/rootvol rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg00/swapvol  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
       initrd /initramfs-2.6.32-358.el6.i686.img

><fs> exit
#

register the qcow2 with virt-manager.
vCPU*1
Memory 1GB
vNIC*1
virsh # dumpxml puppet-vm1
<domain type='kvm' id='8'>
 <name>puppet-vm1</name>
 <uuid> </uuid>
 <memory unit='KiB'>1048576</memory>
 <currentMemory unit='KiB'>1048576</currentMemory>
 <vcpu placement='static'>1</vcpu>
 <os>
   <type arch='i686' machine='pc-i440fx-1.4'>hvm</type>
   <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/bin/kvm-spice</emulator>
   <disk type='file' device='disk'>
     <driver name='qemu' type='raw'/>
     <source file='/var/lib/KVM_images/puppet.qcow2'/>
     <target dev='vda' bus='virtio'/>
     <alias name='virtio-disk0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
   </disk>
   <controller type='usb' index='0'>
     <alias name='usb0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
   </controller>
   <interface type='network'>
     <mac address=''/>
     <source network='default'/>
     <target dev='vnet0'/>
     <model type='virtio'/>
     <alias name='net0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
   </interface>
   <serial type='pty'>
     <source path='/dev/pts/10'/>
     <target port='0'/>
     <alias name='serial0'/>
   </serial>
   <console type='pty' tty='/dev/pts/10'>
     <source path='/dev/pts/10'/>
     <target type='serial' port='0'/>
     <alias name='serial0'/>
   </console>
   <input type='tablet' bus='usb'>
     <alias name='input0'/>
   </input>
   <input type='mouse' bus='ps2'/>
   <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
     <listen type='address' address='127.0.0.1'/>
   </graphics>
   <sound model='ich6'>
     <alias name='sound0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
   </sound>
   <video>
     <model type='cirrus' vram='9216' heads='1'/>
     <alias name='video0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
   </video>
   <memballoon model='virtio'>
     <alias name='balloon0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
   </memballoon>
 </devices>
 <seclabel type='none'/>
</domain>






Okay, I was able to deploy the VM and boot that within KVM.
user: root
pass: puppet

access to https:// Puppet IP
user: puppet@example.com
pass: learningpuppet



There are no puppet nodes to mange. so I need to prepare puppet agents


I am not familiar with Puppet.. I need to study to move forward this.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.