commit libstorage for openSUSE:Factory
Hello community,
here is the log from the commit of package libstorage for openSUSE:Factory checked in at 2013-04-17 23:05:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libstorage (Old)
and /work/SRC/openSUSE:Factory/.libstorage.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage", Maintainer is "ASchnell@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libstorage/libstorage.changes 2013-04-14 10:33:58.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes 2013-04-17 23:05:07.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Apr 16 17:05:08 CEST 2013 - fehr@suse.de
+
+- version 2.24.0
+- add fast way to detect present disks in system (bnc#810823)
+
+-------------------------------------------------------------------
Old:
----
libstorage-2.23.10.tar.bz2
New:
----
libstorage-2.24.0.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libstorage.spec ++++++
--- /var/tmp/diff_new_pack.tYEFGb/_old 2013-04-17 23:05:08.000000000 +0200
+++ /var/tmp/diff_new_pack.tYEFGb/_new 2013-04-17 23:05:08.000000000 +0200
@@ -17,7 +17,7 @@
Name: libstorage
-Version: 2.23.10
+Version: 2.24.0
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: libstorage-%{version}.tar.bz2
++++++ libstorage-2.23.10.tar.bz2 -> libstorage-2.24.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.23.10/VERSION new/libstorage-2.24.0/VERSION
--- old/libstorage-2.23.10/VERSION 2013-03-18 13:56:34.000000000 +0100
+++ new/libstorage-2.24.0/VERSION 2013-04-16 17:08:01.000000000 +0200
@@ -1 +1 @@
-2.23.10
+2.24.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.23.10/bindings/python/libstorage.py new/libstorage-2.24.0/bindings/python/libstorage.py
--- old/libstorage-2.23.10/bindings/python/libstorage.py 2013-04-04 15:45:59.000000000 +0200
+++ new/libstorage-2.24.0/bindings/python/libstorage.py 2013-04-16 17:17:40.000000000 +0200
@@ -1694,6 +1694,10 @@
StorageInterface_swigregister(StorageInterface)
+def getPresentDisks():
+ return _libstorage.getPresentDisks()
+getPresentDisks = _libstorage.getPresentDisks
+
def initDefaultLogger(*args):
return _libstorage.initDefaultLogger(*args)
initDefaultLogger = _libstorage.initDefaultLogger
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.23.10/storage/Disk.cc new/libstorage-2.24.0/storage/Disk.cc
--- old/libstorage-2.23.10/storage/Disk.cc 2013-03-26 17:31:39.000000000 +0100
+++ new/libstorage-2.24.0/storage/Disk.cc 2013-04-16 17:08:01.000000000 +0200
@@ -163,6 +163,15 @@
v->saveData(xmlNewChild(node, "partition"));
}
+string Disk::sysfsToDev( const string& nm )
+ {
+ return( boost::replace_all_copy(nm, "!", "/") );
+ }
+
+string Disk::devToSysfs( const string& nm )
+ {
+ return( boost::replace_all_copy(nm, "/", "!") );
+ }
string
Disk::sysfsPath( const string& device )
@@ -170,7 +179,7 @@
string dev(device);
if( boost::starts_with(dev, "/dev/"))
dev.erase( 0, 5 );
- return SYSFSDIR "/" + boost::replace_all_copy(dev, "/", "!");
+ return SYSFSDIR "/" + devToSysfs(dev);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.23.10/storage/Disk.h new/libstorage-2.24.0/storage/Disk.h
--- old/libstorage-2.23.10/storage/Disk.h 2013-02-15 10:16:33.000000000 +0100
+++ new/libstorage-2.24.0/storage/Disk.h 2013-04-16 17:08:01.000000000 +0200
@@ -177,6 +177,8 @@
};
static bool getSysfsInfo(const string& sysfsdir, SysfsInfo& sysfsinfo);
+ static string devToSysfs(const string& nm);
+ static string sysfsToDev(const string& nm);
protected:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.23.10/storage/Partition.cc new/libstorage-2.24.0/storage/Partition.cc
--- old/libstorage-2.23.10/storage/Partition.cc 2013-01-22 11:28:07.000000000 +0100
+++ new/libstorage-2.24.0/storage/Partition.cc 2013-04-16 17:08:01.000000000 +0200
@@ -140,7 +140,7 @@
string
Partition::sysfsPath() const
{
- return disk()->sysfsPath() + "/" + boost::replace_all_copy(procName(), "/", "!");
+ return disk()->sysfsPath() + "/" + Disk::devToSysfs(procName());
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.23.10/storage/Storage.cc new/libstorage-2.24.0/storage/Storage.cc
--- old/libstorage-2.23.10/storage/Storage.cc 2013-03-11 18:16:33.000000000 +0100
+++ new/libstorage-2.24.0/storage/Storage.cc 2013-04-16 17:08:01.000000000 +0200
@@ -780,7 +780,7 @@
for( list<DiskData>::iterator i = dl.begin(); i!=dl.end(); ++i )
{
DiskData& data( *i );
- data.dev = boost::replace_all_copy(data.name, "!", "/");
+ data.dev = Disk::sysfsToDev(data.name);
y2mil("name sysfs:" << data.name << " parted:" << data.dev);
Disk * d = NULL;
switch( data.typ )
@@ -826,21 +826,19 @@
}
-void
- Storage::autodetectDisks(SystemInfo& systeminfo)
+bool Storage::getDiskList( list< pair< string, Disk::SysfsInfo > >& dlist )
{
+ dlist.clear();
DIR *Dir;
struct dirent *Entry;
if( (Dir=opendir(SYSFSDIR))!=NULL )
- {
- list<DiskData> dl;
- while( (Entry=readdir( Dir ))!=NULL )
{
+ while( (Entry=readdir( Dir ))!=NULL )
+ {
string dn = Entry->d_name;
if (dn == "." || dn == "..")
continue;
-
// we do not treat mds as disks although they can be partitioned since kernel 2.6.28
if (boost::starts_with(dn, "md")||boost::starts_with(dn, "loop"))
continue;
@@ -849,57 +847,87 @@
if (!Disk::getSysfsInfo(SYSFSDIR "/" + dn, sysfsinfo))
continue;
- if (sysfsinfo.range > 1 && (sysfsinfo.size > 0 || dn.find("dasd") == 0))
+ if( (sysfsinfo.range>1 && (sysfsinfo.size>0 || dn.find("dasd")==0)) ||
+ (sysfsinfo.range==1 && sysfsinfo.size>0 && sysfsinfo.vbd) )
+ {
+ dlist.push_back( make_pair( dn, sysfsinfo ) );
+ }
+ }
+ closedir( Dir );
+ }
+ else
+ {
+ y2err("Failed to open:" SYSFSDIR);
+ }
+ return( !dlist.empty() );
+ }
+
+
+void Storage::autodetectDisks(SystemInfo& systeminfo)
+ {
+ list< pair< string, Disk::SysfsInfo > > dlist;
+ getDiskList( dlist );
+ list< pair< string, Disk::SysfsInfo > >::const_iterator i = dlist.begin();
+ list<DiskData> dl;
+ while( i!=dlist.end() )
+ {
+ if( i->second.range > 1 && (i->second.size > 0 || i->first.find("dasd") == 0))
{
- DiskData::DTyp t = (dn.find("dasd") == 0) ? DiskData::DASD : DiskData::DISK;
+ DiskData::DTyp t = (i->first.find("dasd") == 0) ? DiskData::DASD : DiskData::DISK;
- if (t == DiskData::DASD)
+ if (t == DiskData::DASD)
{
- const Dasdview& dasdview = systeminfo.getDasdview("/dev/" + dn);
- if (dasdview.getDasdType() == Dasd::DASDTYPE_FBA)
- t = DiskData::DISK;
+ const Dasdview& dasdview = systeminfo.getDasdview("/dev/" + i->first);
+ if (dasdview.getDasdType() == Dasd::DASDTYPE_FBA)
+ t = DiskData::DISK;
}
- dl.push_back(DiskData(dn, t, sysfsinfo.size / 2));
+ dl.push_back(DiskData(i->first, t, i->second.size / 2));
}
- else if (sysfsinfo.range == 1 && sysfsinfo.size > 0)
+ else if( i->second.range == 1 && i->second.size > 0 && i->second.vbd )
{
- if (sysfsinfo.vbd)
- {
- dl.push_back(DiskData(dn, DiskData::XEN, sysfsinfo.size / 2));
- }
+ dl.push_back(DiskData(i->first, DiskData::XEN, i->second.size / 2));
}
+ ++i;
}
- closedir( Dir );
- initDisk(dl, systeminfo);
- const UdevMap& by_path = systeminfo.getUdevMap("/dev/disk/by-path");
- const UdevMap& by_id = systeminfo.getUdevMap("/dev/disk/by-id");
- for( list<DiskData>::const_iterator i = dl.begin(); i!=dl.end(); ++i )
- {
- if( i->d )
- {
- string tmp1;
- UdevMap::const_iterator it1 = by_path.find(i->dev);
- if (it1 != by_path.end())
- tmp1 = it1->second.front();
-
- list<string> tmp2;
- UdevMap::const_iterator it2 = by_id.find(i->dev);
- if (it2 != by_id.end())
- tmp2 = it2->second;
+ initDisk(dl, systeminfo);
+ const UdevMap& by_path = systeminfo.getUdevMap("/dev/disk/by-path");
+ const UdevMap& by_id = systeminfo.getUdevMap("/dev/disk/by-id");
+ for( list<DiskData>::const_iterator i = dl.begin(); i!=dl.end(); ++i )
+ {
+ if( i->d )
+ {
+ string tmp1;
+ UdevMap::const_iterator it1 = by_path.find(i->dev);
+ if (it1 != by_path.end())
+ tmp1 = it1->second.front();
+
+ list<string> tmp2;
+ UdevMap::const_iterator it2 = by_id.find(i->dev);
+ if (it2 != by_id.end())
+ tmp2 = it2->second;
- i->d->setUdevData(tmp1, tmp2);
- addToList( i->d );
- }
+ i->d->setUdevData(tmp1, tmp2);
+ addToList( i->d );
}
}
- else
+ }
+
+list<string> getPresentDisks()
+ {
+ list<string> ret;
+ list< pair< string, Disk::SysfsInfo > > dlist;
+ Storage::getDiskList( dlist );
+ list< pair< string, Disk::SysfsInfo > >::const_iterator i = dlist.begin();
+ while( i!=dlist.end() )
{
- y2err("Failed to open:" SYSFSDIR);
+ ret.push_back( "/dev/"+Disk::sysfsToDev(i->first) );
+ ++i;
}
+ y2mil( "ret:" << ret );
+ return( ret );
}
-
void
Storage::detectFsData(const VolIterator& begin, const VolIterator& end, SystemInfo& systeminfo)
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.23.10/storage/Storage.h new/libstorage-2.24.0/storage/Storage.h
--- old/libstorage-2.23.10/storage/Storage.h 2013-03-06 14:46:32.000000000 +0100
+++ new/libstorage-2.24.0/storage/Storage.h 2013-04-16 17:08:01.000000000 +0200
@@ -585,6 +585,7 @@
static bool loadModuleIfNeeded( const string& module );
static void clean_tmpdir();
+ static bool getDiskList( list< pair< string, Disk::SysfsInfo > >& dlist );
void getDiskList( bool (* CheckFnc)( const Disk& ),
std::list
participants (1)
-
root@hilbert.suse.de