Exemplo n.º 1
0
void CMirrorWorkThread::RebindMirror()
{
	// Get list of disks involved in the previous mirroring.
	// NOTE : Because disks aggregated can also be mirrored,
	//	there can be more than two disks involved in the mirroring.
	CDiskObjectPtr aggregationRoot;
	aggregationRoot = m_pSource->GetParent();
	while ( !aggregationRoot->GetParent()->IsRoot() )
	{
		aggregationRoot = aggregationRoot->GetParent();
	}

	// Mark all the bitmaps dirty.
	m_pSource->OpenExclusive();
	m_pDest->OpenExclusive();
	m_pSource->MarkAllBitmap();

	CUnitDiskInfoHandlerPtr pHandler = m_pSource->GetInfoHandler();
	aggregationRoot->Rebind( 
						m_pDest, 
						pHandler->GetPosInBind() ^ 0x01
						);
	aggregationRoot->CommitDiskInfo(TRUE);


	// Write binding information to the destination disk
	m_pDest->Mirror(m_pSource);
	m_pDest->CommitDiskInfo(TRUE);
	m_bRebound = TRUE;

	m_pSource->Close();
	m_pDest->Close();
}