From ae70d47f41ce09081494e465f954f87d81315be9 Mon Sep 17 00:00:00 2001
From: Leigh B Stoller <stoller@flux.utah.edu>
Date: Wed, 12 Oct 2016 17:14:26 -0600
Subject: [PATCH] Couple of tiny fixes that I made while stumbling around on a
 question about nobwshaping from Kirk.

---
 tbsetup/libvtop_test.pm.in | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tbsetup/libvtop_test.pm.in b/tbsetup/libvtop_test.pm.in
index 292d1ccef8..9048cb1443 100755
--- a/tbsetup/libvtop_test.pm.in
+++ b/tbsetup/libvtop_test.pm.in
@@ -3662,16 +3662,13 @@ sub GenVirtLans($)
 	    }
 	    else {
 		my $plink = "linksimple/$vname/$member0,$member1";
-		my $bw = '';
+		my $vtbw   = max($top_bw,$top_rbw);
 		my $others = {'isgeninode' => $vlan->_geninodes()};
 		my $wiretype = $vlan->_wiretype();
 
-		if ($emulated) {
-		    $bw = max($top_bw,$top_rbw);
-		}
-		else {
+		if (!$emulated) {
 		    # Let assign choose bw if top_bw is zero.
-		    $bw = ($top_bw == 0 ? "*" : $top_bw);
+		    $vtbw = ($top_bw == 0 ? "*" : $vtbw);
 		    $wiretype = $self->GetWiretype($wiretype,
 						   max($top_bw, $top_rbw));
 		}
@@ -3736,7 +3733,7 @@ sub GenVirtLans($)
 				       'virtual_interface_id' =>"$member0" },
 				      {'virtual_node_id' => $vname1,
 				       'virtual_interface_id' =>"$member1" },
-				      $bw, $wiretype, $others);
+				      $vtbw, $wiretype, $others);
 		}
 	    }
 	}
@@ -4543,7 +4540,10 @@ sub virtlantopbw($$$) {
 	# bandwidth - otherwise, we put in the bandwidth of the type
 	# of physical interface it is likely to get mapped to
 	#
-	if ($virtlan->_emulated()) {
+        my $shaped = $virtlan->membershaped($member);
+
+	if ($virtlan->_emulated() ||
+	    $self->virtlan_use_linkdelay($virtlan, $shaped)) {
 	    $return_rbw = $rbw;
 	}
 	else {
-- 
GitLab