it depends on what you want to do with the "migrate" part of it.

Basically - the monitoring in the QDB's that are on Servers A and B will be lost (the monitoring that is controlled by Control Center - ie any policies that a CC policies). Those 2 QDBs will be removed from CC on Server A and then added to CC on Server 1. You can do that after upgrading them in situ on their current location. Or you can move them over to the new environment whilst they are still AM7 (so long as they are patched accordingly).

I guess the easiest way forward is to get the AM7 environment upgraded to the same version as the AM8 environment. Then remove the 2 QDBs from CC. This will force a stop of all policies that were configured from CC. Any ad-hoc jobs will remain, as will any policies that had been defined in the QDB (so you can either leave them as they are or remove/stop them in preparation for the move to the new CC environment).

Then you add the QDBs to the new CC environment where they will start to inherit the policies defined there - either automatically from any Rule Based MGs and wildcard based MGs, or as you add QDB views to MGs.

The agents can be upgraded at a time that is best - upgrading the core components does not force you to upgrade the agents at the same time. You can do that later. Also, adding the QDBs to the new environment has no effect on the MSs for those QDBs. Those would be upgraded as a part of the QDB upgrades, but can remain the same servers throughout. So the agents from those QDBs will see no changes in core...