From 0618a739c37fbb9e937e8600105f239d1845f21f Mon Sep 17 00:00:00 2001
From: Robert Ricci <ricci@cs.utah.edu>
Date: Tue, 17 Aug 2004 23:19:14 +0000
Subject: [PATCH] Fix up reporting for desires that have no matching features -
 I had borken the code that helps assign figure out which desire was not
 matched.

Also remove some old dead code while I'm in here.
---
 assign/assign.cc | 40 +++++++++++++++-------------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/assign/assign.cc b/assign/assign.cc
index 392cb398b7..ac4472ee6d 100644
--- a/assign/assign.cc
+++ b/assign/assign.cc
@@ -457,20 +457,7 @@ int mapping_precheck() {
 
 		bool potential_match = true;
 		// Grab the first node of the pclass as a representative sample
-		tb_pnode *pnode = *((*it)->members[this_type]->L.begin());
-
-#if 0
-		// Check the number of interfaces - if the pnode is a switch,
-		// for now, we don't check this, since it can end up with more
-		// 'interfaces' due to the fact that it can have interswitch
-		// links
-		if ((pnode->total_interfaces >= v->num_links) ||
-			(!pnode->current_type.compare("switch"))) {
-		    matched_links++;
-		} else {
-		    potential_match = false;
-		}
-#endif
+	 	tb_pnode *pnode = *((*it)->members[this_type]->L.begin());
 
 		// Check to see if any of the link that this pnode has are of
 		// the correct type for the virtual node
@@ -497,7 +484,6 @@ int mapping_precheck() {
 		/*
 		 * Check features and desires
 		*/
-
 		tb_featuredesire_set_iterator
 		    fdit(v->desires.begin(),v->desires.end(),
 			 pnode->features.begin(),pnode->features.end());
@@ -509,22 +495,26 @@ int mapping_precheck() {
 		    // Only check for FDs that would result in a violation if
 		    // unmatched.
 		    if (fdit.either_violateable()) {
+			if (fdit.membership() !=
+				tb_featuredesire_set_iterator::BOTH) {
+			    potential_match = false;
+			}
+
 			// We look for violateable desires on vnodes so that we
 			// can report them to the user
-			if (fdit.membership() ==
-				tb_featuredesire_set_iterator::BOTH &&
-				fdit.membership() ==
-				tb_featuredesire_set_iterator::FIRST_ONLY &&
-				fdit.first_iterator()->is_violateable() &&
-				matched_desires.find(fdit->name())
-				== matched_desires.end()) {
-			    matched_desires[fdit->name()] = 0;
+			if ((fdit.membership() ==
+				tb_featuredesire_set_iterator::FIRST_ONLY ||
+			    fdit.membership() ==
+				 tb_featuredesire_set_iterator::BOTH)
+				&& fdit.first_iterator()->is_violateable()) {
+			    if (matched_desires.find(fdit->name()) ==
+				    matched_desires.end()) {
+				matched_desires[fdit->name()] = 0;
+			    }
 			}
 			if (fdit.membership() ==
 				tb_featuredesire_set_iterator::BOTH) {
 			    matched_desires[fdit->name()]++;
-			} else {
-			    potential_match = false;
 			}
 		    }
 		}
-- 
GitLab