So General Petraeus is being promoted to top General in Iraq. Good for him. If you don't know about this Petraeus fellow, the sentence-long description of him is "the one general to leave Iraq looking better than when he came in." After his first tour in Iraq as commander of the 101st Airborne division -- where he had some substantial successes under his belt -- he returned to the US to write the US Army's new counterinsurgency doctrine. Pretty much everyone has a high opinion of him -- see Spencer Ackerman and Juan Cole, for typical examples.
Which is what makes his promotion such a shame. If there's one officer that the US Army needs, it's men like Petraeus. But he's being promoted to preside over a funeral -- mourning the rotting corpse of US ambitions in Iraq. Any delusions that he can "turn things around" in Iraq would have been appropriate, oh, in August of 2003 or so. Now it's all fantasy.
One of the basic rules of war: Commanders matter (quite a lot) but they aren't miracle workers. You can do everything right and still lose.
The US will have to leave Iraq, will have to do it under Petraeus' tenure (almost certainly) and his career will bear the black mark for that failure, even if the failure isn't his. The military is not generally amenable to the "nobody else could have done better" argument, even when it's clearly true, so when disasters happen officers tend to be sacked.
One final thing to note is that at least part of Petraeus' success -- and here I don't want to take anything from the man -- is due to the fact that he was operating in some of the most heavily-Kurd areas of Iraq, where US presence is still popular. It doesn't diminish any of his successes to say that he had some advantages commanders in other locations didn't.