Hello community,

here is the log from the commit of package libstorage for openSUSE:Factory 
checked in at 2012-08-08 21:55:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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    2012-07-18 
17:24:47.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes       
2012-08-08 21:55:13.000000000 +0200
@@ -1,0 +2,23 @@
+Tue Aug  7 19:18:21 CEST 2012 - [email protected]
+
+- 2.22.9
+- use mount point as base for dm name if available (bnc#768572)
+
+-------------------------------------------------------------------
+Thu Aug  2 13:11:39 CEST 2012 - [email protected]
+
+- fix handling of LVMs with mix of encrypted and unencrypted PVs
+- fix handling of encrypted PVs with non-standard dm name 
+
+-------------------------------------------------------------------
+Tue Jul 24 18:35:04 CEST 2012 - [email protected]
+
+- improve handling of btrfs on non-formatted root fs  
+
+-------------------------------------------------------------------
+Mon Jul 23 17:22:34 CEST 2012 - [email protected]
+
+- fix uuid handling when changing format false->true->false for
+  btrfs filesystems (bnc#772112)
+
+-------------------------------------------------------------------

Old:
----
  libstorage-2.22.8.tar.bz2

New:
----
  libstorage-2.22.9.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libstorage.spec ++++++
--- /var/tmp/diff_new_pack.Wbiwpy/_old  2012-08-08 21:55:14.000000000 +0200
+++ /var/tmp/diff_new_pack.Wbiwpy/_new  2012-08-08 21:55:14.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           libstorage
-Version:        2.22.8
+Version:        2.22.9
 Release:        0
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source:         libstorage-%{version}.tar.bz2

++++++ libstorage-2.22.8.tar.bz2 -> libstorage-2.22.9.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/VERSION 
new/libstorage-2.22.9/VERSION
--- old/libstorage-2.22.8/VERSION       2012-07-16 15:19:31.000000000 +0200
+++ new/libstorage-2.22.9/VERSION       2012-08-08 13:49:37.000000000 +0200
@@ -1 +1 @@
-2.22.8
+2.22.9
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/examples/TestLogging.cc 
new/libstorage-2.22.9/examples/TestLogging.cc
--- old/libstorage-2.22.8/examples/TestLogging.cc       2012-06-13 
10:15:45.000000000 +0200
+++ new/libstorage-2.22.9/examples/TestLogging.cc       2012-08-02 
13:17:13.000000000 +0200
@@ -4,6 +4,7 @@
  *  the disk_* and volume_* files in /var/log/YaST2/ will be generated.
  */
 
+#include <stdlib.h>
 #include <unistd.h>
 #include <iostream>
 #include <fstream>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/Btrfs.cc 
new/libstorage-2.22.9/storage/Btrfs.cc
--- old/libstorage-2.22.8/storage/Btrfs.cc      2012-04-25 11:58:58.000000000 
+0200
+++ new/libstorage-2.22.9/storage/Btrfs.cc      2012-07-24 18:40:52.000000000 
+0200
@@ -131,6 +131,43 @@
     y2mil( "devs:" << devs );
     }
 
+void Btrfs::detectSubvol()
+    {
+    y2mil( "dev:" << device() );
+    if( getFormat() )
+        clearSubvol();
+    else
+        {
+        bool mounted = false;
+        string mp = getMount();
+        if( !isMounted() && getStorage()->mountTmpRo( this, mp ) )
+            mounted = true;
+        if( !mp.empty() )
+            {
+            clearSubvol();
+            SystemCmd cmd( BTRFSBIN " subvolume list " + mp );
+            for( vector<string>::const_iterator s=cmd.stdout().begin(); 
+                 s!=cmd.stdout().end(); ++s )
+                {
+                string subvol;
+                string::size_type pos = s->find( " path " );
+                if( pos!=string::npos )
+                    pos = s->find_first_not_of( app_ws, pos+5 );
+                if( pos!=string::npos )
+                    subvol = s->substr( pos, s->find_last_not_of( app_ws ) );
+                if( !subvol.empty() )
+                    addSubvol( subvol );
+                }
+            }
+        if( mounted )
+            {
+            getStorage()->umountDev( device() );
+            if( mp!=getMount() )
+                rmdir( mp.c_str() );
+            }
+        }
+    y2mil( "ret dev:" << device() << " subvol:" << subvol );
+    }
 
 void Btrfs::addSubvol( const string& path )
     {
@@ -504,13 +541,12 @@
     ret = Volume::setFormat( val, new_fs );
     if( ret==0 )
        {
-       if( val )
-           {
-           orig_uuid = uuid;
-           uuid = co()->fakeUuid();
-           }
+        if( val )
+            uuid = co()->fakeUuid();
+        detectSubvol();
        getStorage()->setBtrfsUsedBy( this );
        }
+    y2mil("device:" << *this );
     y2mil("ret:" << ret);
     return( ret );
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/Btrfs.h 
new/libstorage-2.22.9/storage/Btrfs.h
--- old/libstorage-2.22.8/storage/Btrfs.h       2012-04-25 11:58:58.000000000 
+0200
+++ new/libstorage-2.22.9/storage/Btrfs.h       2012-07-24 16:52:14.000000000 
+0200
@@ -44,6 +44,7 @@
 
        void clearSubvol() { subvol.clear(); }
        void addSubvol( const string& path );
+        void detectSubvol();
        list<string> getDevices( bool add_del=false ) const;
        void getDevices( list<string>& devs, bool add_del=false ) const;
        void getSubvolumes( list<Subvolume>& sv ) const { sv = subvol; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/BtrfsCo.cc 
new/libstorage-2.22.9/storage/BtrfsCo.cc
--- old/libstorage-2.22.8/storage/BtrfsCo.cc    2012-05-03 14:34:25.000000000 
+0200
+++ new/libstorage-2.22.9/storage/BtrfsCo.cc    2012-07-24 16:57:03.000000000 
+0200
@@ -152,35 +152,7 @@
        }
     BtrfsPair p( btrfsPair() );
     for( BtrfsIter i=p.begin(); i!=p.end(); ++i )
-       {
-       y2mil( "dev:" << i->device() );
-       bool mounted = false;
-       string mp = i->getMount();
-       if( !i->isMounted() && getStorage()->mountTmpRo( &(*i), mp ) )
-           mounted = true;
-       if( !mp.empty() )
-           {
-           i->clearSubvol();
-           SystemCmd cmd( BTRFSBIN " subvolume list " + mp );
-           for( vector<string>::const_iterator s=cmd.stdout().begin(); 
-                s!=cmd.stdout().end(); ++s )
-               {
-               string subvol;
-               string::size_type pos = s->find( " path " );
-               if( pos!=string::npos )
-                   pos = s->find_first_not_of( app_ws, pos+5 );
-               if( pos!=string::npos )
-                   subvol = s->substr( pos, s->find_last_not_of( app_ws ) );
-               if( !subvol.empty() )
-                   i->addSubvol( subvol );
-               }
-           }
-       if( mounted )
-           {
-           getStorage()->umountDev( i->device() );
-           rmdir( mp.c_str() );
-           }
-       }
+        i->detectSubvol();
     y2mil("end");
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/LvmVg.cc 
new/libstorage-2.22.9/storage/LvmVg.cc
--- old/libstorage-2.22.8/storage/LvmVg.cc      2012-06-27 11:06:47.000000000 
+0200
+++ new/libstorage-2.22.9/storage/LvmVg.cc      2012-08-08 13:48:58.000000000 
+0200
@@ -974,7 +974,7 @@
 void LvmVg::addPv( Pv*& p )
     {
     PeContainer::addPv( *p );
-    if( !deleted() &&
+    if( !deleted() && p->device!=UNKNOWN_PV_DEVICE &&
         find( pv_remove.begin(), pv_remove.end(), *p )==pv_remove.end() )
        getStorage()->setUsedBy(p->device, UB_LVM, device());
     delete p;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/PeContainer.cc 
new/libstorage-2.22.9/storage/PeContainer.cc
--- old/libstorage-2.22.8/storage/PeContainer.cc        2012-04-25 
11:58:58.000000000 +0200
+++ new/libstorage-2.22.9/storage/PeContainer.cc        2012-08-02 
12:42:16.000000000 +0200
@@ -830,4 +830,12 @@
        return ret;
     }
 
+bool PeContainer::hasUnkownPv() const
+    {
+    bool ret = find( pv.begin(), pv.end(), UNKNOWN_PV_DEVICE )!=pv.end();
+    if( ret )
+        y2mil( "name:" << nm << " ret:" << ret );
+    return( ret );
+    }
+
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/PeContainer.h 
new/libstorage-2.22.9/storage/PeContainer.h
--- old/libstorage-2.22.8/storage/PeContainer.h 2012-04-25 11:58:58.000000000 
+0200
+++ new/libstorage-2.22.9/storage/PeContainer.h 2012-08-02 12:31:37.000000000 
+0200
@@ -26,6 +26,8 @@
 #include "storage/Container.h"
 #include "storage/Dm.h"
 
+#define UNKNOWN_PV_DEVICE "unknown"
+
 namespace storage
 {
 
@@ -48,6 +50,7 @@
        unsigned long peCount() const { return num_pe; }
        unsigned long peFree() const { return free_pe; }
        unsigned numPv() const { return pv.size(); }
+        bool hasUnkownPv() const;
        friend std::ostream& operator<< (std::ostream&, const PeContainer& );
        bool addedPv( const string& dev ) const;
        unsigned long sizeToLe( unsigned long long sizeK ) const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/ProcMdstat.cc 
new/libstorage-2.22.9/storage/ProcMdstat.cc
--- old/libstorage-2.22.8/storage/ProcMdstat.cc 2012-04-25 11:58:58.000000000 
+0200
+++ new/libstorage-2.22.9/storage/ProcMdstat.cc 2012-07-26 12:43:03.000000000 
+0200
@@ -124,9 +124,9 @@
 
            bool is_spare = boost::ends_with(tmp, "(S)");
            if (!is_spare)
-               entry.devices.push_back(d);
+               entry.devices.push_front(d);
            else
-               entry.spares.push_back(d);
+               entry.spares.push_front(d);
 
            line.erase( 0, tmp.length() );
            if( (pos=line.find_first_not_of( app_ws ))!=string::npos && pos!=0 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/Storage.cc 
new/libstorage-2.22.9/storage/Storage.cc
--- old/libstorage-2.22.8/storage/Storage.cc    2012-06-27 17:34:59.000000000 
+0200
+++ new/libstorage-2.22.9/storage/Storage.cc    2012-08-08 13:48:58.000000000 
+0200
@@ -252,7 +252,23 @@
     prepareLogStream(buf);
     printInfo(buf);
     y2mil("DETECTED OBJECTS BEGIN");
-    y2mil(buf.str());
+    string s(buf.str());
+    const char* pos1 = s.c_str();
+    const char* pos2;
+    while( pos1!=NULL && *pos1!=0 )
+        {
+        pos2 = strchr( pos1, '\n' );
+        if( pos2 )
+            {
+            y2mil( string(pos1,pos2-pos1) );
+            pos1=pos2+1;
+            }
+        else
+            {
+            y2mil( string(pos1) );
+            pos1=pos2;
+            }
+        }
     y2mil("DETECTED OBJECTS END");
 }
 
@@ -456,8 +472,11 @@
     const list<string> l = LvmVg::getVgs();
     for( list<string>::const_iterator i=l.begin(); i!=l.end(); ++i )
        {
-       if( findLvmVg( *i ) == lvgEnd() )
+        LvmVgIterator vg = findLvmVg( *i );
+       if( vg==lvgEnd() || vg->hasUnkownPv() )
            {
+            if( vg!=lvgEnd() )
+                removeContainer( &(*vg) );
            LvmVg* v = new LvmVg(this, *i, "/dev/" + *i, systeminfo);
            addToList( v );
            v->normalizeDmDevices();
@@ -5222,6 +5241,22 @@
     return( ret );
     }
 
+bool Storage::usedDmName( const string& nm ) const
+    {
+    bool ret = false;
+    y2mil("nm:" << nm);
+    ConstVolPair vp = volPair();
+    ConstVolIterator v=vp.begin(); 
+    while( !ret && v!=vp.end() )
+       {
+        ret = v->dmcryptDevice()==nm || (v->cType()==DM&&v->device()==nm);
+        if( !ret )
+            ++v;
+       }
+    y2mil("ret:" << ret);
+    return( ret );
+    }
+
 void Storage::changeDeviceName( const string& old, const string& nw )
     {
     y2mil( "old:" << old << " new:" << nw );
@@ -6101,7 +6136,7 @@
                while( v!=li->end() && v->loopDevice()!=d )
                    ++v;
                }
-           if( !li->empty() && v==li->end() && d.find("/dev/mapper/cr_")==0 )
+           if( !li->empty() && v==li->end() && d.find("/dev/mapper/")==0 )
                {
                v = li->begin();
                while( v!=li->end() && v->dmcryptDevice()!=d )
@@ -6760,7 +6795,10 @@
                    ret = removeVolume(it->device());
                    break;
                case UB_LVM:
-                   ret = removeLvmVg(it->device().substr(5));
+                    if( it->device().size()>5 )
+                        ret = removeLvmVg(it->device().substr(5));
+                    else
+                        y2err("strange UsedbyLvm:\"" << it->device() << "\"");
                    break;
                case UB_DMRAID:
                    break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/Storage.h 
new/libstorage-2.22.9/storage/Storage.h
--- old/libstorage-2.22.8/storage/Storage.h     2012-06-27 17:34:59.000000000 
+0200
+++ new/libstorage-2.22.9/storage/Storage.h     2012-08-08 13:48:58.000000000 
+0200
@@ -259,6 +259,7 @@
        string prependRoot(const string& mp) const;
        const string& tmpDir() const { return tempdir; }
        bool hasIScsiDisks() const;
+        bool usedDmName( const string& nm ) const;
        string bootMount() const;
 
        const ArchInfo& getArchInfo() const { return archinfo; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/storage/Volume.cc 
new/libstorage-2.22.9/storage/Volume.cc
--- old/libstorage-2.22.8/storage/Volume.cc     2012-06-19 12:30:31.000000000 
+0200
+++ new/libstorage-2.22.9/storage/Volume.cc     2012-08-07 19:17:11.000000000 
+0200
@@ -24,6 +24,7 @@
 #include <sys/stat.h>
 #include <sstream>
 #include <fstream>
+#include <boost/algorithm/string.hpp>
 
 #include "storage/Volume.h"
 #include "storage/Disk.h"
@@ -579,7 +580,7 @@
        tunefs_opt = "";
        if( label.empty() && !orig_label.empty() )
            label = orig_label;
-       if( uuid.empty() && !orig_uuid.empty() )
+       if( !orig_uuid.empty() )
            uuid = orig_uuid;
        }
     else
@@ -609,9 +610,12 @@
                {
                label.erase( caps.labelLength );
                }
+            if( orig_uuid.empty() )
+                orig_uuid = uuid;
            uuid.erase();
            }
        }
+    y2mil("device:" << *this );
     y2mil("ret:" << ret);
     return( ret );
     }
@@ -923,6 +927,7 @@
 void Volume::updateUuid( const string& new_uuid )
     {
     uuid = new_uuid;
+    orig_uuid.erase();
     alt_names.remove_if(string_contains("/by-uuid/"));
     alt_names.push_back("/dev/disk/by-uuid/" + uuid);
     }
@@ -2234,7 +2239,14 @@
 string Volume::getDmcryptName() const
     {
     string nm;
-    if( cType() != LOOP )
+    if( !mp.empty() )
+        {
+        string m = mp.substr(mp.find_first_not_of( "/" ));
+        if( m.empty() )
+            m = "ROOT";
+        nm = boost::replace_all_copy( m, "/", "_" );
+        }
+    else if( cType() != LOOP )
        {
         if( !udevId().empty() )
             nm = udevId().front();
@@ -2248,8 +2260,12 @@
        }
     if( nm.find( '/' )!=string::npos )
        nm.erase( 0, nm.find_last_of( '/' )+1 );
-    nm = "/dev/mapper/cr_" + nm;
-    return( nm );
+    string ret = "/dev/mapper/cr_" + nm;
+    unsigned cnt=1;
+    while( getStorage()->usedDmName(ret))
+        ret = "/dev/mapper/cr_" + nm + "_" + decString(cnt++);
+    y2mil( "nm:" << ret );
+    return( ret );
     }
 
 void Volume::replaceAltName( const string& prefix, const string& newn )
@@ -2938,6 +2954,8 @@
                    {
                    changed = true;
                    che.mount = mp;
+                    if( encryption!=ENC_NONE )
+                       che.dentry = getDmcryptName();
                    }
                if( fstab_opt!=orig_fstab_opt )
                    {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.8/testsuite/single.out/fstab3.out 
new/libstorage-2.22.9/testsuite/single.out/fstab3.out
--- old/libstorage-2.22.8/testsuite/single.out/fstab3.out       2012-04-25 
11:58:58.000000000 +0200
+++ new/libstorage-2.22.9/testsuite/single.out/fstab3.out       2012-08-08 
14:01:47.000000000 +0200
@@ -6,8 +6,8 @@
 0
 0
 begin of fstab
-/dev/mapper/cr_sda1  /secret              ext4       nofail                0 2
+/dev/mapper/cr_secret /secret              ext4       nofail                0 2
 end of fstab
 begin of crypttab
-cr_sda1         /dev/sda1            none       none
+cr_secret       /dev/sda1            none       none
 end of crypttab

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to