Author: fehr
Date: Tue Oct 25 16:18:35 2011
New Revision: 66576
URL: http://svn.opensuse.org/viewcvs/yast?rev=66576&view=rev
Log:
- version 2.17.118
- add function IsDeviceOnNetwork to be used by Network module (bnc#726057)
Modified:
branches/SuSE-Code-11-SP2-Branch/storage/VERSION
branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc
branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h
branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h
branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes
branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/storage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/VERSION?rev=66576&r1=66575&r2=66576&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/storage/VERSION (original)
+++ branches/SuSE-Code-11-SP2-Branch/storage/VERSION Tue Oct 25 16:18:35 2011
@@ -1 +1 @@
-2.17.117
+2.17.118
Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc?rev=66576&r1=66575&r2=66576&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc (original)
+++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc Tue Oct 25 16:18:35 2011
@@ -5090,11 +5090,21 @@
if (findVolume(device, c, v))
{
ret = 0;
+ if( c->type()==BTRFSC )
+ {
+ const Btrfs * b = dynamic_cast(&(*v));
+ if( b!=NULL && b->getDevices().size()==1 )
+ {
+ findVolume(b->device(), c, v, true);
+ }
+ }
info.ctype = c->type();
info.cname = c->name();
info.cdevice = c->device();
info.vname = v->name();
info.vdevice = v->device();
+ if( v->isNumeric() )
+ info.num = v->nr();
}
else if (findContainer(device, c))
{
@@ -5723,11 +5733,11 @@
}
bool Storage::findVolume( const string& device, ConstContIterator& c,
- ConstVolIterator& v )
+ ConstVolIterator& v, bool no_btrfs )
{
ContIterator ct;
VolIterator vt;
- bool ret = findVolume( device, ct, vt );
+ bool ret = findVolume( device, ct, vt, no_btrfs );
if( ret )
{
c = ct;
Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h?rev=66576&r1=66575&r2=66576&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h (original)
+++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h Tue Oct 25 16:18:35 2011
@@ -2051,7 +2051,7 @@
bool findVolume( const string& device, ContIterator& c,
VolIterator& v, bool no_btrfs=false );
bool findVolume( const string& device, ConstContIterator& c,
- ConstVolIterator& v );
+ ConstVolIterator& v, bool no_btrfs=false );
bool findVolume( const string& device, VolIterator& v,
bool also_del=false, bool no_btrfs=false );
bool findVolume( const string& device, ConstVolIterator& v,
Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h?rev=66576&r1=66575&r2=66576&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h (original)
+++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h Tue Oct 25 16:18:35 2011
@@ -601,12 +601,13 @@
*/
struct ContVolInfo
{
- ContVolInfo() : ctype(CUNKNOWN) {}
+ ContVolInfo() : ctype(CUNKNOWN), num(-1) {}
CType ctype;
string cname;
string cdevice;
string vname;
string vdevice;
+ int num;
};
/**
Modified: branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes?rev=66576&r1=66575&r2=66576&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes Tue Oct 25 16:18:35 2011
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Tue Oct 25 16:08:52 CEST 2011 - fehr@suse.de
+
+- version 2.17.118
+- add function IsDeviceOnNetwork to be used by Network module
+ (bnc#726057)
+
+-------------------------------------------------------------------
Mon Oct 24 14:11:58 CEST 2011 - fehr@suse.de
- version 2.17.117
Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp?rev=66576&r1=66575&r2=66576&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp Tue Oct 25 16:18:35 2011
@@ -510,6 +510,40 @@
return LibStorage::StorageInterface::getIgnoreFstab(sint, device, val) == 0;
}
+symbol toSymbol( map conv, integer val )
+ {
+ return( conv["m",val]:(conv["def_sym"]:`invalid_conv_map) );
+ }
+
+integer fromSymbol( map conv, symbol val )
+ {
+ integer ret = conv["def_int"]:-1;
+ foreach( integer i, symbol s, conv["m"]:$[],
+ ``{
+ if( s==val )
+ ret = i;
+ });
+ return( ret );
+ }
+
+global boolean GetContVolInfo(string device, map& info)
+ {
+ any tmp = LibStorage::ContVolInfo::new("LibStorage::ContVolInfo");
+ if (LibStorage::StorageInterface::getContVolInfo(sint, device, tmp) != 0)
+ return false;
+
+ info = $[ "ctype" : toSymbol(conv_ctype, LibStorage::ContVolInfo::swig_ctype_get(tmp)),
+ "cname" : LibStorage::ContVolInfo::swig_cname_get(tmp),
+ "cdevice" : LibStorage::ContVolInfo::swig_cdevice_get(tmp),
+ "vname" : LibStorage::ContVolInfo::swig_vname_get(tmp),
+ "vdevice" : LibStorage::ContVolInfo::swig_vdevice_get(tmp),
+ "num" : LibStorage::ContVolInfo::swig_num_get(tmp) ];
+
+ y2milestone("GetContVolInfo device:%1 info:%2", device, info);
+ return true;
+ }
+
+
global define map GetTargetMap();
global define void SetTargetMap( map target );
@@ -519,8 +553,9 @@
string key );
-define list<map> GetDiskPartitionTg( string device, map tg )
+define list<map> GetDiskPartitionTg( string inpdev, map tg )
``{
+ string device = inpdev;
list<map> ret = [];
integer dlen = 0;
boolean as_string = false;
@@ -740,6 +775,23 @@
{
tmp["nr"] = "";
}
+ if( size(tg)>0 && !haskey( tg, tmp["disk"]:"" ))
+ {
+ y2milestone( "GetDiskPartitionTg tmp:%1", tmp );
+ map r = $[];
+ if( GetContVolInfo( inpdev, r ))
+ {
+ y2milestone( "GetDiskPartitionTg rtmp:%1", r );
+ if( haskey( tg, r["cdevice"]:"" ))
+ {
+ tmp["disk"] = r["cdevice"]:"";
+ if( r["num"]:-1 != -1 )
+ tmp["nr"] = r["num"]:-1;
+ else
+ tmp["nr"] = r["vname"]:"";
+ }
+ }
+ }
ret = [ tmp ];
}
else
@@ -1188,22 +1240,6 @@
return( ret );
}
-symbol toSymbol( map conv, integer val )
- {
- return( conv["m",val]:(conv["def_sym"]:`invalid_conv_map) );
- }
-
-integer fromSymbol( map conv, symbol val )
- {
- integer ret = conv["def_int"]:-1;
- foreach( integer i, symbol s, conv["m"]:$[],
- ``{
- if( s==val )
- ret = i;
- });
- return( ret );
- }
-
global define boolean CheckBackupState( string who )
{
y2milestone( "CheckBackupStates who:%1", who );
@@ -1849,7 +1885,7 @@
}
else
{
- if( haskey( mp, k ));
+ if( haskey( mp, k ))
{
y2milestone( "HandleBtrfsSimpleVolumes remove key %1", k );
tg = DelPartitionData( tg, p["device"]:"", k );
@@ -2227,23 +2263,6 @@
}
- global boolean GetContVolInfo(string device, map& info)
- {
- any tmp = LibStorage::ContVolInfo::new("LibStorage::ContVolInfo");
- if (LibStorage::StorageInterface::getContVolInfo(sint, device, tmp) != 0)
- return false;
-
- info = $[ "ctype" : toSymbol(conv_ctype, LibStorage::ContVolInfo::swig_ctype_get(tmp)),
- "cname" : LibStorage::ContVolInfo::swig_cname_get(tmp),
- "cdevice" : LibStorage::ContVolInfo::swig_cdevice_get(tmp),
- "vname" : LibStorage::ContVolInfo::swig_vname_get(tmp),
- "vdevice" : LibStorage::ContVolInfo::swig_vdevice_get(tmp) ];
-
- y2milestone("GetContVolInfo device:%1 info:%2", device, info);
- return true;
- }
-
-
global boolean IsInstallationSource(string device)
{
if (part_insts == nil)
@@ -6082,4 +6101,88 @@
include "./storage_update.ycp";
+list<string> GetUsedDisks( string device )
+ {
+ y2milestone( "GetUsedDisks device:%1", device );
+ list<string> ret = [];
+ map tg = GetTargetMap();
+ map info = $[];
+ if( GetContVolInfo(device, info))
+ {
+ y2milestone( "GetUsedDisks info:%1", info );
+ list<string> to_visit = [ device ];
+ list<string> visited_devs = [];
+ do
+ {
+ visited_devs = add( visited_devs, to_visit[0]:"" );
+ to_visit = remove( to_visit, 0 );
+ list<string> add_list = [];
+ if( info["ctype"]:`CT_UNKNOWN==`CT_DISK )
+ {
+ if( !contains( ret, info["cdevice"]:"" ))
+ ret = add( ret, info["cdevice"]:"" );
+ }
+ else if( info["ctype"]:`CT_UNKNOWN==`CT_BTRFS )
+ {
+ map bt = find( map p, tg["/dev/btrfs","partitions"]:[],
+ ``(contains( p["devices"]:[], info["vdevice"]:"" )));
+ y2milestone( "GetUsedDisks bt:%1", bt );
+ if( bt!=nil )
+ add_list = bt["devices"]:[];
+ }
+ else
+ {
+ add_list = tg[info["cdevice"]:"","devices"]:[];
+ }
+ if( size(add_list)>0 )
+ y2milestone( "GetUsedDisks add_list:%1", add_list );
+ foreach( string s, add_list,
+ ``{
+ if( !contains( visited_devs, s ) && !contains( to_visit, s ) &&
+ !contains( ret, s ))
+ to_visit = add( to_visit, s );
+ });
+ y2milestone( "GetUsedDisks to_visit:%1", to_visit );
+ while( size(to_visit)>0 && !GetContVolInfo(to_visit[0]:"", info))
+ {
+ visited_devs = add( visited_devs, to_visit[0]:"" );
+ to_visit = remove( to_visit, 0 );
+ }
+ if( size(to_visit)>0 )
+ y2milestone( "GetUsedDisks info:%1", info );
+ }
+ while( size(to_visit)>0 );
+ if( size(ret)>1 )
+ ret = sort( ret );
+ }
+ else if( substring(device,0,1)!="/" && search(device,":")>0 )
+ ret = [ "/dev/nfs" ];
+ y2milestone( "GetUsedDisks ret:%1", ret );
+ return( ret );
+ }
+
+global symbol IsDeviceOnNetwork( string device )
+ {
+ symbol ret = `no;
+ map tg = GetTargetMap();
+
+ list<string> disks = GetUsedDisks( device );
+ if( disks[0]:""=="/dev/nfs" )
+ ret = `nfs;
+ else
+ {
+ foreach( string s, disks,
+ ``{
+ if( ret == `no )
+ {
+ y2milestone( "disk:%1 tarnsport:%2", s, tg[s,"transport"]:`unknown );
+ if( contains( [ `fcoe, `iscsi ], tg[s,"transport"]:`unknown ))
+ ret = tg[s,"transport"]:`unknown;
+ }
+ });
+ }
+ y2milestone( "IsDeviceOnNetwork device:%1 ret:%2", device, ret );
+ return( ret );
+ }
+
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org