void CMirDiskObject::MigrateV1() { if(::IsEmptyDisk(FirstDisk()) || ::IsEmptyDisk(SecondDisk())) return; // // To migrate, all the disks in the bound must exist // In version 1, only 2 disks can be bound. // ATLASSERT( GetDiskCount() == 2 ); // CUnitDiskObjectPtr firstDisk, secondDisk; CUnitDiskObjectVector vtDisks; // firstDisk = boost::dynamic_pointer_cast<CUnitDiskObject>( front() ); // secondDisk = boost::dynamic_pointer_cast<CUnitDiskObject>( back() ); vtDisks.push_back( FirstDisk() ); vtDisks.push_back( SecondDisk() ); // // Unbind disks & bind again with version 2 information // FirstDisk()->UnBind( FirstDisk() ); SecondDisk()->UnBind( SecondDisk() ); FirstDisk()->Bind( vtDisks, 0, NMT_RAID1 ); SecondDisk()->Bind( vtDisks, 1, NMT_RAID1 ); }
void CAggrDiskObject::MigrateV1() { // // To migrate, all the disks in the bound must exist // In version 1, only 2 disks can be bound. // ATLASSERT( GetDiskCount() == 2 ); CUnitDiskObjectPtr firstDisk, secondDisk; CUnitDiskObjectVector vtDisks; firstDisk = boost::dynamic_pointer_cast<CUnitDiskObject>( front() ); secondDisk = boost::dynamic_pointer_cast<CUnitDiskObject>( back() ); vtDisks.push_back( firstDisk ); vtDisks.push_back( secondDisk ); // // Unbind disks & bind again with version 2 information // firstDisk->UnBind( firstDisk ); secondDisk->UnBind( secondDisk ); firstDisk->Bind( vtDisks, 0, NMT_AGGREGATE ); secondDisk->Bind( vtDisks, 1, NMT_AGGREGATE ); }
BOOL CRAID0DiskObject::IsUsable() const { if ( GetDiskCount() < GetDiskCountInBind() ) return FALSE; // requires all disks in bind be usable BOOL bUsable = TRUE; CDiskObjectList::const_iterator itr; for ( itr = begin(); itr != end(); ++itr ) // Since CRAID0DiskObject is subclass of std::list, // we can use begin, end directly { if ( !(*itr)->IsUsable() ) { bUsable = FALSE; break; } } return bUsable; }
int main(int argc,char * argv[]) { printf("DiskCount: %d\n",GetDiskCount()); return 0; }