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

B #4045: Add pci root ports config on q35 vms

Signed-off-by: Bruno Rodriguez <brodriguez@opennebula.io>
(cherry picked from commit c7e15fc143eafd0e7b595f5d2d2eea64bb080ea7)
This commit is contained in:
Bruno Rodriguez 2023-06-02 13:49:48 +02:00 committed by Ruben S. Montero
parent 3ec4474061
commit 99d6d46913
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 32 additions and 3 deletions

View File

@ -46,11 +46,13 @@ public:
std::string& error) const override;
private:
static const int CEPH_DEFAULT_PORT;
static const int CEPH_DEFAULT_PORT;
static const int GLUSTER_DEFAULT_PORT;
static const int GLUSTER_DEFAULT_PORT;
static const int ISCSI_DEFAULT_PORT;
static const int ISCSI_DEFAULT_PORT;
static const int Q35_ROOT_DEFAULT_PORTS;
static const char * XML_DOMAIN_RNG_PATH;

View File

@ -38,6 +38,8 @@ const int LibVirtDriver::GLUSTER_DEFAULT_PORT = 24007;
const int LibVirtDriver::ISCSI_DEFAULT_PORT = 3260;
const int LibVirtDriver::Q35_ROOT_DEFAULT_PORTS = 16;
const char * LibVirtDriver::XML_DOMAIN_RNG_PATH = "/schemas/libvirt/domain.rng";
#define set_sec_default(v, dv) if (v.empty() && !dv.empty()){v = dv;}
@ -1953,6 +1955,31 @@ int LibVirtDriver::deployment_description_kvm(
file << "\t</devices>" << endl;
std::size_t found = machine.find("q35");
if (found != std::string::npos)
{
int q35_root_ports = 0;
get_attribute(nullptr, host, cluster, "Q35_ROOT_PORTS", q35_root_ports);
if (!q35_root_ports)
{
q35_root_ports = Q35_ROOT_DEFAULT_PORTS;
}
file << "\t<devices>" << endl;
file << "\t\t<controller index='0' type='pci' model='pcie-root'/>" << endl;
for (int i=0; i<q35_root_ports; ++i)
{
file << "\t\t<controller type='pci' model='pcie-root-port'/>" << endl;
}
file << "\t\t<controller type='pci' model='pcie-to-pci-bridge'/>" << endl;
file << "\t</devices>" << endl;
}
// ------------------------------------------------------------------------
// Features
// ------------------------------------------------------------------------