Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

  1. Wiki Markup
    {toggle-cloak:id=VM Definition XML}

    Create the VM XML (click to show):

    Wiki Markup
    {toggle-cloak:id=VM Definition XML}

    Wiki Markup
    {cloak:id=VM Definition XML}
    Code Block
     
     cat  > devcloud-kvm.xml << EOL
     <domain type='kvm'>
       <name>devcloud-kvm</name>
       <memory>8388608</memory>
       <currentMemory>8388608</currentMemory>
       <vcpu>4</vcpu>
       <os>
         <type arch='x86_64' machine='pc-1.0'>hvm</type>
         <boot dev='hd'/>
         <bootmenu enable='yes'/>
       </os>
       <features>
         <acpi/>
         <apic/>
         <pae/>
       </features>
       <cpu match='exact'>
         <model>Westmere</model>
         <vendor>Intel</vendor>
         <feature policy='require' name='vmx'/>
       </cpu>
       <clock offset='utc'/>
       <on_poweroff>destroy</on_poweroff>
       <on_reboot>restart</on_reboot>
       <on_crash>restart</on_crash>
       <devices>
         <emulator>/usr/bin/kvm</emulator>
         <disk type='file' device='disk'>
           <driver name='qemu' type='qcow2'/>
           <source file='/var/lib/libvirt/images/devcloud-kvm.qcow2'/>
           <target dev='vda' bus='virtio'/>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
         </disk>
         <disk type='block' device='cdrom'>
           <driver name='qemu' type='raw'/>
           <target dev='hdc' bus='ide'/>
           <readonly/>
           <address type='drive' controller='0' bus='1' unit='0'/>
         </disk>
         <controller type='usb' index='0'>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
         </controller>
         <controller type='ide' index='0'>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
         </controller>
         <interface type='network'>
           <mac address='52:54:00:4e:ff:4f'/>
           <source network='default'/>
           <model type='virtio'/>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
         </interface>
         <interface type='network'>
           <mac address='52:54:00:52:b1:5e'/>
           <source network='private1'/>
           <model type='virtio'/>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
         </interface>
         <serial type='pty'>
           <target port='0'/>
         </serial>
         <console type='pty'>
           <target type='serial' port='0'/>
         </console>
         <input type='tablet' bus='usb'/>
         <input type='mouse' bus='ps2'/>
         <graphics type='vnc' port='-1' autoport='yes'/>
         <video>
           <model type='cirrus' vram='9216' heads='1'/>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
         </video>
         <memballoon model='virtio'>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
         </memballoon>
       </devices>
     </domain> 
     EOL
     
    Wiki Markup
    {cloak}

  2. Define VM with xml as created above
    Code Block
     virsh define devcloud-kvm.xml
    
  3. Create hard disk that XML points to:
    Code Block
     
    qemu-img create -f qcow2 /var/lib/libvirt/images/devcloud-kvm.qcow2 60G
    
  4. Wiki Markup
    {toggle-cloak:id=NetXML}

    Create the network xml(click to show):

    Wiki Markup
    {toggle-cloak:id=NetXML}

    Wiki Markup
    {cloak:id=NetXML}
    Code Block
     
     cat  > devcloud-kvm-net.xml << EOL
     <network>
      <name>private1</name>
      <uuid>f49f9a26-6c7a-ece4-9d4d-d2e295e6fb80</uuid>
      <bridge name='virbr1' stp='off' delay='0' />
      <mac address='52:54:00:8D:BA:A5'/>
    </network>
     EOL
     
    Wiki Markup
    {cloak}

  5. Create/edit networks required:
    Code Block
     
    virsh net-destroy default
    virsh net-edit default (change ip address range for dhcp so that we have some to manually assign)
    virsh net-start default
    virsh net-define devcloud-kvm-net.xml
    virsh net-autostart private1
    virsh net-start private1
    
  6. Start the vm, attach to vnc
    Code Block
    virsh start kvm-cloudstack
    virsh vncdisplay kvm-cloudstack
    
    • launch your favorite vnc viewer and connect to the localhost port returned by the previous command
  7. Attach CentOS installation iso
    Code Block
     virsh attach-disk kvm-cloudstack ~/Downloads/CentOS-6.3-x86_64-minimal.iso hdc --type cdrom
    
    Note

    Once you attach the disk the VM should reboot on its own. But you may need to reboot it manually.

  8. Install minimal CentOS
    Code Block
    Use 1 partition of 30G for /, and leave another 30G partition blank for a volume group
    

...

Wiki Markup
{toggle-cloak:id=agentscript}

Write the custom startup script to /etc/init.d/cloud-agent (click to show):

Wiki Markup
{toggle-cloak:id=agentscript}

...