Hello community,
here is the log from the commit of package yast2-storage
checked in at Mon Aug 18 22:53:45 CEST 2008.
--------
--- yast2-storage/yast2-storage.changes 2008-08-17 20:13:25.000000000 +0200
+++ yast2-storage/yast2-storage.changes 2008-08-18 14:49:14.791050000 +0200
@@ -1,0 +2,6 @@
+Mon Aug 18 14:08:56 CEST 2008 - aschnell@suse.de
+
+- added lvm snapshot support to libstorage (fate #303613)
+- version 2.17.20
+
+-------------------------------------------------------------------
Old:
----
yast2-storage-2.17.19.tar.bz2
New:
----
yast2-storage-2.17.20.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-storage.spec ++++++
--- /var/tmp/diff_new_pack.c16099/_old 2008-08-18 22:51:37.000000000 +0200
+++ /var/tmp/diff_new_pack.c16099/_new 2008-08-18 22:51:37.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-storage (Version 2.17.19)
+# spec file for package yast2-storage (Version 2.17.20)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-storage
-Version: 2.17.19
+Version: 2.17.20
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-storage-2.17.19.tar.bz2
+Source0: yast2-storage-2.17.20.tar.bz2
Prefix: /usr
BuildRequires: blocxx-devel boost-devel docbook-xsl-stylesheets doxygen gcc-c++ libxcrypt-devel libxslt openssl-devel perl-XML-Writer sablot sgml-skel swig update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-perl-bindings yast2-testsuite
Requires: parted yast2-storage-lib = %version yast2-perl-bindings mdadm lvm2 dmraid multipath-tools kpartx cryptsetup
@@ -57,7 +57,7 @@
Arvin Schnell
%prep
-%setup -n yast2-storage-2.17.19
+%setup -n yast2-storage-2.17.20
%build
%{prefix}/bin/y2tool y2autoconf
@@ -179,6 +179,9 @@
%doc %{prefix}/share/doc/packages/yast2-storage/libstorage
%doc %{prefix}/share/doc/packages/yast2-storage/config.xml.description
%changelog
+* Mon Aug 18 2008 aschnell@suse.de
+- added lvm snapshot support to libstorage (fate #303613)
+- version 2.17.20
* Sun Aug 17 2008 aschnell@suse.de
- use common workaround to prevent segmentation fault on IA64
caused by limitations of generated libstorage bindings
++++++ yast2-storage-2.17.19.tar.bz2 -> yast2-storage-2.17.20.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/configure new/yast2-storage-2.17.20/configure
--- old/yast2-storage-2.17.19/configure 2008-08-17 20:10:54.000000000 +0200
+++ new/yast2-storage-2.17.20/configure 2008-08-18 16:51:07.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for yast2-storage 2.17.19.
+# Generated by GNU Autoconf 2.61 for yast2-storage 2.17.20.
#
# Report bugs to http://bugs.opensuse.org/.
#
@@ -728,8 +728,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-storage'
PACKAGE_TARNAME='yast2-storage'
-PACKAGE_VERSION='2.17.19'
-PACKAGE_STRING='yast2-storage 2.17.19'
+PACKAGE_VERSION='2.17.20'
+PACKAGE_STRING='yast2-storage 2.17.20'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -1449,7 +1449,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures yast2-storage 2.17.19 to adapt to many kinds of systems.
+\`configure' configures yast2-storage 2.17.20 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1520,7 +1520,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-storage 2.17.19:";;
+ short | recursive ) echo "Configuration of yast2-storage 2.17.20:";;
esac
cat <<\_ACEOF
@@ -1630,7 +1630,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-storage configure 2.17.19
+yast2-storage configure 2.17.20
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1644,7 +1644,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by yast2-storage $as_me 2.17.19, which was
+It was created by yast2-storage $as_me 2.17.20, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2465,7 +2465,7 @@
# Define the identity of the package.
PACKAGE='yast2-storage'
- VERSION='2.17.19'
+ VERSION='2.17.20'
cat >>confdefs.h <<_ACEOF
@@ -2693,7 +2693,7 @@
-VERSION="2.17.19"
+VERSION="2.17.20"
RPMNAME="yast2-storage"
MAINTAINER="Arvin Schnell "
@@ -21746,7 +21746,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by yast2-storage $as_me 2.17.19, which was
+This file was extended by yast2-storage $as_me 2.17.20, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21799,7 +21799,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-storage config.status 2.17.19
+yast2-storage config.status 2.17.20
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/configure.in new/yast2-storage-2.17.20/configure.in
--- old/yast2-storage-2.17.19/configure.in 2008-08-17 20:10:40.000000000 +0200
+++ new/yast2-storage-2.17.20/configure.in 2008-08-18 16:50:53.000000000 +0200
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.17.6 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-storage, 2.17.19, http://bugs.opensuse.org/, yast2-storage)
+AC_INIT(yast2-storage, 2.17.20, http://bugs.opensuse.org/, yast2-storage)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -18,7 +18,7 @@
AM_INIT_AUTOMAKE(tar-ustar -Wno-portability)
dnl Important YaST2 variables
-VERSION="2.17.19"
+VERSION="2.17.20"
RPMNAME="yast2-storage"
MAINTAINER="Arvin Schnell "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/Dm.cc new/yast2-storage-2.17.20/libstorage/src/Dm.cc
--- old/yast2-storage-2.17.19/libstorage/src/Dm.cc 2008-08-12 11:16:19.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/Dm.cc 2008-08-18 14:06:24.000000000 +0200
@@ -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;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/Dm.h new/yast2-storage-2.17.20/libstorage/src/Dm.h
--- old/yast2-storage-2.17.19/libstorage/src/Dm.h 2008-08-13 15:36:25.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/Dm.h 2008-08-18 14:06:24.000000000 +0200
@@ -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;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/DmmultipathCo.cc new/yast2-storage-2.17.20/libstorage/src/DmmultipathCo.cc
--- old/yast2-storage-2.17.19/libstorage/src/DmmultipathCo.cc 2008-08-17 19:03:26.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/DmmultipathCo.cc 2008-08-17 21:24:18.000000000 +0200
@@ -60,7 +60,7 @@
for (unsigned int i = 1; i < c.numLines(); i++)
{
string line = *c.getLine(i);
- if (line.find( " \\_" ) == 0)
+ if (boost::starts_with(line, " \\_"))
{
y2mil("mp element:" << line);
string dev = getStorage()->deviceByNumber(extractNthWord(3,line));
@@ -169,7 +169,7 @@
line = *c.getLine(i);
while( iname().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;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/LvmLv.h new/yast2-storage-2.17.20/libstorage/src/LvmLv.h
--- old/yast2-storage-2.17.19/libstorage/src/LvmLv.h 2008-08-13 15:36:25.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/LvmLv.h 2008-08-18 14:06:24.000000000 +0200
@@ -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;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/LvmVg.cc new/yast2-storage-2.17.20/libstorage/src/LvmVg.cc
--- old/yast2-storage-2.17.19/libstorage/src/LvmVg.cc 2008-08-13 16:35:14.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/LvmVg.cc 2008-08-18 14:06:24.000000000 +0200
@@ -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 )
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/LvmVg.h new/yast2-storage-2.17.20/libstorage/src/LvmVg.h
--- old/yast2-storage-2.17.19/libstorage/src/LvmVg.h 2008-08-13 16:35:04.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/LvmVg.h 2008-08-18 14:06:24.000000000 +0200
@@ -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;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/Makefile.am new/yast2-storage-2.17.20/libstorage/src/Makefile.am
--- old/yast2-storage-2.17.19/libstorage/src/Makefile.am 2008-08-17 18:50:43.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/Makefile.am 2008-08-17 22:33:23.000000000 +0200
@@ -21,45 +21,45 @@
lib_LTLIBRARIES = liby2storage.la
-liby2storage_la_SOURCES = \
- StorageInterface.h \
- Storage.cc Storage.h \
- Container.cc Container.h \
- Disk.cc Disk.h \
- Dasd.cc Dasd.h \
- PeContainer.cc PeContainer.h \
- LvmVg.cc LvmVg.h \
- DmPartCo.cc DmPartCo.h \
- DmraidCo.cc DmraidCo.h \
+liby2storage_la_SOURCES = \
+ StorageInterface.h \
+ Storage.cc Storage.h \
+ Container.cc Container.h \
+ Disk.cc Disk.h \
+ Dasd.cc Dasd.h \
+ PeContainer.cc PeContainer.h \
+ LvmVg.cc LvmVg.h \
+ DmPartCo.cc DmPartCo.h \
+ DmraidCo.cc DmraidCo.h \
DmmultipathCo.cc DmmultipathCo.h \
- DmCo.cc DmCo.h \
- MdCo.cc MdCo.h \
- LoopCo.cc LoopCo.h \
- NfsCo.cc NfsCo.h \
- Volume.cc Volume.h \
- Partition.cc Partition.h \
- Dm.cc Dm.h \
- LvmLv.cc LvmLv.h \
- DmPart.cc DmPart.h \
- Dmraid.cc Dmraid.h \
+ DmCo.cc DmCo.h \
+ MdCo.cc MdCo.h \
+ LoopCo.cc LoopCo.h \
+ NfsCo.cc NfsCo.h \
+ Volume.cc Volume.h \
+ Partition.cc Partition.h \
+ Dm.cc Dm.h \
+ LvmLv.cc LvmLv.h \
+ DmPart.cc DmPart.h \
+ Dmraid.cc Dmraid.h \
Dmmultipath.cc Dmmultipath.h \
- Md.cc Md.h \
- Loop.cc Loop.h \
- Nfs.cc Nfs.h \
- SystemCmd.cc SystemCmd.h \
- OutputProcessor.cc OutputProcessor.h \
- Regex.cc Regex.h \
- AsciiFile.cc AsciiFile.h \
- ProcPart.cc ProcPart.h \
- EtcRaidtab.cc EtcRaidtab.h \
- ProcMounts.cc ProcMounts.h \
- EtcFstab.cc EtcFstab.h \
- AppUtil.cc AppUtil.h \
- Lock.cc Lock.h \
- StorageTypes.cc StorageTypes.h \
- FilterIterator.h ListListIterator.h \
- DerefIterator.h IterPair.h \
- Region.h StorageTmpl.h \
+ Md.cc Md.h \
+ Loop.cc Loop.h \
+ Nfs.cc Nfs.h \
+ SystemCmd.cc SystemCmd.h \
+ OutputProcessor.cc OutputProcessor.h \
+ Regex.cc Regex.h \
+ AsciiFile.cc AsciiFile.h \
+ ProcPart.cc ProcPart.h \
+ EtcRaidtab.cc EtcRaidtab.h \
+ ProcMounts.cc ProcMounts.h \
+ EtcFstab.cc EtcFstab.h \
+ AppUtil.cc AppUtil.h \
+ Lock.cc Lock.h \
+ StorageTypes.cc StorageTypes.h \
+ FilterIterator.h ListListIterator.h \
+ DerefIterator.h IterPair.h \
+ Region.h StorageTmpl.h \
StorageDefines.h
liby2storage_la_LDFLAGS = -version-info 2:0
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/Makefile.in new/yast2-storage-2.17.20/libstorage/src/Makefile.in
--- old/yast2-storage-2.17.19/libstorage/src/Makefile.in 2008-08-17 20:10:58.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/Makefile.in 2008-08-18 16:51:11.000000000 +0200
@@ -270,44 +270,44 @@
BUILT_SOURCES = y2storage StorageCallbacksBuiltinTable.h StorageCallbacksBuiltinCalls.h
lib_LTLIBRARIES = liby2storage.la
liby2storage_la_SOURCES = \
- StorageInterface.h \
- Storage.cc Storage.h \
- Container.cc Container.h \
- Disk.cc Disk.h \
- Dasd.cc Dasd.h \
- PeContainer.cc PeContainer.h \
- LvmVg.cc LvmVg.h \
- DmPartCo.cc DmPartCo.h \
- DmraidCo.cc DmraidCo.h \
+ StorageInterface.h \
+ Storage.cc Storage.h \
+ Container.cc Container.h \
+ Disk.cc Disk.h \
+ Dasd.cc Dasd.h \
+ PeContainer.cc PeContainer.h \
+ LvmVg.cc LvmVg.h \
+ DmPartCo.cc DmPartCo.h \
+ DmraidCo.cc DmraidCo.h \
DmmultipathCo.cc DmmultipathCo.h \
- DmCo.cc DmCo.h \
- MdCo.cc MdCo.h \
- LoopCo.cc LoopCo.h \
- NfsCo.cc NfsCo.h \
- Volume.cc Volume.h \
- Partition.cc Partition.h \
- Dm.cc Dm.h \
- LvmLv.cc LvmLv.h \
- DmPart.cc DmPart.h \
- Dmraid.cc Dmraid.h \
+ DmCo.cc DmCo.h \
+ MdCo.cc MdCo.h \
+ LoopCo.cc LoopCo.h \
+ NfsCo.cc NfsCo.h \
+ Volume.cc Volume.h \
+ Partition.cc Partition.h \
+ Dm.cc Dm.h \
+ LvmLv.cc LvmLv.h \
+ DmPart.cc DmPart.h \
+ Dmraid.cc Dmraid.h \
Dmmultipath.cc Dmmultipath.h \
- Md.cc Md.h \
- Loop.cc Loop.h \
- Nfs.cc Nfs.h \
- SystemCmd.cc SystemCmd.h \
- OutputProcessor.cc OutputProcessor.h \
- Regex.cc Regex.h \
- AsciiFile.cc AsciiFile.h \
- ProcPart.cc ProcPart.h \
- EtcRaidtab.cc EtcRaidtab.h \
- ProcMounts.cc ProcMounts.h \
- EtcFstab.cc EtcFstab.h \
- AppUtil.cc AppUtil.h \
- Lock.cc Lock.h \
- StorageTypes.cc StorageTypes.h \
- FilterIterator.h ListListIterator.h \
- DerefIterator.h IterPair.h \
- Region.h StorageTmpl.h \
+ Md.cc Md.h \
+ Loop.cc Loop.h \
+ Nfs.cc Nfs.h \
+ SystemCmd.cc SystemCmd.h \
+ OutputProcessor.cc OutputProcessor.h \
+ Regex.cc Regex.h \
+ AsciiFile.cc AsciiFile.h \
+ ProcPart.cc ProcPart.h \
+ EtcRaidtab.cc EtcRaidtab.h \
+ ProcMounts.cc ProcMounts.h \
+ EtcFstab.cc EtcFstab.h \
+ AppUtil.cc AppUtil.h \
+ Lock.cc Lock.h \
+ StorageTypes.cc StorageTypes.h \
+ FilterIterator.h ListListIterator.h \
+ DerefIterator.h IterPair.h \
+ Region.h StorageTmpl.h \
StorageDefines.h
liby2storage_la_LDFLAGS = -version-info 2:0
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/Storage.cc new/yast2-storage-2.17.20/libstorage/src/Storage.cc
--- old/yast2-storage-2.17.19/libstorage/src/Storage.cc 2008-08-17 18:50:43.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/Storage.cc 2008-08-18 14:06:24.000000000 +0200
@@ -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;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/StorageDefines.h new/yast2-storage-2.17.20/libstorage/src/StorageDefines.h
--- old/yast2-storage-2.17.19/libstorage/src/StorageDefines.h 2008-08-08 14:46:25.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/StorageDefines.h 2008-08-18 14:06:24.000000000 +0200
@@ -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"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/Storage.h new/yast2-storage-2.17.20/libstorage/src/Storage.h
--- old/yast2-storage-2.17.19/libstorage/src/Storage.h 2008-08-17 18:50:43.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/Storage.h 2008-08-18 14:06:24.000000000 +0200
@@ -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 );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/libstorage/src/StorageInterface.h new/yast2-storage-2.17.20/libstorage/src/StorageInterface.h
--- old/yast2-storage-2.17.19/libstorage/src/StorageInterface.h 2008-08-17 18:50:43.000000000 +0200
+++ new/yast2-storage-2.17.20/libstorage/src/StorageInterface.h 2008-08-18 14:06:24.000000000 +0200
@@ -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
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/storage/src/include/ep-hd-lib.ycp new/yast2-storage-2.17.20/storage/src/include/ep-hd-lib.ycp
--- old/yast2-storage-2.17.19/storage/src/include/ep-hd-lib.ycp 2008-08-13 15:35:57.000000000 +0200
+++ new/yast2-storage-2.17.20/storage/src/include/ep-hd-lib.ycp 2008-08-18 16:33:42.000000000 +0200
@@ -64,6 +64,34 @@
}
+ void EpDeleteDisk(string device)
+ {
+ if (device == nil)
+ {
+ Popup::Error(_("No disk selected."));
+ return;
+ }
+
+ map target_map = Storage::GetTargetMap();
+ map disk = Storage::GetDisk(target_map, device);
+
+ if (disk["type"]:`CT_UNKNOWN == `CT_DMRAID)
+ {
+ if (Popup::YesNo(sformat(_("Really delete BIOS RAID %1?"), device)))
+ {
+ if (deleteAllDevPartitions(disk, Stage::initial(), false))
+ Storage::DeleteDmraid(device);
+ UpdateNavigationTree(`hd);
+ TreePanel::Create();
+ }
+ }
+ else
+ {
+ Popup::Error(_("The disk cannot be deleted."));
+ }
+ }
+
+
map GetPossibleSlots(map disk, string disk_device)
{
list<map> slots = [];
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/storage/src/include/ep-hd.ycp new/yast2-storage-2.17.20/storage/src/include/ep-hd.ycp
--- old/yast2-storage-2.17.19/storage/src/include/ep-hd.ycp 2008-08-17 18:50:43.000000000 +0200
+++ new/yast2-storage-2.17.20/storage/src/include/ep-hd.ycp 2008-08-18 16:50:01.000000000 +0200
@@ -36,7 +36,7 @@
else
{
string filename = Directory::clientdir + "/" + client + ".ycp";
- return ( FileUtils::Exists( filename ) );
+ return FileUtils::Exists(filename);
}
}
@@ -63,8 +63,6 @@
list<term> configs = [];
- // TODO: bug #392972
-
if (IsAvailable("iscsi-client")) {
// menu entry text
configs = add(configs, `item(`id(`iscsi), _("Configure &iSCSI...")));
@@ -77,11 +75,11 @@
if (Arch::s390() && IsAvailable("s390")) {
// menu entry text
- configs = add(configs, `item(`id(`dasd), _("Configure DASD...")));
+ configs = add(configs, `item(`id(`dasd), _("Configure &DASD...")));
// menu entry text
- configs = add(configs, `item(`id(`zfcp), _("Configure zFCP...")));
+ configs = add(configs, `item(`id(`zfcp), _("Configure &zFCP...")));
// menu entry text
- configs = add(configs, `item(`id(`xpram), _("Configure XPRAM...")));
+ configs = add(configs, `item(`id(`xpram), _("Configure &XPRAM...")));
}
if (size(configs) > 0) {
@@ -110,6 +108,9 @@
{
boolean CheckAndInstallPackages( list <string> pkgs )
{
+ if (Stage::initial())
+ return true;
+
boolean ret = false;
//switch off pkg-mgmt loading progress dialogs,
//because it just plain sucks
@@ -208,9 +209,10 @@
`HStretch(),
StorageFields::Overview(fields, target_map, device),
`HBox(
+ `PushButton(`id(`delete), _("Delete...")),
+ `HStretch(),
`PushButton(`id(`smart), _("Smart...")),
- `PushButton(`id(`hdparm), _("HD Parm...")),
- `HStretch()
+ `PushButton(`id(`hdparm), _("HD Parm..."))
)
)
);
@@ -227,6 +229,10 @@
switch (widget)
{
+ case `delete:
+ EpDeleteDisk(disk_device);
+ break;
+
case `smart:
DisplayCommandOutput(sformat("/usr/sbin/smartctl --health '%1'", disk_device));
break;
@@ -367,7 +373,7 @@
`partitions : $[ `create : CreateHdDiskPartitionsTab,
`handle : HandleHdDiskPartitionsTab,
`user_data : user_data ],
- `devices : $[ `create : CreateHdDiskDevicesTab,
+ `devices : $[ `create : CreateHdDiskDevicesTab,
`user_data : user_data ] ];
UI::ReplaceWidget(`tree_panel,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-storage-2.17.19/VERSION new/yast2-storage-2.17.20/VERSION
--- old/yast2-storage-2.17.19/VERSION 2008-08-17 20:10:34.000000000 +0200
+++ new/yast2-storage-2.17.20/VERSION 2008-08-18 14:08:48.000000000 +0200
@@ -1 +1 @@
-2.17.19
+2.17.20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org