Author: aschnell
Date: Thu Oct 29 14:44:45 2009
New Revision: 59242
URL: http://svn.opensuse.org/viewcvs/yast?rev=59242&view=rev
Log:
- provide usedby information as list in target-map (bnc #472812)
Modified:
trunk/storage/VERSION
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/include/ep-dm-lib.ycp
trunk/storage/storage/src/include/ep-hd-lib.ycp
trunk/storage/storage/src/include/ep-lib.ycp
trunk/storage/storage/src/include/ep-loop-lib.ycp
trunk/storage/storage/src/include/ep-raid-lib.ycp
trunk/storage/storage/src/modules/Storage.ycp
trunk/storage/storage/src/modules/StorageFields.ycp
Modified: trunk/storage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/VERSION (original)
+++ trunk/storage/VERSION Thu Oct 29 14:44:45 2009
@@ -1 +1 @@
-2.18.19
+2.19.0
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Thu Oct 29 14:44:45 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Oct 29 11:59:20 CET 2009 - aschnell@suse.de
+
+- provide usedby information as list in target-map (bnc #472812)
+- 2.19.0
+
+-------------------------------------------------------------------
Mon Oct 05 17:50:59 CEST 2009 - aschnell@suse.de
- improved popup message (bnc #544169)
Modified: trunk/storage/storage/src/include/ep-dm-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-dm-lib.ycp?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-dm-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-dm-lib.ycp Thu Oct 29 14:44:45 2009
@@ -22,7 +22,7 @@
map target_map = Storage::GetTargetMap();
map data = Storage::GetPartition(target_map, device);
- if (!isempty(data["used_by_device"]:""))
+ if (!isempty(data["used_by"]:[]))
{
// error popup
Popup::Error(sformat(_("The DM %1 is in use. It cannot be
Modified: trunk/storage/storage/src/include/ep-hd-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-hd-lib.ycp?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-hd-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-hd-lib.ycp Thu Oct 29 14:44:45 2009
@@ -22,7 +22,7 @@
map target_map = Storage::GetTargetMap();
map disk = target_map[disk_device]:$[];
- if (!isempty(disk["used_by_device"]:""))
+ if (!isempty(disk["used_by"]:[]))
{
// error popup
Popup::Error(_("The disk is in use and cannot be modified."));
@@ -184,7 +184,7 @@
map target_map = Storage::GetTargetMap();
map disk = target_map[disk_device]:$[];
- if (!isempty(disk["used_by_device"]:""))
+ if (!isempty(disk["used_by"]:[]))
{
// error popup
Popup::Error(_("The disk is in use and cannot be modified."));
@@ -243,7 +243,7 @@
if (!Storage::CanEdit(part, true))
return;
- if (!isempty(part["used_by_device"]:""))
+ if (!isempty(part["used_by"]:[]))
{
// error popup, %1 is replace by partition device name e.g. /dev/sdb1
Popup::Error(sformat(_("The partition %1 is in use. It cannot be
@@ -289,7 +289,7 @@
return;
}
- if (!isempty(part["used_by_device"]:""))
+ if (!isempty(part["used_by"]:[]))
{
// error popup, %1 is replace by partition device name, e.g. /dev/sdb1
Popup::Error(sformat(_("The partition %1 is in use. It cannot be
Modified: trunk/storage/storage/src/include/ep-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-lib.ycp?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-lib.ycp Thu Oct 29 14:44:45 2009
@@ -318,7 +318,7 @@
map target_map = Storage::GetTargetMap();
map disk = Storage::GetDisk(target_map, device);
- if (disk["used_by_type"]:`UB_NONE != `UB_NONE)
+ if (!isempty(disk["used_by"]:[]))
return `Empty();
list <integer> bits = [];
Modified: trunk/storage/storage/src/include/ep-loop-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-loop-lib.ycp?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-loop-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-loop-lib.ycp Thu Oct 29 14:44:45 2009
@@ -45,7 +45,7 @@
map target_map = Storage::GetTargetMap();
map data = Storage::GetPartition(target_map, device);
- if (!isempty(data["used_by_device"]:""))
+ if (!isempty(data["used_by"]:[]))
{
// error popup, %1 is replaced by device name
Popup::Error(sformat(_("The Crypt File %1 is in use. It cannot be
Modified: trunk/storage/storage/src/include/ep-raid-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-raid-lib.ycp?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-raid-lib.ycp (original)
+++ trunk/storage/storage/src/include/ep-raid-lib.ycp Thu Oct 29 14:44:45 2009
@@ -99,7 +99,7 @@
map target_map = Storage::GetTargetMap();
map data = Storage::GetPartition(target_map, device);
- if (!isempty(data["used_by_device"]:""))
+ if (!isempty(data["used_by"]:[]))
{
// error popup, %1 is replaced by device name e.g. /dev/md1
Popup::Error(sformat(_("The RAID %1 is in use. It cannot be
@@ -139,7 +139,7 @@
return;
}
- if (!isempty(data["used_by_device"]:""))
+ if (!isempty(data["used_by"]:[]))
{
// error popup, %1 is replaced by device name e.g. /dev/md1
Popup::Error(sformat(_("The RAID %1 is in use. It cannot be
Modified: trunk/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Thu Oct 29 14:44:45 2009
@@ -1202,6 +1202,8 @@
{
p["used_by_type"] = toSymbol( conv_usedby, t );
p["used_by_device"] = LibStorage::VolumeInfo::swig_usedByDevice_get(vinfo);
+ p["used_by"] = [ $[ "type" : p["used_by_type"]:`UB_NONE,
+ "device" : p["used_by_device"]:"" ] ];
}
tmp = LibStorage::VolumeInfo::swig_fstab_options_get(vinfo);
if( size(tmp)>0 )
@@ -1532,7 +1534,7 @@
{
list<string> l = [ "size_k", "cyl_size", "cyl_count", "label",
"max_logical", "max_primary", "type", "readonly",
- "used_by_type", "used_by_device", "partitions", "dasdfmt",
+ "used_by", "used_by_type", "used_by_device", "partitions", "dasdfmt",
"udev_id", "udev_path" ];
foreach( string s, l,
``{
@@ -1561,6 +1563,8 @@
{
c["used_by_type"] = toSymbol( conv_usedby, t );
c["used_by_device"] = LibStorage::ContainerInfo::swig_usedByDevice_get(info);
+ c["used_by"] = [ $[ "type" : c["used_by_type"]:`UB_NONE,
+ "device" : c["used_by_device"]:"" ] ];
}
boolean b = LibStorage::ContainerInfo::swig_readonly_get(info);
if( b )
Modified: trunk/storage/storage/src/modules/StorageFields.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/StorageFields.ycp?rev=59242&r1=59241&r2=59242&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/StorageFields.ycp (original)
+++ trunk/storage/storage/src/modules/StorageFields.ycp Thu Oct 29 14:44:45 2009
@@ -29,12 +29,12 @@
global void IterateTargetMap(map target_map, void(map, map) callback)
{
const map disk_order = $[ `CT_DMRAID : 0, `CT_DMMULTIPATH : 1, `CT_DISK : 2,
- `CT_MD : 3, `CT_LOOP : 4, `CT_LVM : 5, `CT_DM : 6, `CT_NFS : 8 ];
+ `CT_MD : 3, `CT_LOOP : 4, `CT_LVM : 5, `CT_DM : 6, `CT_NFS : 7 ];
list<string> keys = maplist(string dev, map disk, target_map, { return dev; });
keys = sort(string a, string b, keys, {
- integer oa = disk_order[target_map[a,"type"]:`CT_UNKNOWN]:8;
- integer ob = disk_order[target_map[b,"type"]:`CT_UNKNOWN]:8;
+ integer oa = disk_order[target_map[a, "type"]:`CT_UNKNOWN]:8;
+ integer ob = disk_order[target_map[b, "type"]:`CT_UNKNOWN]:8;
return (oa==ob) ? (a used_by)
{
- switch (used_by_type)
+ symbol type = used_by["type"]:`UB_NONE;
+ string device = used_by["device"]:"";
+
+ switch (type)
{
case `UB_LVM:
- return "LVM " + used_by_device;
+ return "LVM " + device;
case `UB_DM:
- return "DM " + used_by_device;
+ return "DM " + device;
case `UB_DMRAID:
- return "DM RAID " + used_by_device;
+ return "DM RAID " + device;
case `UB_DMMULTIPATH:
- return "DM Multipath " + used_by_device;
+ return "DM Multipath " + device;
case `UB_MD:
- return "RAID " + used_by_device;
+ return "RAID " + device;
default:
- return used_by_device;
+ return device;
}
}
@@ -622,12 +625,16 @@
case `used_by:
{
- string value = UsedByString(data["used_by_type"]:`UB_NONE, data["used_by_device"]:"");
if (style == `table)
- return value;
+ return UsedByString(data["used_by", 0]:$[]);
else
- // row label, %1 is replace by used by device name e.g. /dev/system
- return sformat(_("Used By: %1"), String::EscapeTags(value));
+ {
+ integer n = size(data["used_by"]:[]);
+ return mergestring(maplist(integer i, Integer::Range(n == 0 ? 1 : n), {
+ // row label, %1 is replaced by number, %2 is replace by device name e.g. /dev/system
+ return sformat(_("Used By %1: %2"), i+1, String::EscapeTags(UsedByString(data["used_by", i]:$[])));
+ }), HTML::Newline());
+ }
}
case `uuid:
@@ -1048,14 +1055,14 @@
{
if (partition == nil)
{
- if (contains(devices, disk["used_by_device"]:""))
+ if (find(map used_by, disk["used_by"]:[], { return contains(devices, used_by["device"]:""); }) != nil)
return `showandfollow;
else
return `follow;
}
else
{
- if (contains(devices, partition["used_by_device"]:""))
+ if (find(map used_by, partition["used_by"]:[], { return contains(devices, used_by["device"]:""); }) != nil)
return `show;
else
return `ignore;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org