Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save kylechase/cc6e0199878133b0481f6b3e80095932 to your computer and use it in GitHub Desktop.

Select an option

Save kylechase/cc6e0199878133b0481f6b3e80095932 to your computer and use it in GitHub Desktop.

Revisions

  1. @skamithi skamithi revised this gist Apr 22, 2014. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion converting_from_virtualbox_to_kvm.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## converted Virtualbox Win7 VM to KVM.
    ## converted Virtualbox Win7 VM to KVM. (KVM on Ubuntu 14.04)

    * Shutdown Virtualbox VM.

    @@ -49,3 +49,10 @@ virsh shutdown win7
    ```

    * go to virt-manager and delete the test disk and change the ide setting on first disk to virtio disk.

    * install virt-viewer
    ```
    apt-get install virt-viewer
    ```

    * Use ``virt-viewer`` to access windows7 console
  2. @skamithi skamithi revised this gist Apr 22, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion converting_from_virtualbox_to_kvm.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ qemu-img convert -f raw win7.img -O qcow2 win7.qcow2
    ```
    * Imported win7.qcow2 into libvirt
    ```
    virt-install --import --name win7 --ram 2048 --disk path=$HOME/imgs/cumulus_windows.qcow2,format=qcow2,device=disk
    virt-install --import --name win7 --ram 2048 --disk path=$HOME/imgs/cumulus_windows.qcow2,format=qcow2,device=disk --arch=i686
    ```
    * download latest [virtio drivers](http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers).

  3. @skamithi skamithi revised this gist Apr 22, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion converting_from_virtualbox_to_kvm.md
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,7 @@ apt-get install virt-manager
    virsh start
    ```

    * Use the (redhat virtio howto)[https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/form-Virtualization_Host_Configuration_and_Guest_Installation_Guide-Para_virtualized_drivers-Mounting_the_image_with_virt_manager.html] to install the balloon driver, net virtio driver, virtio storage driver and virtual serial driver
    * Use the [redhat virtio howto](https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/form-Virtualization_Host_Configuration_and_Guest_Installation_Guide-Para_virtualized_drivers-Mounting_the_image_with_virt_manager.html) to install the balloon driver, net virtio driver, virtio storage driver and virtual serial driver

    * after drivers are installed, go to power options and set desired action on power button been pressed to 'shutdown'. This will make the ``virsh shutdown`` command work.

  4. @skamithi skamithi revised this gist Apr 22, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion converting_from_virtualbox_to_kvm.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ qemu-img convert -f raw win7.img -O qcow2 win7.qcow2
    ```
    virt-install --import --name win7 --ram 2048 --disk path=$HOME/imgs/cumulus_windows.qcow2,format=qcow2,device=disk
    ```
    * download latest (virtio drivers)[http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers].
    * download latest [virtio drivers](http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers).

    * create a 2nd disk in a tmp directory this is going to be used to properly install virtio drivers.
    ```
  5. @skamithi skamithi revised this gist Apr 22, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion converting_from_virtualbox_to_kvm.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## Configured Virtualbox Win7 VM to KVM.
    ## converted Virtualbox Win7 VM to KVM.

    * Shutdown Virtualbox VM.

  6. @skamithi skamithi revised this gist Apr 22, 2014. 2 changed files with 56 additions and 0 deletions.
    51 changes: 51 additions & 0 deletions converting_from_virtualbox_to_kvm.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    ## Configured Virtualbox Win7 VM to KVM.

    * Shutdown Virtualbox VM.

    * Convert the vdi to a raw disk images. Note: vdi are compressed and raw images are not and so you will need to leave enough disk space for entire uncompressed disk.
    ```
    VBoxManage clonehd --format RAW win7.vdi win7.img
    ```
    * Then on your KVM host:
    ```
    qemu-img convert -f raw win7.img -O qcow2 win7.qcow2
    ```
    * Imported win7.qcow2 into libvirt
    ```
    virt-install --import --name win7 --ram 2048 --disk path=$HOME/imgs/cumulus_windows.qcow2,format=qcow2,device=disk
    ```
    * download latest (virtio drivers)[http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers].

    * create a 2nd disk in a tmp directory this is going to be used to properly install virtio drivers.
    ```
    qemu-img create- -f qcow2 /home/stanleyk/Downloads test.qcow2
    ```
    * download virt-manager
    ```
    apt-get install virt-manager
    ```

    * using virt-manager, confirm that the following options are there. If not set it.
    - Video set to QXL
    - Console/Serial set to Spice not VNC
    - NIC set to virtio
    - memory set to 2GB
    - first disk set to IDE
    - second disk _(test.qcow2)_ set to Virtio disk

    * start the vm
    ```
    virsh start
    ```

    * Use the (redhat virtio howto)[https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/form-Virtualization_Host_Configuration_and_Guest_Installation_Guide-Para_virtualized_drivers-Mounting_the_image_with_virt_manager.html] to install the balloon driver, net virtio driver, virtio storage driver and virtual serial driver

    * after drivers are installed, go to power options and set desired action on power button been pressed to 'shutdown'. This will make the ``virsh shutdown`` command work.

    * shutdown the vm
    ```
    virsh shutdown win7
    ```

    * go to virt-manager and delete the test disk and change the ide setting on first disk to virtio disk.
    5 changes: 5 additions & 0 deletions win7_libvirt.xml
    Original file line number Diff line number Diff line change
    @@ -58,6 +58,11 @@
    <readonly/>
    <address type='drive' controller='0' bus='1' target='0' unit='1'/>
    </disk>
    <disk type="file" device="disk">
    <driver name="qemu" type="qcow2"/>
    <source dev="/home/stanleyk/Downloads/test.qcow2'/>
    <target dev='vdb' bus='virtio'/>
    </disk>
    <controller type='usb' index='0'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
  7. @skamithi skamithi created this gist Apr 22, 2014.
    102 changes: 102 additions & 0 deletions win7_libvirt.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,102 @@
    <domain type='kvm'>
    <name>win7</name>
    <uuid>a0dc1844-6a10-52d2-2bb1-ef27de3b047f</uuid>
    <memory unit='KiB'>2097152</memory>
    <currentMemory unit='KiB'>1048576</currentMemory>
    <vcpu placement='static'>1</vcpu>
    <os>
    <type arch='i686' machine='pc-i440fx-trusty'>hvm</type>
    <boot dev='hd'/>
    </os>
    <features>
    <acpi/>
    <apic/>
    <pae/>
    </features>
    <cpu mode='custom' match='exact'>
    <model fallback='allow'>SandyBridge</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='dtes64'/>
    <feature policy='require' name='vmx'/>
    <feature policy='require' name='erms'/>
    <feature policy='require' name='xtpr'/>
    <feature policy='require' name='smep'/>
    <feature policy='require' name='pcid'/>
    <feature policy='require' name='est'/>
    <feature policy='require' name='monitor'/>
    <feature policy='require' name='tm'/>
    <feature policy='require' name='acpi'/>
    <feature policy='require' name='osxsave'/>
    <feature policy='require' name='ht'/>
    <feature policy='require' name='pdcm'/>
    <feature policy='require' name='fsgsbase'/>
    <feature policy='require' name='f16c'/>
    <feature policy='require' name='ds'/>
    <feature policy='require' name='tm2'/>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='pbe'/>
    <feature policy='require' name='ds_cpl'/>
    <feature policy='require' name='rdrand'/>
    </cpu>
    <clock offset='localtime'/>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>restart</on_crash>
    <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
    <driver name='qemu' type='qcow2'/>
    <source file='/home/stanleyk/imgs/cumulus_windows.qcow2'/>
    <target dev='vda' bus='virtio'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='block' device='cdrom'>
    <driver name='qemu' type='raw'/>
    <source dev='/home/stanleyk/Downloads/virtio-win-0.1-74.iso'/>
    <target dev='hdd' bus='ide'/>
    <readonly/>
    <address type='drive' controller='0' bus='1' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <interface type='network'>
    <mac address='52:54:00:96:23:0b'/>
    <source network='default'/>
    <model type='virtio'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
    <target port='0'/>
    </serial>
    <console type='pty'>
    <target type='serial' port='0'/>
    </console>
    <channel type='spicevmc'>
    <target type='virtio' name='com.redhat.spice.0'/>
    <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes'/>
    <sound model='ac97'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </sound>
    <video>
    <model type='qxl' ram='65536' vram='65536' heads='1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </video>
    <memballoon model='virtio'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
    </devices>
    </domain>