From caefeb0e37a2f71bd50e0454b32720f2a7ba15d5 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 14 Jul 2016 15:34:55 +0200 Subject: [PATCH] feature #4620: Add PCI network requests to automatic requirements --- src/vm/VirtualMachine.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index b3c40c3069..a09ccc2b86 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -1522,6 +1522,27 @@ int VirtualMachine::automatic_requirements(string& error_str) } } + vatts.clear(); + + // Get cluster id from all PCI attibutes, TYPE = NIC + num_vatts = obj_template->get("PCI", vatts); + + for(int i=0; ivector_value("TYPE") != "NIC" ) + { + continue; + } + + rc = check_and_set_cluster_id("CLUSTER_ID", vatts[i], cluster_ids); + + if ( rc != 0 ) + { + incomp_id = i; + goto error_pci; + } + } + if ( !cluster_ids.empty() ) { set::iterator i = cluster_ids.begin(); @@ -1635,6 +1656,20 @@ error_nic: goto error_common; +error_pci: + if (rc == -1) + { + oss << "Incompatible clusters in PCI (TYPE=NIC). It is is not the same" + << " as the one used by other VM elements (cluster " + << one_util::join(cluster_ids, ',') << ")"; + } + else + { + oss << "Missing clusters. Network for PCI device of TYPE=NIC"; + } + + goto error_common; + error_common: error_str = oss.str();