[one-users] VM Templates

Luca Lorenzini lorenzini.luca at gmail.com
Thu Nov 18 09:05:52 PST 2010


@Upendra Moturi: the setting of the vnc port is based on the VMID and it's
unique. Also i havent any other applications or vms using vnc.

I think i found the problem: I'm using qcow2 image format to save disk space
and I noticed that the DRIVER attribute is discarded in deployment file
creation and i'm not able to use qcow2 format for my images. Without this i
cant use images created with backing_file either. I put the <driver
name='qemu' type='qcow2' /> by hand in the deployment file and deploy it
manually and the image boot.
To do this i left my "not-booting-vm" running so the link to the image wasnt
deleted, i change few things in the deployment.0 file (the name, the vnc
port, and i've add the driver tag) and used "virsh create deployment.0"
command. The vm works fine and use the image with backing_file option.

I hope this feature will be fixed asap!

Here my template, deployment file generated by opennebula, the correct one,
and the virsh dumpxml output.


Luca

~~~~~~~~ VM TEMPLATE FILE ~~~~~~~~~~~~~


NAME   = ubuntu.qcow2
MEMORY = 512
CPU=0.5

OS = [
    BOOT    ="hd",
    ROOT    ="hda"
]

DISK = [
    TYPE= "disk",
    DRIVER="qcow2",
    SOURCE     = "/public/luca/ubuntu10.qcow2",
    TARGET     = "hda",
    CLONE     = "no",
    SAVE = "no"
]

INPUT = [ type = "tablet", bus = "usb" ]

GRAPHICS = [TYPE = "vnc", LISTEN = "localhost", port="5901"]
NIC    = [ NETWORK = "private" ]

FEATURES=[ acpi="no" ]


~~~~~~~~ DEPLOYMENT FILE ~~~~~~~~~~~~~

<domain type='kvm'>
    <name>one-61</name>
    <memory>524288</memory>
    <os>
        <type>hvm</type>
        <boot dev='hd'/>
    </os>
    <devices>
        <emulator>/usr/bin/kvm</emulator>
        <disk type='file' device='disk'>
            <source file='/var/lib/one//61/images/disk.0'/>
            <target dev='hda'/>
        </disk>
        <interface type='bridge'>
            <source bridge='virbr0'/>
            <mac address='02:00:c0:a8:7a:09'/>
        </interface>
        <graphics type='vnc' listen='localhost' port='5961'/>
        <input type='tablet' bus='usb'/>
    </devices>
    <features>
        <acpi/>
    </features>
</domain>



~~~~~~~~ WORKING DEPLOYMENT FILE ~~~~~~~~~~

<domain type='kvm'>
    <name>one-test</name> #Changed the name
    <memory>524288</memory>
    <os>
        <type>hvm</type>
        <boot dev='hd'/>
    </os>
    <devices>
        <emulator>/usr/bin/kvm</emulator>
        <disk type='file' device='disk'>
            <driver name='qemu' type='qcow2'/>  #Added this line
            <source file='/var/lib/one//61/images/disk.0'/>
            <target dev='hda'/>
        </disk>
        <interface type='bridge'>
            <source bridge='virbr0'/>
            <mac address='02:00:c0:a8:7a:09'/>
        </interface>
        <graphics type='vnc' listen='localhost' port='5901'/>  #Changed vnc
port
        <input type='tablet' bus='usb'/>
    </devices>
    <features>
        <acpi/>
    </features>
</domain>



~~~~~~~~ VIRSH DUMPXML # ~~~~~~~~~~~~~~~

**
<domain type='kvm' id='70'>
  <name>one-test</name>
  <uuid>98cbf252-5f3c-005a-1b29-a66fad8882d9</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='i686' machine='pc-0.12'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/one//61/images/disk.0'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <interface type='bridge'>
      <mac address='02:00:c0:a8:7a:09'/>
      <source bridge='virbr0'/>
      <target dev='vnet2'/>
    </interface>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='no' listen='localhost'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
  <seclabel type='dynamic' model='apparmor'>
    <label>libvirt-98cbf252-5f3c-005a-1b29-a66fad8882d9</label>
    <imagelabel>libvirt-98cbf252-5f3c-005a-1b29-a66fad8882d9</imagelabel>
  </seclabel>
</domain>


On Thu, Nov 18, 2010 at 9:56 AM, Upendra Moturi <upendra.m at hexagrid.com>wrote:

> Can you check libvirt logs of host.
> Generally the below message comes when there is address already in use(vnc
> port).
> error: monitor socket did not show up.: Connection refused
> If change the vncport and try.
>
>
> On Thu, Nov 18, 2010 at 2:15 PM, Ruben Diez <rdiez at cesga.es> wrote:
>
>> Try to comment the "GRAPHICS " stuff.... Do it works for this case??
>>
>> Regards
>>
>> Luca Lorenzini escribió:
>>
>>> I've some problems to create the exact vm template for any distribution
>>> different from Ubuntu. I want to try OpenSuse for my vm's images but or i
>>> get status failed [1] o if I delete the  KERNEL variable in the template I
>>> get "No bootable device". the image isnt corrupted, infact i can use it
>>> using kvm from console (kvm -hda /public/images/osuse.qcow2 -m 1024).
>>> Some suggestions?
>>>
>>> PS: It's possible to add in the website some tested and working
>>> templates?
>>>
>>>
>>> [1] ~~~~~~~~~~~ vm.log ~~~~~~~~~~~~~~~~~~~~~
>>>
>>> Wed Nov 17 17:29:15 2010 [VMM][I]: Generating deployment file:
>>> /var/lib/one/26/deployment.0
>>> Wed Nov 17 17:29:47 2010 [VMM][I]: Command execution fail:
>>> /tmp/one/vmm/kvm/deploy /var/lib/one//26/images/deployment.0
>>> Wed Nov 17 17:29:47 2010 [VMM][I]: STDERR follows.
>>> Wed Nov 17 17:29:47 2010 [VMM][I]: error: Failed to create domain from
>>> /var/lib/one//26/images/deployment.0
>>> Wed Nov 17 17:29:47 2010 [VMM][I]: error: monitor socket did not show
>>> up.: Connection refused
>>> Wed Nov 17 17:29:47 2010 [VMM][I]: ExitCode: 255
>>> Wed Nov 17 17:29:47 2010 [VMM][E]: Error deploying virtual machine
>>> Wed Nov 17 17:29:48 2010 [DiM][I]: New VM state is FAILED
>>>
>>> ~~~~~~~~~~~ vm template ~~~~~~~~~~~~~~~~~~~~~
>>>
>>> NAME   = osuse test
>>> MEMORY =1024
>>> CPU=1
>>>
>>> OS = [
>>>    BOOT    ="hd",
>>>    KERNEL    ="/vmlinuz", # i made a link on / pointing at
>>> /boot/"kernel-file"
>>>    INITRD    ="/initrd", #i made a link on / pointing at
>>> /boot/"initrd-image-file"
>>>    ROOT    ="sda2" #mount execution on the vm states  "/dev/sda2 on /
>>> type ext4"
>>> ]
>>>
>>> DISK = [
>>>    SOURCE     = "/public/images/osuse.qcow2",
>>>    TARGET     = "sda",
>>>    CLONE     = "no",
>>>    SAVE     = "no",
>>>   DRIVER     = "qcow2"
>>> ]
>>>
>>>
>>> INPUT = [ type = "tablet", bus = "usb" ]
>>> GRAPHICS = [TYPE = "vnc", LISTEN = "localhost"]
>>>
>>> FEATURES=[ acpi="no" ]
>>>
>>>
>>> ~~~~~~~~~~~ generated deployment ~~~~~~~~~~~~~~~~~~~~~
>>>
>>>
>>> <domain type='kvm'>
>>>    <name>one-26</name>
>>>    <memory>524288</memory>
>>>    <os>
>>>        <type>hvm</type>
>>>        <kernel>/vmlinuz</kernel>
>>>        <initrd>/initrd</initrd>
>>>        <cmdline>root=/dev/sda2 </cmdline>
>>>        <boot dev='hd'/>
>>>    </os>
>>>    <devices>
>>>        <emulator>/usr/bin/kvm</emulator>
>>>        <disk type='file' device='disk'>
>>>            <source file='/var/lib/one//26/images/disk.0'/>
>>>            <target dev='sda'/>
>>>        </disk>
>>>        <graphics type='vnc' listen='localhost' port='5926' />
>>>        <input type='tablet' bus='usb'/>
>>>    </devices>
>>> </domain>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>
>>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>
>
>
> --
> Thanks and Regards,
> Upendra.M
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20101118/0e2dccde/attachment-0003.htm>


More information about the Users mailing list