Hello community,

here is the log from the commit of package libstorage-ng for openSUSE:Leap:15.2 
checked in at 2020-03-19 08:35:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/libstorage-ng (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.libstorage-ng.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libstorage-ng"

Thu Mar 19 08:35:45 2020 rev:228 rq:786012 version:4.2.68

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/libstorage-ng/libstorage-ng.changes    
2020-03-13 10:55:23.592349891 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.libstorage-ng.new.3160/libstorage-ng.changes  
2020-03-19 08:35:52.385832019 +0100
@@ -1,0 +2,17 @@
+Fri Mar 13 12:48:25 UTC 2020 - [email protected]
+
+- merge gh#openSUSE/libstorage-ng#711
+- increase minor so version
+- 4.2.68
+
+--------------------------------------------------------------------
+Fri Mar 13 09:57:52 UTC 2020 - [email protected]
+
+- merge gh#openSUSE/libstorage-ng#709
+- add adjust_block_size() method to Region class (bsc#1164295)
+- track device block size when creating an Md RAID (bsc#1164295)
+- add tests for adjust_block_size()
+- add block_size check for Md::add_device()
+- 4.2.67
+
+--------------------------------------------------------------------

Old:
----
  libstorage-ng-4.2.66.tar.xz

New:
----
  libstorage-ng-4.2.68.tar.xz

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

Other differences:
------------------
++++++ libstorage-ng.spec ++++++
--- /var/tmp/diff_new_pack.vsvwwG/_old  2020-03-19 08:35:52.713832220 +0100
+++ /var/tmp/diff_new_pack.vsvwwG/_new  2020-03-19 08:35:52.713832220 +0100
@@ -18,7 +18,7 @@
 
 %define libname %{name}1
 Name:           libstorage-ng
-Version:        4.2.66
+Version:        4.2.68
 Release:        0
 Summary:        Library for storage management
 License:        GPL-2.0-only

++++++ libstorage-ng-4.2.66.tar.xz -> libstorage-ng-4.2.68.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/LIBVERSION 
new/libstorage-ng-4.2.68/LIBVERSION
--- old/libstorage-ng-4.2.66/LIBVERSION 2020-03-05 12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/LIBVERSION 2020-03-13 13:48:25.000000000 +0100
@@ -1 +1 @@
-1.28.0
+1.29.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/VERSION 
new/libstorage-ng-4.2.68/VERSION
--- old/libstorage-ng-4.2.66/VERSION    2020-03-05 12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/VERSION    2020-03-13 13:48:25.000000000 +0100
@@ -1 +1 @@
-4.2.66
+4.2.68
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/bindings/storage-catches.i 
new/libstorage-ng-4.2.68/bindings/storage-catches.i
--- old/libstorage-ng-4.2.66/bindings/storage-catches.i 2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/bindings/storage-catches.i 2020-03-13 
13:48:25.000000000 +0100
@@ -311,6 +311,7 @@
 %catches(storage::Exception) 
storage::Partitionable::get_default_partition_table_type() const;
 %catches(storage::WrongNumberOfChildren, storage::DeviceHasWrongType) 
storage::Partitionable::get_partition_table();
 %catches(storage::WrongNumberOfChildren, storage::DeviceHasWrongType) 
storage::Partitionable::get_partition_table() const;
+%catches(storage::InvalidBlockSize) 
storage::Region::adjust_block_size(unsigned int block_size);
 %catches(storage::Exception) storage::Region::adjust_length(long long delta);
 %catches(storage::Exception) storage::Region::adjust_start(long long delta);
 %catches(storage::Exception) storage::Region::get_end() const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/storage/Devices/MdImpl.cc 
new/libstorage-ng-4.2.68/storage/Devices/MdImpl.cc
--- old/libstorage-ng-4.2.66/storage/Devices/MdImpl.cc  2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/storage/Devices/MdImpl.cc  2020-03-13 
13:48:25.000000000 +0100
@@ -830,10 +830,14 @@
        unsigned long long sum = 0;
        unsigned long long smallest = std::numeric_limits<unsigned long 
long>::max();
 
+       unsigned int block_size = 0;
+
        for (const BlkDevice* blk_device : devices)
        {
            unsigned long long size = blk_device->get_size();
 
+           block_size = std::max( block_size, 
blk_device->get_region().get_block_size() );
+
            const MdUser* md_user = 
blk_device->get_impl().get_single_out_holder_of_type<const MdUser>();
            bool spare = md_user->is_spare();
 
@@ -915,6 +919,14 @@
                break;
        }
 
+       // adjust block size
+       if (block_size && block_size != get_region().get_block_size())
+       {
+           Region region(get_region());
+           region.adjust_block_size(block_size);
+           set_region(region);
+       }
+
        set_size(size);
        set_topology(Topology(0, optimal_io_size));
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/storage/Utils/Region.cc 
new/libstorage-ng-4.2.68/storage/Utils/Region.cc
--- old/libstorage-ng-4.2.66/storage/Utils/Region.cc    2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/storage/Utils/Region.cc    2020-03-13 
13:48:25.000000000 +0100
@@ -167,6 +167,13 @@
     }
 
 
+    void
+    Region::adjust_block_size(unsigned int block_size)
+    {
+       get_impl().adjust_block_size(block_size);
+    }
+
+
     unsigned long long
     Region::to_bytes(unsigned long long blocks) const
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/storage/Utils/Region.h 
new/libstorage-ng-4.2.68/storage/Utils/Region.h
--- old/libstorage-ng-4.2.66/storage/Utils/Region.h     2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/storage/Utils/Region.h     2020-03-13 
13:48:25.000000000 +0100
@@ -130,6 +130,13 @@
        unsigned int get_block_size() const;
        void set_block_size(unsigned int block_size);
 
+       /**
+        * Adjusts the block size while keeping the region's sizes (in bytes).
+        *
+        * @throw Exception
+        */
+       void adjust_block_size(unsigned int block_size);
+
        unsigned long long to_bytes(unsigned long long blocks) const;
        unsigned long long to_blocks(unsigned long long bytes) const;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/storage/Utils/RegionImpl.cc 
new/libstorage-ng-4.2.68/storage/Utils/RegionImpl.cc
--- old/libstorage-ng-4.2.66/storage/Utils/RegionImpl.cc        2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/storage/Utils/RegionImpl.cc        2020-03-13 
13:48:25.000000000 +0100
@@ -107,6 +107,27 @@
     }
 
 
+    void
+    Region::Impl::adjust_block_size(unsigned int block_size)
+    {
+       assert_valid_block_size(block_size);
+
+       if (block_size == Impl::block_size)
+           return;
+
+       if (start * Impl::block_size % block_size ||
+           length * Impl::block_size % block_size)
+       {
+           ST_THROW(InvalidBlockSize(block_size));
+       }
+
+       start = start * Impl::block_size / block_size;
+       length = length * Impl::block_size / block_size;
+
+       Impl::block_size = block_size;
+    }
+
+
     unsigned long long
     Region::Impl::to_bytes(unsigned long long blocks) const
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/storage/Utils/RegionImpl.h 
new/libstorage-ng-4.2.68/storage/Utils/RegionImpl.h
--- old/libstorage-ng-4.2.66/storage/Utils/RegionImpl.h 2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/storage/Utils/RegionImpl.h 2020-03-13 
13:48:25.000000000 +0100
@@ -55,6 +55,7 @@
 
        unsigned int get_block_size() const { return block_size; }
        void set_block_size(unsigned int block_size);
+       void adjust_block_size(unsigned int block_size);
 
        unsigned long long to_bytes(unsigned long long blocks) const;
        unsigned long long to_blocks(unsigned long long bytes) const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/testsuite/Makefile.am 
new/libstorage-ng-4.2.68/testsuite/Makefile.am
--- old/libstorage-ng-4.2.66/testsuite/Makefile.am      2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/testsuite/Makefile.am      2020-03-13 
13:48:25.000000000 +0100
@@ -16,9 +16,9 @@
        dynamic.test ensure-mounted.test environment.test find-vertex.test      
\
        fstab.test crypttab.test output.test probe.test range.test stable.test  
\
        relatives.test mount-opts.test etc-mdadm.test mount-by.test btrfs.test  
\
-       md1.test md2.test md3.test md4.test encryption1.test encryption2.test   
\
-       lvm1.test lvm-pv-usable-size.test graphviz.test copy-individual.test    
\
-       mountpoint.test bcache1.test
+       md1.test md2.test md3.test md4.test md5.test encryption1.test           
\
+       encryption2.test lvm1.test lvm-pv-usable-size.test graphviz.test        
\
+       copy-individual.test mountpoint.test bcache1.test
 
 AM_DEFAULT_SOURCE_EXT = .cc
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/testsuite/Utils/region.cc 
new/libstorage-ng-4.2.68/testsuite/Utils/region.cc
--- old/libstorage-ng-4.2.66/testsuite/Utils/region.cc  2020-03-05 
12:44:31.000000000 +0100
+++ new/libstorage-ng-4.2.68/testsuite/Utils/region.cc  2020-03-13 
13:48:25.000000000 +0100
@@ -355,3 +355,25 @@
     BOOST_CHECK_EQUAL(unused_regions[1].get_start(), 80);
     BOOST_CHECK_EQUAL(unused_regions[1].get_length(), 20);
 }
+
+
+BOOST_AUTO_TEST_CASE(test_adjust_block_size1)
+{
+    Region r(100, 1000, 10);
+
+    r.adjust_block_size(20);
+
+    BOOST_CHECK_EQUAL(r.get_start(), 50);
+    BOOST_CHECK_EQUAL(r.get_length(), 500);
+    BOOST_CHECK_EQUAL(r.get_block_size(), 20);
+}
+
+
+BOOST_AUTO_TEST_CASE(test_adjust_block_size2)
+{
+    Region r1(100, 1000, 10);
+    Region r2(200, 1100, 10);
+
+    BOOST_CHECK_THROW(r1.adjust_block_size(2000), InvalidBlockSize);
+    BOOST_CHECK_THROW(r2.adjust_block_size(2000), InvalidBlockSize);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.2.66/testsuite/md5.cc 
new/libstorage-ng-4.2.68/testsuite/md5.cc
--- old/libstorage-ng-4.2.66/testsuite/md5.cc   1970-01-01 01:00:00.000000000 
+0100
+++ new/libstorage-ng-4.2.68/testsuite/md5.cc   2020-03-13 13:48:25.000000000 
+0100
@@ -0,0 +1,50 @@
+
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE libstorage
+
+#include <boost/test/unit_test.hpp>
+
+#include "storage/Devices/Disk.h"
+#include "storage/Devices/Md.h"
+#include "storage/Devicegraph.h"
+#include "storage/Storage.h"
+#include "storage/Environment.h"
+
+
+using namespace std;
+using namespace storage;
+
+
+BOOST_AUTO_TEST_CASE(adjust_block_size)
+{
+    Environment environment(true, ProbeMode::NONE, TargetMode::DIRECT);
+
+    Storage storage(environment);
+
+    Devicegraph* staging = storage.get_staging();
+
+    Disk* sda = Disk::create(staging, "/dev/sda", Region(0, 10000000, 1024));
+    Disk* sdb = Disk::create(staging, "/dev/sdb", Region(0, 10000000, 512));
+    Disk* sdc = Disk::create(staging, "/dev/sdc", Region(0, 10000000, 4096));
+
+    Md* md0 = Md::create(staging, "/dev/md0");
+    md0->set_md_level(MdLevel::RAID0);
+
+    BOOST_CHECK_EQUAL(md0->get_region().get_block_size(), 512);
+
+    md0->add_device(sda);
+
+    BOOST_CHECK_EQUAL(md0->get_region().get_block_size(), 1024);
+
+    md0->add_device(sdb);
+
+    BOOST_CHECK_EQUAL(md0->get_region().get_block_size(), 1024);
+
+    md0->add_device(sdc);
+
+    BOOST_CHECK_EQUAL(md0->get_region().get_block_size(), 4096);
+
+    md0->remove_device(sdc);
+
+    BOOST_CHECK_EQUAL(md0->get_region().get_block_size(), 1024);
+}


Reply via email to