Hello community,

here is the log from the commit of package libstorage for openSUSE:Factory 
checked in at 2013-04-03 12:57:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libstorage (Old)
 and      /work/SRC/openSUSE:Factory/.libstorage.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libstorage", Maintainer is "aschn...@suse.com"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libstorage/libstorage.changes    2013-03-05 
16:32:36.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes       
2013-04-03 12:58:00.000000000 +0200
@@ -1,0 +2,23 @@
+Tue Mar 26 17:25:02 CET 2013 - f...@suse.de
+
+- fix wrong handling of shrinking swap (bnc#803800)
+- restructured handling of resizing of existing fs
+
+-------------------------------------------------------------------
+Tue Mar 19 18:41:08 CET 2013 - f...@suse.de
+
+- fix wrong size calculation when deleting thin LVs (bnc#810305)
+
+-------------------------------------------------------------------
+Mon Mar 11 17:53:25 CET 2013 - f...@suse.de
+
+- version 2.23.10
+- fix LVM encryption when btrfs fs is present (bnc#808020)
+
+-------------------------------------------------------------------
+Wed Mar  6 14:43:59 CET 2013 - f...@suse.de
+
+- improve handling of udev by-id links for dm devices
+- fix detect of encrypted volumes (bnc#808487)
+
+-------------------------------------------------------------------

Old:
----
  libstorage-2.23.9.tar.bz2

New:
----
  libstorage-2.23.10.tar.bz2

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

Other differences:
------------------
++++++ libstorage.spec ++++++
--- /var/tmp/diff_new_pack.4CNPJ2/_old  2013-04-03 12:58:02.000000000 +0200
+++ /var/tmp/diff_new_pack.4CNPJ2/_new  2013-04-03 12:58:02.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           libstorage
-Version:        2.23.9
+Version:        2.23.10
 Release:        0
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source:         libstorage-%{version}.tar.bz2

++++++ libstorage-2.23.9.tar.bz2 -> libstorage-2.23.10.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/VERSION 
new/libstorage-2.23.10/VERSION
--- old/libstorage-2.23.9/VERSION       2013-03-05 12:16:50.000000000 +0100
+++ new/libstorage-2.23.10/VERSION      2013-03-18 13:56:34.000000000 +0100
@@ -1 +1 @@
-2.23.9
+2.23.10
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/AppUtil.cc 
new/libstorage-2.23.10/storage/AppUtil.cc
--- old/libstorage-2.23.9/storage/AppUtil.cc    2013-02-20 18:26:33.000000000 
+0100
+++ new/libstorage-2.23.10/storage/AppUtil.cc   2013-03-11 18:16:32.000000000 
+0100
@@ -146,20 +146,24 @@
 
 
     bool
-    getMajorMinor(const string& device, unsigned long& major, unsigned long& 
minor)
+    getMajorMinor(const string& device, unsigned long& major, unsigned long& 
minor, bool may_fail)
     {
        bool ret = false;
        string dev = normalizeDevice(device);
        struct stat sbuf;
        if (stat(device.c_str(), &sbuf) == 0)
        {
-           major = gnu_dev_major(sbuf.st_rdev);
-           minor = gnu_dev_minor(sbuf.st_rdev);
-           ret = true;
+           ret = S_ISBLK(sbuf.st_mode)||S_ISLNK(sbuf.st_mode);
+           if( ret )
+               {
+               major = gnu_dev_major(sbuf.st_rdev);
+               minor = gnu_dev_minor(sbuf.st_rdev);
+               }
        }
-       else
+       else 
        {
-           y2err("stat for " << device << " failed errno:" << errno << " (" << 
strerror(errno) << ")");
+           if( !may_fail )
+               y2err("stat for " << device << " failed errno:" << errno << " 
(" << strerror(errno) << ")");
        }
        return ret;
     }
@@ -538,7 +542,12 @@
 
                    string::size_type pos = tmp.find_first_not_of("./");
                    if (pos != string::npos)
-                       links[udevDecode(entry->d_name)] = tmp.substr(pos);
+                       {
+                       tmp.erase(0,pos);
+                       if( boost::starts_with(tmp, "dev/"))
+                           tmp.erase(0,4);
+                       links[udevDecode(entry->d_name)] = tmp;
+                       }
                }
                closedir(dir);
            }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/AppUtil.h 
new/libstorage-2.23.10/storage/AppUtil.h
--- old/libstorage-2.23.9/storage/AppUtil.h     2013-02-20 18:26:33.000000000 
+0100
+++ new/libstorage-2.23.10/storage/AppUtil.h    2013-03-11 18:16:32.000000000 
+0100
@@ -57,7 +57,7 @@
 
     bool getStatVfs(const string& path, StatVfs&);
 
-    bool getMajorMinor(const string& device, unsigned long& major, unsigned 
long& minor);
+    bool getMajorMinor(const string& device, unsigned long& major, unsigned 
long& minor, bool may_fail=false);
 
 
 string extractNthWord(int Num_iv, const string& Line_Cv, bool GetRest_bi = 
false);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Container.cc 
new/libstorage-2.23.10/storage/Container.cc
--- old/libstorage-2.23.9/storage/Container.cc  2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Container.cc 2013-03-12 17:06:33.000000000 
+0100
@@ -211,12 +211,12 @@
            else if( vol->needExtend() )
                ret = doResize( vol );
            if (vol->needCrsetup(false))
-               ret = vol->doCrsetup();
+               ret = vol->doCrsetup(!vol->isUsedBy(UB_LVM)&&!vol->getFormat());
            break;
 
        case FORMAT:
            if (vol->needCrsetup(true))
-               ret = vol->doCrsetup();
+               ret = vol->doCrsetup(false);
            if( ret==0 && vol->getFormat() )
                ret = vol->doFormat();
            if( ret==0 && vol->needLabel() )
@@ -227,7 +227,7 @@
            if( vol->needRemount() )
                {
                if (vol->needCrsetup(true))
-                   vol->doCrsetup();
+                   vol->doCrsetup(true);
                ret = vol->doMount();
                }
            if( ret==0 && vol->needFstabUpdate() )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Dasd.cc 
new/libstorage-2.23.10/storage/Dasd.cc
--- old/libstorage-2.23.9/storage/Dasd.cc       2013-02-21 19:11:32.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Dasd.cc      2013-03-05 17:56:33.000000000 
+0100
@@ -272,6 +272,15 @@
                                      cylinderToKb(len), Region(start, len), 
type);
        p->setCreated();
        device = p->device();
+       PartPair pp = partPair();
+       for( PartIter i = pp.begin(); i != pp.end(); ++i)
+           {
+           if (i->deleted() && i->nr()==p->nr() && !i->getCryptPwd().empty())
+               {
+               y2mil("harvesting old password");
+               p->setCryptPwd(i->getCryptPwd());
+               }
+           }
        addToList( p );
        }
     y2mil("ret:" << ret);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Device.cc 
new/libstorage-2.23.10/storage/Device.cc
--- old/libstorage-2.23.9/storage/Device.cc     2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Device.cc    2013-03-11 18:16:32.000000000 
+0100
@@ -110,7 +110,7 @@
     bool
     Device::getMajorMinor()
     {
-       return storage::getMajorMinor(dev, mjr, mnr);
+       return storage::getMajorMinor(dev, mjr, mnr, create);
     }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Disk.cc 
new/libstorage-2.23.10/storage/Disk.cc
--- old/libstorage-2.23.9/storage/Disk.cc       2013-03-04 15:46:32.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Disk.cc      2013-03-26 17:31:39.000000000 
+0100
@@ -208,7 +208,7 @@
 void
 Disk::setUdevData(const string& path, const list<string>& id)
 {
-    y2mil("disk:" << nm << " path:" << path << "id:" << id);
+    y2mil("disk:" << nm << " path:" << path << " id:" << id);
     udev_path = path;
     udev_id = id;
     udev_id.remove_if(string_starts_with("edd-"));
@@ -2327,7 +2327,6 @@
     if( p != NULL )
        {
        bool remount = false;
-       bool needExtend = !p->needShrink();
        getStorage()->showInfoCb( p->resizeText(true), silent );
        if( !dmp_slave && p->isMounted() )
            {
@@ -2335,10 +2334,8 @@
            if( ret==0 )
                remount = true;
            }
-       if( ret==0 && !dmp_slave && !needExtend && 
-           p->getFs()!=HFS && p->getFs()!=HFSPLUS && p->getFs()!=VFAT && 
-           p->getFs()!=FSNONE )
-           ret = p->resizeFs();
+       if( ret==0 && !dmp_slave )
+           ret = p->resizeBefore();
        if( ret==0 )
            {
            y2mil("doResize container " << name() << " name " << p->name());
@@ -2382,6 +2379,8 @@
                {
                ret = DISK_RESIZE_PARTITION_PARTED_FAILED;
                }
+           if( ret==0 && !dmp_slave )
+               ret = p->resizeAfter();
            if( !getPartedValues( p ))
                {
                if( ret==0 )
@@ -2391,10 +2390,6 @@
                Storage::waitForDevice(p->device());
            y2mil("after resize size:" << p->sizeK() << " resize:" << 
(p->needShrink()||p->needExtend()));
            }
-       if( ret == 0 && needExtend && !dmp_slave &&
-           p->getFs()!=HFS && p->getFs()!=HFSPLUS && p->getFs()!=VFAT && 
-           p->getFs()!=FSNONE )
-           ret = p->resizeFs();
        if( ret==0 && remount )
            ret = p->mount();
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Dm.cc 
new/libstorage-2.23.10/storage/Dm.cc
--- old/libstorage-2.23.9/storage/Dm.cc 2013-02-20 18:26:33.000000000 +0100
+++ new/libstorage-2.23.10/storage/Dm.cc        2013-03-06 14:46:32.000000000 
+0100
@@ -25,6 +25,7 @@
 #include "storage/Dm.h"
 #include "storage/PeContainer.h"
 #include "storage/SystemCmd.h"
+#include "storage/SystemInfo.h"
 #include "storage/AppUtil.h"
 #include "storage/Regex.h"
 #include "storage/Storage.h"
@@ -215,11 +216,30 @@
     pe_larger = false;
     }
 
+void Dm::setUdevData(SystemInfo& si)
+    {
+    const UdevMap& by_id = si.getUdevMap("/dev/disk/by-id");
+    alt_names.remove_if(string_starts_with("/dev/disk/by-id/"));
+    UdevMap::const_iterator it = by_id.find(procName());
+    if (it != by_id.end())
+       {
+       list<string> sl = it->second;
+       partition(sl.begin(), sl.end(), string_starts_with("dm-name-"));
+       y2mil("dev:" << dev << " udev_id:" << sl);
+       for (list<string>::const_iterator i = sl.begin(); i != sl.end(); ++i)
+           alt_names.push_back("/dev/disk/by-id/" + *i);
+       }
+    }
+
 void Dm::updateMajorMinor()
     {
     getMajorMinor();
     if( majorNr()==Dm::dmMajor() )
-       addDmNames(minorNr());
+       {
+       string d = "/dev/dm-" + decString(minorNr());
+       if( d!=dev )
+           replaceAltName( "/dev/dm-", d );
+       }
     num = mnr;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Dm.h 
new/libstorage-2.23.10/storage/Dm.h
--- old/libstorage-2.23.9/storage/Dm.h  2013-01-22 11:28:07.000000000 +0100
+++ new/libstorage-2.23.10/storage/Dm.h 2013-03-06 14:46:32.000000000 +0100
@@ -70,6 +70,7 @@
 
        virtual string procName() const { return "dm-" + decString(mnr); }
        virtual string sysfsPath() const;
+       void setUdevData(SystemInfo& systeminfo);
 
        void updateMajorMinor();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmPart.cc 
new/libstorage-2.23.10/storage/DmPart.cc
--- old/libstorage-2.23.9/storage/DmPart.cc     2013-02-20 18:26:33.000000000 
+0100
+++ new/libstorage-2.23.10/storage/DmPart.cc    2013-03-11 18:16:32.000000000 
+0100
@@ -39,8 +39,7 @@
                   Partition* pa)
        : Dm(c, name, device, name), p(pa)
     {
-       Dm::init();
-
+    Dm::init();
     numeric = true;
     num = nr;
     getTableInfo();
@@ -49,6 +48,13 @@
     y2mil("constructed DmPart " << dev << " on " << cont->device());
 }
 
+    DmPart::DmPart(const DmPartCo& c, const string& name, const string& 
device, unsigned nr,
+                  Partition* pa, SystemInfo& si)
+       : DmPart(c, name, device, nr, pa)
+    {
+    Dm::setUdevData(si);
+    }
+
 
     DmPart::DmPart(const DmPartCo& c, const DmPart& v)
        : Dm(c, v)
@@ -84,8 +90,8 @@
     getMajorMinor();
     if (mjr != old_mjr || mnr != old_mnr)
        {
-       addDmNames(mnr);
        getTableInfo();
+       replaceAltName("/dev/dm-", "/dev/dm-" + decString(mnr));
        }
     }
 
@@ -104,7 +110,7 @@
     {
     unsigned long long si = 0;
     updateSize();
-       if (mjr > 0 && parts.getSize("/dev/dm-" + decString(mnr), si))
+    if (mjr > 0 && parts.getSize("/dev/dm-" + decString(mnr), si))
        setSize( si );
     }
 
@@ -115,16 +121,32 @@
     }
 
 
-    void
-    DmPart::addAltUdevId(unsigned num)
+void
+DmPart::addAltUdevId(unsigned num)
     {
-       alt_names.remove_if(string_contains("/by-id/"));
-
-       const list<string> tmp = co()->udevId();
-       for (list<string>::const_iterator i = tmp.begin(); i != tmp.end(); ++i)
-           alt_names.push_back("/dev/disk/by-id/" + udevAppendPart(*i, num));
-
-       mount_by = orig_mount_by = defaultMountBy();
+    list<string> by_id;
+    list<string>::iterator e = alt_names.begin();
+    while( e!=alt_names.end() )
+       {
+       if( boost::contains(*e,"/by-id/") )
+           {
+           by_id.push_back(*e);
+           e=alt_names.erase(e);
+           }
+       else
+           ++e;
+       }
+    const list<string> tmp = co()->udevId();
+    for (list<string>::const_iterator i = tmp.begin(); i != tmp.end(); ++i)
+       {
+       string s = "/dev/disk/by-id/"+((num>0)?udevAppendPart(*i, num):*i);
+       e = find( by_id.begin(), by_id.end(), s );
+       if( e!=by_id.end() )
+           by_id.erase(e);
+       alt_names.push_back(s);
+       }
+    alt_names.splice(alt_names.end(),by_id);
+    mount_by = orig_mount_by = defaultMountBy();
     }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmPart.h 
new/libstorage-2.23.10/storage/DmPart.h
--- old/libstorage-2.23.9/storage/DmPart.h      2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/DmPart.h     2013-03-06 14:46:32.000000000 
+0100
@@ -38,6 +38,8 @@
     public:
 
        DmPart(const DmPartCo& c, const string& name, const string& device, 
unsigned nr,
+              Partition* p, SystemInfo& si);
+       DmPart(const DmPartCo& c, const string& name, const string& device, 
unsigned nr,
               Partition* p);
        DmPart(const DmPartCo& c, const DmPart& v);
        virtual ~DmPart();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmPartCo.cc 
new/libstorage-2.23.10/storage/DmPartCo.cc
--- old/libstorage-2.23.9/storage/DmPartCo.cc   2013-03-05 11:56:31.000000000 
+0100
+++ new/libstorage-2.23.10/storage/DmPartCo.cc  2013-03-26 17:31:39.000000000 
+0100
@@ -317,7 +317,7 @@
            if (tmp.empty())
                activate_part(true);
            }
-       getVolumes(systeminfo.getProcParts());
+       getVolumes(systeminfo);
        active = true;
        }
     }
@@ -344,9 +344,16 @@
     dm = new DmPart( *this, getPartName(num), getPartDevice(num), num, p );
     }
 
+void 
+DmPartCo::newP( DmPart*& dm, unsigned num, Partition* p, SystemInfo& si )
+    {
+    y2mil( "num:" << num );
+    dm = new DmPart( *this, getPartName(num), getPartDevice(num), num, p, si );
+    }
+
 
 void
-    DmPartCo::getVolumes(const ProcParts& parts)
+    DmPartCo::getVolumes(SystemInfo& si)
     {
     clearPointerList(vols);
     Disk::PartPair pp = disk->partPair();
@@ -354,12 +361,12 @@
     DmPart * p = NULL;
     while( i!=pp.end() )
        {
-       newP( p, i->nr(), &(*i) );
-       p->updateSize(parts);
+       newP( p, i->nr(), &(*i), si );
+       p->updateSize(si.getProcParts());
        addToList( p );
        ++i;
        }
-    handleWholeDevice();
+    handleWholeDevice(si);
     }
 
 void DmPartCo::handleWholeDevice()
@@ -385,6 +392,29 @@
        }
     }
     
+void DmPartCo::handleWholeDevice(SystemInfo& si)
+    {
+    Disk::PartPair pp = disk->partPair( Partition::notDeleted );
+    y2mil("empty:" << pp.empty());
+    if( pp.empty() )
+       {
+       DmPart * p = NULL;
+       newP( p, 0, NULL, si );
+       p->setSize( size_k );
+       addToList( p );
+       }
+    else
+       {
+       DmPartIter i;
+       if( findDm( 0, i ))
+           {
+           DmPart* dm = &(*i);
+           if( !removeFromList( dm ))
+               y2err( "not found:" << *i );
+           }
+       }
+    }
+    
 Partition* 
 DmPartCo::getPartition( unsigned nr, bool del )
     {
@@ -860,10 +890,8 @@
     if( ret==0 && l == NULL )
        ret = DMPART_INVALID_VOLUME;
     bool remount = false;
-    bool needExtend = false;
     if( ret==0 )
        {
-       needExtend = !l->needShrink();
        getStorage()->showInfoCb( l->resizeText(true), silent );
        if( l->isMounted() )
            {
@@ -871,8 +899,8 @@
            if( ret==0 )
                remount = true;
            }
-       if( ret==0 && !needExtend && l->getFs()!=VFAT && l->getFs()!=FSNONE )
-           ret = l->resizeFs();
+       if( ret==0 )
+           ret = l->resizeBefore();
        }
     if( ret==0 )
        {
@@ -887,8 +915,8 @@
        activate_part(false);
        activate_part(true);
        }
-    if( ret==0 && needExtend && l->getFs()!=VFAT && l->getFs()!=FSNONE )
-       ret = l->resizeFs();
+    if( ret==0 )
+       ret = l->resizeAfter();
     if( ret==0 )
        {
        ProcParts parts;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmPartCo.h 
new/libstorage-2.23.10/storage/DmPartCo.h
--- old/libstorage-2.23.9/storage/DmPartCo.h    2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/DmPartCo.h   2013-03-06 14:46:32.000000000 
+0100
@@ -169,13 +169,15 @@
        void activate_part( bool val );
        void init(SystemInfo& systeminfo);
        void createDisk(SystemInfo& systeminfo);
-       void getVolumes(const ProcParts& parts);
+       void getVolumes(SystemInfo& si);
        void updatePointers( bool invalid=false );
        void updateMinor();
+       virtual void newP( DmPart*& dm, unsigned num, Partition* p, SystemInfo& 
si );
        virtual void newP( DmPart*& dm, unsigned num, Partition* p );
        int addNewDev( string& device );
        int updateDelDev();
        void handleWholeDevice();
+       void handleWholeDevice(SystemInfo& si);
        void removeFromMemory();
        void removePresentPartitions();
        bool validPartition( const Partition* p );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Dmmultipath.cc 
new/libstorage-2.23.10/storage/Dmmultipath.cc
--- old/libstorage-2.23.9/storage/Dmmultipath.cc        2013-01-22 
11:28:07.000000000 +0100
+++ new/libstorage-2.23.10/storage/Dmmultipath.cc       2013-03-06 
14:46:32.000000000 +0100
@@ -41,6 +41,13 @@
        y2mil("constructed Dmmultipath " << dev << " on " << cont->device());
     }
 
+    Dmmultipath::Dmmultipath(const DmmultipathCo& c, const string& name, const 
string& device,
+                            unsigned nr, Partition* p, SystemInfo& si)
+       : DmPart(c, name, device, nr, p, si)
+    {
+       y2mil("constructed Dmmultipath " << dev << " on " << cont->device());
+    }
+
 
     Dmmultipath::Dmmultipath(const DmmultipathCo& c, const Dmmultipath& v)
        : DmPart(c, v)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Dmmultipath.h 
new/libstorage-2.23.10/storage/Dmmultipath.h
--- old/libstorage-2.23.9/storage/Dmmultipath.h 2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Dmmultipath.h        2013-03-06 
14:46:32.000000000 +0100
@@ -37,6 +37,8 @@
 
        Dmmultipath(const DmmultipathCo& c, const string& name, const string& 
device, unsigned nr,
                    Partition* p);
+       Dmmultipath(const DmmultipathCo& c, const string& name, const string& 
device, unsigned nr,
+                   Partition* p, SystemInfo& si);
        Dmmultipath(const DmmultipathCo& c, const Dmmultipath& v);
        virtual ~Dmmultipath();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmmultipathCo.cc 
new/libstorage-2.23.10/storage/DmmultipathCo.cc
--- old/libstorage-2.23.9/storage/DmmultipathCo.cc      2013-01-22 
11:28:07.000000000 +0100
+++ new/libstorage-2.23.10/storage/DmmultipathCo.cc     2013-03-06 
14:46:32.000000000 +0100
@@ -213,6 +213,12 @@
     dm = new Dmmultipath( *this, getPartName(num), getPartDevice(num), num, p 
);
     }
 
+void
+DmmultipathCo::newP( DmPart*& dm, unsigned num, Partition* p, SystemInfo& si )
+    {
+    y2mil( "num:" << num );
+    dm = new Dmmultipath( *this, getPartName(num), getPartDevice(num), num, p, 
si );
+    }
 
 void
     DmmultipathCo::addPv(const Pv& p)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmmultipathCo.h 
new/libstorage-2.23.10/storage/DmmultipathCo.h
--- old/libstorage-2.23.9/storage/DmmultipathCo.h       2013-01-22 
11:28:07.000000000 +0100
+++ new/libstorage-2.23.10/storage/DmmultipathCo.h      2013-03-06 
14:46:32.000000000 +0100
@@ -139,6 +139,7 @@
        void getMultipathData(const string& name, SystemInfo& systeminfo);
        void addPv(const Pv& pv);
        void newP( DmPart*& dm, unsigned num, Partition* p );
+       void newP( DmPart*& dm, unsigned num, Partition* p, SystemInfo& si );
 
        static void activate(bool val);
        static bool isActive() { return active; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Dmraid.cc 
new/libstorage-2.23.10/storage/Dmraid.cc
--- old/libstorage-2.23.9/storage/Dmraid.cc     2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Dmraid.cc    2013-03-06 14:46:32.000000000 
+0100
@@ -41,6 +41,13 @@
        y2mil("constructed Dmraid " << dev << " on " << cont->device());
     }
 
+    Dmraid::Dmraid(const DmraidCo& c, const string& name, const string& 
device, unsigned nr,
+                  Partition* p, SystemInfo& si)
+       : DmPart(c, name, device, nr, p, si)
+    {
+       y2mil("constructed Dmraid " << dev << " on " << cont->device());
+    }
+
 
     Dmraid::Dmraid(const DmraidCo& c, const Dmraid& v)
        : DmPart(c, v)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Dmraid.h 
new/libstorage-2.23.10/storage/Dmraid.h
--- old/libstorage-2.23.9/storage/Dmraid.h      2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Dmraid.h     2013-03-06 14:46:32.000000000 
+0100
@@ -37,6 +37,8 @@
 
        Dmraid(const DmraidCo& c, const string& name, const string& device, 
unsigned nr,
               Partition* p);
+       Dmraid(const DmraidCo& c, const string& name, const string& device, 
unsigned nr,
+              Partition* p, SystemInfo& si);
        Dmraid(const DmraidCo& c, const Dmraid& v);
        virtual ~Dmraid();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmraidCo.cc 
new/libstorage-2.23.10/storage/DmraidCo.cc
--- old/libstorage-2.23.9/storage/DmraidCo.cc   2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/DmraidCo.cc  2013-03-06 14:46:32.000000000 
+0100
@@ -176,6 +176,12 @@
     dm = new Dmraid( *this, getPartName(num), getPartDevice(num), num, p );
     }
 
+void
+DmraidCo::newP( DmPart*& dm, unsigned num, Partition* p, SystemInfo& si )
+    {
+    y2mil( "num:" << num );
+    dm = new Dmraid( *this, getPartName(num), getPartDevice(num), num, p, si );
+    }
 
     void
     DmraidCo::addPv(const Pv& pv)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/DmraidCo.h 
new/libstorage-2.23.10/storage/DmraidCo.h
--- old/libstorage-2.23.9/storage/DmraidCo.h    2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/DmraidCo.h   2013-03-06 14:46:32.000000000 
+0100
@@ -137,6 +137,7 @@
        void getRaidData(const string& name, SystemInfo& systeminfo);
        void addPv(const Pv& pv);
        void newP( DmPart*& dm, unsigned num, Partition* p );
+       void newP( DmPart*& dm, unsigned num, Partition* p, SystemInfo& si );
 
        Text removeText( bool doing ) const;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/LoopCo.cc 
new/libstorage-2.23.10/storage/LoopCo.cc
--- old/libstorage-2.23.9/storage/LoopCo.cc     2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/LoopCo.cc    2013-03-11 18:16:32.000000000 
+0100
@@ -322,7 +322,7 @@
            ret = LOOP_FILE_CREATE_FAILED;
        if( ret==0 )
            {
-           ret = l->doCrsetup();
+           ret = l->doCrsetup(false);
            }
        if( ret==0 )
            {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/LvmLv.cc 
new/libstorage-2.23.10/storage/LvmLv.cc
--- old/libstorage-2.23.9/storage/LvmLv.cc      2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/LvmLv.cc     2013-03-06 14:46:32.000000000 
+0100
@@ -37,11 +37,13 @@
 
 
     LvmLv::LvmLv(const LvmVg& c, const string& name, const string& device, 
const string& origi,
-                unsigned long le, const string& uuid, const string& stat, 
const string& alloc)
+                unsigned long le, const string& uuid, const string& stat, 
const string& alloc,
+                SystemInfo& si)
        : Dm(c, name, device, makeDmTableName(c.name(), name)), origin(origi), 
           chunk_size(0), pool(false)
 {
-       Dm::init();
+    Dm::init();
+    setUdevData(si);
     setUuid( uuid );
     setStatus( stat );
     setAlloc( alloc );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/LvmLv.h 
new/libstorage-2.23.10/storage/LvmLv.h
--- old/libstorage-2.23.9/storage/LvmLv.h       2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/LvmLv.h      2013-03-06 14:46:32.000000000 
+0100
@@ -36,9 +36,10 @@
     public:
 
        LvmLv(const LvmVg& c, const string& name, const string& device, const 
string& origin,
-             unsigned long le, const string& uuid, const string& status, const 
string& alloc);
+             unsigned long le, const string& uuid, const string& status, const 
string& alloc,
+             SystemInfo& si);
        LvmLv(const LvmVg& c, const string& name, const string& device, const 
string& origin,
-             unsigned long le, unsigned stripe);
+             unsigned long le, unsigned stripe );
        LvmLv(const LvmVg& c, const xmlNode* node);
        LvmLv(const LvmVg& c, const LvmLv& v);
        virtual ~LvmLv();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/LvmVg.cc 
new/libstorage-2.23.10/storage/LvmVg.cc
--- old/libstorage-2.23.9/storage/LvmVg.cc      2013-03-04 15:46:32.000000000 
+0100
+++ new/libstorage-2.23.10/storage/LvmVg.cc     2013-03-26 17:31:39.000000000 
+0100
@@ -28,6 +28,7 @@
 #include "storage/SystemCmd.h"
 #include "storage/AppUtil.h"
 #include "storage/Storage.h"
+#include "storage/SystemInfo.h"
 #include "storage/StorageDefines.h"
 
 
@@ -219,7 +220,7 @@
            pvn.device = d;
 
            const Volume* v;
-           if (getStorage()->findVolume(d, v) && v->dmcrypt())
+           if (getStorage()->findVolume(d, v, true) && v->dmcrypt())
                pvn.dmcryptDevice = v->dmcryptDevice();
 
            pv_add.push_back( pvn );
@@ -436,7 +437,7 @@
            {
            ret = LVM_CHECK_RESIZE_INVALID_VOLUME;
            }
-    }
+       }
     if( ret==0 )
        checkConsistency();
     y2mil("ret:" << ret);
@@ -549,7 +550,7 @@
     {
     int ret = 0;
     y2mil("name:" << name);
-    LvmLv* i;
+    LvmLv* i=NULL;
     checkConsistency();
     if( readonly() )
        {
@@ -571,14 +572,15 @@
        else
            ret = LVM_LV_REMOVE_USED_BY;
        }
-    if( ret==0 )
+    if( ret==0 && !i->isThin())
        {
        map<string,unsigned long> pe_map = i->getPeMap();
        ret = remLvPeDistribution( i->getLe(), pe_map, pv, pv_add );
        }
     if( ret==0 )
        {
-       free_pe += i->getLe();
+       if( !i->isThin() )
+           free_pe += i->getLe();
        if( i->created() )
            {
            if( !removeFromList( &(*i) ))
@@ -792,6 +794,7 @@
     string line;
     string tmp;
     string::size_type pos;
+    SystemInfo si;
     while( i<cnt )
        {
        line = c.getLine( i++ );
@@ -866,7 +869,7 @@
                    {
                         addLv(origin.empty() ? num_le : num_cow_le, vname, 
                                 origin, uuid, status, allocation,
-                                readOnly, pool, used_pool, pool_chunk);
+                                readOnly, pool, used_pool, pool_chunk, si);
                    }
                    vname = extractNthWord( 2, line );
                    if( (pos=vname.rfind( "/" ))!=string::npos )
@@ -924,7 +927,7 @@
                {
                 addLv(origin.empty() ? num_le : num_cow_le, vname, origin, 
                       uuid, status, allocation, readOnly, pool, 
-                      used_pool, pool_chunk);
+                      used_pool, pool_chunk, si);
                }
            Pv *p = new Pv;
            while( i<cnt )
@@ -939,7 +942,7 @@
                    p->device = extractNthWord( 2, line );
 
                    const Volume* v;
-                   if (getStorage()->findVolume(p->device, v))
+                   if (getStorage()->findVolume(p->device, v, true))
                        {
                        p->device = v->device();
                        p->dmcryptDevice = v->dmcryptDevice();
@@ -971,10 +974,13 @@
     LvmLvPair p=lvmLvPair(lvDeleted);
     for( LvmLvIter i=p.begin(); i!=p.end(); ++i )
        {
-       //cout << "Deleted:" << *i << endl;
-       map<string,unsigned long> pe_map = i->getPeMap();
-       remLvPeDistribution( i->getLe(), pe_map, pv, pv_add );
-       free_pe += i->getLe();
+       cout << "Deleted:" << *i << endl;
+       if( !i->isThin() )
+           {
+           map<string,unsigned long> pe_map = i->getPeMap();
+           remLvPeDistribution( i->getLe(), pe_map, pv, pv_add );
+           free_pe += i->getLe();
+           }
        }
     p=lvmLvPair(lvCreated);
     for( LvmLvIter i=p.begin(); i!=p.end(); ++i )
@@ -1016,7 +1022,7 @@
 void 
 LvmVg::addLv(unsigned long& le, string& name, string& origin, string& uuid,
             string& status, string& alloc, bool& ro, bool& pool, 
-            string& used_pool, unsigned long long& pchunk )
+            string& used_pool, unsigned long long& pchunk, SystemInfo& si )
     {
     y2mil("addLv:" << name);
     LvmLvPair p=lvmLvPair(lvNotDeletedCreated);
@@ -1060,7 +1066,7 @@
        if( i==p.end() )
            {
             LvmLv *n = new LvmLv( *this, name, dev + "/" + name, origin, 
-                    le, uuid, status, alloc );
+                                 le, uuid, status, alloc, si );
            if( ro )
                n->setReadonly();
             if( pool )
@@ -1656,8 +1662,8 @@
            if( ret==0 )
                remount = true;
            }
-       if( ret==0 && old_le>new_le && l->getFs()!=FSNONE )
-           ret = v->resizeFs();
+       if( ret==0 )
+           ret = v->resizeBefore();
        if( ret==0 && old_le>new_le )
            {
            string cmd = LVREDUCEBIN " -f " + instSysString() +
@@ -1680,8 +1686,8 @@
                setExtError( c );
                }
            }
-       if( ret==0 && old_le<new_le && l->getFs()!=FSNONE )
-           ret = v->resizeFs();
+       if( ret==0 )
+           ret = v->resizeAfter();
        if( old_le!=new_le )
            l->calcSize();
        if( ret==0 && remount )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/LvmVg.h 
new/libstorage-2.23.10/storage/LvmVg.h
--- old/libstorage-2.23.9/storage/LvmVg.h       2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/LvmVg.h      2013-03-06 14:46:32.000000000 
+0100
@@ -169,7 +169,7 @@
 
        void addLv(unsigned long& le, string& name, string& origin, string& 
uuid,
                   string& status, string& alloc, bool& ro, bool& pool, 
-                   string& used_pool, unsigned long long& pchunk );
+                   string& used_pool, unsigned long long& pchunk, SystemInfo& 
si );
        void addPv( Pv*& p );
         LvmLv* findLv(const string& name);
         bool checkChunk( unsigned long long val, unsigned long long mi=0, 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/MdPartCo.cc 
new/libstorage-2.23.10/storage/MdPartCo.cc
--- old/libstorage-2.23.9/storage/MdPartCo.cc   2013-03-05 11:56:31.000000000 
+0100
+++ new/libstorage-2.23.10/storage/MdPartCo.cc  2013-03-26 17:31:39.000000000 
+0100
@@ -1018,10 +1018,8 @@
     if( ret==0 && l == NULL )
         ret = MDPART_INVALID_VOLUME;
     bool remount = false;
-    bool needExtend = false;
     if( ret==0 )
         {
-        needExtend = !l->needShrink();
        getStorage()->showInfoCb( l->resizeText(true), silent );
         if( l->isMounted() )
             {
@@ -1029,8 +1027,8 @@
             if( ret==0 )
                 remount = true;
             }
-        if( ret==0 && !needExtend && l->getFs()!=VFAT && l->getFs()!=FSNONE )
-            ret = l->resizeFs();
+        if( ret==0 )
+            ret = l->resizeBefore();
         }
     if( ret==0 )
         {
@@ -1045,8 +1043,8 @@
         activate_part(false);
         activate_part(true);
         }
-    if( ret==0 && needExtend && l->getFs()!=VFAT && l->getFs()!=FSNONE )
-        ret = l->resizeFs();
+    if( ret==0 )
+        ret = l->resizeAfter();
     if( ret==0 )
         {
         ProcParts pp;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Storage.cc 
new/libstorage-2.23.10/storage/Storage.cc
--- old/libstorage-2.23.9/storage/Storage.cc    2013-02-21 16:25:43.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Storage.cc   2013-03-11 18:16:33.000000000 
+0100
@@ -2996,7 +2996,7 @@
        {
        ret = STORAGE_CHANGE_READONLY;
        }
-    else if( findVolume( device, cont, vol ) )
+    else if( findVolume( device, cont, vol, true ) )
        {
        ret = vol->setEncryption( val, typ );
        }
@@ -3022,7 +3022,7 @@
     y2mil("device:" << device);
     ConstVolIterator vol;
     ConstContIterator cont;
-    if( findVolume( device, cont, vol ) )
+    if( findVolume( device, cont, vol, true ) )
        {
        val = vol->getEncryption();
        }
@@ -3050,7 +3050,7 @@
        {
        ret = STORAGE_CHANGE_READONLY;
        }
-    else if( findVolume( device, vol ) )
+    else if( findVolume( device, vol, false, true ) )
        {
        ret = vol->setCryptPwd( pwd );
        if( ret==0 && vol->detectEncryption()==ENC_UNKNOWN )
@@ -3114,7 +3114,7 @@
        {
        ret = STORAGE_CHANGE_READONLY;
        }
-    else if( findVolume( device, vol ) )
+    else if( findVolume( device, vol, false, true ) )
        {
        ret = vol->setCryptPwd( pwd );
        if( i!=pwdBuf.end() )
@@ -5259,12 +5259,6 @@
     }
 
 
-static bool isDmContainer( const Container& co )
-{
-    return co.type()==DM || co.type()==LVM || co.type()==DMRAID || 
co.type()==DMMULTIPATH;
-}
-
-
 bool Storage::removeDmMapsTo( const string& dev )
     {
     bool ret = false;
@@ -6293,6 +6287,24 @@
                while( v!=li->end() && v->device()!=tmp )
                    ++v;
                }
+           if( v==li->end() )
+               {
+               unsigned long mjr, mnr;
+               mjr = mnr = 0;
+               const Device* dev = NULL;
+               if( !testmode() && getMajorMinor( d, mjr, mnr, true ) &&
+                   (dev=deviceByNumber( mjr, mnr ))!=NULL )
+                   {
+                   v = li->begin();
+                   while( v!=li->end() && v->device()!=dev->device() )
+                       ++v;
+                   if( v!=li->end() )
+                       {
+                       y2war( "found over major/minor:" << d << " is:" << 
v->device() );
+                       y2mil( "vol:" << *v );
+                       }
+                   }
+               }
            }
        else if( !label.empty() )
            {
@@ -6409,7 +6421,7 @@
     void
     Storage::setUsedBy(const string& dev, UsedByType type, const string& 
device)
     {
-       Device* tmp = findDevice(dev);
+       Device* tmp = findDevice(dev,true);
        if (tmp)
        {
            tmp->setUsedBy(type, device);
@@ -6766,7 +6778,7 @@
         findVolume( dev, v ) )
        {
        v->setDmcryptDevEnc( dm, typ, siz!=0 );
-       v->addDmNames(dmnum);
+       v->addDmCryptNames(dmnum);
        v->setSize( siz );
        ret = true;
        }
@@ -7061,9 +7073,12 @@
        {
        if( vol->needCrsetup() )
            {
-           ret = vol->doCrsetup()==0;
+           bool slnt = vol->isSilent();
+           vol->setSilent(true);
+           ret = vol->doCrsetup(true)==0;
            if( ret==0 )
                didCrsetup = true;
+           vol->setSilent(slnt);
            }
        if( ret )
            {
@@ -7094,7 +7109,7 @@
        vol->setSilent(true);
        if( on && vol->needCrsetup() )
            {
-           ret = vol->doCrsetup();
+           ret = vol->doCrsetup(true);
            }
        else if( !on )
            {
@@ -7173,8 +7188,7 @@
     {
        string opts = opt;
        list<string> ls = splitString( vol->getFstabOption(), "," );
-       y2mil( "ls=" << ls );
-       y2mil( "format:" << vol->getFormat() );
+       y2mil( "ls=" << ls << " format:" << vol->getFormat() );
        if( opt.find( "subvolid=0" )!=string::npos || vol->getFormat() )
            {
            ls.remove_if( string_starts_with("subvol=") );
@@ -7286,7 +7300,7 @@
                rmdir( mp.c_str() );
                }
 
-           if( vol->needCrsetup() && vol->doCrsetup() )
+           if( vol->needCrsetup() && vol->doCrsetup(true) )
                {
                ret = vol->mount( mp )==0;
                if( !ret )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Storage.h 
new/libstorage-2.23.10/storage/Storage.h
--- old/libstorage-2.23.9/storage/Storage.h     2013-01-22 11:28:07.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Storage.h    2013-03-06 14:46:32.000000000 
+0100
@@ -239,6 +239,8 @@
            { return d.type() == storage::DMRAID || d.type() == 
storage::DMMULTIPATH; }
        static bool isMdPart( const Container&d )
            { return d.type() == storage::MDPART; }
+       static bool isDmContainer( const Container&d )
+           { return d.type()==DM || d.type()==LVM || d.type()==DMRAID || 
d.type()==DMMULTIPATH; }
 
        Storage(const Environment& env);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Volume.cc 
new/libstorage-2.23.10/storage/Volume.cc
--- old/libstorage-2.23.9/storage/Volume.cc     2013-03-05 11:56:31.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Volume.cc    2013-03-26 17:31:39.000000000 
+0100
@@ -229,30 +229,86 @@
        {
        unsigned long dummy, minor;
        storage::getMajorMinor( dmcrypt_dev, dummy, minor );
-       addDmNames(minor);
+       addDmCryptNames(minor);
        }
     else
-       removeDmNames();
+       removeDmCryptNames();
     y2mil( "this:" << *this );
     }
 
 void Volume::setDmcryptDevEnc( const string& dm, storage::EncryptType typ, 
bool active )
     {
     y2mil("enc_type:" << toString(typ));
+    encryption = orig_encryption = typ;
     setDmcryptDev(dm,active);
     }
 
-void Volume::addDmNames( unsigned long minor )
+void Volume::addDmCryptNames( unsigned long minor )
     {
-    replaceAltName( "/dev/dm-", Dm::dmDeviceName(minor) );
-    replaceAltName( "/dev/disk/by-id/dm-name-", 
-                    "/dev/disk/by-id/dm-name-"+afterLast(dmcrypt_dev,"/"));
+    y2mil( "alt before:" << altNames() );
+    string crname = Dm::dmDeviceName(minor);
+    if( !Storage::isDmContainer(*cont))
+       replaceAltName( "/dev/dm-", crname );
+    else
+       {
+       string my_name = Dm::dmDeviceName(mnr);
+       y2mil( "my_name:" << my_name << " cr_name:" << crname );
+       list<string>::iterator i = alt_names.begin();
+       while( i!=alt_names.end() && boost::starts_with( *i, "/dev/dm-" ) &&
+              *i!=my_name )
+           ++i;
+       if( i!=alt_names.end() )
+           *i = crname;
+       else
+           alt_names.push_back(crname);
+       }
+    string s = afterLast(dmcrypt_dev,"/");
+    string pre = "/dev/disk/by-id/dm-name-";
+    string my_name;
+    const Dm* dm = dynamic_cast<const Dm*>(this);
+    if( dm!=NULL )
+       my_name = dm->getTableName();
+    if( my_name.empty() )
+       {
+       if( !s.empty() )
+           replaceAltName( pre, pre+s );
+       else
+           replaceAltName( pre, "" );
+       }
+    else
+       {
+       y2mil( "my_name:" << my_name << " cr_name:" << s );
+       list<string>::iterator i = alt_names.begin();
+       while( i!=alt_names.end() && boost::starts_with( *i, pre ) &&
+              *i!=my_name )
+           ++i;
+       if( i!=alt_names.end() )
+           *i = pre+s;
+       else
+           alt_names.push_back(pre+s);
+       }
+    y2mil( "alt  after:" << altNames() );
     }
 
-void Volume::removeDmNames()
+void Volume::removeDmCryptNames()
     {
-    replaceAltName( "/dev/dm-", "" );
-    replaceAltName( "/dev/disk/by-id/dm-name-", "" );
+    if( !Storage::isDmContainer(*cont))
+       replaceAltName( "/dev/dm-", "" );
+    else
+       {
+       string my_name = Dm::dmDeviceName(mnr);
+       list<string>::iterator i = alt_names.begin();
+       while( i!=alt_names.end() )
+           {
+           if( boost::starts_with( *i, "/dev/dm-" ) && *i!=my_name )
+               i=alt_names.erase(i);
+           else 
+               ++i;
+           }
+       }
+    string s = afterLast(dmcrypt_dev,"/");
+    if( !s.empty() )
+       replaceAltName( "/dev/disk/by-id/dm-name-"+s, "" );
     }
 
 const string& Volume::mountDevice() const
@@ -1342,7 +1398,7 @@
            ret = VOLUME_CRYPTUNSETUP_FAILED;
            dmcrypt_active = false;
            }
-       removeDmNames();
+       removeDmCryptNames();
        }
     return( ret );
     }
@@ -1523,6 +1579,28 @@
     return( ret );
     }
 
+int Volume::resizeBefore()
+    {
+    int ret = 0;
+    FsType fs = getFs();
+    if( (needShrink()&&fs!=SWAP) && 
+        fs!=HFS && fs!=HFSPLUS && fs!=VFAT && fs!=FSNONE )
+       ret = resizeFs();
+    y2mil( "ret:" << ret );
+    return( ret );
+    }
+
+int Volume::resizeAfter()
+    {
+    int ret = 0;
+    FsType fs = getFs();
+    if( (needExtend()||(needShrink()&&fs==SWAP)) && 
+        fs!=HFS && fs!=HFSPLUS && fs!=VFAT && fs!=FSNONE )
+       ret = resizeFs();
+    y2mil( "ret:" << ret );
+    return( ret );
+    }
+
 int Volume::resizeFs()
     {
     SystemCmd c;
@@ -1675,7 +1753,9 @@
     y2mil("val:" << val << " typ:" << toString(typ));
     if (isUsedBy())
        {
-       ret = VOLUME_ALREADY_IN_USE;
+       const Volume* btrfs = NULL;
+       if( !getStorage()->isUsedBySingleBtrfs(*this, &btrfs) )
+           ret = VOLUME_ALREADY_IN_USE;
        }
     if( ret==0 )
        {
@@ -2309,11 +2389,12 @@
     }
 
 
-int Volume::doCryptsetup()
+int Volume::doCryptsetup(bool readonly)
     {
     int ret = 0;
     y2mil("device:" << dev << " mp:" << mp << " dmcrypt:" << dmcrypt() << 
-          " active:" << dmcrypt_active << " format:" << format );
+          " active:" << dmcrypt_active << " format:" << format <<
+         " ro:" << readonly );
     if( dmcrypt() )
        {
        getStorage()->showInfoCb( crsetupText(true), silent );
@@ -2346,8 +2427,15 @@
            pwdfile << crypt_pwd;
            pwdfile.close();
            SystemCmd cmd;
-           if( format || (isTmpCryptMp(mp)&&crypt_pwd.empty()) ||
-               (encryption!=ENC_NONE&&orig_crypt_pwd!=crypt_pwd) )
+           y2mil( "format:" << format << " tmpc:" << isTmpCryptMp(mp) << 
+                  " pwempty:" << crypt_pwd.empty() << " ro:" << readonly <<
+                  " enc!=NONE:" << (encryption!=ENC_NONE) );
+#ifdef DEBUG_CRYPT_PASSWORD
+           y2mil( "pw:\"" << crypt_pwd << "\" orig:\"" << orig_crypt_pwd << 
"\"" );
+#endif
+           if( !readonly &&
+               (format || (isTmpCryptMp(mp)&&crypt_pwd.empty()) ||
+                (encryption!=ENC_NONE&&orig_crypt_pwd!=crypt_pwd)) )
                {
                string cmdline = getCryptsetupCmd( encryption, dmcrypt_dev, mp, 
fname, true,
                                                   crypt_pwd.empty() );
@@ -2382,7 +2470,7 @@
            if (cType() == LOOP)
                getMajorMinor();
            storage::getMajorMinor( dmcrypt_dev, dummy, minor );
-           addDmNames(minor);
+           addDmCryptNames(minor);
            ProcParts parts;
            unsigned long long sz;
            if (parts.getSize( Dm::dmDeviceName(minor), sz))
@@ -2398,9 +2486,10 @@
     return( ret );
     }
 
-int Volume::doCrsetup()
+int Volume::doCrsetup(bool readonly)
     {
     int ret = 0;
+    y2mil("ro:" << readonly);
     bool force_fstab_rewrite = false;
     bool losetup_done = false;
     bool did_cryptsetup = false;
@@ -2415,7 +2504,7 @@
            encryption != ENC_NONE &&
            ((!crypt_pwd.empty() && crypt_pwd!=orig_crypt_pwd) ||
             (crypt_pwd.empty() && isTmpCryptMp(mp) && format));
-       ret = doCryptsetup();
+       ret = doCryptsetup(readonly);
        if( ret!=0 && losetup_done )
            loUnsetup();
        did_cryptsetup = true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/Volume.h 
new/libstorage-2.23.10/storage/Volume.h
--- old/libstorage-2.23.9/storage/Volume.h      2013-02-20 18:26:33.000000000 
+0100
+++ new/libstorage-2.23.10/storage/Volume.h     2013-03-26 17:31:39.000000000 
+0100
@@ -165,9 +165,11 @@
        int canResize( unsigned long long newSizeK ) const;
        int doMount();
        int doFormat();
-       int doCrsetup();
+       int doCrsetup(bool readonly);
        int doSetLabel();
        int doFstabUpdate(bool force=false);
+       int resizeBefore();
+       int resizeAfter();
        int resizeFs();
        void fstabUpdateDone();
        bool isMounted() const { return( is_mounted ); }
@@ -229,12 +231,12 @@
        bool getLoopFile( string& fname ) const;
        void setExtError( const SystemCmd& cmd, bool serr=true );
        string getDmcryptName() const;
-       void addDmNames(unsigned long minor);
-       void removeDmNames();
+       void addDmCryptNames(unsigned long minor);
+       void removeDmCryptNames();
        bool needLosetup( bool urgent ) const; 
        bool needCryptsetup() const; 
        int doLosetup();
-       int doCryptsetup();
+       int doCryptsetup(bool readonly);
        int loUnsetup( bool force=false );
        int cryptUnsetup( bool force=false );
        bool pwdLengthOk( storage::EncryptType typ, const string& val, 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.23.9/storage/gen_md5sum.cc 
new/libstorage-2.23.10/storage/gen_md5sum.cc
--- old/libstorage-2.23.9/storage/gen_md5sum.cc 2013-03-05 12:22:21.000000000 
+0100
+++ new/libstorage-2.23.10/storage/gen_md5sum.cc        2013-03-26 
17:37:18.000000000 +0100
@@ -1,5 +1,5 @@
-#define SOURCES_MD5SUM   "aba904178fa91e4c03929cd2e424465e"
-#define SOURCES_MD5_DATE " Tue Mar 5 12:22:21 CET 2013 "
+#define SOURCES_MD5SUM   "335f8c05b705c53cd8d932fc78650114"
+#define SOURCES_MD5_DATE " Tue Mar 26 17:37:18 CET 2013 "
 namespace storage
 {
 const char* GetSourceMd5() { return SOURCES_MD5SUM; }

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to