Hello community, here is the log from the commit of package libstorage for openSUSE:Factory checked in at 2011-12-07 14:37:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage (Old) and /work/SRC/openSUSE:Factory/.libstorage.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage/libstorage.changes 2011-11-08 17:43:41.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes 2011-12-07 14:38:00.000000000 +0100 @@ -1,0 +2,41 @@ +Tue Dec 06 14:08:41 CET 2011 - [email protected] + +- add function getResursiveUsedBy (for bnc#734786) +- make getResursiveUsing also take a list as input + +------------------------------------------------------------------- +Wed Nov 23 15:25:59 CET 2011 - [email protected] + +- add name in /dev/md/ to alt-names of partitioned RAID + (bnc#726319) + +------------------------------------------------------------------- +Tue Nov 22 10:20:02 UTC 2011 - [email protected] + +- add libtool as buildrequire to avoid implicit dependency + +------------------------------------------------------------------- +Fri Nov 18 15:01:39 CET 2011 - [email protected] + +- merged proofread texts + +------------------------------------------------------------------- +Thu Nov 17 15:44:52 CET 2011 - [email protected] + +- create btrfs subvolumes before mounting (bnc#731059) + +------------------------------------------------------------------- +Tue Nov 15 17:12:34 CET 2011 - [email protected] + +- try umount in mountTmpMount by dir first to handle cases where + same device is mounted multiple times + +------------------------------------------------------------------- +Wed Nov 09 12:29:53 CET 2011 - [email protected] + +- avoid detection on volumes on disk used by other stuff (bnc#729155) +- fixed NFS detection (bnc#729155) +- improved multipath parser (see bnc#727428) +- 2.22.0 + +------------------------------------------------------------------- Old: ---- libstorage-2.21.15.tar.bz2 New: ---- libstorage-2.22.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage.spec ++++++ --- /var/tmp/diff_new_pack.vh1sVY/_old 2011-12-07 14:38:01.000000000 +0100 +++ /var/tmp/diff_new_pack.vh1sVY/_new 2011-12-07 14:38:01.000000000 +0100 @@ -19,7 +19,7 @@ Name: libstorage -Version: 2.21.15 +Version: 2.22.0 Release: 0 License: GPL Group: System/Libraries @@ -28,7 +28,7 @@ Prefix: /usr -BuildRequires: blocxx-devel boost-devel dejagnu doxygen gcc-c++ libxml2-devel python-devel ruby-devel swig +BuildRequires: blocxx-devel boost-devel dejagnu doxygen gcc-c++ libtool libxml2-devel python-devel ruby-devel swig Summary: Library for storage management Url: http://en.opensuse.org/Portal:Libstorage ++++++ libstorage-2.21.15.tar.bz2 -> libstorage-2.22.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/VERSION new/libstorage-2.22.0/VERSION --- old/libstorage-2.21.15/VERSION 2011-11-08 11:42:24.000000000 +0100 +++ new/libstorage-2.22.0/VERSION 2011-11-09 14:47:02.000000000 +0100 @@ -1 +1 @@ -2.21.15 +2.22.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/bindings/python/libstorage.py new/libstorage-2.22.0/bindings/python/libstorage.py --- old/libstorage-2.21.15/bindings/python/libstorage.py 2011-10-25 17:55:14.000000000 +0200 +++ new/libstorage-2.22.0/bindings/python/libstorage.py 2011-12-06 17:17:58.000000000 +0100 @@ -1573,6 +1573,7 @@ def setRecursiveRemoval(self, *args): return _libstorage.StorageInterface_setRecursiveRemoval(self, *args) def getRecursiveRemoval(self): return _libstorage.StorageInterface_getRecursiveRemoval(self) def getRecursiveUsing(self, *args): return _libstorage.StorageInterface_getRecursiveUsing(self, *args) + def getRecursiveUsedBy(self, *args): return _libstorage.StorageInterface_getRecursiveUsedBy(self, *args) def setZeroNewPartitions(self, *args): return _libstorage.StorageInterface_setZeroNewPartitions(self, *args) def getZeroNewPartitions(self): return _libstorage.StorageInterface_getZeroNewPartitions(self) def setPartitionAlignment(self, *args): return _libstorage.StorageInterface_setPartitionAlignment(self, *args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/bindings/ruby/storage_wrap.cxx new/libstorage-2.22.0/bindings/ruby/storage_wrap.cxx --- old/libstorage-2.21.15/bindings/ruby/storage_wrap.cxx 2011-10-25 17:56:02.000000000 +0200 +++ new/libstorage-2.22.0/bindings/ruby/storage_wrap.cxx 2011-12-06 17:18:25.000000000 +0100 @@ -22026,49 +22026,107 @@ SWIGINTERN VALUE _wrap_StorageInterface_getRecursiveUsing(int argc, VALUE *argv, VALUE self) { storage::StorageInterface *arg1 = (storage::StorageInterface *) 0 ; - string *arg2 = 0 ; - std::list< string > *arg3 = 0 ; + std::list< string > *arg2 = 0 ; + bool arg3 ; + std::list< string > *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - void *argp3 = 0 ; - int res3 = 0 ; + void *argp2 ; + int res2 = 0 ; + bool val3 ; + int ecode3 = 0 ; + void *argp4 = 0 ; + int res4 = 0 ; int result; VALUE vresult = Qnil; - if ((argc < 2) || (argc > 2)) { - rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_storage__StorageInterface, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "storage::StorageInterface *","getRecursiveUsing", 1, self )); } arg1 = reinterpret_cast< storage::StorageInterface * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(argv[0], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "string const &","getRecursiveUsing", 2, argv[0] )); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "string const &","getRecursiveUsing", 2, argv[0])); - } - arg2 = ptr; + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::list< string > const &","getRecursiveUsing", 2, argv[0] )); } - res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::list< string > &","getRecursiveUsing", 3, argv[1] )); + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::list< string > const &","getRecursiveUsing", 2, argv[0])); } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::list< string > &","getRecursiveUsing", 3, argv[1])); + arg2 = reinterpret_cast< std::list< string > * >(argp2); + ecode3 = SWIG_AsVal_bool(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","getRecursiveUsing", 3, argv[1] )); + } + arg3 = static_cast< bool >(val3); + res4 = SWIG_ConvertPtr(argv[2], &argp4, SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::list< string > &","getRecursiveUsing", 4, argv[2] )); } - arg3 = reinterpret_cast< std::list< string > * >(argp3); - result = (int)(arg1)->getRecursiveUsing((string const &)*arg2,*arg3); + if (!argp4) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::list< string > &","getRecursiveUsing", 4, argv[2])); + } + arg4 = reinterpret_cast< std::list< string > * >(argp4); + result = (int)(arg1)->getRecursiveUsing((std::list< string > const &)*arg2,arg3,*arg4); + vresult = SWIG_From_int(static_cast< int >(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_StorageInterface_getRecursiveUsedBy(int argc, VALUE *argv, VALUE self) { + storage::StorageInterface *arg1 = (storage::StorageInterface *) 0 ; + std::list< string > *arg2 = 0 ; + bool arg3 ; + std::list< string > *arg4 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + bool val3 ; + int ecode3 = 0 ; + void *argp4 = 0 ; + int res4 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 3) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_storage__StorageInterface, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "storage::StorageInterface *","getRecursiveUsedBy", 1, self )); + } + arg1 = reinterpret_cast< storage::StorageInterface * >(argp1); + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::list< string > const &","getRecursiveUsedBy", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::list< string > const &","getRecursiveUsedBy", 2, argv[0])); + } + arg2 = reinterpret_cast< std::list< string > * >(argp2); + ecode3 = SWIG_AsVal_bool(argv[1], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","getRecursiveUsedBy", 3, argv[1] )); + } + arg3 = static_cast< bool >(val3); + res4 = SWIG_ConvertPtr(argv[2], &argp4, SWIGTYPE_p_std__listT_std__string_std__allocatorT_std__string_t_t, 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::list< string > &","getRecursiveUsedBy", 4, argv[2] )); + } + if (!argp4) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::list< string > &","getRecursiveUsedBy", 4, argv[2])); + } + arg4 = reinterpret_cast< std::list< string > * >(argp4); + result = (int)(arg1)->getRecursiveUsedBy((std::list< string > const &)*arg2,arg3,*arg4); vresult = SWIG_From_int(static_cast< int >(result)); - if (SWIG_IsNewObj(res2)) delete arg2; return vresult; fail: - if (SWIG_IsNewObj(res2)) delete arg2; return Qnil; } @@ -38414,6 +38472,7 @@ rb_define_method(SwigClassStorageInterface.klass, "setRecursiveRemoval", VALUEFUNC(_wrap_StorageInterface_setRecursiveRemoval), -1); rb_define_method(SwigClassStorageInterface.klass, "getRecursiveRemoval", VALUEFUNC(_wrap_StorageInterface_getRecursiveRemoval), -1); rb_define_method(SwigClassStorageInterface.klass, "getRecursiveUsing", VALUEFUNC(_wrap_StorageInterface_getRecursiveUsing), -1); + rb_define_method(SwigClassStorageInterface.klass, "getRecursiveUsedBy", VALUEFUNC(_wrap_StorageInterface_getRecursiveUsedBy), -1); rb_define_method(SwigClassStorageInterface.klass, "setZeroNewPartitions", VALUEFUNC(_wrap_StorageInterface_setZeroNewPartitions), -1); rb_define_method(SwigClassStorageInterface.klass, "getZeroNewPartitions", VALUEFUNC(_wrap_StorageInterface_getZeroNewPartitions), -1); rb_define_method(SwigClassStorageInterface.klass, "setPartitionAlignment", VALUEFUNC(_wrap_StorageInterface_setPartitionAlignment), -1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/libstorage.spec.in new/libstorage-2.22.0/libstorage.spec.in --- old/libstorage-2.21.15/libstorage.spec.in 2011-10-06 19:24:40.000000000 +0200 +++ new/libstorage-2.22.0/libstorage.spec.in 2011-11-22 11:24:36.000000000 +0100 @@ -28,7 +28,7 @@ Prefix: /usr -BuildRequires: blocxx-devel boost-devel dejagnu doxygen gcc-c++ libxml2-devel python-devel ruby-devel swig +BuildRequires: blocxx-devel boost-devel dejagnu doxygen gcc-c++ libtool libxml2-devel python-devel ruby-devel swig Summary: Library for storage management Url: http://en.opensuse.org/Portal:Libstorage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Btrfs.cc new/libstorage-2.22.0/storage/Btrfs.cc --- old/libstorage-2.21.15/storage/Btrfs.cc 2011-09-07 16:52:25.000000000 +0200 +++ new/libstorage-2.22.0/storage/Btrfs.cc 2011-12-05 16:52:55.000000000 +0100 @@ -658,14 +658,14 @@ { // displayed text during action, // %1$s and %2$s are replaced by a device names (e.g. /dev/hda1) - txt = sformat( _("Extending BTRFS volume %1$s by %2$s"), name().c_str(), + txt = sformat( _("Extending Btrfs volume %1$s by %2$s"), name().c_str(), dev.c_str() ); } else { // displayed text before action, // %1$s and %2$s are replaced by a device names (e.g. /dev/hda1) - txt = sformat( _("Extend BTRFS volume %1$s by %2$s"), name().c_str(), + txt = sformat( _("Extend Btrfs volume %1$s by %2$s"), name().c_str(), dev.c_str() ); } return( txt ); @@ -679,14 +679,14 @@ { // displayed text during action, // %1$s and %2$s are replaced by a device names (e.g. /dev/hda1) - txt = sformat( _("Reducing BTRFS volume %1$s by %2$s"), name().c_str(), + txt = sformat( _("Reducing Btrfs volume %1$s by %2$s"), name().c_str(), dev.c_str() ); } else { // displayed text before action, // %1$s and %2$s are replaced by a device names (e.g. /dev/hda1) - txt = sformat( _("Reduce BTRFS volume %1$s by %2$s"), name().c_str(), + txt = sformat( _("Reduce Btrfs volume %1$s by %2$s"), name().c_str(), dev.c_str() ); } return( txt ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Device.h new/libstorage-2.22.0/storage/Device.h --- old/libstorage-2.21.15/storage/Device.h 2011-01-25 12:55:54.000000000 +0100 +++ new/libstorage-2.22.0/storage/Device.h 2011-12-05 14:16:16.000000000 +0100 @@ -93,6 +93,8 @@ bool isUsedBy(UsedByType type) const; const list<UsedBy>& getUsedBy() const { return uby; } + virtual list<string> getUsing() const { return list<string>(); } + void logDifference(std::ostream& log, const Device& rhs) const; friend std::ostream& operator<<(std::ostream& s, const Device& d); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Dm.cc new/libstorage-2.22.0/storage/Dm.cc --- old/libstorage-2.21.15/storage/Dm.cc 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/Dm.cc 2011-12-05 14:37:38.000000000 +0100 @@ -500,6 +500,15 @@ } + list<string> + Dm::getUsing() const + { + list<string> ret; + ret.push_back(cont->device()); + return ret; + } + + void Dm::getInfo( DmInfo& tinfo ) const { Volume::getInfo(info.v); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Dm.h new/libstorage-2.22.0/storage/Dm.h --- old/libstorage-2.21.15/storage/Dm.h 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/Dm.h 2011-12-05 14:37:07.000000000 +0100 @@ -85,6 +85,8 @@ static string devToTable( const string& dev ); + virtual list<string> getUsing() const; + bool equalContent(const Dm& rhs) const; void logDifference(std::ostream& log, const Dm& rhs) const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/DmmultipathCo.cc new/libstorage-2.22.0/storage/DmmultipathCo.cc --- old/libstorage-2.21.15/storage/DmmultipathCo.cc 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/DmmultipathCo.cc 2011-12-05 13:47:36.000000000 +0100 @@ -45,6 +45,8 @@ if (c.retcode() != 0 || c.numLines() == 0) return; + Regex lun("[[:digit:]]+:[[:digit:]]+:[[:digit:]]+:[[:digit:]]+"); + const vector<string>& lines = c.stdout(); vector<string>::const_iterator it1 = lines.begin(); @@ -77,8 +79,7 @@ if (it1->empty() || isalnum((*it1)[0])) break; - if (boost::starts_with(*it1, "| `-") || boost::starts_with(*it1, " `-") || - boost::starts_with(*it1, " |-")) + if (lun.match(*it1)) { string tmp = it1->substr(5); y2mil("mp element:" << tmp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Dmraid.cc new/libstorage-2.22.0/storage/Dmraid.cc --- old/libstorage-2.21.15/storage/Dmraid.cc 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/Dmraid.cc 2011-11-18 15:17:14.000000000 +0100 @@ -64,13 +64,13 @@ if( doing ) { // displayed text during action, %1$s is replaced by raid partition name e.g. pdc_dabaheedj_part1 - txt = sformat( _("Deleting raid partition %1$s"), d.c_str() ); + txt = sformat( _("Deleting RAID partition %1$s"), d.c_str() ); } else { // displayed text before action, %1$s is replaced by raid partition name e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Delete raid partition %1$s (%2$s)"), d.c_str(), + txt = sformat( _("Delete RAID partition %1$s (%2$s)"), d.c_str(), sizeString().c_str() ); } return( txt ); @@ -83,7 +83,7 @@ if( doing ) { // displayed text during action, %1$s is replaced by raid partition name e.g. pdc_dabaheedj_part1 - txt = sformat( _("Creating raid partition %1$s"), d.c_str() ); + txt = sformat( _("Creating RAID partition %1$s"), d.c_str() ); } else { @@ -91,7 +91,7 @@ { // displayed text before action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Create swap raid partition %1$s (%2$s)"), + txt = sformat( _("Create swap RAID partition %1$s (%2$s)"), d.c_str(), sizeString().c_str() ); } else if( !mp.empty() ) @@ -102,7 +102,7 @@ // %2$s is replaced by size (e.g. 623.5 MB) // %3$s is replaced by file system type (e.g. reiserfs) // %4$s is replaced by mount point (e.g. /usr) - txt = sformat( _("Create raid partition %1$s (%2$s) for %4$s with %3$s"), + txt = sformat( _("Create RAID partition %1$s (%2$s) for %4$s with %3$s"), d.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } @@ -112,7 +112,7 @@ // %2$s is replaced by size (e.g. 623.5 MB) // %3$s is replaced by file system type (e.g. reiserfs) // %4$s is replaced by mount point (e.g. /usr) - txt = sformat( _("Create encrypted raid partition %1$s (%2$s) for %4$s with %3$s"), + txt = sformat( _("Create encrypted RAID partition %1$s (%2$s) for %4$s with %3$s"), d.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } @@ -121,14 +121,14 @@ { // displayed text before action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Create extended raid partition %1$s (%2$s)"), + txt = sformat( _("Create extended RAID partition %1$s (%2$s)"), d.c_str(), sizeString().c_str() ); } else { // displayed text before action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Create raid partition %1$s (%2$s)"), + txt = sformat( _("Create RAID partition %1$s (%2$s)"), d.c_str(), sizeString().c_str() ); } } @@ -144,7 +144,7 @@ // displayed text during action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) // %3$s is replaced by file system type (e.g. reiserfs) - txt = sformat( _("Formatting raid partition %1$s (%2$s) with %3$s"), + txt = sformat( _("Formatting RAID partition %1$s (%2$s) with %3$s"), d.c_str(), sizeString().c_str(), fsTypeString().c_str() ); } else @@ -155,7 +155,7 @@ { // displayed text before action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Format raid partition %1$s (%2$s) for swap"), + txt = sformat( _("Format RAID partition %1$s (%2$s) for swap"), d.c_str(), sizeString().c_str() ); } else if( encryption==ENC_NONE ) @@ -164,7 +164,7 @@ // %2$s is replaced by size (e.g. 623.5 MB) // %3$s is replaced by file system type (e.g. reiserfs) // %4$s is replaced by mount point (e.g. /usr) - txt = sformat( _("Format raid partition %1$s (%2$s) for %4$s with %3$s"), + txt = sformat( _("Format RAID partition %1$s (%2$s) for %4$s with %3$s"), d.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } @@ -174,7 +174,7 @@ // %2$s is replaced by size (e.g. 623.5 MB) // %3$s is replaced by file system type (e.g. reiserfs) // %4$s is replaced by mount point (e.g. /usr) - txt = sformat( _("Format encrypted raid partition %1$s (%2$s) for %4$s with %3$s"), + txt = sformat( _("Format encrypted RAID partition %1$s (%2$s) for %4$s with %3$s"), d.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } @@ -184,7 +184,7 @@ // displayed text before action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) // %3$s is replaced by file system type (e.g. reiserfs) - txt = sformat( _("Format raid partition %1$s (%2$s) with %3$s"), + txt = sformat( _("Format RAID partition %1$s (%2$s) with %3$s"), d.c_str(), sizeString().c_str(), fsTypeString().c_str() ); } @@ -201,11 +201,11 @@ if( needShrink() ) // displayed text during action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Shrinking raid partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); + txt = sformat( _("Shrinking RAID partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); else // displayed text during action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Extending raid partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); + txt = sformat( _("Extending RAID partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); txt += Text(" ", " "); // text displayed during action txt += _("(progress bar might not move)"); @@ -215,11 +215,11 @@ if( needShrink() ) // displayed text before action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Shrink raid partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); + txt = sformat( _("Shrink RAID partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); else // displayed text before action, %1$s is replaced by raid partition e.g. pdc_dabaheedj_part1 // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat( _("Extend raid partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); + txt = sformat( _("Extend RAID partition %1$s to %2$s"), d.c_str(), sizeString().c_str() ); } return( txt ); @@ -233,14 +233,14 @@ { // displayed text during action, %1$s is replaced by partition name (e.g. pdc_dabaheedj_part1), // %2$s is replaced by hexadecimal number (e.g. 8E) - txt = sformat( _("Setting type of raid partition %1$s to %2$X"), + txt = sformat( _("Setting type of RAID partition %1$s to %2$X"), d.c_str(), id() ); } else { // displayed text before action, %1$s is replaced by partition name (e.g. pdc_dabaheedj_part1), // %2$s is replaced by hexadecimal number (e.g. 8E) - txt = sformat( _("Set type of raid partition %1$s to %2$X"), + txt = sformat( _("Set type of RAID partition %1$s to %2$X"), d.c_str(), id() ); } return( txt ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/DmraidCo.cc new/libstorage-2.22.0/storage/DmraidCo.cc --- old/libstorage-2.21.15/storage/DmraidCo.cc 2011-08-23 12:15:03.000000000 +0200 +++ new/libstorage-2.22.0/storage/DmraidCo.cc 2011-11-18 15:17:14.000000000 +0100 @@ -237,12 +237,12 @@ if( doing ) { // displayed text during action, %1$s is replaced by a name (e.g. pdc_igeeeadj), - txt = sformat( _("Removing raid %1$s"), name().c_str() ); + txt = sformat( _("Removing RAID %1$s"), name().c_str() ); } else { // displayed text before action, %1$s is replaced by a name (e.g. pdc_igeeeadj), - txt = sformat( _("Remove raid %1$s"), name().c_str() ); + txt = sformat( _("Remove RAID %1$s"), name().c_str() ); } return( txt ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/EtcFstab.cc new/libstorage-2.22.0/storage/EtcFstab.cc --- old/libstorage-2.21.15/storage/EtcFstab.cc 2011-04-07 18:17:28.000000000 +0200 +++ new/libstorage-2.22.0/storage/EtcFstab.cc 2011-11-18 15:17:14.000000000 +0100 @@ -320,7 +320,11 @@ while( i!=co.end() && i->old.dentry != entry.dentry ) ++i; if( i!=co.end() ) + { + y2mil( "entry old:" << i->nnew ); i->nnew.device = i->old.device = device; + y2mil( "entry new:" << i->nnew ); + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Md.cc new/libstorage-2.22.0/storage/Md.cc --- old/libstorage-2.21.15/storage/Md.cc 2011-10-26 13:15:03.000000000 +0200 +++ new/libstorage-2.22.0/storage/Md.cc 2011-12-05 14:35:36.000000000 +0100 @@ -525,6 +525,15 @@ } + list<string> + Md::getUsing() const + { + list<string> ret = devs; + ret.insert(ret.end(), spare.begin(), spare.end()); + return ret; + } + + void Md::getInfo( MdInfo& tinfo ) const { Volume::getInfo(info.v); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Md.h new/libstorage-2.22.0/storage/Md.h --- old/libstorage-2.21.15/storage/Md.h 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/Md.h 2011-12-05 14:50:40.000000000 +0100 @@ -89,6 +89,8 @@ bool updateEntry(EtcMdadm* mdadm) const; + virtual list<string> getUsing() const; + protected: void computeSize(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/MdPart.cc new/libstorage-2.22.0/storage/MdPart.cc --- old/libstorage-2.21.15/storage/MdPart.cc 2011-03-24 14:09:06.000000000 +0100 +++ new/libstorage-2.22.0/storage/MdPart.cc 2011-12-05 14:51:38.000000000 +0100 @@ -183,6 +183,16 @@ return txt; } + + list<string> + MdPart::getUsing() const + { + list<string> ret; + ret.push_back(cont->device()); + return ret; + } + + void MdPart::getInfo( MdPartInfo& tinfo ) const { Volume::getInfo(info.v); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/MdPart.h new/libstorage-2.22.0/storage/MdPart.h --- old/libstorage-2.21.15/storage/MdPart.h 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/MdPart.h 2011-12-05 14:51:04.000000000 +0100 @@ -69,6 +69,8 @@ virtual string procName() const { return nm; } virtual string sysfsPath() const; + virtual list<string> getUsing() const; + protected: const MdPartCo* co() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/MdPartCo.cc new/libstorage-2.22.0/storage/MdPartCo.cc --- old/libstorage-2.21.15/storage/MdPartCo.cc 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/MdPartCo.cc 2011-12-05 14:53:21.000000000 +0100 @@ -1354,6 +1354,9 @@ { md_uuid = details.uuid; md_name = details.devname; + + alt_names.remove_if(string_starts_with("/dev/md/")); + alt_names.push_back("/dev/md/" + md_name); } getStorage()->addUsedBy(devs, UB_MDPART, dev); @@ -1583,6 +1586,15 @@ } + list<string> + MdPartCo::getUsing() const + { + list<string> ret = devs; + ret.insert(ret.end(), spare.begin(), spare.end()); + return ret; + } + + bool MdPartCo::active = false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/MdPartCo.h new/libstorage-2.22.0/storage/MdPartCo.h --- old/libstorage-2.21.15/storage/MdPartCo.h 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/MdPartCo.h 2011-12-05 14:52:49.000000000 +0100 @@ -117,6 +117,8 @@ Partition* getPartition( unsigned nr, bool del ); + virtual list<string> getUsing() const; + void getInfo( storage::MdPartCoInfo& info ) const; bool equalContent( const Container& rhs ) const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Nfs.cc new/libstorage-2.22.0/storage/Nfs.cc --- old/libstorage-2.21.15/storage/Nfs.cc 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/Nfs.cc 2011-11-18 15:17:14.000000000 +0100 @@ -67,12 +67,12 @@ if( doing ) { // displayed text during action, %1$s is replaced by volume name e.g. hilbert:/work - txt = sformat( _("Removing nfs volume %1$s"), dev.c_str() ); + txt = sformat( _("Removing NFS volume %1$s"), dev.c_str() ); } else { // displayed text before action, %1$s is replaced by volume name e.g. hilbert:/work - txt = sformat( _("Remove nfs volume %1$s"), dev.c_str() ); + txt = sformat( _("Remove NFS volume %1$s"), dev.c_str() ); } return( txt ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/NfsCo.cc new/libstorage-2.22.0/storage/NfsCo.cc --- old/libstorage-2.21.15/storage/NfsCo.cc 2011-02-03 15:52:36.000000000 +0100 +++ new/libstorage-2.22.0/storage/NfsCo.cc 2011-11-09 14:47:02.000000000 +0100 @@ -183,9 +183,17 @@ { Nfs *n = NULL; NfsIter nfs; - if( findNfs( i->device, nfs )) + + if( findNfs( Nfs::canonicalName(i->device), nfs )) { n = &(*nfs); + + list<string> tmp = n->altNames(); + if (!contains(tmp, i->device)) + { + tmp.push_back(i->device); + n->setAltNames(tmp); + } } else { @@ -209,7 +217,7 @@ { NfsPair p=nfsPair(); i=p.begin(); - while( i!=p.end() && i->device()!=dev ) + while( i!=p.end() && !i->sameDevice(dev) ) ++i; return( i!=p.end() ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Partition.cc new/libstorage-2.22.0/storage/Partition.cc --- old/libstorage-2.21.15/storage/Partition.cc 2011-09-07 16:52:25.000000000 +0200 +++ new/libstorage-2.22.0/storage/Partition.cc 2011-12-05 14:32:58.000000000 +0100 @@ -568,6 +568,15 @@ } + list<string> + Partition::getUsing() const + { + list<string> ret; + ret.push_back(cont->device()); + return ret; + } + + void Partition::getInfo( PartitionAddInfo& tinfo ) const { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Partition.h new/libstorage-2.22.0/storage/Partition.h --- old/libstorage-2.21.15/storage/Partition.h 2011-08-09 13:36:56.000000000 +0200 +++ new/libstorage-2.22.0/storage/Partition.h 2011-12-05 14:32:23.000000000 +0100 @@ -120,6 +120,8 @@ bool operator> ( const Partition& rhs ) const { return( !(*this<=rhs) ); } + virtual list<string> getUsing() const; + protected: Region reg; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/PeContainer.cc new/libstorage-2.22.0/storage/PeContainer.cc --- old/libstorage-2.21.15/storage/PeContainer.cc 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/PeContainer.cc 2011-12-06 11:57:01.000000000 +0100 @@ -816,4 +816,18 @@ setChildValue(node, "pe_free", free_pe); } + + list<string> + PeContainer::getUsing() const + { + list<string> ret; + for (list<Pv>::const_iterator it = pv.begin(); it != pv.end(); ++it) + ret.push_back(it->device); + for (list<Pv>::const_iterator it = pv_add.begin(); it != pv_add.end(); ++it) + ret.push_back(it->device); + for (list<Pv>::const_iterator it = pv_remove.begin(); it != pv_remove.end(); ++it) + ret.remove(it->device); + return ret; + } + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/PeContainer.h new/libstorage-2.22.0/storage/PeContainer.h --- old/libstorage-2.21.15/storage/PeContainer.h 2010-11-03 12:41:22.000000000 +0100 +++ new/libstorage-2.22.0/storage/PeContainer.h 2011-12-05 14:15:43.000000000 +0100 @@ -63,6 +63,8 @@ string getDeviceByNumber( const string& majmin ) const; + virtual list<string> getUsing() const; + protected: struct Pv { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Storage.cc new/libstorage-2.22.0/storage/Storage.cc --- old/libstorage-2.21.15/storage/Storage.cc 2011-11-07 11:58:34.000000000 +0100 +++ new/libstorage-2.22.0/storage/Storage.cc 2011-12-06 17:06:17.000000000 +0100 @@ -365,8 +365,8 @@ "If they are clean devices or contain partitions then you can choose to use\n" "MD Partitionable RAID sysbsystem to handle them. In case of clean device you\n" "will be able to install system on it and boot from such RAID.\n" - "Do you want MD Partitionable RAID subsystem to manage those partitions?" - ), boost::join(l, " ").c_str() ); + "Do you want MD Partitionable RAID subsystem to manage those partitions?"), + boost::join(l, " ").c_str()); if( yesnoPopupCb(txt) ) { @@ -857,7 +857,8 @@ SystemCmd Losetup(LOSETUPBIN " -a"); for( VolIterator i=begin; i!=end; ++i ) { - if (!i->isUsedBy()) + if( !i->isUsedBy() && + (i->getContainer()==NULL||!i->getContainer()->isUsedBy())) { i->getLoopData( Losetup ); i->getFsData(systeminfo.getBlkid()); @@ -866,7 +867,8 @@ } for( VolIterator i=begin; i!=end; ++i ) { - if (!i->isUsedBy()) + if( !i->isUsedBy() && + (i->getContainer()==NULL||!i->getContainer()->isUsedBy())) { i->getMountData(systeminfo.getProcMounts(), !detectMounted); i->getFstabData( *fstab ); @@ -967,19 +969,27 @@ int -Storage::getRecursiveUsing(const string& device, list<string>& devices) +Storage::getRecursiveUsing(const list<string>& devices, bool itself, list<string>& using_devices) { - y2mil("device:" << device); + y2mil("devices:" << devices); assertInit(); - devices.clear(); - int ret = getRecursiveUsingHelper(device, devices); - y2mil("ret:" << ret << " devices:" << devices); + int ret = 0; + using_devices.clear(); + + for (list<string>::const_iterator it = devices.begin(); it != devices.end(); ++it) + { + ret = getRecursiveUsingHelper(*it, itself, using_devices); + if (ret != 0) + break; + } + + y2mil("ret:" << ret << " using_devices:" << using_devices); return ret; } int -Storage::getRecursiveUsingHelper(const string& device, list<string>& devices) +Storage::getRecursiveUsingHelper(const string& device, bool itself, list<string>& using_devices) { int ret = 0; ConstContIterator cont; @@ -987,14 +997,18 @@ if (findVolume(device, vol)) { + if (itself && find(using_devices.begin(), using_devices.end(), + vol->device()) == using_devices.end()) + using_devices.push_back(vol->device()); + if (vol->isUsedBy()) { const list<UsedBy> usedBy = vol->getUsedBy(); for( list<UsedBy>::const_iterator it = usedBy.begin(); it != usedBy.end(); ++it) { - addIfNotThere( devices, it->device() ); - getRecursiveUsingHelper(it->device(), devices); + addIfNotThere( using_devices, it->device() ); + getRecursiveUsingHelper(it->device(), itself, using_devices); } } CType typ = vol->cType(); @@ -1064,17 +1078,21 @@ } for( list<string>::const_iterator i = dl.begin(); i != dl.end(); ++i ) { - addIfNotThere( devices, *i ); - getRecursiveUsingHelper(*i, devices); + addIfNotThere( using_devices, *i ); + getRecursiveUsingHelper(*i, itself, using_devices); } } else if (findContainer(device, cont)) { + if (itself && find(using_devices.begin(), using_devices.end(), + cont->device()) == using_devices.end()) + using_devices.push_back(cont->device()); + Container::ConstVolPair p = cont->volPair(Volume::notDeleted); for( Container::ConstVolIterator it = p.begin(); it != p.end(); ++it ) { - addIfNotThere( devices, it->device() ); - getRecursiveUsingHelper(it->device(), devices); + addIfNotThere( using_devices, it->device() ); + getRecursiveUsingHelper(it->device(), itself, using_devices); } if (cont->isUsedBy()) @@ -1083,8 +1101,8 @@ for( list<UsedBy>::const_iterator it = usedBy.begin(); it != usedBy.end(); ++it) { - addIfNotThere( devices, it->device() ); - getRecursiveUsingHelper(it->device(), devices); + addIfNotThere( using_devices, it->device() ); + getRecursiveUsingHelper(it->device(), itself, using_devices); } } } @@ -1096,6 +1114,57 @@ } +int +Storage::getRecursiveUsedBy(const list<string>& devices, bool itself, list<string>& usedby_devices) +{ + y2mil("devices:" << devices); + assertInit(); + int ret = 0; + usedby_devices.clear(); + + for (list<string>::const_iterator it = devices.begin(); it != devices.end(); ++it) + { + ret = getRecursiveUsedByHelper(*it, itself, usedby_devices); + if (ret != 0) + break; + } + + y2mil("ret:" << ret << " usedby_devices:" << usedby_devices); + return ret; +} + + +int +Storage::getRecursiveUsedByHelper(const string& device, bool itself, list<string>& usedby_devices) +{ + int ret = 0; + + const Device* p = findDevice(device, true); + if (p) + { + if (itself && find(usedby_devices.begin(), usedby_devices.end(), + p->device()) == usedby_devices.end()) + usedby_devices.push_back(p->device()); + + list<string> tmp = p->getUsing(); + for (list<string>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) + { + if (find(usedby_devices.begin(), usedby_devices.end(), *it) == usedby_devices.end()) + { + usedby_devices.push_back(*it); + getRecursiveUsedByHelper(*it, itself, usedby_devices); + } + } + } + else + { + ret = STORAGE_DEVICE_NOT_FOUND; + } + + return ret; +} + + void Storage::setZeroNewPartitions(bool val) { y2mil("val:" << val); @@ -4876,7 +4945,7 @@ y2mil("p.length:" << p.length()); typedef array<CommitStage, 5> Stages; - const Stages stages = { { DECREASE, INCREASE, FORMAT, MOUNT, SUBVOL } }; + const Stages stages = { { DECREASE, INCREASE, FORMAT, SUBVOL, MOUNT } }; for (Stages::const_iterator stage = stages.begin(); stage != stages.end(); ++stage) { @@ -6837,7 +6906,9 @@ VolIterator vol; if( findVolume( device, vol ) ) { - if (vol->getFs() == FSUNKNOWN || vol->getFs() == FSNONE || vol->getFs() == SWAP) + if( (vol->getEncryption()!=ENC_NONE && vol->needCryptPwd()) || + (vol->getEncryption()==ENC_NONE && + (vol->getFs() == FSUNKNOWN || vol->getFs() == FSNONE || vol->getFs() == SWAP))) { ret = false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Storage.h new/libstorage-2.22.0/storage/Storage.h --- old/libstorage-2.21.15/storage/Storage.h 2011-10-25 16:24:38.000000000 +0200 +++ new/libstorage-2.22.0/storage/Storage.h 2011-12-06 17:00:20.000000000 +0100 @@ -426,8 +426,11 @@ void setRecursiveRemoval( bool val=true ); bool getRecursiveRemoval() const { return recursiveRemove; } - int getRecursiveUsing(const string& device, list<string>& devices); - int getRecursiveUsingHelper(const string& device, list<string>& devices); + int getRecursiveUsing(const list<string>& devices, bool itself, list<string>& using_devices); + int getRecursiveUsingHelper(const string& device, bool itself, list<string>& using_devices); + + int getRecursiveUsedBy(const list<string>& devices, bool itself, list<string>& usedby_devices); + int getRecursiveUsedByHelper(const string& device, bool itself, list<string>& usedby_devices); void setZeroNewPartitions( bool val=true ); bool getZeroNewPartitions() const { return zeroNewPartitions; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/StorageInterface.h new/libstorage-2.22.0/storage/StorageInterface.h --- old/libstorage-2.21.15/storage/StorageInterface.h 2011-10-25 16:24:38.000000000 +0200 +++ new/libstorage-2.22.0/storage/StorageInterface.h 2011-12-06 17:16:11.000000000 +0100 @@ -1703,14 +1703,28 @@ virtual bool getRecursiveRemoval() const = 0; /** - * Recursively get all devices using device. Volumes of containers are + * Recursively get all devices using devices. Volumes of containers are * also considered as using the devices. * - * @param device name of device, e.g. /dev/sda - * @param devices name of devices using device, e.g. /dev/sda1 /dev/sda2 + * @param devices name of device, e.g. /dev/sda + * @param itself whether the device itself is included in the result + * @param using_devices name of devices using device, e.g. /dev/sda1 /dev/sda2 * @return zero if all is ok, a negative number to indicate an error */ - virtual int getRecursiveUsing(const string& device, list<string>& devices) = 0; + virtual int getRecursiveUsing(const list<string>& devices, bool itself, + list<string>& using_devices) = 0; + + /** + * Recursively get all devices used by devices. Containers of volumes are + * also considered as used by the devices. + * + * @param devices list of name of devices, e.g. /dev/sda1 + * @param itself whether the device itself is included in the result + * @param usedby_devices name of devices used by devices, e.g. /dev/sda + * @return zero if all is ok, a negative number to indicate an error + */ + virtual int getRecursiveUsedBy(const list<string>& devices, bool itself, + list<string>& usedby_devices) = 0; /** * Set handling of newly created partitions. With this flag diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/StorageTypes.h new/libstorage-2.22.0/storage/StorageTypes.h --- old/libstorage-2.21.15/storage/StorageTypes.h 2011-08-04 17:31:19.000000000 +0200 +++ new/libstorage-2.22.0/storage/StorageTypes.h 2011-11-18 10:51:04.000000000 +0100 @@ -94,7 +94,7 @@ std::ostream& operator<<(std::ostream& s, const PartitionSlotInfo& a); std::ostream& operator<<(std::ostream& s, const FsCapabilities& a); - enum CommitStage { DECREASE, INCREASE, FORMAT, MOUNT, SUBVOL }; + enum CommitStage { DECREASE, INCREASE, FORMAT, SUBVOL, MOUNT }; class Volume; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Tmpfs.cc new/libstorage-2.22.0/storage/Tmpfs.cc --- old/libstorage-2.21.15/storage/Tmpfs.cc 2011-04-07 18:48:42.000000000 +0200 +++ new/libstorage-2.22.0/storage/Tmpfs.cc 2011-11-18 15:17:14.000000000 +0100 @@ -69,12 +69,12 @@ if( doing ) { // displayed text during action, %1$s is replaced by path name e.g /var/run - txt = sformat( _("Removing Tmpfs volume from mount point %1$s"), orig_mp.c_str() ); + txt = sformat( _("Removing tmpfs volume from mount point %1$s"), orig_mp.c_str() ); } else { // displayed text before action, %1$s is replaced by path name e.g /var/run - txt = sformat( _("Remove Tmpfs volume from mount point %1$s"), orig_mp.c_str() ); + txt = sformat( _("Remove tmpfs volume from mount point %1$s"), orig_mp.c_str() ); } return( txt ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Volume.cc new/libstorage-2.22.0/storage/Volume.cc --- old/libstorage-2.21.15/storage/Volume.cc 2011-11-03 13:42:51.000000000 +0100 +++ new/libstorage-2.22.0/storage/Volume.cc 2011-12-05 14:32:36.000000000 +0100 @@ -369,12 +369,14 @@ if( !found && !(uuid.empty()&&label.empty()) ) { found = fstabData.findUuidLabel( uuid, label, entry ); - fstabData.setDevice( entry, device() ); + if(found) + fstabData.setDevice( entry, device() ); } if( !found && !(udevId().empty()&&udevPath().empty()) ) { found = fstabData.findIdPath( udevId(), udevPath(), entry ); - fstabData.setDevice( entry, device() ); + if(found) + fstabData.setDevice( entry, device() ); } } @@ -732,8 +734,11 @@ int Volume::umountTmpMount( const string& m, int ret ) { int r = ret; - if( !getStorage()->umountDev( mountDevice() ) && r==0 ) - r = VOLUME_CANNOT_TMP_UMOUNT; + if( mp.empty() || !umountDir(m) ) + { + if( !getStorage()->umountDev( mountDevice() ) && r==0 ) + r = VOLUME_CANNOT_TMP_UMOUNT; + } if( m.substr( 0, 16 )== "/tmp/libstorage-" ) rmdir( m.c_str() ); return( r ); @@ -1192,6 +1197,18 @@ y2mil( "no access to " << path ); } +bool Volume::umountDir( const string& mp ) + { + bool ret = false; + y2mil("mp:" << mp); + if( !mp.empty() ) + { + SystemCmd cmd( UMOUNTBIN " " + quote(mp) ); + ret = cmd.retcode()==0; + } + return( ret ); + } + int Volume::umount( const string& mp ) { SystemCmd cmd; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/storage/Volume.h new/libstorage-2.22.0/storage/Volume.h --- old/libstorage-2.21.15/storage/Volume.h 2011-11-03 13:43:23.000000000 +0100 +++ new/libstorage-2.22.0/storage/Volume.h 2011-12-05 14:38:55.000000000 +0100 @@ -205,6 +205,7 @@ const string& fsTypeString() const { return toString(fs); } static bool isTmpCryptMp( const string& mp ); + static bool umountDir( const string& mp ); protected: void init(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/testsuite/Makefile.am new/libstorage-2.22.0/testsuite/Makefile.am --- old/libstorage-2.21.15/testsuite/Makefile.am 2010-10-12 12:19:23.000000000 +0200 +++ new/libstorage-2.22.0/testsuite/Makefile.am 2011-12-06 16:50:54.000000000 +0100 @@ -18,8 +18,8 @@ lvm_create.single lvm_create2.single lvm_extend.single \ md_create.single partition1.single partitionname.single \ partitionprefix.single recursive1.single recursive2.single \ - renumber1.single renumber2.single renumber3.single udevdecode.single \ - udevencode.single usedby1.single uuid1.single + recursive3.single renumber1.single renumber2.single renumber3.single \ + udevdecode.single udevencode.single usedby1.single uuid1.single backupstate1_single_SOURCES = backupstate1.cc common.h common.cc contvolinfo1_single_SOURCES = contvolinfo1.cc common.h common.cc @@ -41,6 +41,7 @@ partitionprefix_single_SOURCES = partitionprefix.cc common.cc recursive1_single_SOURCES = recursive1.cc common.h common.cc recursive2_single_SOURCES = recursive2.cc common.h common.cc +recursive3_single_SOURCES = recursive3.cc common.h common.cc renumber1_single_SOURCES = renumber1.cc common.h common.cc renumber2_single_SOURCES = renumber2.cc common.h common.cc renumber3_single_SOURCES = renumber3.cc common.h common.cc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/testsuite/Makefile.in new/libstorage-2.22.0/testsuite/Makefile.in --- old/libstorage-2.21.15/testsuite/Makefile.in 2011-11-08 11:43:28.000000000 +0100 +++ new/libstorage-2.22.0/testsuite/Makefile.in 2011-12-06 17:19:47.000000000 +0100 @@ -48,10 +48,11 @@ lvm_extend.single$(EXEEXT) md_create.single$(EXEEXT) \ partition1.single$(EXEEXT) partitionname.single$(EXEEXT) \ partitionprefix.single$(EXEEXT) recursive1.single$(EXEEXT) \ - recursive2.single$(EXEEXT) renumber1.single$(EXEEXT) \ - renumber2.single$(EXEEXT) renumber3.single$(EXEEXT) \ - udevdecode.single$(EXEEXT) udevencode.single$(EXEEXT) \ - usedby1.single$(EXEEXT) uuid1.single$(EXEEXT) + recursive2.single$(EXEEXT) recursive3.single$(EXEEXT) \ + renumber1.single$(EXEEXT) renumber2.single$(EXEEXT) \ + renumber3.single$(EXEEXT) udevdecode.single$(EXEEXT) \ + udevencode.single$(EXEEXT) usedby1.single$(EXEEXT) \ + uuid1.single$(EXEEXT) subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -150,6 +151,10 @@ recursive2_single_OBJECTS = $(am_recursive2_single_OBJECTS) recursive2_single_LDADD = $(LDADD) recursive2_single_DEPENDENCIES = ../storage/libstorage.la +am_recursive3_single_OBJECTS = recursive3.$(OBJEXT) common.$(OBJEXT) +recursive3_single_OBJECTS = $(am_recursive3_single_OBJECTS) +recursive3_single_LDADD = $(LDADD) +recursive3_single_DEPENDENCIES = ../storage/libstorage.la am_renumber1_single_OBJECTS = renumber1.$(OBJEXT) common.$(OBJEXT) renumber1_single_OBJECTS = $(am_renumber1_single_OBJECTS) renumber1_single_LDADD = $(LDADD) @@ -230,10 +235,11 @@ $(lvm_extend_single_SOURCES) $(md_create_single_SOURCES) \ $(partition1_single_SOURCES) $(partitionname_single_SOURCES) \ $(partitionprefix_single_SOURCES) $(recursive1_single_SOURCES) \ - $(recursive2_single_SOURCES) $(renumber1_single_SOURCES) \ - $(renumber2_single_SOURCES) $(renumber3_single_SOURCES) \ - $(udevdecode_single_SOURCES) $(udevencode_single_SOURCES) \ - $(usedby1_single_SOURCES) $(uuid1_single_SOURCES) + $(recursive2_single_SOURCES) $(recursive3_single_SOURCES) \ + $(renumber1_single_SOURCES) $(renumber2_single_SOURCES) \ + $(renumber3_single_SOURCES) $(udevdecode_single_SOURCES) \ + $(udevencode_single_SOURCES) $(usedby1_single_SOURCES) \ + $(uuid1_single_SOURCES) DIST_SOURCES = $(backupstate1_single_SOURCES) \ $(contvolinfo1_single_SOURCES) $(disklabel1_single_SOURCES) \ $(format1_single_SOURCES) $(freeinfo1_single_SOURCES) \ @@ -244,10 +250,11 @@ $(lvm_extend_single_SOURCES) $(md_create_single_SOURCES) \ $(partition1_single_SOURCES) $(partitionname_single_SOURCES) \ $(partitionprefix_single_SOURCES) $(recursive1_single_SOURCES) \ - $(recursive2_single_SOURCES) $(renumber1_single_SOURCES) \ - $(renumber2_single_SOURCES) $(renumber3_single_SOURCES) \ - $(udevdecode_single_SOURCES) $(udevencode_single_SOURCES) \ - $(usedby1_single_SOURCES) $(uuid1_single_SOURCES) + $(recursive2_single_SOURCES) $(recursive3_single_SOURCES) \ + $(renumber1_single_SOURCES) $(renumber2_single_SOURCES) \ + $(renumber3_single_SOURCES) $(udevdecode_single_SOURCES) \ + $(udevencode_single_SOURCES) $(usedby1_single_SOURCES) \ + $(uuid1_single_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -456,6 +463,7 @@ partitionprefix_single_SOURCES = partitionprefix.cc common.cc recursive1_single_SOURCES = recursive1.cc common.h common.cc recursive2_single_SOURCES = recursive2.cc common.h common.cc +recursive3_single_SOURCES = recursive3.cc common.h common.cc renumber1_single_SOURCES = renumber1.cc common.h common.cc renumber2_single_SOURCES = renumber2.cc common.h common.cc renumber3_single_SOURCES = renumber3.cc common.h common.cc @@ -566,6 +574,9 @@ recursive2.single$(EXEEXT): $(recursive2_single_OBJECTS) $(recursive2_single_DEPENDENCIES) @rm -f recursive2.single$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(recursive2_single_OBJECTS) $(recursive2_single_LDADD) $(LIBS) +recursive3.single$(EXEEXT): $(recursive3_single_OBJECTS) $(recursive3_single_DEPENDENCIES) + @rm -f recursive3.single$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(recursive3_single_OBJECTS) $(recursive3_single_LDADD) $(LIBS) renumber1.single$(EXEEXT): $(renumber1_single_OBJECTS) $(renumber1_single_DEPENDENCIES) @rm -f renumber1.single$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(renumber1_single_OBJECTS) $(renumber1_single_LDADD) $(LIBS) @@ -615,6 +626,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partitionprefix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recursive1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recursive2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recursive3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renumber1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renumber2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renumber3.Po@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/testsuite/recursive2.cc new/libstorage-2.22.0/testsuite/recursive2.cc --- old/libstorage-2.21.15/testsuite/recursive2.cc 2010-07-29 15:47:00.000000000 +0200 +++ new/libstorage-2.22.0/testsuite/recursive2.cc 2011-12-06 17:09:38.000000000 +0100 @@ -16,11 +16,14 @@ test(const string& device) { list<string> devices; - int ret = s->getRecursiveUsing(device, devices); + devices.push_back(device); - cout << device << " "; + list<string> using_devices; + int ret = s->getRecursiveUsing(devices, false, using_devices); + + cout << device << ": "; if (ret == 0) - cout << boost::join(devices, " "); + cout << boost::join(using_devices, " "); else cout << ret; cout << endl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/testsuite/recursive3.cc new/libstorage-2.22.0/testsuite/recursive3.cc --- old/libstorage-2.21.15/testsuite/recursive3.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-2.22.0/testsuite/recursive3.cc 2011-12-06 16:55:31.000000000 +0100 @@ -0,0 +1,54 @@ + +#include <iostream> +#include <boost/algorithm/string.hpp> + +#include "common.h" + + +using namespace storage; +using namespace std; + + +StorageInterface* s = NULL; + + +void +test(const string& device) +{ + list<string> devices; + devices.push_back(device); + + list<string> usedby_devices; + int ret = s->getRecursiveUsedBy(devices, false, usedby_devices); + + cout << device << ": "; + if (ret == 0) + cout << boost::join(usedby_devices, " "); + else + cout << ret; + cout << endl; +} + + +int +main() +{ + cout.setf(std::ios::boolalpha); + + setup_logger(); + + setup_system("thalassa"); + + s = createStorageInterface(TestEnvironment()); + + test("/dev/sda"); + test("/dev/sda1"); + test("/dev/sda2"); + + test("/dev/system"); + test("/dev/system/root"); + + test("/dev/sdxyz"); + + delete s; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/testsuite/single.out/recursive2.out new/libstorage-2.22.0/testsuite/single.out/recursive2.out --- old/libstorage-2.21.15/testsuite/single.out/recursive2.out 2010-07-29 15:47:00.000000000 +0200 +++ new/libstorage-2.22.0/testsuite/single.out/recursive2.out 2011-12-06 17:10:11.000000000 +0100 @@ -1,8 +1,8 @@ -/dev/sda /dev/sda1 /dev/sda2 /dev/system /dev/system/abuild /dev/system/arvin /dev/system/root /dev/system/swap /dev/system/virtualbox -/dev/sda1 -/dev/sda2 /dev/system /dev/system/abuild /dev/system/arvin /dev/system/root /dev/system/swap /dev/system/virtualbox -/dev/sdb /dev/sdb1 /dev/sdb2 /dev/sdb5 /dev/sdb6 -/dev/sdb1 -/dev/sdb2 /dev/sdb5 /dev/sdb6 -/dev/system /dev/system/abuild /dev/system/arvin /dev/system/root /dev/system/swap /dev/system/virtualbox -/dev/sdxyz -2034 +/dev/sda: /dev/sda1 /dev/sda2 /dev/system /dev/system/abuild /dev/system/arvin /dev/system/root /dev/system/swap /dev/system/virtualbox +/dev/sda1: +/dev/sda2: /dev/system /dev/system/abuild /dev/system/arvin /dev/system/root /dev/system/swap /dev/system/virtualbox +/dev/sdb: /dev/sdb1 /dev/sdb2 /dev/sdb5 /dev/sdb6 +/dev/sdb1: +/dev/sdb2: /dev/sdb5 /dev/sdb6 +/dev/system: /dev/system/abuild /dev/system/arvin /dev/system/root /dev/system/swap /dev/system/virtualbox +/dev/sdxyz: -2034 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.21.15/testsuite/single.out/recursive3.out new/libstorage-2.22.0/testsuite/single.out/recursive3.out --- old/libstorage-2.21.15/testsuite/single.out/recursive3.out 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-2.22.0/testsuite/single.out/recursive3.out 2011-12-06 17:10:45.000000000 +0100 @@ -0,0 +1,6 @@ +/dev/sda: +/dev/sda1: /dev/sda +/dev/sda2: /dev/sda +/dev/system: /dev/sda2 /dev/sda +/dev/system/root: /dev/system /dev/sda2 /dev/sda +/dev/sdxyz: -2034 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
