|
yast2-storage
|
00001 /* 00002 * Copyright (c) [2004-2010] Novell, Inc. 00003 * 00004 * All Rights Reserved. 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of version 2 of the GNU General Public License as published 00008 * by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, but WITHOUT 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 * more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, contact Novell, Inc. 00017 * 00018 * To contact Novell about this file by physical or electronic mail, you may 00019 * find current contact information at www.novell.com. 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 SystemInfo& si); 00041 LvmLv(const LvmVg& c, const string& name, const string& device, const string& origin, 00042 unsigned long le, unsigned stripe ); 00043 LvmLv(const LvmVg& c, const xmlNode* node); 00044 LvmLv(const LvmVg& c, const LvmLv& v); 00045 virtual ~LvmLv(); 00046 00047 void saveData(xmlNode* node) const; 00048 00049 const LvmVg* vg() const; 00050 00051 void calcSize(); 00052 00053 void getState(LvmLvSnapshotStateInfo& info); 00054 00055 void setOrigin( const string& o ) { origin=o; } 00056 string getOrigin() const { return origin; } 00057 00058 bool isSnapshot() const { return !origin.empty(); } 00059 bool hasSnapshots() const; 00060 00061 bool isPool() const { return pool; } 00062 void setPool( bool p=true ) { pool=p; } 00063 const string& usedPool() const { return used_pool; } 00064 void setUsedPool( const string& val ) { used_pool=val; } 00065 bool isThin() const { return !used_pool.empty(); } 00066 unsigned long long chunkSize() const { return chunk_size; } 00067 void setChunkSize( unsigned long long val ) { chunk_size=val; } 00068 00069 void setUuid( const string& uuid ) { vol_uuid=uuid; } 00070 void setStatus( const string& s ) { status=s; } 00071 void setAlloc( const string& a ) { allocation=a; } 00072 00073 friend std::ostream& operator<< (std::ostream& s, const LvmLv &p ); 00074 bool operator< ( const LvmLv& rhs ) const; 00075 bool operator<= ( const LvmLv& rhs ) const 00076 { return( *this<rhs || *this==rhs ); } 00077 bool operator>= ( const LvmLv& rhs ) const 00078 { return( !(*this<rhs) ); } 00079 bool operator> ( const LvmLv& rhs ) const 00080 { return( !(*this<=rhs) ); } 00081 00082 virtual void print( std::ostream& s ) const { s << *this; } 00083 Text removeText( bool doing ) const; 00084 Text createText( bool doing ) const; 00085 Text formatText( bool doing ) const; 00086 Text resizeText( bool doing ) const; 00087 int setFormat( bool format, storage::FsType fs ); 00088 int changeMount( const string& val ); 00089 void getInfo( storage::LvmLvInfo& info ) const; 00090 bool equalContent( const LvmLv& rhs ) const; 00091 virtual list<string> getUsing() const; 00092 void logDifference(std::ostream& log, const LvmLv& rhs) const; 00093 00094 static bool notDeleted(const LvmLv& l) { return !l.deleted(); } 00095 00096 protected: 00097 static string makeDmTableName(const string& vg_name, const string& lv_name); 00098 00099 virtual const string shortPrintedName() const { return "Lv"; } 00100 00101 string origin; // only for snapshots, empty otherwise 00102 00103 string vol_uuid; 00104 string status; 00105 string allocation; 00106 string used_pool; // indicates a thin volumes, empty otherwise 00107 unsigned long long chunk_size; 00108 bool pool; 00109 00110 mutable storage::LvmLvInfo info; // workaround for broken ycp bindings 00111 00112 private: 00113 00114 LvmLv(const LvmLv&); // disallow 00115 LvmLv& operator=(const LvmLv&); // disallow 00116 00117 }; 00118 00119 } 00120 00121 #endif
1.7.3