mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
feature #1312: Add DEV_PREFIX to all disk types. Remove BUS from Libvirt drivers
This commit is contained in:
parent
256a63f9e6
commit
a26fad7fe5
@ -454,7 +454,9 @@ int Image::disk_attribute( VectorAttribute * disk,
|
||||
if (dev_prefix.empty())//Removed from image template, get it again
|
||||
{
|
||||
dev_prefix = ImagePool::default_dev_prefix();
|
||||
}
|
||||
}
|
||||
|
||||
disk->replace("DEV_PREFIX", dev_prefix);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -296,16 +296,21 @@ int ImagePool::disk_attribute(VectorAttribute * disk,
|
||||
|
||||
transform(type.begin(),type.end(),type.begin(),(int(*)(int))toupper);
|
||||
|
||||
if ( type == "SWAP" || type == "FS" )
|
||||
{
|
||||
dev_prefix = _default_dev_prefix;
|
||||
img_type = Image::DATABLOCK;
|
||||
}
|
||||
else
|
||||
if ( type != "SWAP" && type != "FS" )
|
||||
{
|
||||
error_str = "Unknown disk type " + type;
|
||||
return -1;
|
||||
}
|
||||
|
||||
img_type = Image::DATABLOCK;
|
||||
dev_prefix = disk->vector_value("DEV_PREFIX");
|
||||
|
||||
if ( dev_prefix.empty() ) //DEV_PEFIX not in DISK, get default
|
||||
{
|
||||
dev_prefix = _default_dev_prefix;
|
||||
|
||||
disk->replace("DEV_PREFIX", dev_prefix);
|
||||
}
|
||||
}
|
||||
|
||||
if ( img != 0 )
|
||||
|
@ -304,7 +304,6 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
type = disk->vector_value("TYPE");
|
||||
target = disk->vector_value("TARGET");
|
||||
ro = disk->vector_value("READONLY");
|
||||
bus = disk->vector_value("BUS");
|
||||
driver = disk->vector_value("DRIVER");
|
||||
cache = disk->vector_value("CACHE");
|
||||
disk->vector_value_str("DISK_ID", disk_id);
|
||||
@ -354,18 +353,7 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
|
||||
// ---- target device to map the disk ----
|
||||
|
||||
file << "\t\t\t<target dev='" << target << "'";
|
||||
|
||||
// ---- bus ----
|
||||
|
||||
if (!bus.empty())
|
||||
{
|
||||
file << " bus='" << bus << "'/>" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
file << "/>" << endl;
|
||||
}
|
||||
file << "\t\t\t<target dev='" << target << "'/>" << endl;
|
||||
|
||||
// ---- readonly attribute for the disk ----
|
||||
|
||||
|
@ -50,7 +50,6 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
|
||||
string type = "";
|
||||
string target = "";
|
||||
string bus = "";
|
||||
string ro = "";
|
||||
string source = "";
|
||||
string datastore = "";
|
||||
@ -197,7 +196,6 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
type = disk->vector_value("TYPE");
|
||||
target = disk->vector_value("TARGET");
|
||||
ro = disk->vector_value("READONLY");
|
||||
bus = disk->vector_value("BUS");
|
||||
source = disk->vector_value("SOURCE");
|
||||
driver = disk->vector_value("DRIVER");
|
||||
disk->vector_value_str("DISK_ID", disk_id);
|
||||
@ -224,6 +222,8 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
transform(type.begin(),type.end(),type.begin(),(int(*)(int))toupper);
|
||||
}
|
||||
|
||||
// ---- Disk type and source for the image ----
|
||||
|
||||
if ( type == "BLOCK" )
|
||||
{
|
||||
file << "\t\t<disk type='block' device='disk'>" << endl;
|
||||
@ -243,16 +243,11 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
<< "/disk." << disk_id << "/disk.vmdk'/>" << endl;
|
||||
}
|
||||
|
||||
file << "\t\t\t<target dev='" << target << "'";
|
||||
// ---- target device to map the disk ----
|
||||
|
||||
if (!bus.empty())
|
||||
{
|
||||
file << " bus='" << bus << "'/>" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
file << "/>" << endl;
|
||||
}
|
||||
file << "\t\t\t<target dev='" << target << "'/>" << endl;
|
||||
|
||||
// ---- Image Format using qemu driver ----
|
||||
|
||||
if ( !driver.empty() )
|
||||
{
|
||||
@ -267,6 +262,8 @@ int LibVirtDriver::deployment_description_vmware(
|
||||
}
|
||||
}
|
||||
|
||||
// ---- readonly attribute for the disk ----
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
file << "\t\t\t<readonly/>" << endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user