There was an error in this gadget

Wednesday, July 13, 2011

Build WinXP image into NOVA

The method to bundle WinXP image 


Refference [CSS group] Image management

I'm using WinXP b32 Eng.


On a linux host and kvm is installed inside this machine , Actually , you can use nova-compute node





1. Prepare a WinXP  ISO image. I named it as "WinXP_E.ISO".  Make an ISO image
I use free software ImgBurn to build iso image on Windows.

2. The first step would be to create a raw image on Client1, this will represent the main HDD of the virtual machine, so make sure to give it as much space as you will need.
kvm-img create -f raw winxp.img 20G 


3.OpenStack presents the disk using aVIRTIO interface while launching the instance. Hence the OS needs to have drivers for VIRTIO. By default, the Windows Server 2008 ISO does not have the drivers for VIRTIO. Sso download a virtual floppy drive containing VIRTIO drivers from the following location

http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/

Download both files for later using .
   Parent Directory                                        -   
      virtio-win-0.1-mm34.iso            15-Jun-2011 18:02   40M  
      virtio-win-1.1.16.vfd              15-Jun-2011 18:02  1.4M 

4.Attach it during installation and Start running by
sudo kvm -m 1024 -cdrom WinXP_E.ISO -drive file=winxp.img,if=virtio,boot=on -fda virtio-win-1.1.16.vfd -boot d -nographic -vnc :0

Caution:
I. open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support [means your machine do not support VT]

II. pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
You have to install kvm-pxe
apt-get install kvm-pxe

5. I use VNC on my windows desktop . For now , you need RealVNC to connect your VM. Don't forget the -vnc :0 with your VNC viewer.
The IP address is the host which hold the VM.

After that you'll see a QEMU window , Just follow the installation step. You'll get into XP soon.


6. Install any softwares that you'll run in cloud server later.

7. Configure your XP for Cloud starting up.

  • Create an "ADMIN" account for RDP connection
  • Enable RDP connection




  • Due to the security will be handle by openstack , and RDP port should be open. I disabled windows firewall


  • Verify the Network interface is set to DHCP mode, Nova assign IP for instance by dnsmasq(FlatDHCP&Vlan)



8. Now turn off you Windows VM , everything is been write in winxp.img , we have to bundle it into cloud now. Euca2ool will be use in my example . But it wastes lots of time for Openstack Nova.

euca-bundle-image -i winxp.img
euca-upload-bundle -b mybucket -m /tmp/winxp.img.manifest.xml
euca-register mybucket/winxp.img.manifest.xml

Due to nova-objectstore need to untarring the image for Glance , It takes time to do that.
We can check the status by
glance index
watch "glance show img_id"

Once the "image_state" is available , yes it's ready. In my case , it takes 15mins to untar
URI: http://0.0.0.0/images/48
Id: 48
Public: Yes
Name: None
Size: 21474836480
Location: file:///var/lib/glance/images/48
Disk format: ami
Container format: ami
Property 'image_location': WinXP/windowsserver.img.manifest.xml
Property 'image_state': available
Property 'project_id': hugopro
Property 'architecture': x86_64

Actually , we can add the image to Glance directly without euca2ools."#glance add" or "glance-upload" cmds will be faster. Plz check the instruction for more details


9. Security group for RDP connection. For OpenStack to allow incoming RDP Connections, use euca-authorize command to open up port 3389 .

 euca-authorize -P tcp -p 3389 default

root@nova:~# euca-describe-group
GROUP   pro1    default default
PERMISSION      pro1    default ALLOWS  icmp    -1      -1      FROM    CIDR    0.0.0.0/0
PERMISSION      pro1    default ALLOWS  tcp     22      22      FROM    CIDR    0.0.0.0/0
PERMISSION      pro1    default ALLOWS  tcp     3389    3389    FROM    CIDR    0.0.0.0/0

10. You can associate a public IP for the instance , and connect to winXP by RDP



11. Use volume storage(EBS) in WIN instance
Attach a volume to instance as usual . You have to partition the new storage of instance.





My issue:
 Any possible to get console-output of raw image?

5 comments:

  1. 你好:
    冒昧的請教您,如果執行
    euca-bundle-image -i winxp.img
    發生
    Invalid cert
    應該如何解決,我嘗試過將
    cacert.pem cert.pem novarc pk.pem
    複製到相關路徑下,但是還是發生同樣問題

    還請您不吝指教,謝謝

    ReplyDelete
    Replies
    1. 已解決了,不好意思打擾了!

      Delete
  2. Hi!

    I've tried to create the windows image, but the file: virtio-win-1.1.16.vfd is no longer on the website, instead there is a file virtio-win-0.1-22.iso.

    I use this file (iso) and just doesn't work.

    Then I made some research and you can put "-drive file=virtio-win-0.1-22.iso,media=cdrom" and after that I receive the following
    inet_listen_opts: bind(ipv4,0.0.0.0,5900): Address already in use
    inet_listen_opts: FAILED

    So, I made some research and I've found the error, and It tells me is something with the vnc.

    After I delete de -vnc :0 option and I execute:
    kvm -m 1024 -cdrom win2k8_64std.iso -drive file=windows.img,if=virtio,boot=on -drive file=virtio-win-0.1-22.iso,media=cdrom -boot d -net nic -net user -nographic

    I get this:
    [81640.114408] kvm: 4393: cpu0 unhandled wrmsr: 0x198 data 0

    So, I have some questions:

    - Do I need a graphic environment in order to create a windows image that can run in stackops?
    - How/Where do I configure the IP address for the VM? or What do I put in the vnc option in order to access my VM?

    Thank you.

    Greetings, from Mexico. :)

    ReplyDelete
  3. Great beat ! I wish to apprentice whilst you amend your website, how can i subscribe for a blog website?
    The account aided me a appropriate deal. I had been tiny bit familiar of this your broadcast offered brilliant clear concept.
    microsoft inbox


    ReplyDelete