00001 #ifndef LVM_LV_H
00002 #define LVM_LV_H
00003
00004 #include <map>
00005
00006 #include "y2storage/Dm.h"
00007
00008 namespace storage
00009 {
00010
00011 class LvmVg;
00012
00013 class LvmLv : public Dm
00014 {
00015 public:
00016 LvmLv(const LvmVg& d, const string& name, const string& origin, unsigned long le,
00017 const string& uuid, const string& status, const string& alloc);
00018 LvmLv(const LvmVg& d, const string& name, const string& origin, unsigned long le,
00019 unsigned stripe);
00020 LvmLv(const LvmVg& d, const LvmLv& l);
00021
00022 virtual ~LvmLv();
00023
00024 const LvmVg* vg() const;
00025
00026 void calcSize();
00027
00028 void getState(LvmLvSnapshotStateInfo& info);
00029
00030 void setOrigin( const string& o ) { origin=o; }
00031 string getOrigin() const { return origin; }
00032
00033 bool isSnapshot() const { return !origin.empty(); }
00034 bool hasSnapshots() const;
00035
00036 void setUuid( const string& uuid ) { vol_uuid=uuid; }
00037 void setStatus( const string& s ) { status=s; }
00038 void setAlloc( const string& a ) { allocation=a; }
00039 friend std::ostream& operator<< (std::ostream& s, const LvmLv &p );
00040 virtual void print( std::ostream& s ) const { s << *this; }
00041 string removeText( bool doing ) const;
00042 string createText( bool doing ) const;
00043 string formatText( bool doing ) const;
00044 string resizeText( bool doing ) const;
00045 void getInfo( storage::LvmLvInfo& info ) const;
00046 bool equalContent( const LvmLv& rhs ) const;
00047 void logDifference( const LvmLv& d ) const;
00048
00049 protected:
00050 void init( const string& name );
00051 virtual const string shortPrintedName() const { return( "Lv" ); }
00052 LvmLv& operator=( const LvmLv& );
00053
00054 string origin;
00055
00056 string vol_uuid;
00057 string status;
00058 string allocation;
00059 mutable storage::LvmLvInfo info;
00060 };
00061
00062 }
00063
00064 #endif