In regards to Portugal, I caution against assuming Nap will honor the agreement of division. He may just hand the whole crown to someone, and screw Godoy/Spain (who has not been a very reliable or enthusiastic ally).
If say Fernando VII has a son, this is probably the best case scenario for Napoleon as it avoids the Spanish ulcer almost entirely. The problem with Spain was that its choice of Kings during Napoleon's reign was quite bad. Carlos IV was easily influenced, incompetent, and decadent which as a result made him despised by his people. He however was pro-Napoleon, but with Ferdinand VII having popular support to unseat his father, this became a problem for Napoleon. He couldn't really trust Carlos to rule Spain as a reliable ally because of his incompetence, while Ferdinand was less-enthused with Napoleon.
Thus Napoleon decided to cut the Gordian knot of this whole situation, and arrest both of them while installing his brother as King securing Spain as an ally. Of course this backfired in his face spectacularly. If say Ferdinand has a son, the young boy King could instead be placed on the throne. This would mostly quiet the Spanish nationalist feeling rising against Napoleon as they have a legitimate Bourbon King instead of the foreign "Jose" Bonaparte. This also keeps Joseph happy as he was popular in Naples and quite liked the Kingdom there. He could then have a soft-puppet government put in place in conjunction with a assembling and action of a Cortes to create a French-based Constitution for Spain which would probably provide some stability for Spain, allowing it to liberalize somewhat. Thought this "liberalization" should not be conflated really with democratization as Napoleon and later his nephew in otl created basically a Constitutionally absolute monarchy in the manner of the Roman Republican Monarchy which created a centralized but more absolutist state than Louis XIV could ever dream of.
A Spain influenced by a victorious Napoleonic France would likely follow a similar path.
As for Portugal, to get Spain on its side, Napoleon might grant them parts of Southern Portugal while giving Murat the new puppet Kingdom as Napoleon initially promised. This keeps Murat out of the way (prevents Caroline Bonaparte from causing problems with her schemes) and sates his ego/vanity, but would also keep him dependent of France for support as he would likely be embraced by the Portuguese population with indifference/apathy.