Hello community,

here is the log from the commit of package libstorage for openSUSE:Factory 
checked in at 2012-05-08 11:14:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-03-22 
12:35:45.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes       
2012-05-08 11:14:58.000000000 +0200
@@ -1,0 +2,19 @@
+Wed May  2 18:08:06 CEST 2012 - [email protected]
+
+- 2.22.2
+- add code to support resizing of a btrfs volume (bnc#731753)
+
+-------------------------------------------------------------------
+Thu Apr  5 11:59:15 CEST 2012 - [email protected]
+
+- suppress dm maps for "-real" and "-cow" of LVM snapshots in
+  general Dm container
+- fix order of LV removals in removeVg when snapshots are present
+  (bnc#755021)
+
+-------------------------------------------------------------------
+Mon Apr 02 16:11:03 CEST 2012 - [email protected]
+
+- calculate max_primary for artificial XEN disks (bnc#754649)
+
+-------------------------------------------------------------------

Old:
----
  libstorage-2.22.1.tar.bz2

New:
----
  libstorage-2.22.2.tar.bz2

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

Other differences:
------------------
++++++ libstorage.spec ++++++
--- /var/tmp/diff_new_pack.Wdw6XM/_old  2012-05-08 11:14:59.000000000 +0200
+++ /var/tmp/diff_new_pack.Wdw6XM/_new  2012-05-08 11:14:59.000000000 +0200
@@ -15,27 +15,46 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
-
 
 Name:           libstorage
-Version:        2.22.1
+Version:        2.22.2
 Release:        0
-License:        GPL-2.0
-Group:          System/Libraries
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source:         libstorage-%{version}.tar.bz2
 
 Prefix:         /usr
 
-BuildRequires:  blocxx-devel boost-devel dejagnu doxygen gcc-c++ libtool 
libxml2-devel python-devel ruby-devel swig
+BuildRequires:  blocxx-devel
+BuildRequires:  boost-devel
+BuildRequires:  dejagnu
+BuildRequires:  doxygen
+BuildRequires:  gcc-c++
+BuildRequires:  libtool
+BuildRequires:  libxml2-devel
+BuildRequires:  python-devel
+BuildRequires:  ruby
+BuildRequires:  ruby-devel
+BuildRequires:  swig
 
 Summary:        Library for storage management
+License:        GPL-2.0
+Group:          System/Libraries
 Url:            http://en.opensuse.org/Portal:Libstorage
 
 %description
 This package contains libstorage, a library for storage management.
 
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
+%{!?py_requires: %global py_requires Requires: python}
+
+%if 0%{?ruby_sitelib} == 0
+%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 
0%{?fedora} || 0%{?rhel}
+%{!?ruby_sitelib: %global ruby_sitelib %(ruby -r rbconfig -e 'vd = 
Config::CONFIG["vendorlibdir"]; print(vd ? vd : Config::CONFIG["sitelibdir"])')}
+%{!?ruby_sitearch: %global ruby_sitearch %(ruby -r rbconfig -e 'vad = 
Config::CONFIG["vendorarchdir"]; print(vad ? vad : 
Config::CONFIG["sitearchdir"])')}
+%endif
+%endif
+
 %prep
 %setup -n libstorage-%{version}
 
@@ -50,6 +69,14 @@
 autoconf
 
 %{?suse_update_config:%{suse_update_config -f}}
+%if 0%{?fedora_version} || 0%{?centos_version}
+CXXFLAGS="-I/usr/include/libxml2" \
+%else
+%if 0%{?rhel_version} >= 500 && 0%{?rhel_version} < 600
+CXXFLAGS="-I/usr/include/libxml2 -I/usr/include/c++/4.1.1/tr1" \
+%endif
+%endif
+
 ./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir} 
--disable-silent-rules
 make %{?jobs:-j%jobs}
 
@@ -76,19 +103,34 @@
 %if 0%{?mandriva_version}
 rm $RPM_BUILD_ROOT/%{ruby_sitearchdir}/storage.la
 %endif
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
+rm $RPM_BUILD_ROOT/%{ruby_sitearch}/storage.la
+%endif
 
 %clean
 rm -rf "$RPM_BUILD_ROOT"
 
 %package -n libstorage3
 
-Requires:       parted >= 2.2 mdadm device-mapper lvm2 dmraid multipath-tools 
cryptsetup
-Requires:       coreutils udev util-linux >= 2.16 grep lsscsi
+Requires:       coreutils
+Requires:       cryptsetup
+Requires:       device-mapper
+Requires:       dmraid
+Requires:       grep
+Requires:       lsscsi
+Requires:       lvm2
+Requires:       mdadm
+Requires:       multipath-tools
+Requires:       parted >= 2.2
+Requires:       udev
+Requires:       util-linux >= 2.16
 %ifarch s390 s390x
 Requires:       s390-tools
 %endif
 
+%if 0%{?suse_version}
 PreReq:         %fillup_prereq
+%endif
 Obsoletes:      yast2-storage-lib
 Provides:       yast2-storage-lib
 Obsoletes:      libstorage < 2.21.2
@@ -115,15 +157,21 @@
 
 %post -n libstorage3
 /sbin/ldconfig
+%if 0%{?suse_version}
 %{fillup_only -an storage}
+%endif
 
 %postun -n libstorage3
 /sbin/ldconfig
 
 %package -n libstorage-devel
 
+Requires:       blocxx-devel
+Requires:       boost-devel
+Requires:       gcc-c++
+Requires:       libstdc++-devel
 Requires:       libstorage3 = %version
-Requires:       gcc-c++ libstdc++-devel boost-devel blocxx-devel libxml2-devel
+Requires:       libxml2-devel
 Summary:        Header files and documentation for libstorage
 Group:          Development/Languages/C and C++
 
@@ -147,6 +195,7 @@
 %package -n libstorage-python
 
 Requires:       libstorage3 = %version
+%{py_requires}
 Summary:        Python bindings for libstorage
 Group:          System/Libraries
 
@@ -184,6 +233,9 @@
 %if 0%{?mandriva_version}
 %{ruby_sitearchdir}/storage.so
 %endif
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
+%{ruby_sitearch}/storage.so
+%endif
 
 %package -n libstorage-testsuite
 

++++++ libstorage-2.22.1.tar.bz2 -> libstorage-2.22.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/VERSION 
new/libstorage-2.22.2/VERSION
--- old/libstorage-2.22.1/VERSION       2012-03-15 17:18:28.000000000 +0100
+++ new/libstorage-2.22.2/VERSION       2012-05-02 18:10:55.000000000 +0200
@@ -1 +1 @@
-2.22.1
+2.22.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/bindings/python/libstorage.py 
new/libstorage-2.22.2/bindings/python/libstorage.py
--- old/libstorage-2.22.1/bindings/python/libstorage.py 2012-03-15 
17:20:23.000000000 +0100
+++ new/libstorage-2.22.2/bindings/python/libstorage.py 2012-05-02 
18:11:53.000000000 +0200
@@ -1483,6 +1483,8 @@
 BTRFS_EXTEND_FAIL = _libstorage.BTRFS_EXTEND_FAIL
 BTRFS_REDUCE_FAIL = _libstorage.BTRFS_REDUCE_FAIL
 BTRFS_LIST_EMPTY = _libstorage.BTRFS_LIST_EMPTY
+BTRFS_RESIZE_INVALID_VOLUME = _libstorage.BTRFS_RESIZE_INVALID_VOLUME
+BTRFS_MULTIDEV_SHRINK_UNSUPPORTED = 
_libstorage.BTRFS_MULTIDEV_SHRINK_UNSUPPORTED
 TMPFS_REMOVE_INVALID_VOLUME = _libstorage.TMPFS_REMOVE_INVALID_VOLUME
 TMPFS_REMOVE_NO_TMPFS = _libstorage.TMPFS_REMOVE_NO_TMPFS
 TMPFS_REMOVE_NOT_FOUND = _libstorage.TMPFS_REMOVE_NOT_FOUND
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/bindings/ruby/storage_wrap.cxx 
new/libstorage-2.22.2/bindings/ruby/storage_wrap.cxx
--- old/libstorage-2.22.1/bindings/ruby/storage_wrap.cxx        2012-03-15 
17:20:50.000000000 +0100
+++ new/libstorage-2.22.2/bindings/ruby/storage_wrap.cxx        2012-05-02 
18:11:57.000000000 +0200
@@ -38440,6 +38440,8 @@
   rb_define_const(mStorage, "BTRFS_EXTEND_FAIL", SWIG_From_int(static_cast< 
int >(storage::BTRFS_EXTEND_FAIL)));
   rb_define_const(mStorage, "BTRFS_REDUCE_FAIL", SWIG_From_int(static_cast< 
int >(storage::BTRFS_REDUCE_FAIL)));
   rb_define_const(mStorage, "BTRFS_LIST_EMPTY", SWIG_From_int(static_cast< int 
>(storage::BTRFS_LIST_EMPTY)));
+  rb_define_const(mStorage, "BTRFS_RESIZE_INVALID_VOLUME", 
SWIG_From_int(static_cast< int >(storage::BTRFS_RESIZE_INVALID_VOLUME)));
+  rb_define_const(mStorage, "BTRFS_MULTIDEV_SHRINK_UNSUPPORTED", 
SWIG_From_int(static_cast< int >(storage::BTRFS_MULTIDEV_SHRINK_UNSUPPORTED)));
   rb_define_const(mStorage, "TMPFS_REMOVE_INVALID_VOLUME", 
SWIG_From_int(static_cast< int >(storage::TMPFS_REMOVE_INVALID_VOLUME)));
   rb_define_const(mStorage, "TMPFS_REMOVE_NO_TMPFS", 
SWIG_From_int(static_cast< int >(storage::TMPFS_REMOVE_NO_TMPFS)));
   rb_define_const(mStorage, "TMPFS_REMOVE_NOT_FOUND", 
SWIG_From_int(static_cast< int >(storage::TMPFS_REMOVE_NOT_FOUND)));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/libstorage.spec.in 
new/libstorage-2.22.2/libstorage.spec.in
--- old/libstorage-2.22.1/libstorage.spec.in    2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/libstorage.spec.in    2012-04-25 11:40:29.000000000 
+0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libstorage
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,8 +15,6 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
-
 
 Name:           libstorage
 Version:        @VERSION@
@@ -28,7 +26,8 @@
 
 Prefix:         /usr
 
-BuildRequires:  blocxx-devel boost-devel dejagnu doxygen gcc-c++ libtool 
libxml2-devel python-devel ruby-devel swig
+BuildRequires:  blocxx-devel boost-devel dejagnu doxygen gcc-c++ libtool 
libxml2-devel python-devel swig
+BuildRequires: ruby ruby-devel
 
 Summary:        Library for storage management
 Url:            http://en.opensuse.org/Portal:Libstorage
@@ -36,6 +35,17 @@
 %description
 This package contains libstorage, a library for storage management.
 
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
+%{!?py_requires: %global py_requires Requires: python}
+
+%if 0%{?ruby_sitelib} == 0
+%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 
0%{?fedora} || 0%{?rhel}
+%{!?ruby_sitelib: %global ruby_sitelib %(ruby -r rbconfig -e 'vd = 
Config::CONFIG["vendorlibdir"]; print(vd ? vd : Config::CONFIG["sitelibdir"])')}
+%{!?ruby_sitearch: %global ruby_sitearch %(ruby -r rbconfig -e 'vad = 
Config::CONFIG["vendorarchdir"]; print(vad ? vad : 
Config::CONFIG["sitearchdir"])')}
+%endif
+%endif
+
 %prep
 %setup -n libstorage-%{version}
 
@@ -50,6 +60,14 @@
 autoconf
 
 %{?suse_update_config:%{suse_update_config -f}}
+%if 0%{?fedora_version} || 0%{?centos_version}
+CXXFLAGS="-I/usr/include/libxml2" \
+%else
+%if 0%{?rhel_version} >= 500 && 0%{?rhel_version} < 600
+CXXFLAGS="-I/usr/include/libxml2 -I/usr/include/c++/4.1.1/tr1" \
+%endif
+%endif
+
 ./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir} 
--disable-silent-rules
 make %{?jobs:-j%jobs}
 
@@ -76,6 +94,9 @@
 %if 0%{?mandriva_version}
 rm $RPM_BUILD_ROOT/%{ruby_sitearchdir}/storage.la
 %endif
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
+rm $RPM_BUILD_ROOT/%{ruby_sitearch}/storage.la
+%endif
 
 %clean
 rm -rf "$RPM_BUILD_ROOT"
@@ -88,7 +109,9 @@
 Requires:       s390-tools
 %endif
 
+%if 0%{?suse_version}
 PreReq:         %fillup_prereq
+%endif
 Obsoletes:      yast2-storage-lib
 Provides:       yast2-storage-lib
 Obsoletes:      libstorage < 2.21.2
@@ -115,7 +138,9 @@
 
 %post -n libstorage@LIBVERSION_MAJOR@
 /sbin/ldconfig
+%if 0%{?suse_version}
 %{fillup_only -an storage}
+%endif
 
 %postun -n libstorage@LIBVERSION_MAJOR@
 /sbin/ldconfig
@@ -147,6 +172,7 @@
 %package -n libstorage-python
 
 Requires:       libstorage@LIBVERSION_MAJOR@ = %version
+%{py_requires}
 Summary:        Python bindings for libstorage
 Group:          System/Libraries
 
@@ -184,6 +210,9 @@
 %if 0%{?mandriva_version}
 %{ruby_sitearchdir}/storage.so
 %endif
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
+%{ruby_sitearch}/storage.so
+%endif
 
 %package -n libstorage-testsuite
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/BtrfsCo.cc 
new/libstorage-2.22.2/storage/BtrfsCo.cc
--- old/libstorage-2.22.1/storage/BtrfsCo.cc    2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/BtrfsCo.cc    2012-04-05 12:47:17.000000000 
+0200
@@ -496,6 +496,38 @@
        }
     }
 
+int BtrfsCo::resizeVolume( Volume* v, Container* r_co,
+                           Volume* r_v, unsigned long long newSize )
+    {
+    int ret = 0;
+    Btrfs *b = dynamic_cast<Btrfs *>(v);
+    if( b != NULL )
+       {
+       long long size_diff = newSize - b->sizeK();
+       y2mil( "size_diff:" << size_diff );
+       if( b->getDevices().size()==1 || size_diff>0 )
+           {
+           y2mil( "r_v:" << *r_v );
+           ret = r_co->resizeVolume( r_v, r_v->sizeK()+size_diff );
+           y2mil( "r_v:" << *r_v );
+           }
+       else if( size_diff<0 )
+           {
+           ret = BTRFS_MULTIDEV_SHRINK_UNSUPPORTED;
+           }
+       y2mil( "ret:" << ret << " size_diff:" << size_diff );
+       if( ret==0 )
+           {
+           v->setSilent();
+           v->setResizedSize( v->sizeK()+size_diff );
+           }
+       y2mil( "size_diff:" << size_diff );
+       y2mil( "this:" << *this );
+       }
+    else
+       ret = BTRFS_RESIZE_INVALID_VOLUME;
+    return( ret );
+    }
 
 void
 BtrfsCo::logData(const string& Dir) const
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/BtrfsCo.h 
new/libstorage-2.22.2/storage/BtrfsCo.h
--- old/libstorage-2.22.1/storage/BtrfsCo.h     2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/BtrfsCo.h     2012-04-05 12:47:17.000000000 
+0200
@@ -66,6 +66,8 @@
        void getToCommit( storage::CommitStage stage, list<const Container*>& 
col,
                          list<const Volume*>& vo ) const;
 
+       int resizeVolume( Volume* v, Container* r_co, Volume* r_v,
+                         unsigned long long newSize );
        int removeVolume( Volume* v );
        int removeVolume( Volume* v, bool quiet );
        int removeUuid( const string& uuid );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/Disk.cc 
new/libstorage-2.22.2/storage/Disk.cc
--- old/libstorage-2.22.1/storage/Disk.cc       2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/Disk.cc       2012-04-26 18:18:08.000000000 
+0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2004-2010] Novell, Inc.
+ * Copyright (c) [2004-2012] Novell, Inc.
  *
  * All Rights Reserved.
  *
@@ -67,12 +67,14 @@
     Disk::Disk(Storage* s, const string& name, const string& device, unsigned 
num,
               unsigned long long SizeK, SystemInfo& systeminfo)
        : Container(s, name, device, staticType(), systeminfo),
+         max_primary(0), ext_possible(false), max_logical(0),
          init_disk(false), transport(TUNKNOWN), dmp_slave(false), 
no_addpart(false),
-         gpt_enlarge(false), del_ptable(false)
+         gpt_enlarge(false), range(255), del_ptable(false)
     {
     y2mil("constructed Disk name:" << name << " nr " << num << " sizeK:" << 
SizeK);
     logfile_name = name + decString(num);
     ronly = true;
+    label = "xenxvd";          // artificial
     size_k = SizeK;
     addPartition( num, size_k, systeminfo );
     }
@@ -681,6 +683,7 @@
        { "dasd", false, 3, 0, (1ULL << 32) - 1 },
        { "aix", false, 0, 0, (1ULL << 32) - 1 },
        { "amiga", false, 63, 0, (1ULL << 32) - 1 },
+       { "xenxvd", false, 256, 0, (1ULL << 32) - 1 },  // artificial
        { "", false, 0, 0, 0 }
     };
 
@@ -2135,12 +2138,10 @@
        {
        y2mil( "previous:" << *previous );
        if( previous->cylEnd()<endBefore )
-           {
            startBefore = previous->cylEnd();
-           y2mil( "startBefore:" << startBefore );
-           }
        else
            startBefore = cylinders();
+        y2mil( "startBefore:" << startBefore );
        }
 
     if( next != pp.end() )
@@ -2390,6 +2391,7 @@
        p->setSize( sz );
        }
     addToList( p );
+    max_primary = max(max_primary, num);
     }
 
 unsigned Disk::numPartitions() const
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/DmCo.cc 
new/libstorage-2.22.2/storage/DmCo.cc
--- old/libstorage-2.22.1/storage/DmCo.cc       2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/DmCo.cc       2012-04-05 14:52:05.000000000 
+0200
@@ -281,6 +281,24 @@
                if (getStorage()->isUsedBy(it->first, UB_DM))
                    getStorage()->clearUsedBy(it->first);
                }
+           if( !skip && (boost::ends_with(table,"-real")||
+                          boost::ends_with(table,"-cow")))
+               {
+                static Regex delim( "[^-]-[^-]" );
+                string on = table;
+                if( boost::ends_with(on,"-real"))
+                    on.erase( on.size()-5 );
+                if( boost::ends_with(tmp,"-cow"))
+                    on.erase( on.size()-4 );
+                if( delim.match( on ) )
+                    {
+                    on[delim.so(0)+1] = '/';
+                    boost::replace_all(on,"--","-");
+                    on = "/dev/" + on;
+                    skip = getStorage()->knownDevice( on );
+                    y2mil( "devname:" << on << " skip:" << skip );
+                    }
+               }
            if (!skip && m->sizeK()>0 && !only_crypt )
                addDm( m );
            else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/LvmVg.cc 
new/libstorage-2.22.2/storage/LvmVg.cc
--- old/libstorage-2.22.1/storage/LvmVg.cc      2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/LvmVg.cc      2012-04-05 11:53:14.000000000 
+0200
@@ -123,7 +123,15 @@
        {
        LvmLvPair p = lvmLvPair(LvmLv::notDeleted);
        for( LvmLvIter i=p.begin(); i!=p.end(); ++i )
-           ret = removeLv( i->name() );
+            {
+            if( i->isSnapshot() )
+                ret = removeLv( i->name() );
+            }
+       for( LvmLvIter i=p.begin(); i!=p.end(); ++i )
+            {
+            if( !i->isSnapshot() )
+                ret = removeLv( i->name() );
+            }
        setDeleted();
        }
     if( ret==0 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/Storage.cc 
new/libstorage-2.22.2/storage/Storage.cc
--- old/libstorage-2.22.1/storage/Storage.cc    2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/Storage.cc    2012-05-02 17:55:54.000000000 
+0200
@@ -3260,40 +3260,33 @@
        }
     else if( findVolume( device, cont, vol, noBtrfs ) )
        {
+       y2mil( "vol:" << *vol );
+       if( ignoreFs )
+           vol->setIgnoreFs();
        if( cont->type()!=BTRFSC )
-           {
-           y2mil( "vol:" << *vol );
-           if( ignoreFs )
-               vol->setIgnoreFs();
            ret = cont->resizeVolume(&(*vol), newSizeK);
-           eraseCachedFreeInfo(vol->device());
-           y2mil( "vol:" << *vol );
-           }
        else
            {
-           BtrfsCo* bco = dynamic_cast<BtrfsCo *>(&(*cont));
-           Btrfs* b = dynamic_cast<Btrfs *>(&(*vol));
-           if( bco!=NULL && b!=NULL )
+           VolIterator r_vol;
+           ContIterator r_cont;
+           BtrfsCo* co=NULL;
+           if( findVolume( device, r_cont, r_vol, true ) )
                {
-               list<string> devs = b->getDevices();
-               if( devs.size()==1 )
+               if( haveBtrfs(co) )
                    {
-                   ret = resizeVolume( devs.front(), newSizeK, ignoreFs, true 
);
-                   if( ret==0 && findVolume( devs.front(), vol, false, true ) )
-                       {
-                       b->setSize( vol->sizeK() );
-                       y2mil( "vol:" << *vol );
-                       y2mil( "b:" << *b );
-                       }
+                   ret = co->resizeVolume( &(*vol), &(*r_cont), &(*r_vol),
+                                           newSizeK );
+                   y2mil( "vol:" << *vol );
+                   y2mil( "rvo:" << *r_vol );
                    }
-               else 
-                   ret = VOLUME_ALREADY_IN_USE;
+               else
+                   ret = STORAGE_BTRFS_CO_NOT_FOUND;
                }
            else
-               {
-               ret = STORAGE_RESIZE_INVALID_CONTAINER;
-               }
+               ret = STORAGE_VOLUME_NOT_FOUND;
            }
+       eraseCachedFreeInfo(vol->device());
+       y2mil( "vol:" << *vol );
        }
     else
        {
@@ -5739,8 +5732,8 @@
     static FsCapabilitiesX ext4Caps (true, true, true, false, true, true,
                                     true, 16, 32*1024);
 
-    static FsCapabilitiesX btrfsCaps (false, false, false, false, true, true,
-                                     false, 16, 256*1024);
+    static FsCapabilitiesX btrfsCaps (true, true, true, true, true, true,
+                                     false, 256, 256*1024);
 
     static FsCapabilitiesX xfsCaps (true, true, false, false, true, true,
                                    false, 12, 40*1024);
@@ -6144,6 +6137,22 @@
     if( vol )
        y2mil( "vol:" << *vol );
     return( ret );
+    }
+
+bool Storage::findUuid( const string& uuid, Volume const * &vol )
+    {
+    bool ret = false;
+    vol = NULL;
+    ConstVolIterator v;
+    if( findVolume( "UUID="+uuid, v, false, false ))
+       {
+       vol = &(*v);
+       ret = true;
+       }
+    y2mil( "uuid:" << uuid << " ret:" << ret );
+    if( vol )
+       y2mil( "vol:" << *vol );
+    return( ret );
     }
 
 string Storage::findNormalDevice( const string& device )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/Storage.h 
new/libstorage-2.22.2/storage/Storage.h
--- old/libstorage-2.22.1/storage/Storage.h     2012-03-15 17:19:14.000000000 
+0100
+++ new/libstorage-2.22.2/storage/Storage.h     2012-05-02 17:52:09.000000000 
+0200
@@ -307,6 +307,7 @@
        string findNormalDevice( const string& device );
        bool findVolume( const string& device, Volume const* &vol, 
                         bool no_btrfsc=false );
+       bool findUuid( const string& uuid, Volume const* &vol );
        bool findDm( const string& device, const Dm*& dm );
        bool findDmUsing( const string& device, const Dm*& dm );
        bool findDevice( const string& dev, const Device* &vol,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/StorageInterface.h 
new/libstorage-2.22.2/storage/StorageInterface.h
--- old/libstorage-2.22.1/storage/StorageInterface.h    2012-03-15 
17:17:46.000000000 +0100
+++ new/libstorage-2.22.2/storage/StorageInterface.h    2012-04-05 
12:47:17.000000000 +0200
@@ -914,6 +914,8 @@
        BTRFS_EXTEND_FAIL = -15018,
        BTRFS_REDUCE_FAIL = -15019,
        BTRFS_LIST_EMPTY = -15020,
+       BTRFS_RESIZE_INVALID_VOLUME = -15021,
+       BTRFS_MULTIDEV_SHRINK_UNSUPPORTED = -15022,
 
        TMPFS_REMOVE_INVALID_VOLUME = -16001,
        TMPFS_REMOVE_NO_TMPFS = -16002,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/Volume.cc 
new/libstorage-2.22.2/storage/Volume.cc
--- old/libstorage-2.22.1/storage/Volume.cc     2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/Volume.cc     2012-05-02 18:10:07.000000000 
+0200
@@ -713,7 +713,7 @@
     return( ret );
     }
 
-int Volume::prepareTmpMount( string& m, bool& needUmount, bool useMounted, 
const string& options )
+int Volume::prepareTmpMount( string& m, bool& needUmount, bool useMounted, 
const string& options ) const
     {
     y2mil( "useMounted:" << useMounted << " opts:" << options ); 
     int ret = 0;
@@ -731,7 +731,7 @@
     return( ret );
     }
 
-int Volume::umountTmpMount( const string& m, int ret )
+int Volume::umountTmpMount( const string& m, int ret ) const
     {
     int r = ret;
     if( mp.empty() || !umountDir(m) )
@@ -1154,6 +1154,7 @@
     eraseLabel();
     setMount( "" );
     format = false;
+    is_mounted = false;
     detected_fs = fs;
     setUsedBy( ubt, uuid );
     }
@@ -1596,6 +1597,34 @@
                    }
                }
                break;
+           case BTRFS:
+               {
+               bool needumount = false;
+               string mp;
+                const Volume* v = this;
+                if( isUsedBy(UB_BTRFS) )
+                    getStorage()->findUuid( getUsedBy().front().device(), v );
+               ret = v->prepareTmpMount( mp, needumount );
+               if( ret==0 )
+                   {
+                   cmd = BTRFSBIN " filesystem resize ";
+                   if( needShrink() )
+                       cmd += " -" + decString(orig_size_k-size_k) + "K";
+                   else
+                       cmd += " max";
+                   cmd += " ";
+                   cmd += mp;
+                   c.execute( cmd );
+                   if( c.retcode()!=0 )
+                       {
+                       ret = VOLUME_RESIZE_FAILED;
+                       setExtError( c );
+                       }
+                   }
+               if( needumount )
+                   ret = v->umountTmpMount( mp, ret );
+               }
+               break;
            default:
                break;
            }
@@ -2663,7 +2692,7 @@
 Volume::getCommitActions(list<commitAction>& l) const
     {
     Volume const * p=this;
-    if( getStorage()->isUsedBySingleBtrfs(*this))
+    if( getStorage()->isUsedBySingleBtrfs(*this) )
        {
        Volume const * n=NULL;
        string id = "UUID="+getUsedBy().front().device();
@@ -2680,7 +2709,7 @@
        }
     else if( needShrink() && !format )
        {
-       l.push_back(commitAction(DECREASE, cType(), p->resizeText(false), this, 
true));
+       l.push_back(commitAction(DECREASE, cType(), this->resizeText(false), 
this, true));
        }
     else if( created() )
        {
@@ -2688,7 +2717,7 @@
        }
     else if( needExtend() && !format )
        {
-       l.push_back(commitAction(INCREASE, cType(), p->resizeText(false), this, 
true));
+       l.push_back(commitAction(INCREASE, cType(), this->resizeText(false), 
this, true));
        }
     else if( format )
        {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.22.1/storage/Volume.h 
new/libstorage-2.22.2/storage/Volume.h
--- old/libstorage-2.22.1/storage/Volume.h      2012-03-15 17:17:46.000000000 
+0100
+++ new/libstorage-2.22.2/storage/Volume.h      2012-05-02 18:01:52.000000000 
+0200
@@ -107,8 +107,8 @@
        const string& getMount() const { return mp; }
        bool hasOrigMount() const { return !orig_mp.empty(); }
        bool needRemount() const;
-       bool needShrink() const { return !del && size_k<orig_size_k; }
-       bool needExtend() const { return !del && size_k>orig_size_k; }
+       bool needShrink() const { return cType()!=BTRFSC && !del && 
size_k<orig_size_k; }
+       bool needExtend() const { return cType()!=BTRFSC && !del && 
size_k>orig_size_k; }
        long long extendSize() const { return size_k-orig_size_k; }
        storage::FsType getFs() const { return fs; }
        storage::FsType detectedFs() const { return detected_fs; }
@@ -238,8 +238,8 @@
                          bool format ) const;
        bool noFreqPassno() const;
        int prepareTmpMount( string& m, bool& needUmount, bool useMounted=true,
-                            const string& options="" );
-       int umountTmpMount( const string& m, int ret );
+                            const string& options="" ) const;
+       int umountTmpMount( const string& m, int ret ) const;
        int doFormatBtrfs();
 
        string getLosetupCmd( storage::EncryptType, const string& pwdfile ) 
const;

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

Reply via email to