Author: aschnell
Date: Mon Aug 18 14:10:49 2008
New Revision: 50175
URL: http://svn.opensuse.org/viewcvs/yast?rev=50175&view=rev
Log:
- merged snapshot changes r50049:50173 into trunk
Modified:
trunk/storage/VERSION
trunk/storage/libstorage/src/Dm.cc
trunk/storage/libstorage/src/Dm.h
trunk/storage/libstorage/src/LvmLv.cc
trunk/storage/libstorage/src/LvmLv.h
trunk/storage/libstorage/src/LvmVg.cc
trunk/storage/libstorage/src/LvmVg.h
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/Storage.h
trunk/storage/libstorage/src/StorageDefines.h
trunk/storage/libstorage/src/StorageInterface.h
trunk/storage/package/yast2-storage.changes
Modified: trunk/storage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/VERSION (original)
+++ trunk/storage/VERSION Mon Aug 18 14:10:49 2008
@@ -1 +1 @@
-2.17.19
+2.17.20
Modified: trunk/storage/libstorage/src/Dm.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Dm.cc?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Dm.cc (original)
+++ trunk/storage/libstorage/src/Dm.cc Mon Aug 18 14:10:49 2008
@@ -95,6 +95,14 @@
y2warning( "could not find major/minor pair %s",
majmin.c_str());
}
+ else if (target == "snapshot-origin")
+ {
+ // AFAIS snapshot-origins do not really use space.
+ }
+ else if (target == "snapshot")
+ {
+ // AFAIS think snapshots do not really use space.
+ }
else if( target=="striped" )
{
unsigned str;
Modified: trunk/storage/libstorage/src/Dm.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Dm.h?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Dm.h (original)
+++ trunk/storage/libstorage/src/Dm.h Mon Aug 18 14:10:49 2008
@@ -27,7 +27,7 @@
void setLe( unsigned long long le );
void modifyPeSize( unsigned long long old, unsigned long long neww );
bool removeTable();
- void calcSize();
+ virtual void calcSize();
const std::map& getPeMap() const { return( pe_map ); }
void setPeMap( const std::map& m );
unsigned long long usingPe( const string& dev ) const;
Modified: trunk/storage/libstorage/src/LvmLv.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmLv.cc?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LvmLv.cc (original)
+++ trunk/storage/libstorage/src/LvmLv.cc Mon Aug 18 14:10:49 2008
@@ -9,14 +9,18 @@
#include "y2storage/SystemCmd.h"
#include "y2storage/AppUtil.h"
#include "y2storage/Storage.h"
+#include "y2storage/StorageDefines.h"
using namespace storage;
using namespace std;
-LvmLv::LvmLv( const LvmVg& d, const string& name, unsigned long le,
- const string& uuid, const string& stat, const string& alloc ) :
- Dm( d, dupDash(d.name())+"-"+dupDash(name) )
- {
+
+LvmLv::LvmLv(const LvmVg& d, const string& name, const string& origi,
+ unsigned long le, const string& uuid, const string& stat,
+ const string& alloc)
+ : Dm( d, dupDash(d.name())+"-"+dupDash(name) ),
+ origin(origi)
+{
init( name );
setUuid( uuid );
setStatus( stat );
@@ -24,28 +28,38 @@
setLe( le );
calcSize();
getTableInfo();
- y2debug( "constructed lvm lv %s on vg %s", dev.c_str(),
- cont->name().c_str() );
- }
-LvmLv::LvmLv( const LvmVg& d, const string& name, unsigned long le,
- unsigned str ) :
- Dm( d, dupDash(d.name())+"-"+dupDash(name) )
- {
+ y2deb("constructed lvm lv dev:" << dev << " vg:" << cont->name() << " origin:" << origin);
+}
+
+
+LvmLv::LvmLv(const LvmVg& d, const string& name, const string& origi,
+ unsigned long le, unsigned str)
+ : Dm( d, dupDash(d.name())+"-"+dupDash(name) ),
+ origin(origi)
+{
init( name );
setLe( le );
calcSize();
stripe = str;
fs = detected_fs = FSNONE;
alt_names.push_back( "/dev/mapper/" + dupDash(cont->name()) + "-" + dupDash(name) );
- y2debug( "constructed lvm lv %s on vg %s", dev.c_str(),
- cont->name().c_str() );
- }
+
+ y2deb("constructed lvm lv dev:" << dev << " vg:" << cont->name() << " origin:" << origin);
+}
+
LvmLv::~LvmLv()
- {
- y2debug( "destructed lvm lv %s", dev.c_str() );
- }
+{
+ y2deb("destructed lvm lv dev:" << dev);
+}
+
+
+const LvmVg* LvmLv::vg() const
+{
+ return(dynamic_cast(cont));
+}
+
void LvmLv::init( const string& name )
{
@@ -54,6 +68,67 @@
Dm::init();
}
+
+void LvmLv::calcSize()
+{
+ if (!isSnapshot())
+ {
+ Dm::calcSize();
+ }
+ else
+ {
+ LvmVg::ConstLvmLvPair p = vg()->LvmVg::lvmLvPair(LvmVg::lvNotDeleted);
+ LvmVg::ConstLvmLvIter i = p.begin();
+ while( i!=p.end() && i->name()!=origin )
+ ++i;
+ if (i != p.end())
+ {
+ setSize(i->sizeK());
+ }
+ else
+ {
+ setSize(0);
+ y2err("not found " << origin);
+ }
+ }
+}
+
+
+bool
+LvmLv::hasSnapshots() const
+{
+ LvmVg::ConstLvmLvPair p = vg()->LvmVg::lvmLvPair(LvmVg::lvNotDeleted);
+ LvmVg::ConstLvmLvIter i = p.begin();
+ while( i!=p.end() && i->getOrigin()!=name() )
+ ++i;
+ return i != p.end();
+}
+
+
+void
+LvmLv::getState(LvmLvSnapshotStateInfo& info)
+{
+ SystemCmd cmd(LVSBIN " --options lv_name,lv_attr,snap_percent " + quote(cont->name()));
+
+ if (cmd.retcode() == 0 && cmd.numLines() > 0)
+ {
+ for (unsigned int l = 1; l < cmd.numLines(); l++)
+ {
+ string line = *cmd.getLine(l);
+
+ if (extractNthWord(0, line) == name())
+ {
+ string attr = extractNthWord(1, line);
+ info.active = attr.size() >= 6 && attr[4] == 'a';
+
+ string percent = extractNthWord(2, line);
+ percent >> info.allocated;
+ }
+ }
+ }
+}
+
+
string LvmLv::removeText( bool doing ) const
{
string txt;
@@ -219,6 +294,10 @@
info.allocation = allocation;
info.dm_table = tname;
info.dm_target = target;
+
+ info.sizeK = num_le * pec()->peSize();
+ info.origin = origin;
+
tinfo = info;
}
Modified: trunk/storage/libstorage/src/LvmLv.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmLv.h?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LvmLv.h (original)
+++ trunk/storage/libstorage/src/LvmLv.h Mon Aug 18 14:10:49 2008
@@ -13,13 +13,26 @@
class LvmLv : public Dm
{
public:
- LvmLv( const LvmVg& d, const string& name, unsigned long le,
- const string& uuid, const string& status, const string& alloc );
- LvmLv( const LvmVg& d, const string& name, unsigned long le,
- unsigned stripe );
- LvmLv( const LvmVg& d, const LvmLv& l );
+ LvmLv(const LvmVg& d, const string& name, const string& origin, unsigned long le,
+ const string& uuid, const string& status, const string& alloc);
+ LvmLv(const LvmVg& d, const string& name, const string& origin, unsigned long le,
+ unsigned stripe);
+ LvmLv(const LvmVg& d, const LvmLv& l);
virtual ~LvmLv();
+
+ const LvmVg* vg() const;
+
+ void calcSize();
+
+ void getState(LvmLvSnapshotStateInfo& info);
+
+ void setOrigin( const string& o ) { origin=o; }
+ string getOrigin() const { return origin; }
+
+ bool isSnapshot() const { return !origin.empty(); }
+ bool hasSnapshots() const;
+
void setUuid( const string& uuid ) { vol_uuid=uuid; }
void setStatus( const string& s ) { status=s; }
void setAlloc( const string& a ) { allocation=a; }
@@ -38,6 +51,8 @@
virtual const string shortPrintedName() const { return( "Lv" ); }
LvmLv& operator=( const LvmLv& );
+ string origin; // only for snapshots, empty otherwise
+
string vol_uuid;
string status;
string allocation;
Modified: trunk/storage/libstorage/src/LvmVg.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmVg.cc?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LvmVg.cc (original)
+++ trunk/storage/libstorage/src/LvmVg.cc Mon Aug 18 14:10:49 2008
@@ -279,7 +279,7 @@
ret = addLvPeDistribution( num_le, stripe, pv, pv_add, pe_map );
if( ret==0 )
{
- LvmLv* l = new LvmLv( *this, name, num_le, stripe );
+ LvmLv* l = new LvmLv( *this, name, "", num_le, stripe );
l->setCreated( true );
l->setPeMap( pe_map );
device = l->device();
@@ -297,13 +297,24 @@
int ret = 0;
y2milestone( "newSizeK:%llu vol:%s", newSize, v->name().c_str() );
checkConsistency();
- if( readonly() )
- {
+
+ LvmLv * l = dynamic_cast(v);
+
+ if (readonly())
+ {
ret = LVM_CHANGE_READONLY;
- }
- else
- {
- LvmLv * l = dynamic_cast(v);
+ }
+ else if (l->isSnapshot())
+ {
+ ret = LVM_LV_IS_SNAPSHOT;
+ }
+ else if (l->hasSnapshots())
+ {
+ ret = LVM_LV_HAS_SNAPSHOTS;
+ }
+
+ if (ret == 0)
+ {
unsigned long new_le = sizeToLe(newSize);
if( l->stripes()>1 )
new_le = ((new_le+l->stripes()-1)/l->stripes())*l->stripes();
@@ -347,7 +358,7 @@
{
ret = LVM_CHECK_RESIZE_INVALID_VOLUME;
}
- }
+ }
if( ret==0 )
checkConsistency();
y2milestone( "ret:%d", ret );
@@ -378,6 +389,8 @@
++i;
if( i==p.end() )
ret = LVM_LV_UNKNOWN_NAME;
+ else if (i->hasSnapshots())
+ ret = LVM_LV_HAS_SNAPSHOTS;
}
if( ret==0 && i->getUsedByType() != UB_NONE )
{
@@ -494,6 +507,126 @@
return( ret );
}
+
+int
+LvmVg::createLvSnapshot(const string& origin, const string& name,
+ unsigned long long cowSizeK, string& device)
+{
+ int ret = 0;
+ device.erase();
+ y2mil("origin:" << origin << " name:" << name << " cowSizeK:" << cowSizeK );
+ checkConsistency();
+ if (readonly())
+ {
+ ret = LVM_CHANGE_READONLY;
+ }
+ if (ret == 0 && name.find("\"\' /\n\t:*?") != string::npos)
+ {
+ ret = LVM_LV_INVALID_NAME;
+ }
+ int stripe = 1;
+ if (ret == 0)
+ {
+ LvmLvPair p = lvmLvPair(lvNotDeleted);
+ LvmLvIter i = p.begin();
+ while (i != p.end() && i->name() != origin)
+ ++i;
+ if (i == p.end())
+ ret = LVM_LV_UNKNOWN_ORIGIN;
+ else
+ stripe = i->stripes();
+ }
+ if (ret == 0)
+ {
+ LvmLvPair p = lvmLvPair(lvNotDeleted);
+ LvmLvIter i = p.begin();
+ while (i != p.end() && i->name() != name)
+ ++i;
+ if (i != p.end())
+ ret = LVM_LV_DUPLICATE_NAME;
+ }
+ unsigned long num_le = sizeToLe(cowSizeK);
+ if( stripe>1 )
+ num_le = ((num_le+stripe-1)/stripe)*stripe;
+ if (ret == 0 && free_pe < num_le)
+ {
+ ret = LVM_LV_NO_SPACE;
+ }
+ map pe_map;
+ if (ret == 0)
+ ret = addLvPeDistribution(num_le, stripe, pv, pv_add, pe_map);
+ if (ret == 0)
+ {
+ LvmLv* l = new LvmLv(*this, name, origin, num_le, stripe);
+ l->setCreated(true);
+ l->setPeMap(pe_map);
+ device = l->device();
+ free_pe -= num_le;
+ addToList(l);
+ }
+ if (ret == 0)
+ checkConsistency();
+ y2mil("ret:" << ret << " device:" << device);
+ return ret;
+}
+
+
+int
+LvmVg::removeLvSnapshot(const string& name)
+{
+ int ret = 0;
+ y2mil("name:" << name);
+ if( ret==0 )
+ {
+ LvmLvPair p=lvmLvPair(lvNotDeleted);
+ LvmLvIter i=p.begin();
+ while( i!=p.end() && i->name()!=name )
+ ++i;
+ if (i==p.end())
+ ret = LVM_LV_UNKNOWN_NAME;
+ else if (!i->isSnapshot())
+ ret = LVM_LV_NOT_SNAPSHOT;
+ }
+ if (ret == 0)
+ {
+ ret = removeLv(name);
+ }
+ y2mil("ret:" << ret);
+ return ret;
+}
+
+
+int
+LvmVg::getLvSnapshotState(const string& name, LvmLvSnapshotStateInfo& info)
+{
+ int ret = 0;
+ y2mil("name:" << name);
+ LvmLvIter i;
+ checkConsistency();
+ if (ret == 0)
+ {
+ LvmLvPair p=lvmLvPair(lvNotDeleted);
+ i=p.begin();
+ while( i!=p.end() && i->name()!=name )
+ ++i;
+ if (i == p.end())
+ ret = LVM_LV_UNKNOWN_NAME;
+ else if (!i->isSnapshot())
+ ret = LVM_LV_NOT_SNAPSHOT;
+ }
+ if (ret == 0 && i->created())
+ {
+ ret = LVM_LV_NOT_ON_DISK;
+ }
+ if (ret == 0)
+ {
+ i->getState(info);
+ }
+ y2mil("ret:" << ret);
+ return ret;
+}
+
+
void LvmVg::getVgData( const string& name, bool exists )
{
y2milestone( "name:%s", name.c_str() );
@@ -559,10 +692,12 @@
line = *c.getLine( i++ );
}
string vname;
+ string origin;
string uuid;
string status;
string allocation;
unsigned long num_le = 0;
+ unsigned long num_cow_le = 0;
bool readOnly = false;
while( line.find( "Physical volume" )==string::npos && i> num_le;
}
+ else if (line.find( "COW-table LE" ) == 0)
+ {
+ extractNthWord( 2, line ) >> num_cow_le;
+ }
else if( line.find( "Allocation" ) == 0 )
{
allocation = extractNthWord( 1, line );
@@ -601,9 +750,9 @@
line = *c.getLine( i++ );
}
if( !vname.empty() )
- {
- addLv( num_le, vname, uuid, status, allocation, readOnly );
- }
+ {
+ addLv(origin.empty() ? num_le : num_cow_le, vname, origin, uuid, status, allocation, readOnly);
+ }
Pv *p = new Pv;
while( isetLe( le );
if( i->created() )
@@ -705,6 +854,7 @@
}
i->setUuid( uuid );
i->setStatus( status );
+ i->setOrigin( origin );
i->setAlloc( alloc );
i->getTableInfo();
i->updateMajorMinor();
@@ -722,7 +872,7 @@
if( i==p.end() )
{
num_lv++;
- LvmLv *n = new LvmLv( *this, name, le, uuid, status, alloc );
+ LvmLv *n = new LvmLv( *this, name, origin, le, uuid, status, alloc );
if( ro )
n->setReadonly();
if( !n->inactive() )
@@ -734,11 +884,12 @@
}
}
}
- name = uuid = status = alloc = "";
+ name = origin = uuid = status = alloc = "";
le = 0;
ro = false;
}
+
void LvmVg::addPv( Pv*& p )
{
PeContainer::addPv( p );
@@ -1177,14 +1328,23 @@
}
checkConsistency();
string cmd = LVCREATEBIN " " + instSysString() + " -l " + decString(l->getLe());
- if( l->stripes()>1 )
+ if (l->getOrigin().empty())
+ {
+ if( l->stripes()>1 )
{
- cmd += " -i " + decString(l->stripes());
- if( l->stripeSize()>0 )
- cmd += " -I " + decString(l->stripeSize());
+ cmd += " -i " + decString(l->stripes());
+ if( l->stripeSize()>0 )
+ cmd += " -I " + decString(l->stripeSize());
}
- cmd += " -n " + quote(l->name());
- cmd += " " + quote(name());
+ cmd += " --name " + quote(l->name());
+ cmd += " " + quote(name());
+ }
+ else
+ {
+ cmd += " --snapshot";
+ cmd += " --name " + quote(l->name());
+ cmd += " " + quote(name() + "/" + l->getOrigin());
+ }
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
Modified: trunk/storage/libstorage/src/LvmVg.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmVg.h?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LvmVg.h (original)
+++ trunk/storage/libstorage/src/LvmVg.h Mon Aug 18 14:10:49 2008
@@ -10,6 +10,7 @@
class LvmVg : public PeContainer
{
friend class Storage;
+ friend class LvmLv;
public:
LvmVg( Storage * const s, const string& Name );
@@ -34,6 +35,11 @@
int changeStripeSize( const string& name,
unsigned long long stripeSize );
+ int createLvSnapshot(const string& origin, const string& name,
+ unsigned long long cowSizeK, string& device);
+ int removeLvSnapshot(const string& name);
+ int getLvSnapshotState(const string& name, LvmLvSnapshotStateInfo& info);
+
int setPeSize( long long unsigned peSizeK );
void normalizeDmDevices();
void getCommitActions( std::liststorage::commitAction*& l ) const;
@@ -124,8 +130,8 @@
string instSysString();
void logData( const string& Dir );
- void addLv( unsigned long& le, string& name, string& uuid,
- string& status, string& alloc, bool& ro );
+ void addLv(unsigned long& le, string& name, string& origin, string& uuid,
+ string& status, string& alloc, bool& ro);
void addPv( Pv*& p );
string status;
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Mon Aug 18 14:10:49 2008
@@ -2770,6 +2770,90 @@
int
+Storage::createLvmLvSnapshot(const string& vg, const string& origin,
+ const string& name, unsigned long long cowSizeK,
+ string& device)
+{
+ int ret = 0;
+ device.erase();
+ assertInit();
+ y2mil("vg:" << vg << " origin:" << origin << " name:" << name << " cowSizeK:" << cowSizeK);
+ LvmVgIterator i = findLvmVg(vg);
+ if (readonly)
+ {
+ ret = STORAGE_CHANGE_READONLY;
+ }
+ else if (i != lvgEnd())
+ {
+ ret = i->createLvSnapshot(origin, name, cowSizeK, device);
+ }
+ else
+ {
+ ret = STORAGE_LVM_VG_NOT_FOUND;
+ }
+ if (ret == 0)
+ {
+ ret = checkCache();
+ }
+ y2mil("ret:" << ret << " device:" << device);
+ return ret;
+}
+
+
+int
+Storage::removeLvmLvSnapshot(const string& vg, const string& name)
+{
+ int ret = 0;
+ assertInit();
+ y2mil("vg:" << vg << " name:" << name);
+ LvmVgIterator i = findLvmVg(vg);
+ if (readonly)
+ {
+ ret = STORAGE_CHANGE_READONLY;
+ }
+ else if (i != lvgEnd())
+ {
+ ret = i->removeLvSnapshot(name);
+ }
+ else
+ {
+ ret = STORAGE_LVM_VG_NOT_FOUND;
+ }
+ if (ret == 0)
+ {
+ ret = checkCache();
+ }
+ y2mil("ret:" << ret);
+ return ret;
+}
+
+
+int
+Storage::getLvmLvSnapshotStateInfo(const string& vg, const string& name,
+ LvmLvSnapshotStateInfo& info)
+{
+ int ret = 0;
+ assertInit();
+ y2mil("vg:" << vg << " name:" << name);
+ LvmVgIterator i = findLvmVg(vg);
+ if (i != lvgEnd())
+ {
+ ret = i->getLvSnapshotState(name, info);
+ }
+ else
+ {
+ ret = STORAGE_LVM_VG_NOT_FOUND;
+ }
+ if (ret == 0)
+ {
+ ret = checkCache();
+ }
+ y2mil("ret:" << ret);
+ return ret;
+}
+
+
+int
Storage::nextFreeMd(int &nr, string &device)
{
int ret = 0;
Modified: trunk/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Mon Aug 18 14:10:49 2008
@@ -404,6 +404,13 @@
int changeLvStripeSize( const string& vg, const string& name,
unsigned long long stripeSize );
+ int createLvmLvSnapshot(const string& vg, const string& origin,
+ const string& name, unsigned long long cowSizeK,
+ string& device);
+ int removeLvmLvSnapshot(const string& vg, const string& name);
+ int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
+ LvmLvSnapshotStateInfo& info);
+
int nextFreeMd(int &nr, string &device);
int createMd( const string& name, storage::MdType rtype,
const deque<string>& devs );
Modified: trunk/storage/libstorage/src/StorageDefines.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageDefines.h?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageDefines.h (original)
+++ trunk/storage/libstorage/src/StorageDefines.h Mon Aug 18 14:10:49 2008
@@ -15,6 +15,7 @@
#define LVREMOVEBIN "/sbin/lvremove"
#define LVEXTENDBIN "/sbin/lvextend"
#define LVREDUCEBIN "/sbin/lvreduce"
+#define LVSBIN "/sbin/lvs"
#define VGCREATEBIN "/sbin/vgcreate"
#define VGREMOVEBIN "/sbin/vgremove"
Modified: trunk/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageInterface.h (original)
+++ trunk/storage/libstorage/src/StorageInterface.h Mon Aug 18 14:10:49 2008
@@ -318,6 +318,18 @@
string allocation;
string dm_table;
string dm_target;
+ string origin;
+ unsigned long long sizeK;
+ };
+
+ /**
+ *
+ */
+ struct LvmLvSnapshotStateInfo
+ {
+ LvmLvSnapshotStateInfo() {}
+ bool active;
+ double allocated;
};
/**
@@ -572,6 +584,11 @@
LVM_LV_REMOVE_USED_BY = -4025,
LVM_LV_ALREADY_ON_DISK = -4026,
LVM_LV_NO_STRIPE_SIZE = -4027,
+ LVM_LV_UNKNOWN_ORIGIN = -4028,
+ LVM_LV_NOT_ON_DISK = -4029,
+ LVM_LV_NOT_SNAPSHOT = -4030,
+ LVM_LV_HAS_SNAPSHOTS = -4031,
+ LVM_LV_IS_SNAPSHOT = -4032,
FSTAB_ENTRY_NOT_FOUND = -5000,
FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
@@ -1529,6 +1546,41 @@
unsigned long long stripeSize ) = 0;
/**
+ * Create a LVM logical volume snapshot
+ *
+ * @param vg name of volume group
+ * @param origin name of logical volume origin
+ * @param name of logical volume snapshot
+ * @param cowSizeK size of snapshot in kilobytes
+ * @param device is set to the device name of the new snapshot
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int createLvmLvSnapshot(const string& vg, const string& origin,
+ const string& name, unsigned long long cowSizeK,
+ string& device) = 0;
+
+ /**
+ * Remove a LVM logical volume snapshot
+ *
+ * @param vg name of volume group
+ * @param device name of logical volume snapshot
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
+
+ /**
+ * Get state of a LVM logical volume snapshot
+ *
+ * @pre This can only be done after the snapshot has been created on disk.
+ *
+ * @param name name of snapshot
+ * @param info record that gets filled with snapshot special data
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
+ LvmLvSnapshotStateInfo& info) = 0;
+
+ /**
* Determine the device name of the next created software raid device
*
* @param nr is set to the number of the next created software raid device
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=50175&r1=50174&r2=50175&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Mon Aug 18 14:10:49 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Aug 18 14:08:56 CEST 2008 - aschnell@suse.de
+
+- added lvm snapshot support to libstorage (fate #303613)
+- version 2.17.20
+
+-------------------------------------------------------------------
Sun Aug 17 20:04:51 CEST 2008 - aschnell@suse.de
- use common workaround to prevent segmentation fault on IA64
@@ -16,7 +22,7 @@
Thu Aug 14 17:43:43 CEST 2008 - kmachalkova@suse.cz
- First steps to integrate nfs-client into partitioner (making it
- one of its views) (FaTE#303326)
+ one of its views) (FaTE#303326)
-------------------------------------------------------------------
Wed Aug 13 15:16:27 CEST 2008 - aschnell@suse.de
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org