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:
parent
3ec4474061
commit
99d6d46913
@ -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;
|
||||
|
||||
|
@ -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
|
||||
// ------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user