2 Samuel 21:1 During the reign of David, there was a famine for three successive years; so David sought the face of the Lord. The Lord said, “It is on account of Saul and his blood-stained house; it is because he put the Gibeonites to death.”

2 The king summoned the Gibeonites and spoke to them. (Now the Gibeonites were not a part of Israel but were survivors of the Amorites; the Israelites had sworn to spare them, but Saul in his zeal for Israel and Judah had tried to annihilate them.) 3 David asked the Gibeonites, “What shall I do for you? How shall I make atonement so that you will bless the Lord’s inheritance?”

4 The Gibeonites answered him, “We have no right to demand silver or gold from Saul or his family, nor do we have the right to put anyone in Israel to death.”

“What do you want me to do for you?” David asked.

5 They answered the king, “As for the man who destroyed us and plotted against us so that we have been decimated and have no place anywhere in Israel, 6 let seven of his male descendants be given to us to be killed and their bodies exposed before the Lord at Gibeah of Saul—the Lord’s chosen one.”

So the king said, “I will give them to you.”

7 The king spared Mephibosheth son of Jonathan, the son of Saul, because of the oath before the Lord between David and Jonathan son of Saul. 8 But the king took Armoni and Mephibosheth, the two sons of Aiah’s daughter Rizpah, whom she had borne to Saul, together with the five sons of Saul’s daughter Merab,[a] whom she had borne to Adriel son of Barzillai the Meholathite. 9 He handed them over to the Gibeonites, who killed them and exposed their bodies on a hill before the Lord. All seven of them fell together; they were put to death during the first days of the harvest, just as the barley harvest was beginning.

10 Rizpah daughter of Aiah took sackcloth and spread it out for herself on a rock. From the beginning of the harvest till the rain poured down from the heavens on the bodies, she did not let the birds touch them by day or the wild animals by night. 11 When David was told what Aiah’s daughter Rizpah, Saul’s concubine, had done, 12 he went and took the bones of Saul and his son Jonathan from the citizens of Jabesh Gilead. (They had stolen their bodies from the public square at Beth Shan, where the Philistines had hung them after they struck Saul down on Gilboa.) 13 David brought the bones of Saul and his son Jonathan from there, and the bones of those who had been killed and exposed were gathered up.

14 They buried the bones of Saul and his son Jonathan in the tomb of Saul’s father Kish, at Zela in Benjamin, and did everything the king commanded. After that, God answered prayer in behalf of the land.

a. 2 Samuel 21:8 Two Hebrew manuscripts, some Septuagint manuscripts and Syriac (see also 1 Samuel 18:19); most Hebrew and Septuagint manuscripts Michal

This is from enduringword.com.

In the days of Joshua – more than 400 years before David’s time – Israel swore not to harm the Gibeonites, a neighboring tribe (Joshua 9). God expected Israel to keep its promise, even though the Gibeonites tricked Israel into making the agreement. Saul’s crime was not only in killing the Gibeonites but also in breaking this ancient and important oath.

Joshua 9 was an interesting story. It was around the time of Jericho. The Gibeonites were next on the list to be annihilated just as Jericho and Ai had. Those shifty Gibeonites knew that the Israelites would make a peace treaty with people who lived far away. So they sent a delegation to see Joshua [head judge of the Israelites at the time]. They dressed the delegate up like he had been on the road a long long long time.... and they got away with it. Joshua made the treaty.... and even tho they were tricked into swearing an oath.... they still had to own up to it.

This is from Bibletrack.org.

Well...Saul's been dead for quite sometime, but now Israel has famine; David discovers (from the Lord) that it is because of Saul's wrongdoing in violating his oath to the Gibeonites. David goes to these Gibeonites to see what it will take for them to be appeased for Saul's wrongdoing. David gets outsmarted here; look at II Samuel 21:4, "And the Gibeonites said unto him, We will have no silver nor gold of Saul, nor of his house; neither for us shalt thou kill any man in Israel. And he said, What ye shall say, that will I do for you." David had been assured in his negotiations with them that nobody had to die here, but he didn't listen very well to the fine print of the carefully-worded contract before he agreed to its terms. They want to do their own killing of Saul's descendants.

David has already agreed (an oath, you see) to the terms of the contract, so he then surrenders seven children and grandchildren of Saul to the Gibeonites at their request for execution. Michal, David's wife, had been raising her sister's (Merab) five children. They were surrendered for death among the seven. It's a gruesome story. David had made a promise to Jonathan regarding his offspring. Therefore, Mephibosheth was not surrendered. Let's face it, David was outsmarted here. He should have consulted with God before he agreed to the contract with the Gibeonites. While God had chastised Israel for Saul's disregard for Israel's oath with them, God was not a party to this solution. However, verse 14 tells us that, despite the troubling solution agreed to by David, God responded by lifting the famine.

So... the Gibeonites were really quite quick.... they tricked Joshua into signing a peace treaty. Then hundreds of years later... they tricked David into giving them "What ye shall say, that I will do for you".

Did you notice though... Michal, David's wife, had been raising her sister's children? Children who had grown up in David's home were executed.