1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

feature #3028: add pci passthrough to deployment file

This commit is contained in:
Javi Fontan 2015-08-21 16:11:14 +02:00
parent 371a96c5ed
commit 2b7a2e9915

View File

@ -173,6 +173,13 @@ int LibVirtDriver::deployment_description_kvm(
const VectorAttribute * input;
const VectorAttribute * pci;
string domain = "";
/* bus is already defined for disks */
string slot = "";
string func = "";
const VectorAttribute * features;
bool pae = false;
@ -949,6 +956,42 @@ int LibVirtDriver::deployment_description_kvm(
attrs.clear();
// ------------------------------------------------------------------------
// PCI Passthrough
// ------------------------------------------------------------------------
num = vm->get_template_attribute("PCI",attrs);
for (int i=0; i < num ;i++)
{
pci = dynamic_cast<const VectorAttribute *>(attrs[i]);
if ( pci == 0 )
{
continue;
}
domain = pci->vector_value("DOMAIN");
bus = pci->vector_value("BUS");
slot = pci->vector_value("SLOT");
func = pci->vector_value("FUNCTION");
file << "\t\t<hostdev mode='subsystem' type='pci' managed='yes'>";
file << endl;
file << "\t\t\t<source>" << endl;
file << "\t\t\t\t<address ";
file << "domain='0x" << domain << "' ";
file << "bus='0x" << bus << "' ";
file << "slot='0x" << slot << "' ";
file << "function='0x" << func << "'/>" << endl;
file << "\t\t\t</source>" << endl;
file << "\t\t</hostdev>" << endl;
}
attrs.clear();
file << "\t</devices>" << endl;
// ------------------------------------------------------------------------