diff --git a/src/plugins/accounting_storage/mysql/as_mysql_federation.c b/src/plugins/accounting_storage/mysql/as_mysql_federation.c
index b0e749e68a7e9566118884a636c4a0481cdb5c38..9baf6f7cff7292afc26fc4f3f22b09b25c404b95 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_federation.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_federation.c
@@ -283,7 +283,8 @@ static int _assign_clusters_to_federation(mysql_conn_t *mysql_conn,
 	    (rc = _remove_all_clusters_from_fed(mysql_conn, federation,
 						add_list)))
 		goto end_it;
-	if (list_count(rem_list) &&
+	if (!clear_clusters &&
+	    list_count(rem_list) &&
 	    (rc = _remove_clusters_from_fed(mysql_conn, rem_list)))
 		goto end_it;
 	if (list_count(add_list) &&
diff --git a/src/sacctmgr/cluster_functions.c b/src/sacctmgr/cluster_functions.c
index cc107f464176640e86fd791d51e37c79163a3441..d9e6c5bfd9f0562adc12dfd38a8138a7a01d379a 100644
--- a/src/sacctmgr/cluster_functions.c
+++ b/src/sacctmgr/cluster_functions.c
@@ -648,6 +648,55 @@ extern int sacctmgr_list_cluster(int argc, char *argv[])
 	return rc;
 }
 
+static int _find_cluster_rec_in_list(void *obj, void *key)
+{
+	slurmdb_cluster_rec_t *rec = (slurmdb_cluster_rec_t *)obj;
+	char *char_key = (char *)key;
+
+	if (!xstrcasecmp(rec->name, char_key))
+		return 1;
+
+	return 0;
+}
+
+/* Prepare cluster_list to be federation centric that will be passed to
+ * verify_clsuters_exists in federation_functions.c.
+ */
+static int _verify_fed_clusters(List cluster_list, const char *fed_name,
+				bool *existing_fed)
+{
+	int   rc         = SLURM_SUCCESS;
+	char *tmp_name   = NULL;
+	List  tmp_list   = list_create(slurmdb_destroy_cluster_rec);
+	ListIterator itr = list_iterator_create(cluster_list);
+
+	while ((tmp_name = list_next(itr))) {
+		slurmdb_cluster_rec_t *rec =
+			xmalloc(sizeof(slurmdb_cluster_rec_t));
+		slurmdb_init_cluster_rec(rec, 0);
+		rec->name = xstrdup(tmp_name);
+		list_append(tmp_list, rec);
+	}
+
+	if ((rc = verify_fed_clusters(tmp_list, fed_name, existing_fed)))
+		goto end_it;
+
+	/* have to reconcile lists now, clusters may have been removed from
+	 * tmp_list */
+	list_iterator_reset(itr);
+	while ((tmp_name = list_next(itr))) {
+		if (!list_find_first(tmp_list, _find_cluster_rec_in_list,
+				     tmp_name))
+			list_delete_item(itr);
+	}
+
+end_it:
+	FREE_NULL_LIST(tmp_list);
+	list_iterator_destroy(itr);
+
+	return rc;
+}
+
 extern int sacctmgr_modify_cluster(int argc, char *argv[])
 {
 	int rc = SLURM_SUCCESS;
@@ -661,6 +710,7 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[])
 	int cond_set = 0, prev_set = 0, rec_set = 0, set = 0;
 	List ret_list = NULL;
 	slurmdb_cluster_cond_t cluster_cond;
+	bool existing_fed = false;
 
 	slurmdb_init_assoc_rec(assoc, 0);
 
@@ -709,12 +759,35 @@ extern int sacctmgr_modify_cluster(int argc, char *argv[])
 
 	if (cluster->fed.name && cluster->fed.name[0]) {
 		int rc;
+		/* Make sure federation exists. */
 		List fed_list = list_create(slurm_destroy_char);
 		list_append(fed_list, xstrdup(cluster->fed.name));
 		rc = verify_federations_exist(fed_list);
 		FREE_NULL_LIST(fed_list);
 		if (rc)
 			goto end_it;
+
+		/* See if cluster is assigned to another federation already. */
+		if (list_count(cluster_cond.cluster_list)) {
+			if (_verify_fed_clusters(cluster_cond.cluster_list,
+						 cluster->fed.name,
+						 &existing_fed))
+					goto end_it;
+			else if (!list_count(cluster_cond.cluster_list)) {
+				/* irrelevant changes have been removed and
+				 * nothing to change now. */
+				printf("Nothing to change\n");
+				rc = SLURM_ERROR;
+				goto end_it;
+			} else if (existing_fed) {
+				char *warning =
+					"\nAre you sure you want to continue?";
+				if (!commit_check(warning)) {
+					rc = SLURM_ERROR;
+					goto end_it;
+				}
+			}
+		}
 	}
 
 	if (cond_set & 1) {
diff --git a/src/sacctmgr/federation_functions.c b/src/sacctmgr/federation_functions.c
index 63a9eb02ae188628e394f938ceabc968fd5c2971..2bf270c47a705244c92de9a6ef2c19d0979fcce6 100644
--- a/src/sacctmgr/federation_functions.c
+++ b/src/sacctmgr/federation_functions.c
@@ -269,18 +269,29 @@ extern int verify_federations_exist(List name_list)
 	return _verify_federations(name_list, 0);
 }
 
-static int _verify_clusters_exist(List cluster_list,
-				  char *fed_name,
-				  bool *existing_fed)
+/* Verify that clusters exist in the database.
+ * Will remove clusters from list if they are already on the federation or if
+ * a cluster is being removed and it doesn't exist on the federation.
+ *
+ * IN cluster_list: list of slurmdb_cluster_rec_t's with cluster names set.
+ * IN fed_name: (optional) Name of federation that is being added/modified.
+ * OUT existing_fed: Will be set to TRUE if a cluster in cluster_list is
+ *                   assigned to a federation that is not fed_name. If fed_name
+ *                   is set to NULL and a cluster is assigned to federation then
+ *                   existing_fed will be set to TRUE.
+ */
+extern int verify_fed_clusters(List cluster_list, const char *fed_name,
+			       bool *existing_fed)
 {
 	char        *missing_str  = NULL;
 	char        *existing_str = NULL;
 	List         temp_list    = NULL;
-	ListIterator itr          = NULL;
+	ListIterator itr_db       = NULL;
 	ListIterator itr_c        = NULL;
 	slurmdb_cluster_rec_t *cluster_rec  = NULL;
 	slurmdb_cluster_cond_t cluster_cond;
 
+	/* Get existing clusters from database */
 	slurmdb_init_cluster_cond(&cluster_cond, 0);
 	cluster_cond.cluster_list = list_create(slurm_destroy_char);
 	itr_c = list_iterator_create(cluster_list);
@@ -304,10 +315,12 @@ static int _verify_clusters_exist(List cluster_list,
 		return SLURM_ERROR;
 	}
 
+	/* See if the clusters we are looking to add are in the cluster list
+	 * from the db. */
 	list_iterator_reset(itr_c);
-	itr = list_iterator_create(temp_list);
+	itr_db = list_iterator_create(temp_list);
 	while((cluster_rec = list_next(itr_c))) {
-		slurmdb_cluster_rec_t *tmp_rec = NULL;
+		slurmdb_cluster_rec_t *db_rec = NULL;
 		char *tmp_name = cluster_rec->name;
 		if (!tmp_name)
 			continue;
@@ -315,24 +328,37 @@ static int _verify_clusters_exist(List cluster_list,
 		if (tmp_name[0] == '+' || tmp_name[0] == '-')
 			tmp_name++;
 
-		list_iterator_reset(itr);
-		while((tmp_rec = list_next(itr))) {
-			if (!strcasecmp(tmp_rec->name, tmp_name))
+		list_iterator_reset(itr_db);
+		while((db_rec = list_next(itr_db))) {
+			if (!strcasecmp(db_rec->name, tmp_name))
 				break;
 		}
-		if (!tmp_rec) {
+		if (!db_rec) {
 			xstrfmtcat(missing_str, " The cluster %s doesn't exist."
-				   " Please add first.\n", cluster_rec->name);
-		} else if (tmp_rec->fed.name && tmp_rec->fed.name[0] &&
-			   (!fed_name || strcmp(fed_name, tmp_rec->fed.name)))
-		{
-			xstrfmtcat(existing_str, " The cluster %s is already "
-				   "assigned to federation %s\n",
-				   tmp_rec->name, tmp_rec->fed.name);
+				   " Please add first.\n", tmp_name);
+		} else if (*cluster_rec->name != '-' &&
+			   db_rec->fed.name && *db_rec->fed.name) {
+
+			if (fed_name && !xstrcmp(fed_name, db_rec->fed.name)) {
+				fprintf(stderr, " The cluster %s is already "
+						"assigned to federation %s\n",
+					db_rec->name, db_rec->fed.name);
+				list_delete_item(itr_c);
+			} else {
+				xstrfmtcat(existing_str, " The cluster %s is "
+					   "assigned to federation %s\n",
+					   db_rec->name, db_rec->fed.name);
+			}
+		} else if (*cluster_rec->name == '-' &&
+			   fed_name && xstrcmp(fed_name, db_rec->fed.name)) {
+			fprintf(stderr, " The cluster %s isn't assigned to "
+					"federation %s\n",
+				db_rec->name, fed_name);
+			list_delete_item(itr_c);
 		}
 	}
 
-	list_iterator_destroy(itr);
+	list_iterator_destroy(itr_db);
 	list_iterator_destroy(itr_c);
 	FREE_NULL_LIST(temp_list);
 	if (missing_str) {
@@ -406,23 +432,18 @@ extern int sacctmgr_add_federation(int argc, char *argv[])
 
 		/* ensure that clusters exist in db */
 		/* and if the clusters are already assigned to another fed. */
-		if (_verify_clusters_exist(start_fed->cluster_list, NULL,
-					   &existing_feds)) {
+		if (verify_fed_clusters(start_fed->cluster_list, NULL,
+					&existing_feds)) {
 			FREE_NULL_LIST(name_list);
 			slurmdb_destroy_federation_rec(start_fed);
 			return SLURM_ERROR;
 		} else if (existing_feds) {
-			/* If there is ask to if they want to continue. */
-			char *warning = xstrdup_printf(
-				"\nAre you sure you want to continue?");
-
+			char *warning = "\nAre you sure you want to continue?";
 			if (!commit_check(warning)) {
-				xfree(warning);
 				FREE_NULL_LIST(name_list);
 				slurmdb_destroy_federation_rec(start_fed);
 				return SLURM_ERROR;
 			}
-			xfree(warning);
 		}
 	}
 
@@ -686,41 +707,90 @@ extern int sacctmgr_list_federation(int argc, char *argv[])
 	return rc;
 }
 
-static int _add_all_clusters_to_remove(List cluster_list, char *federation)
+/* Add clusters to be removed if "setting" a federation to a specific set of
+ * clusters or clearing all clusters.
+ *
+ * IN cluster_list: list of slurmdb_cluster_rec_t's with cluster names set that
+ *                  are to be "set" on the federation the federation.
+ * IN federation: name of the federation that is being added/modified.
+ */
+static int _add_clusters_to_remove(List cluster_list, const char *federation)
 {
-	/* remove all clusters from federation. */
-	List   temp_list = NULL;
-	ListIterator itr = NULL;
-	slurmdb_federation_cond_t tmp_cond;
-	slurmdb_federation_rec_t *tmp_rec = NULL;
-	slurmdb_cluster_rec_t    *tmp_cluster = NULL;
-
-	slurmdb_init_federation_cond(&tmp_cond, 0);
-	tmp_cond.federation_list = list_create(slurm_destroy_char);
-	list_append(tmp_cond.federation_list, federation);
-
-	temp_list = acct_storage_g_get_federations(db_conn, my_uid, &tmp_cond);
-	if (!temp_list || !list_count(temp_list)) {
+	List        db_list = NULL;
+	ListIterator db_itr = NULL;
+	slurmdb_federation_cond_t db_cond;
+	slurmdb_federation_rec_t *db_rec = NULL;
+	slurmdb_cluster_rec_t    *db_cluster = NULL;
+
+	slurmdb_init_federation_cond(&db_cond, 0);
+	db_cond.federation_list = list_create(slurm_destroy_char);
+	list_append(db_cond.federation_list, xstrdup(federation));
+
+	db_list = acct_storage_g_get_federations(db_conn, my_uid, &db_cond);
+	if (!db_list || !list_count(db_list)) {
 		fprintf(stderr, " Problem getting federations "
 			"from database. Contact your admin.\n");
 		return SLURM_ERROR;
 	}
-	FREE_NULL_LIST(tmp_cond.federation_list);
-	tmp_rec = list_peek(temp_list);
-	itr = list_iterator_create(tmp_rec->cluster_list);
-	while((tmp_cluster = list_next(itr))) {
+	FREE_NULL_LIST(db_cond.federation_list);
+	db_rec = list_peek(db_list);
+	db_itr = list_iterator_create(db_rec->cluster_list);
+	while ((db_cluster = list_next(db_itr))) {
+		bool found_cluster = false;
+		slurmdb_cluster_rec_t *orig_cluster = NULL;
+		ListIterator orig_itr = list_iterator_create(cluster_list);
+
+		/* Figure out if cluster in cluster_list is already on the
+		 * federation. If if is, don't add to list to remove */
+		while ((orig_cluster = list_next(orig_itr))) {
+			char *db_name = db_cluster->name;
+			if (*db_name == '+' || *db_name == '-')
+				++db_name;
+			if (!xstrcmp(orig_cluster->name, db_name)) {
+				found_cluster = true;
+				break;
+			}
+		}
+		list_iterator_destroy(orig_itr);
+		if (found_cluster)
+			continue;
+
 		slurmdb_cluster_rec_t *cluster =
 			xmalloc(sizeof(slurmdb_cluster_rec_t));
 		slurmdb_init_cluster_rec(cluster, 0);
-		cluster->name = xstrdup_printf("-%s", tmp_cluster->name);
+		cluster->name = xstrdup_printf("-%s", db_cluster->name);
 		list_append(cluster_list, cluster);
 	}
-	list_iterator_destroy(itr);
-	FREE_NULL_LIST(temp_list);
+	list_iterator_destroy(db_itr);
+	FREE_NULL_LIST(db_list);
 
 	return SLURM_SUCCESS;
 }
 
+/* Change add mode of clusters to be added to federation to += mode.
+ * A cluster that is already part of a federation will be removed from the list
+ * to set the federation clusters to, so all assigns need to be changed to '+'
+ * plus modes. Clusters that are to be removed from the federation clustesr will
+ * have already been added to the list in '-' mode.
+ */
+static int _change_assigns_to_adds(List cluster_list)
+{
+	int rc = SLURM_SUCCESS;
+	ListIterator itr = list_iterator_create(cluster_list);
+	slurmdb_cluster_rec_t *cluster = NULL;
+
+	while ((cluster = list_next(itr))) {
+		if (cluster->name && *cluster->name &&
+		    (*cluster->name != '-' && *cluster->name != '+')) {
+			char *tmp_name = xstrdup_printf("+%s", cluster->name);
+			xfree(cluster->name);
+			cluster->name = tmp_name;
+		}
+	}
+
+	return rc;
+}
+
 extern int sacctmgr_modify_federation(int argc, char *argv[])
 {
 	int rc = SLURM_SUCCESS;
@@ -778,6 +848,9 @@ extern int sacctmgr_modify_federation(int argc, char *argv[])
 	if (federation->cluster_list) {
 		bool existing_feds = false;
 		char *mod_fed = NULL;
+		slurmdb_cluster_rec_t *tmp_c = NULL;
+		List cluster_list = federation->cluster_list;
+
 		if (federation_cond->federation_list &&
 		    (list_count(federation_cond->federation_list) > 1)) {
 			fprintf(stderr, " Can't assign clusters to "
@@ -785,25 +858,30 @@ extern int sacctmgr_modify_federation(int argc, char *argv[])
 			rc = SLURM_ERROR;
 			goto end_it;
 		}
-		mod_fed = list_peek(federation_cond->federation_list);
 
-		if (!list_count(federation->cluster_list) &&
-		    _add_all_clusters_to_remove(federation->cluster_list,
-						xstrdup(mod_fed))) {
+		/* Add all clusters that need to be removed if clearing all
+		 * clusters or add clusters that will be removed if setting
+		 * clusters to specific set. */
+		mod_fed = list_peek(federation_cond->federation_list);
+		if ((!list_count(cluster_list) ||
+		     ((tmp_c = list_peek(cluster_list)) &&
+		      *tmp_c->name != '-' && *tmp_c->name != '+')) &&
+		    ((rc = _add_clusters_to_remove(cluster_list, mod_fed)) ||
+		     (rc = _change_assigns_to_adds(cluster_list)))) {
+			goto end_it;
+		} else if ((rc = verify_fed_clusters(cluster_list, mod_fed,
+						     &existing_feds))) {
 			goto end_it;
-		}  else if ((rc =
-			     _verify_clusters_exist(federation->cluster_list,
-						    mod_fed, &existing_feds))) {
+		} else if (!list_count(cluster_list)) {
+			printf("Nothing to change\n");
+			rc = SLURM_ERROR;
 			goto end_it;
 		} else if (existing_feds) {
-			char *warning = xstrdup_printf(
-				"\nAre you sure you want to continue?");
+			char *warning = "\nAre you sure you want to continue?";
 			if (!commit_check(warning)) {
-				xfree(warning);
 				rc = SLURM_ERROR;
 				goto end_it;
 			}
-			xfree(warning);
 		}
 	}
 
diff --git a/src/sacctmgr/sacctmgr.h b/src/sacctmgr/sacctmgr.h
index 9167c84ecd7daa71df4597c1f6181f9b2ec2b539..8bded7634c782636d6fe752e8750af7a561c8353 100644
--- a/src/sacctmgr/sacctmgr.h
+++ b/src/sacctmgr/sacctmgr.h
@@ -355,5 +355,7 @@ extern int sacctmgr_list_runaway_jobs(int argc, char *argv[]);
 
 /* federation_functions.c */
 extern int verify_federations_exist(List name_list);
+extern int verify_fed_clusters(List cluster_list, const char *fed_name,
+			       bool *existing_fed);
 
 #endif
diff --git a/testsuite/expect/test37.1 b/testsuite/expect/test37.1
index 6257788156833d3f2a62d493973682294374c68a..717756713b0247e398b1ee170ecef7b0245fd317 100644
--- a/testsuite/expect/test37.1
+++ b/testsuite/expect/test37.1
@@ -907,7 +907,6 @@ if {$exit_code || $matches != 4} {
 	end_it 1
 }
 
-send_user "tc1 = $tc1\n"
 set matches 0
 set my_pid [spawn $sacctmgr show federation $fed1 $fed2 format="federation%20,flags,cluster%20,fedstate%20,weight" tree]
 expect {
@@ -1027,6 +1026,10 @@ if {$exit_code || $matches != 3} {
 set matches 0
 set my_pid [spawn $sacctmgr -i modify cluster $tc2 set federation=$fed1]
 expect {
+	-re "The cluster $tc2 is assigned to federation $fed2$eol" {
+		incr matches
+		exp_continue
+	}
 	-re "Setting$eol" {
 		incr matches
 		exp_continue
@@ -1052,7 +1055,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 5} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -1094,6 +1097,10 @@ if {$exit_code || $matches != 4} {
 set matches 0
 set my_pid [spawn $sacctmgr -i modify cluster $tc1 set federation=$fed2]
 expect {
+	-re "The cluster $tc1 is assigned to federation $fed1$eol" {
+		incr matches
+		exp_continue
+	}
 	-re "Setting$eol" {
 		incr matches
 		exp_continue
@@ -1119,7 +1126,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 5} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -1161,6 +1168,10 @@ if {$exit_code || $matches != 4} {
 set matches 0
 set my_pid [spawn $sacctmgr -i modify cluster $tc2 set federation=$fed2]
 expect {
+	-re "The cluster $tc2 is assigned to federation $fed1$eol" {
+		incr matches
+		exp_continue
+	}
 	-re "Setting$eol" {
 		incr matches
 		exp_continue
@@ -1186,7 +1197,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 5} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -1234,11 +1245,11 @@ if {$exit_code || $matches != 4} {
 set matches 0
 set my_pid [spawn $sacctmgr add federation $fed3 flags=LLC clusters=$tc1,$tc2]
 expect {
-	-re "The cluster $tc1 is already assigned to federation $fed2$eol" {
+	-re "The cluster $tc1 is assigned to federation $fed2$eol" {
 		incr matches
 		exp_continue
 	}
-	-re "The cluster $tc2 is already assigned to federation $fed2$eol" {
+	-re "The cluster $tc2 is assigned to federation $fed2$eol" {
 		incr matches
 		exp_continue
 	}
@@ -1568,19 +1579,11 @@ expect {
 expect -re $
 set my_pid [spawn $sacctmgr -i modify cluster $tc4 set federation=$fed3]
 expect {
-	-re "Setting" {
-		incr matches
-		exp_continue
-	}
-	-re "^\\s+Federation\\s+=\\s+$fed3$eol" {
-		incr matches
-		exp_continue
-	}
-	-re "Modified cluster...$eol" {
+	-re "The cluster $tc4 is already assigned to federation $fed3" {
 		incr matches
 		exp_continue
 	}
-	-re "^\\s+$tc4$eol" {
+	"Nothing to change" {
 		incr matches
 		exp_continue
 	}
@@ -1593,7 +1596,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 2} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -1627,19 +1630,11 @@ if {$exit_code || $matches != 2} {
 set matches 0
 set my_pid [spawn $sacctmgr -i modify federation $fed3 set clusters+=$tc4]
 expect {
-	-re "Setting$eol" {
-		incr matches
-		exp_continue
-	}
-	-re "Cluster\\s+ \\+= $tc4$eol" {
-		incr matches
-		exp_continue
-	}
-	-re "^\\s+Modified federation...$eol" {
+	-re "The cluster $tc4 is already assigned to federation $fed3" {
 		incr matches
 		exp_continue
 	}
-	-re "\\s+$fed3$eol" {
+	"Nothing to change" {
 		incr matches
 		exp_continue
 	}
@@ -1652,7 +1647,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 2} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -1686,6 +1681,10 @@ if {$exit_code || $matches != 2} {
 set matches 0
 set my_pid [spawn $sacctmgr -i modify cluster $tc4 set federation=$fed2]
 expect {
+	-re "The cluster $tc4 is assigned to federation $fed3$eol" {
+		incr matches
+		exp_continue
+	}
 	-re "Setting" {
 		incr matches
 		exp_continue
@@ -1711,7 +1710,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 5} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -1750,6 +1749,10 @@ expect -re $
 set matches 0
 set my_pid [spawn $sacctmgr -i modify federation $fed3 set clusters+=$tc4]
 expect {
+	-re "The cluster $tc4 is assigned to federation $fed2$eol" {
+		incr matches
+		exp_continue
+	}
 	-re "Setting$eol" {
 		incr matches
 		exp_continue
@@ -1775,7 +1778,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 5} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -1908,11 +1911,11 @@ expect {
 		incr matches
 		exp_continue
 	}
-	-re "Cluster\\s+ = $tc1$eol" {
+	-re "Cluster\\s+ \\+= $tc1$eol" {
 		incr matches
 		exp_continue
 	}
-	-re "Cluster\\s+ = $tc2$eol" {
+	-re "Cluster\\s+ \\+= $tc2$eol" {
 		incr matches
 		exp_continue
 	}
@@ -1970,15 +1973,19 @@ if {$exit_code || $matches != 3} {
 set matches 0
 set my_pid [spawn $sacctmgr -i modify federation $fed1 set clusters=$tc1,$tc3]
 expect {
+	-re "The cluster $tc1 is already assigned to federation $fed1" {
+		incr matches
+		exp_continue
+	}
 	-re "Setting$eol" {
 		incr matches
 		exp_continue
 	}
-	-re "Cluster\\s+ = $tc1$eol" {
+	-re "Cluster\\s+ \\+= $tc3$eol" {
 		incr matches
 		exp_continue
 	}
-	-re "Cluster\\s+ = $tc3$eol" {
+	-re "Cluster\\s+ -= $tc2$eol" {
 		incr matches
 		exp_continue
 	}
@@ -1999,7 +2006,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 5} {
+if {$exit_code || $matches != 6} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -2161,16 +2168,138 @@ if {$exit_code || $matches != 2} {
 	end_it 1
 }
 
+
+set matches 0
+set my_pid [spawn $sacctmgr -i modify federation $fed1 set clusters-=$tc1,$tc3]
+expect {
+	-re "The cluster $tc1 isn't assigned to federation $fed1" {
+		incr matches
+		exp_continue
+	}
+	-re "Setting$eol" {
+		incr matches
+		exp_continue
+	}
+	-re "Cluster\\s+ -= $tc3$eol" {
+		incr matches
+		exp_continue
+	}
+	-re "^\\s+Modified federation...$eol" {
+		incr matches
+		exp_continue
+	}
+	-re "\\s+$fed1$eol" {
+		incr matches
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: sacctmgr add not responding\n"
+		slow_kill $my_pid
+		set exit_code 1
+	}
+	eof {
+		wait
+	}
+}
+if {$exit_code || $matches != 5} {
+	send_user "$matches FAILURE: unexpected error.\n"
+	end_it 1
+}
+
+set matches 0
+set my_pid [spawn $sacctmgr show federation $fed1 format="federation%20,cluster%20,fedstate%20"]
+expect {
+	-re "Federation\\s+Cluster\\s+FedState $eol" {
+		incr matches
+		exp_continue
+	}
+	-re "\\s+$fed1\\s+ $eol" {
+		incr matches
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: sacctmgr add not responding\n"
+		slow_kill $my_pid
+		set exit_code 1
+	}
+	eof {
+		wait
+	}
+}
+if {$exit_code || $matches != 2} {
+	send_user "$matches FAILURE: unexpected error.\n"
+	end_it 1
+}
+
+#####################################
+# TEST: error checking on using +, - and =
+#####################################
+set matches 0
+set my_pid [spawn $sacctmgr -i modify federation $fed1 set cluster=$tc1,+$tc2]
+expect {
+	"sacctmgr: error: You can't use '=' and '+' or '-' in the same line" {
+		incr matches
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: sacctmgr add not responding\n"
+		slow_kill $my_pid
+		set exit_code 1
+	}
+	eof {
+		wait
+	}
+}
+if {$exit_code || $matches != 1} {
+	send_user "FAILURE: failed testing mod with + and =\n"
+	end_it 1
+}
+
+set matches 0
+set my_pid [spawn $sacctmgr -i modify federation $fed1 set cluster=$tc1,-$tc2]
+expect {
+	"sacctmgr: error: You can't use '=' and '+' or '-' in the same line" {
+		incr matches
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: sacctmgr add not responding\n"
+		slow_kill $my_pid
+		set exit_code 1
+	}
+	eof {
+		wait
+	}
+}
+if {$exit_code || $matches != 1} {
+	send_user "FAILURE: failed testing mod with - and =\n"
+	end_it 1
+}
+
+
 #####################################
 # TEST: modify federation, clear clusters
 #####################################
 set matches 0
+set my_pid [spawn $sacctmgr -i modify cluster $tc1 $tc2 $tc3 set federation=$fed1]
+expect {
+}
+expect -re $
+
 set my_pid [spawn $sacctmgr -i modify federation $fed1 set clusters=]
 expect {
 	-re "Setting$eol" {
 		incr matches
 		exp_continue
 	}
+	-re "Cluster\\s+ -= $tc1$eol" {
+		incr matches
+		exp_continue
+	}
+	-re "Cluster\\s+ -= $tc2$eol" {
+		incr matches
+		exp_continue
+	}
 	-re "Cluster\\s+ -= $tc3$eol" {
 		incr matches
 		exp_continue
@@ -2192,7 +2321,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 4} {
+if {$exit_code || $matches != 6} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }
@@ -2204,7 +2333,7 @@ expect {
 		incr matches
 		exp_continue
 	}
-	-re "\\s+$fed1\\s+(\\S+)\\s+ACTIVE $eol" {
+	-re "\\s+$fed1\\s+ $eol" {
 		incr matches
 		exp_continue
 	}
@@ -2217,7 +2346,7 @@ expect {
 		wait
 	}
 }
-if {$exit_code || $matches != 1} {
+if {$exit_code || $matches != 2} {
 	send_user "$matches FAILURE: unexpected error.\n"
 	end_it 1
 }