For years, rumors percolated that HP was trying to sell its troubled consulting unit, Enterprise Services.

At the same time, HP Enterprise CEO Meg Whitman kept insisting the unit was essential to her company's future and that she was committed to it.

On Tuesday, Whitman shocked everyone with an elegant new plan that lets her do both.

She is dumping the unit in the lap of its arch competitor, CSC (which has faced a lot of its own troubles in recent years) and HP's Enterprise Services business and CSC will merge to form a new company.

HP Enterprise will own half of the company. The new company has a three-year commitment with HP Enterprise to continue to push HP Enterprise's hardware and software.

According to one long-time former employee we talked to, who recently left the company, employees inside HP Enterprise said the plan "came as a complete shock to them."

But among those who work in other HP Enterprise units "most are glad to get rid of that boat anchor," this person said.

A weird bird for HP

Whitman inherited command of HP Enterprise when the old HP split into two companies in 2015. (The other company, HP Inc., sells hardware like printers and PCs.)

Within HP Enterprise lived a division called HP Enterprise Services, which provided consulting and services for big customers.

It was formed when HP bought EDS in 2008 for $13.9 billion. Many HP employees we talked to said the two companies, HP and EDS were never a good culture fit.

As the person we talked to described it, "In my own experience, they were difficult to work with and never were fully integrated into HP."

Consulting is an employee-heavy kind of business and the division nearly doubled HP's headcount, from 172,000 to more than 311,000 in 2008.

From the get go, the unit had layoffs but as Enterprise Services revenues tanked, by 2012, HP began cutting deeper.

The company got rid of more than 55,000 people, and had plans to cut another 25,000 - 30,000 people.

On top of that, Whitman also said she was offshoring up to 60% of the unit's remaining jobs in order to lower costs and bring profit margins up to 9%.

HP Enterprise did other things to reduce headcount. Last year, it told thousands that they were to go for a contract labor company, doing their same jobs, typically for less pay and benefits. If they refused and quit they might not be entitled to severance. (Some HP employees staged a revolt and, surprisingly, won.)

All told, HP had been spending about $1 billion a year for the last seven years cutting jobs.

Employees shifting to the new company probably won't be spared layoffs.

Whitman warned that there will "cost synergies" of $1.5 billion to be had after the transaction closes in 2017 and that word almost always includes cutting jobs.

But the savings won't just come from layoffs. For instance, between the two companies they have 95 data centers. "Okay, we definitely do not need 95 data centers," Whitman says.

CSC is like HP's doppelganger

CSC CEO Mike Lawrie CSC For its part, CSC had its own troubles.

CSO also had layoffs, filed a weird a lawsuit accusing one of its star executives of fraud (which the executive denied); paid $190 million penalty to settle the charges from the SEC over how certain executives were doing the books, and ended 2015, by cleaving its company into two.

CSC's CEO Mike Lawrie will be tapped as chairman and CEO of the new joint company. Whitman and HP's exec running HP Enterprise Services will be on the new company's board.