[one-users] VM template disk type cdrom
Ruben S. Montero
rubensm at dacya.ucm.es
Fri May 28 02:36:50 PDT 2010
Hi,
I think that the patch proposed by Shashank should fix the problem,
and as Florian said it is quite strange that Libvirt.cc uses "<source
file=" and the logs you are showing is "<source dev="
I fill a ticket for this http://dev.opennebula.org/issues/245
Thank you very much for your feedback and patches !
Ruben
On Fri, May 28, 2010 at 10:37 AM, florian chazal
<florianchazal at gmail.com> wrote:
> Hi Shashank,
>
> Thanks for your answer. Iwanted to do the same modification. But something
> is weird in your XML description file :
> <source dev='/var/lib/one/16/images/disk.0'/>
> <target dev='hdb'/>
>
> Why it's dev, at this point it should be file as you set in the
> LibVirtDriver.cc , isn't it? I think the probllem come from there and not
> from libvirt.
>
> Let me know when you fix it.
>
> 2010/5/28 Shashank Rachamalla <shashank.rachamalla at hexagrid.com>
>>
>> Hi
>>
>> I have faced the same issue while working with OpenNebula 1.4.
>>
>> As you have already mentioned, I had to change LibVirtDriver.cc and
>> recompile from source.
>>
>> I had to add an else if block ( in bold font ) to the below piece of code
>> in LibVirtDriver.cc
>>
>> if ( type == "BLOCK" )
>> {
>> file << "\t\t<disk type='block' device='disk'>" << endl
>> << "\t\t\t<source dev='" << vm->get_remote_dir() <<
>> "/disk."
>> << i << "'/>" << endl;
>> }
>>
>> /* Added newly */
>> else if ( type == "CDROM")
>> {
>> file << "\t\t<disk type='file' device='cdrom'>" << endl
>> << "\t\t\t<source file='" << vm->get_remote_dir() <<
>> "/disk."
>> << i << "'/>" << endl;
>> }
>>
>> else
>> {
>> file << "\t\t<disk type='file' device='disk'>" << endl
>> << "\t\t\t<source file='" << vm->get_remote_dir() <<
>> "/disk."
>> << i << "'/>" << endl;
>> }
>>
>> I have also seen issues while working with qemu hypervisor version 0.11.0
>> (qemu-kvm-0.11.0). After making the above changes, I have created a new VM
>> and the following deployment descriptor was created:
>>
>> <domain type='kvm'>
>> <name>one-16</name>
>> <memory>524288</memory>
>> <os>
>> <type>hvm</type>
>> <boot dev='cdrom'/>
>> </os>
>> <devices>
>> <emulator>/usr/bin/kvm</emulator>
>> <disk type='file' device='cdrom'>
>> <source dev='/var/lib/one/16/images/disk.0'/>
>> <target dev='hdb'/>
>> </disk>
>> <graphics type='vnc' listen='0.0.0.0' port='15'/>
>> </devices>
>> <features>
>> <acpi/>
>> </features>
>> </domain>
>>
>> disk.0 is linked to an iso file.
>> lrwxrwxrwx 1 oneadmin nogroup 23 2010-05-27 22:37 disk.0 ->
>> /mnt/onenfs/ReactOS.iso
>>
>>
>> The following are the contents of var/log/libvirt/qemu/one-16.log
>>
>> LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>> /usr/bin/kvm -S -M pc-0.11 -m 512 -smp 1 -name one-16 -uuid
>> 70ac26ff-654e-9149-8323-283a7e66f1b6 -monitor
>> unix:/var/run/libvirt/qemu/one-16.monitor,server,nowait -boot d -drive
>> file=,if=ide,media=cdrom,index=1 -net none -serial none -parallel none -usb
>> -vnc 0.0.0.0:-5885 -vga cirrus
>>
>> Note the line in bold above. Ideally file should be pointing to
>> '/var/lib/one/16/images/disk.0' but it was not pointing to anything. As a
>> result VM couldn't boot.
>>
>> Can somebody please throw some light on this issue.
>>
>> On 18 May 2010 07:56, florian chazal <florianchazal at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> Is it normal that when you create a virtual machine and you configure one
>>> of its disk as a cdrom :
>>>
>>> #########Open nebula VM Template #########
>>> ...
>>> OS = [ BOOT = \"cdrom\" ]
>>> ...
>>> DISK = [ TYPE = "cdrom" ,
>>> SOURCE = "/srv/cloud/one/IM_template/debian-504-i386-netinst.iso" ,
>>> TARGET = "hdc" ,
>>> CLONE = "no" ,
>>> SAVE = "no" ,
>>> READONLY = "no" ]
>>> DISK = [ TYPE = "disk" ,
>>> SOURCE = "/srv/cloud/one/IM_template/test.qcow2" ,
>>> TARGET = "hda" ,
>>> CLONE = "no" ,
>>> SAVE = "no" ,
>>> READONLY = "no" ]
>>> ...
>>> ################################
>>>
>>> the libvirt driver translate it like this :
>>>
>>> #########LibVirt VM Template #########
>>> ...
>>> <os>
>>> <type>hvm</type>
>>> <boot dev='"cdrom"'/>
>>> </os>
>>> <devices>
>>> <emulator>/usr/bin/kvm</emulator>
>>> <disk type='file' device='disk'>
>>> <source
>>> file='/srv/cloud/one/var/94/images/disk.0'/>
>>> <target dev='hdc'/>
>>> </disk>
>>> <disk type='file' device='disk'>
>>> <source
>>> file='/srv/cloud/one/var/94/images/disk.1'/>
>>> <target dev='hda'/>
>>> </disk>
>>> ...
>>> ################################
>>>
>>> That is to say the translation doesn't care about my cdrom type . And the
>>> vm failed. but if I put cdrom in the device attirbute it works ...
>>>
>>> I searched in the code and I realized that if the type is block in the ON
>>> template the device attirbute will be set as disk and if not it will be set
>>> at disk again : root / src / vmm / LibVirtDriver.cc line 687 to 697 ...
>>>
>>>
>>> --
>>> Florian Chazal
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>
>>
>>
>>
>> --
>> Regards,
>> Shashank Rachamalla
>
>
>
> --
> Florian Chazal
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
--
Dr. Ruben Santiago Montero
Associate Professor (Profesor Titular), Complutense University of Madrid
URL: http://dsa-research.org/doku.php?id=people:ruben
Weblog: http://blog.dsa-research.org/?author=7
More information about the Users
mailing list