1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

Bug #2252: Guest XML incorrect for CDROM images in a ceph datastore

Also prepare a new DiskType for Gluster, which might be useful in the future
This commit is contained in:
Jaime Melis 2013-10-08 18:51:54 +02:00
parent 3b2e92856e
commit 3c300cc5c3
3 changed files with 42 additions and 14 deletions

View File

@ -75,10 +75,12 @@ public:
*/
enum DiskType
{
FILE = 0, /** < File-based disk */
CD_ROM = 1, /** < An ISO9660 disk */
BLOCK = 2, /** < Block-device disk */
RBD = 3 /** < CEPH RBD disk */
FILE = 0, /** < File-based disk */
CD_ROM = 1, /** < An ISO9660 disk */
BLOCK = 2, /** < Block-device disk */
RBD = 3, /** < CEPH RBD disk */
RBD_CDROM = 4, /** < CEPH RBD CDROM disk */
GLUSTER = 5 /** < Gluster Block Device */
};
/**
@ -90,11 +92,13 @@ public:
{
switch (ob)
{
case FILE: return "FILE" ; break;
case CD_ROM: return "CDROM" ; break;
case BLOCK: return "BLOCK" ; break;
case RBD: return "RBD" ; break;
default: return "";
case FILE: return "FILE" ; break;
case CD_ROM: return "CDROM" ; break;
case BLOCK: return "BLOCK" ; break;
case RBD: return "RBD" ; break;
case RBD_CDROM: return "RBD_CDROM" ; break;
case GLUSTER: return "GLUSTER" ; break;
default: return "";
}
};

View File

@ -571,16 +571,27 @@ int Image::disk_attribute( VectorAttribute * disk,
{
case OS:
case DATABLOCK:
case RBD: //Type is FILE or BLOCK as inherited from the DS
disk_attr_type = disk_type_to_str(disk_type);
break;
break;
case CDROM: //Always use CDROM type for these ones
disk_attr_type = "CDROM";
break;
DiskType new_disk_type;
switch(disk_type)
{
case RBD:
new_disk_type = RBD_CDROM;
break;
default:
new_disk_type = CD_ROM;
}
disk_attr_type = disk_type_to_str(new_disk_type);
break;
default: //Other file types should not be never a DISK
break;
break;
}
disk->replace("TYPE", disk_attr_type);

View File

@ -362,6 +362,19 @@ int LibVirtDriver::deployment_description_kvm(
file << "'/>" << endl;
}
else if ( type == "RBD_CDROM" )
{
file << "\t\t<disk type='network' device='cdrom'>" << endl
<< "\t\t\t<source protocol='rbd' name='"
<< source;
if ( clone == "YES" )
{
file << "-" << vm->get_oid() << "-" << disk_id;
}
file << "'/>" << endl;
}
else if ( type == "CDROM" )
{
file << "\t\t<disk type='file' device='cdrom'>" << endl