[one-users] VM template disk type cdrom

florian chazal florianchazal at gmail.com
Fri May 28 01:37:25 PDT 2010


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<http://dev.opennebula.org/projects/opennebula/repository/revisions/master/show>/
>> src<http://dev.opennebula.org/projects/opennebula/repository/revisions/master/show/src>/
>> vmm<http://dev.opennebula.org/projects/opennebula/repository/revisions/master/show/src/vmm>/
>> LibVirtDriver.cc<http://dev.opennebula.org/projects/opennebula/repository/revisions/master/changes/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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20100528/af11ffaa/attachment-0003.htm>


More information about the Users mailing list