00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LVM_LV_H
00024 #define LVM_LV_H
00025
00026 #include "storage/Dm.h"
00027
00028
00029 namespace storage
00030 {
00031
00032 class LvmVg;
00033
00034 class LvmLv : public Dm
00035 {
00036 public:
00037
00038 LvmLv(const LvmVg& c, const string& name, const string& device, const string& origin,
00039 unsigned long le, const string& uuid, const string& status, const string& alloc);
00040 LvmLv(const LvmVg& c, const string& name, const string& device, const string& origin,
00041 unsigned long le, unsigned stripe);
00042 LvmLv(const LvmVg& c, const xmlNode* node);
00043 LvmLv(const LvmVg& c, const LvmLv& v);
00044 virtual ~LvmLv();
00045
00046 void saveData(xmlNode* node) const;
00047
00048 const LvmVg* vg() const;
00049
00050 void calcSize();
00051
00052 void getState(LvmLvSnapshotStateInfo& info);
00053
00054 void setOrigin( const string& o ) { origin=o; }
00055 string getOrigin() const { return origin; }
00056
00057 bool isSnapshot() const { return !origin.empty(); }
00058 bool hasSnapshots() const;
00059
00060 void setUuid( const string& uuid ) { vol_uuid=uuid; }
00061 void setStatus( const string& s ) { status=s; }
00062 void setAlloc( const string& a ) { allocation=a; }
00063 friend std::ostream& operator<< (std::ostream& s, const LvmLv &p );
00064 virtual void print( std::ostream& s ) const { s << *this; }
00065 Text removeText( bool doing ) const;
00066 Text createText( bool doing ) const;
00067 Text formatText( bool doing ) const;
00068 Text resizeText( bool doing ) const;
00069 void getInfo( storage::LvmLvInfo& info ) const;
00070 bool equalContent( const LvmLv& rhs ) const;
00071 virtual list<string> getUsing() const;
00072 void logDifference(std::ostream& log, const LvmLv& rhs) const;
00073
00074 static bool notDeleted(const LvmLv& l) { return !l.deleted(); }
00075
00076 protected:
00077 static string makeDmTableName(const string& vg_name, const string& lv_name);
00078
00079 virtual const string shortPrintedName() const { return "Lv"; }
00080
00081 string origin;
00082
00083 string vol_uuid;
00084 string status;
00085 string allocation;
00086
00087 mutable storage::LvmLvInfo info;
00088
00089 private:
00090
00091 LvmLv(const LvmLv&);
00092 LvmLv& operator=(const LvmLv&);
00093
00094 };
00095
00096 }
00097
00098 #endif