mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Merge branch 'feature-1312'
This commit is contained in:
commit
65751db776
@ -394,7 +394,6 @@ public:
|
||||
/**
|
||||
* Modifies the given disk attribute adding the following attributes:
|
||||
* * SOURCE: the file-path.
|
||||
* * BUS: will only be set if the Image's definition includes it.
|
||||
* * TARGET: will only be set if the Image's definition includes it.
|
||||
*
|
||||
* @param disk attribute for the VM template
|
||||
|
@ -426,7 +426,6 @@ int Image::disk_attribute( VectorAttribute * disk,
|
||||
ImageType& img_type,
|
||||
string& dev_prefix)
|
||||
{
|
||||
string bus;
|
||||
string target;
|
||||
string driver;
|
||||
string disk_attr_type;
|
||||
@ -434,17 +433,14 @@ int Image::disk_attribute( VectorAttribute * disk,
|
||||
ostringstream iid;
|
||||
|
||||
img_type = type;
|
||||
bus = disk->vector_value("BUS");
|
||||
target = disk->vector_value("TARGET");
|
||||
driver = disk->vector_value("DRIVER");
|
||||
dev_prefix = disk->vector_value("DEV_PREFIX");
|
||||
iid << oid;
|
||||
|
||||
string template_bus;
|
||||
string template_target;
|
||||
string template_driver;
|
||||
|
||||
get_template_attribute("BUS", template_bus);
|
||||
get_template_attribute("TARGET", template_target);
|
||||
get_template_attribute("DRIVER", template_driver);
|
||||
|
||||
@ -458,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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -468,11 +466,6 @@ int Image::disk_attribute( VectorAttribute * disk,
|
||||
disk->replace("IMAGE_ID", iid.str());
|
||||
disk->replace("SOURCE", source);
|
||||
|
||||
if (bus.empty() && !template_bus.empty()) //BUS in Image, not in DISK
|
||||
{
|
||||
disk->replace("BUS",template_bus);
|
||||
}
|
||||
|
||||
if (driver.empty() && !template_driver.empty())//DRIVER in Image,not in DISK
|
||||
{
|
||||
disk->replace("DRIVER",template_driver);
|
||||
|
@ -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 )
|
||||
|
@ -98,15 +98,6 @@ var create_image_tmpl =
|
||||
<input type="text" name="img_dev_prefix" id="img_dev_prefix" />\
|
||||
<div class="tip">'+tr("Prefix for the emulated device this image will be mounted at. For instance, “hd”, “sd”. If omitted, the default value is the one defined in oned.conf (installation default is “hd”).")+'</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_bus">'+tr("Bus")+':</label>\
|
||||
<select name="img_bus" id="img_bus">\
|
||||
<option value="ide">'+tr("IDE")+'</option>\
|
||||
<option value="scsi">'+tr("SCSI")+'</option>\
|
||||
<option value="virtio">'+tr("Virtio (KVM)")+'</option>\
|
||||
</select>\
|
||||
<div class="tip">'+tr("Type of disk device to emulate.")+'</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_driver">'+tr("Driver")+':</label>\
|
||||
<input type="text" name="img_driver" id="img_driver" />\
|
||||
@ -909,9 +900,6 @@ function setupCreateImageDialog(){
|
||||
img_json["DEV_PREFIX"] = dev_prefix;
|
||||
}
|
||||
|
||||
var bus = $('#img_bus',this).val();
|
||||
img_json["BUS"] = bus;
|
||||
|
||||
var driver = $('#img_driver',this).val();
|
||||
if (driver.length)
|
||||
img_json["DRIVER"] = driver;
|
||||
|
@ -188,7 +188,7 @@ var create_template_tmpl = '<div id="template_create_tabs">\
|
||||
\
|
||||
\
|
||||
<!--disks section using image or declaring\
|
||||
image, image ID, bus, target, driver\
|
||||
image, image ID, target, driver\
|
||||
type, source, size, format, clone, save,\
|
||||
readonly SEVERAL DISKS-->\
|
||||
<div class="vm_section" id="disks">\
|
||||
@ -211,12 +211,6 @@ var create_template_tmpl = '<div id="template_create_tabs">\
|
||||
<div class="tip">'+tr("Name of the image to use")+'</div>\
|
||||
<input type="hidden" id="IMAGE_UNAME" name="image_uname" value=""/>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt vmware_opt">\
|
||||
<label for="BUS">'+tr("Bus")+':</label>\
|
||||
<select id="BUS" name="bus">\
|
||||
</select>\
|
||||
<div class="tip">'+tr("Type of disk device to emulate: ide, scsi")+'</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt vmware_opt">\
|
||||
<label for="TARGET">'+tr("Target")+':</label>\
|
||||
<input type="text" id="TARGET" name="target" />\
|
||||
@ -1020,7 +1014,6 @@ function setupCreateTemplateDialog(){
|
||||
//empty selects
|
||||
$('select#BOOT',section_os_boot).empty();
|
||||
$('select#TYPE',section_disks).empty();
|
||||
$('select#BUS',section_disks).empty();
|
||||
|
||||
//hide options about boot method
|
||||
$('div#kernel_bootloader',section_os_boot).show();
|
||||
@ -1082,7 +1075,6 @@ function setupCreateTemplateDialog(){
|
||||
//KVM particularities:
|
||||
// * Add custom disk types
|
||||
// * Add custom boot options
|
||||
// * Add custom bus options
|
||||
// * Show boot options
|
||||
// * Set the raw type to kvm
|
||||
// * Show the inputs and graphics section
|
||||
@ -1108,13 +1100,6 @@ function setupCreateTemplateDialog(){
|
||||
$('select#BOOT',section_os_boot).parent().show();
|
||||
$('select#boot_method option#no_boot',section_os_boot).html(tr("Driver default"));
|
||||
|
||||
var bus_opts =
|
||||
'<option value="ide">'+tr("IDE")+'</option>\
|
||||
<option value="scsi">'+tr("SCSI")+'</option>\
|
||||
<option value="virtio">'+tr("Virtio")+'</option>';
|
||||
|
||||
$('select#BUS',section_disks).html(bus_opts);
|
||||
|
||||
$('input#TYPE', section_raw).val("kvm");
|
||||
|
||||
$(section_inputs).show();
|
||||
@ -1130,7 +1115,6 @@ function setupCreateTemplateDialog(){
|
||||
// XEN particularities:
|
||||
// * Add custom disk types
|
||||
// * Remove driver default boot method
|
||||
// * Add custom bus types
|
||||
// * Set the raw section to XEN
|
||||
// * Show the graphics section
|
||||
|
||||
@ -1146,12 +1130,6 @@ function setupCreateTemplateDialog(){
|
||||
|
||||
$('select#boot_method option#no_boot',section_os_boot).html(tr("Please choose"));
|
||||
|
||||
var bus_opts =
|
||||
'<option value="ide">'+tr("IDE")+'</option>\
|
||||
<option value="scsi">'+tr("SCSI")+'</option>';
|
||||
|
||||
$('select#BUS',section_disks).html(bus_opts);
|
||||
|
||||
$('input#TYPE', section_raw).val("xen");
|
||||
};
|
||||
|
||||
@ -1165,7 +1143,6 @@ function setupCreateTemplateDialog(){
|
||||
//VMWARE particularities
|
||||
// * Add custom disk types
|
||||
// * Hide boot method field
|
||||
// * Add custom bus types
|
||||
// * Set the raw type to vmware
|
||||
|
||||
var type_opts =
|
||||
@ -1177,11 +1154,6 @@ function setupCreateTemplateDialog(){
|
||||
|
||||
$('div#kernel_bootloader',section_os_boot).hide();
|
||||
|
||||
var bus_opts =
|
||||
'<option value="ide">'+tr("IDE")+'</option>\
|
||||
<option value="scsi">'+tr("SCSI")+'</option>';
|
||||
|
||||
$('select#BUS',section_disks).html(bus_opts);
|
||||
$('input#TYPE', section_raw).val("vmware");
|
||||
};
|
||||
|
||||
|
@ -1249,7 +1249,6 @@ function hotpluggingOps(){
|
||||
}
|
||||
disk_obj.IMAGE_ID = $('select[name="IMAGE_ID"]',this).val();
|
||||
disk_obj.DEV_PREFIX = $('input[name="DEV_PREFIX"]',this).val();
|
||||
disk_obj.BUS = 'scsi';
|
||||
break;
|
||||
case "volatile":
|
||||
disk_obj.SIZE = $('input[name="SIZE"]',this).val();
|
||||
|
@ -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;
|
||||
|
@ -40,14 +40,12 @@ while IFS= read -r -d '' element; do
|
||||
done < <($XPATH $DISK_XPATH/DRIVER \
|
||||
$DISK_XPATH/TYPE \
|
||||
$DISK_XPATH/READONLY \
|
||||
$DISK_XPATH/BUS \
|
||||
$DISK_XPATH/CACHE)
|
||||
|
||||
DRIVER="${XPATH_ELEMENTS[0]:-$DEFAULT_TYPE}"
|
||||
TYPE="${XPATH_ELEMENTS[1]}"
|
||||
READONLY="${XPATH_ELEMENTS[2]}"
|
||||
BUS="${XPATH_ELEMENTS[3]}"
|
||||
CACHE="${XPATH_ELEMENTS[4]}"
|
||||
CACHE="${XPATH_ELEMENTS[3]}"
|
||||
|
||||
TYPE=$(echo "$TYPE"|tr A-Z a-z)
|
||||
|
||||
@ -67,7 +65,6 @@ cdrom)
|
||||
esac
|
||||
|
||||
[ -n "$CACHE" ] && CACHE="cache='$CACHE'"
|
||||
[ -n "$BUS" ] && BUS="bus='$BUS'"
|
||||
|
||||
if [ "$READONLY" = "YES" ]; then
|
||||
READONLY="<readonly/>"
|
||||
@ -81,7 +78,7 @@ cat <<EOF > $ATTACH_FILE
|
||||
<disk type='$TYPE' device='$DEVICE'>
|
||||
<driver name='qemu' type='$DRIVER' $CACHE/>
|
||||
<source $TYPE_SOURCE='$SOURCE'/>
|
||||
<target dev='$TARGET' $BUS/>
|
||||
<target dev='$TARGET'/>
|
||||
$READONLY
|
||||
</disk>
|
||||
EOF
|
||||
|
Loading…
x
Reference in New Issue
Block a user