1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-18 06:03:39 +03:00

B OpenNebula/one#5705: Allow multiple sd SATA disks on q35 VMs

If needed, q35 VMs will create a new SATA controller to allow more than
a sd[a-z] SATA disk to be attached to a VM
This commit is contained in:
Bruno Rodriguez 2023-11-01 13:01:22 +01:00
parent c461d30846
commit cdd80b6bf6
No known key found for this signature in database
GPG Key ID: D49FF9C0084152A3

View File

@ -1039,6 +1039,8 @@ int LibVirtDriver::deployment_description_kvm(
// ------------------------------------------------------------------------
// Disks
// ------------------------------------------------------------------------
bool need_sata_controller = 0;
get_attribute(nullptr, host, cluster, "DISK", "DRIVER", default_driver);
if (default_driver.empty())
@ -1570,12 +1572,27 @@ int LibVirtDriver::deployment_description_kvm(
if ( target_number >= 0 && target_number < 256 )
{
file << "\t\t\t<address type='drive' controller='0' bus='0' " <<
"target='" << target_number << "' unit='0'/>" << endl;
if ( sd_bus.compare((std::string)("sata")) == 0 )
{
need_sata_controller = machine.find("q35");
if (need_sata_controller)
file << "\t\t\t<address type='drive' controller='1' bus='0' " <<
"target='0' unit='" << target_number << "'/>" << endl;
else
file << "\t\t\t<address type='drive' controller='0' bus='0' " <<
"target='" << target_number << "' unit='0'/>" << endl;
}
else
{
file << "\t\t\t<address type='drive' controller='0' bus='0' " <<
"target='" << target_number << "' unit='0'/>" << endl;
}
}
}
file << "\t\t</disk>" << endl;
}
// ------------------------------------------------------------------------
@ -1669,6 +1686,9 @@ int LibVirtDriver::deployment_description_kvm(
file << "/>" << endl
<< "\t\t</controller>" << endl;
if (need_sata_controller)
file << "\t\t<controller type='sata' index='1'/>" << endl;
// ------------------------------------------------------------------------
// Network interfaces
// ------------------------------------------------------------------------