YaST Commits
Threads by month
- ----- 2024 -----
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
April 2009
- 24 participants
- 518 discussions
[yast-commit] r56936 - in /trunk/storage/libstorage/src: Disk.cc Disk.h
by aschnell@svn.opensuse.org 23 Apr '09
by aschnell@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: aschnell
Date: Thu Apr 23 15:45:02 2009
New Revision: 56936
URL: http://svn.opensuse.org/viewcvs/yast?rev=56936&view=rev
Log:
- added some const
Modified:
trunk/storage/libstorage/src/Disk.cc
trunk/storage/libstorage/src/Disk.h
Modified: trunk/storage/libstorage/src/Disk.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?r…
==============================================================================
--- trunk/storage/libstorage/src/Disk.cc (original)
+++ trunk/storage/libstorage/src/Disk.cc Thu Apr 23 15:45:02 2009
@@ -583,7 +583,7 @@
bool
Disk::scanPartedLine( const string& Line, unsigned& nr, unsigned long& start,
unsigned long& csize, PartitionType& type, unsigned& id,
- bool& boot )
+ bool& boot ) const
{
unsigned long StartM, EndM;
string PartitionType, TInfo;
@@ -846,7 +846,7 @@
bool
Disk::checkPartedValid(const ProcPart& pp, const string& diskname,
- list<Partition*>& pl, unsigned long& range_exceed)
+ list<Partition*>& pl, unsigned long& range_exceed) const
{
unsigned ext_nr = 0;
bool ret=true;
@@ -1395,13 +1395,13 @@
}
int Disk::createChecks( PartitionType& type, unsigned long start,
- unsigned long len, bool checkRelaxed )
+ unsigned long len, bool checkRelaxed ) const
{
y2mil("begin type " << type << " at " << start << " len " << len << " relaxed:" << checkRelaxed);
unsigned fuzz = checkRelaxed ? 2 : 0;
int ret = 0;
Region r( start, len );
- PartPair ext = partPair(notDeletedExt);
+ ConstPartPair ext = partPair(notDeletedExt);
if( type==PTYPE_ANY )
{
if( ext.empty() || !ext.begin()->contains( Region(start,1) ))
@@ -1429,9 +1429,8 @@
}
if( ret==0 )
{
- PartPair p = (type!=LOGICAL) ? partPair( notDeleted )
- : partPair( notDeletedLog );
- PartIter i = p.begin();
+ ConstPartPair p = (type != LOGICAL) ? partPair(notDeleted) : partPair(notDeletedLog);
+ ConstPartIter i = p.begin();
while( i!=p.end() && !i->intersectArea( r, fuzz ))
{
++i;
@@ -1458,7 +1457,7 @@
}
}
y2mil("ret:" << ret);
- return( ret );
+ return ret;
}
int Disk::changePartitionArea( unsigned nr, unsigned long start,
@@ -2014,7 +2013,7 @@
}
bool
-Disk::getPartedValues( Partition *p )
+Disk::getPartedValues( Partition *p ) const
{
bool ret = false;
if( getStorage()->test() )
@@ -2060,7 +2059,7 @@
bool
Disk::getPartedSectors( const Partition *p, unsigned long long& start,
- unsigned long long& end )
+ unsigned long long& end ) const
{
bool ret = false;
if( getStorage()->test() )
@@ -2549,12 +2548,12 @@
return( ret );
}
-const Partition * Disk::getPartitionAfter( const Partition * p )
+const Partition* Disk::getPartitionAfter(const Partition* p) const
{
- const Partition * ret = NULL;
+ const Partition* ret = NULL;
y2mil( "p:" << *p );
- PartPair pp = partPair( (p->type()==LOGICAL)?notDeleted:notDeletedLog );
- for( PartIter pi=pp.begin(); pi!=pp.end(); ++pi )
+ ConstPartPair pp = partPair((p->type() == LOGICAL) ? notDeleted : notDeletedLog);
+ for (ConstPartIter pi = pp.begin(); pi != pp.end(); ++pi)
{
if( !pi->created() &&
pi->cylStart()>p->cylStart() &&
@@ -2565,7 +2564,7 @@
y2mil( "ret:NULL" );
else
y2mil( "ret:" << *ret );
- return( ret );
+ return ret;
}
unsigned Disk::numPartitions() const
Modified: trunk/storage/libstorage/src/Disk.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.h?re…
==============================================================================
--- trunk/storage/libstorage/src/Disk.h (original)
+++ trunk/storage/libstorage/src/Disk.h Thu Apr 23 15:45:02 2009
@@ -173,13 +173,13 @@
bool scanPartedLine( const string& Line, unsigned& nr,
unsigned long& start, unsigned long& csize,
storage::PartitionType& type,
- unsigned& id, bool& boot );
+ unsigned& id, bool& boot ) const;
bool checkPartedValid( const ProcPart& pp, const string& diskname,
- std::list<Partition*>& pl, unsigned long& rng );
- bool getPartedValues( Partition *p );
+ std::list<Partition*>& pl, unsigned long& rng ) const;
+ bool getPartedValues( Partition *p ) const;
bool getPartedSectors( const Partition *p, unsigned long long& start,
- unsigned long long& end );
- const Partition * getPartitionAfter( const Partition * p );
+ unsigned long long& end ) const;
+ const Partition * getPartitionAfter( const Partition * p ) const;
virtual void print( std::ostream& s ) const { s << *this; }
virtual Container* getCopy() const { return( new Disk( *this ) ); }
void getGeometry( const string& line, unsigned long& c,
@@ -188,7 +188,7 @@
void changeNumbers( const PartIter& b, const PartIter& e,
unsigned start, int incr );
int createChecks( storage::PartitionType& type, unsigned long start,
- unsigned long len, bool checkRelaxed );
+ unsigned long len, bool checkRelaxed ) const;
void removePresentPartitions();
void removeFromMemory();
void enlargeGpt();
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56935 - /trunk/packager/src/include/repositories_include.ycp
by lslezak@svn.opensuse.org 23 Apr '09
by lslezak@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: lslezak
Date: Thu Apr 23 15:44:35 2009
New Revision: 56935
URL: http://svn.opensuse.org/viewcvs/yast?rev=56935&view=rev
Log:
- ISO over sfto is also not supported
Modified:
trunk/packager/src/include/repositories_include.ycp
Modified: trunk/packager/src/include/repositories_include.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/include/repositorie…
==============================================================================
--- trunk/packager/src/include/repositories_include.ycp (original)
+++ trunk/packager/src/include/repositories_include.ycp Thu Apr 23 15:44:35 2009
@@ -276,10 +276,10 @@
map parsed_url = URL::Parse(url);
string scheme = tolower(parsed_url["scheme"]:"");
- if (contains(["ftp", "http", "https"], scheme))
+ if (contains(["ftp", "sftp", "http", "https"], scheme))
{
// error message
- _msg1 = _msg1 + "\n\n" + _("Using an ISO image over ftp or http(s) protocol is not possible.\nChange the protocol or unpack the ISO image on the server side.");
+ _msg1 = _msg1 + "\n\n" + _("Using an ISO image over ftp or http protocol is not possible.\nChange the protocol or unpack the ISO image on the server side.");
}
}
// popup message part 2
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56934 - in /trunk/packager: package/yast2-packager.changes src/include/repositories_include.ycp
by lslezak@svn.opensuse.org 23 Apr '09
by lslezak@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: lslezak
Date: Thu Apr 23 15:21:32 2009
New Revision: 56934
URL: http://svn.opensuse.org/viewcvs/yast?rev=56934&view=rev
Log:
- display an additional help when adding an ISO repository over
FTP or HTTP protocol fails (bnc#341668)
Modified:
trunk/packager/package/yast2-packager.changes
trunk/packager/src/include/repositories_include.ycp
Modified: trunk/packager/package/yast2-packager.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.…
==============================================================================
--- trunk/packager/package/yast2-packager.changes (original)
+++ trunk/packager/package/yast2-packager.changes Thu Apr 23 15:21:32 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Apr 23 15:19:17 CEST 2009 - lslezak(a)suse.cz
+
+- display an additional help when adding an ISO repository over
+ FTP or HTTP protocol fails (bnc#341668)
+
+-------------------------------------------------------------------
Tue Apr 21 15:34:48 CEST 2009 - lslezak(a)suse.cz
- Append additional RPM output to the installation log only if it
Modified: trunk/packager/src/include/repositories_include.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/include/repositorie…
==============================================================================
--- trunk/packager/src/include/repositories_include.ycp (original)
+++ trunk/packager/src/include/repositories_include.ycp Thu Apr 23 15:21:32 2009
@@ -270,6 +270,18 @@
// popup message part 1
string _msg1 = sformat( _("Unable to create repository
from URL '%1'."), URL::HidePassword(url) );
+
+ if (regexpmatch(url, "\\.iso$"))
+ {
+ map parsed_url = URL::Parse(url);
+ string scheme = tolower(parsed_url["scheme"]:"");
+
+ if (contains(["ftp", "http", "https"], scheme))
+ {
+ // error message
+ _msg1 = _msg1 + "\n\n" + _("Using an ISO image over ftp or http(s) protocol is not possible.\nChange the protocol or unpack the ISO image on the server side.");
+ }
+ }
// popup message part 2
string _msg2 = _("Try again?");
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56933 - in /trunk/bootloader/src: grub/ modules/ routines/
by juhliarik@svn.opensuse.org 23 Apr '09
by juhliarik@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: juhliarik
Date: Thu Apr 23 14:56:26 2009
New Revision: 56933
URL: http://svn.opensuse.org/viewcvs/yast?rev=56933&view=rev
Log:
small addaptation to new perl-Bootloader and creating new module for
handling storage data in yast2-bootloader
Modified:
trunk/bootloader/src/grub/misc.ycp
trunk/bootloader/src/grub/options.ycp
trunk/bootloader/src/modules/BootArch.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootELILO.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/BootLILO.ycp
trunk/bootloader/src/modules/BootPOWERLILO.ycp
trunk/bootloader/src/modules/BootStorage.ycp
trunk/bootloader/src/modules/BootSupportCheck.ycp
trunk/bootloader/src/modules/Bootloader.ycp
trunk/bootloader/src/routines/global_widgets.ycp
trunk/bootloader/src/routines/i386.ycp
trunk/bootloader/src/routines/lib_iface.ycp
trunk/bootloader/src/routines/lilolike.ycp
trunk/bootloader/src/routines/misc.ycp
trunk/bootloader/src/routines/section_widgets.ycp
Modified: trunk/bootloader/src/grub/misc.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/misc.ycp?rev…
==============================================================================
--- trunk/bootloader/src/grub/misc.ycp (original)
+++ trunk/bootloader/src/grub/misc.ycp Thu Apr 23 14:56:26 2009
@@ -47,7 +47,7 @@
else if (BootCommon::globals["boot_custom"]:nil ==
StorageDevices::FloppyDevice())
ret = true;
- else if (contains (BootCommon::getFloppyDevices (),
+ else if (contains (BootStorage::getFloppyDevices (),
BootCommon::globals["boot_custom"]:nil))
ret = true;
y2milestone ("Installing to floppy: %1", ret);
@@ -143,11 +143,11 @@
// }
// (bnc # 337742) - Unable to boot the openSUSE (32 and 64 bits) after installation
- // if loader_device is disk device activate BootCommon::BootPartitionDevice
+ // if loader_device is disk device activate BootStorage::BootPartitionDevice
if (num == 0)
{
y2milestone ("loader_device is disk device");
- p_dev = Storage::GetDiskPartition (BootCommon::BootPartitionDevice);
+ p_dev = Storage::GetDiskPartition (BootStorage::BootPartitionDevice);
num = BootCommon::myToInteger( p_dev["nr"]:nil );
}
@@ -462,10 +462,10 @@
{
string result = "";
string boot_device = "";
- if ((BootCommon::BootPartitionDevice != nil) && (BootCommon::BootPartitionDevice != ""))
- boot_device = BootCommon::BootPartitionDevice;
+ if ((BootStorage::BootPartitionDevice != nil) && (BootStorage::BootPartitionDevice != ""))
+ boot_device = BootStorage::BootPartitionDevice;
else
- boot_device = BootCommon::RootPartitionDevice;
+ boot_device = BootStorage::RootPartitionDevice;
foreach(map p, partitions, {
if (p["device"]:"" == boot_device)
@@ -525,7 +525,7 @@
// - is on the first disk (with the MBR): boot_partition_is_on_mbr_disk -> true
map<string,any> tm = Storage::GetTargetMap ();
- map dp = Storage::GetDiskPartition (BootCommon::BootPartitionDevice);
+ map dp = Storage::GetDiskPartition (BootStorage::BootPartitionDevice);
string boot_partition_disk = dp["disk"]:"";
boolean boot_partition_is_on_mbr_disk =
(boot_partition_disk == BootCommon::mbrDisk);
@@ -538,8 +538,8 @@
// determine the underlying devices for the "/boot" partition (either the
// BootPartitionDevice, or the devices from which the soft-RAID device for
// "/boot" is built)
- list<string> underlying_boot_partition_devices = [ BootCommon::BootPartitionDevice ];
- map<string,integer> md_info = BootCommon::Md2Partitions (BootCommon::BootPartitionDevice);
+ list<string> underlying_boot_partition_devices = [ BootStorage::BootPartitionDevice ];
+ map<string,integer> md_info = BootCommon::Md2Partitions (BootStorage::BootPartitionDevice);
if (md_info != nil && size (md_info) > 0)
{
boot_partition_is_on_mbr_disk = false;
@@ -646,7 +646,7 @@
}
SetBootloaderDevice(selected_location);
- if (! contains (BootCommon::getPartitionList (`boot), (BootCommon::GetBootloaderDevices())[0]:nil))
+ if (! contains (BootStorage::getPartitionList (`boot, "grub"), (BootCommon::GetBootloaderDevices())[0]:nil))
{
selected_location = `mbr; // default to mbr
SetBootloaderDevice(selected_location);
@@ -701,10 +701,10 @@
map<string,any> tm = Storage::GetTargetMap ();
string device = "";
- if (BootCommon::BootPartitionDevice != "")
- device = BootCommon::BootPartitionDevice;
+ if (BootStorage::BootPartitionDevice != "")
+ device = BootStorage::BootPartitionDevice;
else
- device = BootCommon::RootPartitionDevice;
+ device = BootStorage::RootPartitionDevice;
map dp = Storage::GetDiskPartition (device);
string disk = dp["disk"]:"";
@@ -748,19 +748,19 @@
y2milestone( "mountPoints %1", mp );
y2milestone( "mountdata_boot %1", mountdata_boot );
- BootCommon::RootPartitionDevice = mp["/", 0]:"";
+ BootStorage::RootPartitionDevice = mp["/", 0]:"";
- if (BootCommon::RootPartitionDevice == "")
+ if (BootStorage::RootPartitionDevice == "")
{
y2error ("No mountpoint for / !!");
}
// if /boot changed, re-configure location
- BootCommon::BootPartitionDevice
- = mountdata_boot[0]:BootCommon::RootPartitionDevice;
+ BootStorage::BootPartitionDevice
+ = mountdata_boot[0]:BootStorage::RootPartitionDevice;
// get extended partition device (if exists)
- BootCommon::ExtendedPartitionDevice = grub_GetExtendedPartitionDev();
+ BootStorage::ExtendedPartitionDevice = grub_GetExtendedPartitionDev();
if (BootCommon::mbrDisk == "" || BootCommon::mbrDisk == nil)
{
@@ -771,7 +771,7 @@
// if no bootloader devices have been set up, or any of the set up
// bootloader devices have become unavailable, then re-propose the
// bootloader location.
- list<string> all_boot_partitions = BootCommon::getPartitionList(`boot);
+ list<string> all_boot_partitions = BootStorage::getPartitionList(`boot, "grub");
list<string> bldevs = BootCommon::GetBootloaderDevices();
boolean need_location_reconfigure = false;
@@ -808,22 +808,22 @@
string actual_extended = grub_GetExtendedPartitionDev();
if ( BootCommon::globals["boot_boot"]:"false" == "true" &&
- actual_boot != BootCommon::BootPartitionDevice )
+ actual_boot != BootStorage::BootPartitionDevice )
ret = $[
"changed" : true,
"reason" : (string) ret["reason"]:"" +
"Selected bootloader location \"/boot\" is not on " +
- BootCommon::BootPartitionDevice +
+ BootStorage::BootPartitionDevice +
" any more.\n"
];
if ( BootCommon::globals["boot_root"]:"false" == "true" &&
- actual_root != BootCommon::RootPartitionDevice )
+ actual_root != BootStorage::RootPartitionDevice )
ret = $[
"changed" : true,
"reason" : (string) ret["reason"]:"" +
"Selected bootloader location \"/\" is not on " +
- BootCommon::RootPartitionDevice +
+ BootStorage::RootPartitionDevice +
" any more.\n"
];
@@ -841,18 +841,18 @@
}
if ( BootCommon::globals["boot_extended"]:"false" == "true" &&
- actual_extended != BootCommon::ExtendedPartitionDevice )
+ actual_extended != BootStorage::ExtendedPartitionDevice )
ret = $[
"changed" : true,
"reason" : (string) ret["reason"]:"" +
"Selected bootloader location \"extended partition\" is not on " +
- BootCommon::ExtendedPartitionDevice +
+ BootStorage::ExtendedPartitionDevice +
" any more.\n"
];
if ( BootCommon::globals["boot_custom"]:nil != nil ) {
- list all_boot_partitions = BootCommon::getPartitionList(`boot);
+ list all_boot_partitions = BootStorage::getPartitionList(`boot, "grub");
if ( ! contains(all_boot_partitions, BootCommon::globals["boot_custom"]:nil) )
ret = $[
@@ -906,7 +906,7 @@
))
{
grub_DetectDisks ();
- BootCommon::del_parts = BootCommon::getPartitionList (`deleted);
+ BootCommon::del_parts = BootStorage::getPartitionList (`deleted, "grub");
// check whether edd is loaded; if not: load it
string lsmod_command = "lsmod | grep edd";
y2milestone ("Running command %1", lsmod_command);
@@ -924,8 +924,8 @@
y2milestone("(2) globals: %1", BootCommon::globals);
// refresh device map
- if ((BootCommon::device_mapping == nil)
- || (size (BootCommon::device_mapping) == 0)
+ if ((BootStorage::device_mapping == nil)
+ || (size (BootStorage::device_mapping) == 0)
|| (BootCommon::cached_settings_base_data_change_time != Storage::GetTargetChangeTime()))
{
BootCommon::ProposeDeviceMap();
@@ -969,7 +969,7 @@
return false;
}
// find grub id in device map for chainloader device
- string grub_id = BootCommon::device_mapping[disk_dev]:"";
+ string grub_id = BootStorage::device_mapping[disk_dev]:"";
y2milestone("Disk from windows chainloader: %1 grub id from device map: %2", disk_dev, grub_id);
// check if disk is the first in order...
@@ -1033,18 +1033,18 @@
{
boolean result = false;
- if (size(BootCommon::device_mapping)>8)
+ if (size(BootStorage::device_mapping)>8)
{
result = true;
- list <string> bios_order = (list <string> ) Map::Values(BootCommon::device_mapping);
+ list <string> bios_order = (list <string> ) Map::Values(BootStorage::device_mapping);
//delete all grub devices with order more than 9
bios_order = filter(string key, bios_order, {return (size(key) < 4);});
bios_order = lsort(bios_order);
y2debug("ordered values (grub devices): %1", bios_order);
map<string,string> inverse_device_map = $[];
map<string,string> new_device_map = $[];
- y2milestone("Device map before reducing: %1", BootCommon::device_mapping);
- foreach(string key, string value, BootCommon::device_mapping,
+ y2milestone("Device map before reducing: %1", BootStorage::device_mapping);
+ foreach(string key, string value, BootStorage::device_mapping,
{
inverse_device_map[value]=key;
});
@@ -1065,10 +1065,10 @@
break;
}
});
- BootCommon::device_mapping = new_device_map;
- y2milestone("Device map after reducing: %1", BootCommon::device_mapping);
+ BootStorage::device_mapping = new_device_map;
+ y2milestone("Device map after reducing: %1", BootStorage::device_mapping);
} else {
- y2milestone("Device map includes less than 9 devices. It is not reduced. device_map: %1", BootCommon::device_mapping);
+ y2milestone("Device map includes less than 9 devices. It is not reduced. device_map: %1", BootStorage::device_mapping);
}
return result;
}
@@ -1086,16 +1086,16 @@
{
boolean result = false;
- if (size(BootCommon::device_mapping)>8)
+ if (size(BootStorage::device_mapping)>8)
{
result = false;
- list <string> bios_order = (list <string> ) Map::Values(BootCommon::device_mapping);
+ list <string> bios_order = (list <string> ) Map::Values(BootStorage::device_mapping);
//delete all grub devices with order more than 9
bios_order = filter(string key, bios_order, {return (size(key) < 4);});
bios_order = lsort(bios_order);
y2debug("ordered values (grub devices): %1", bios_order);
map<string,string> inverse_device_map = $[];
- foreach(string key, string value, BootCommon::device_mapping,
+ foreach(string key, string value, BootStorage::device_mapping,
{
inverse_device_map[value]=key;
});
Modified: trunk/bootloader/src/grub/options.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/options.ycp?…
==============================================================================
--- trunk/bootloader/src/grub/options.ycp (original)
+++ trunk/bootloader/src/grub/options.ycp Thu Apr 23 14:56:26 2009
@@ -316,7 +316,7 @@
});
BootCommon::mbrDisk = result[0]:"";
integer index = 0;
- BootCommon::device_mapping = listmap (string d, result, {
+ BootStorage::device_mapping = listmap (string d, result, {
string indexs = tostring(index);
index = index + 1;
return $[ d : sformat ("hd%1", indexs)];
@@ -444,7 +444,7 @@
* @param widget string widget key
*/
void InitBootLoaderLocationWidget(string widget) {
- list<string> boot_devices = BootCommon::getPartitionList(`boot);
+ list<string> boot_devices = BootStorage::getPartitionList(`boot, "grub");
list <string> list_global_target_keys = ["boot_mbr", "boot_boot", "boot_root", "boot_extended"];
foreach(string key, list_global_target_keys,
{
Modified: trunk/bootloader/src/modules/BootArch.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootArch.…
==============================================================================
--- trunk/bootloader/src/modules/BootArch.ycp (original)
+++ trunk/bootloader/src/modules/BootArch.ycp Thu Apr 23 14:56:26 2009
@@ -186,7 +186,6 @@
{
ret = "unknown";
}
-
}
y2milestone("Type of architecture: %1", ret);
Modified: trunk/bootloader/src/modules/BootCommon.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommo…
==============================================================================
--- trunk/bootloader/src/modules/BootCommon.ycp (original)
+++ trunk/bootloader/src/modules/BootCommon.ycp Thu Apr 23 14:56:26 2009
@@ -77,52 +77,6 @@
-
-/**
- * Saved change time from target map - only for checkCallingDiskInfo()
- */
-
-global integer disk_change_time_checkCallingDiskInfo = nil;
-
-
-
-/**
- * device mapping between Linux and firmware
- */
-global map<string,string> device_mapping = $[];
-
-/**
- * device mapping between real devices and multipath
- */
-global map<string,string> multipath_mapping = $[];
-
-
-/**
- * mountpoints for perl-Bootloader
- */
-
-global map<string,any> mountpoints = $[];
-
-
-/**
- * list of all partitions for perl-Bootloader
- */
-
-global list<list> partinfo = [];
-
-/**
- * information about MD arrays for perl-Bootloader
- */
-global map<string,list<string> > md_info = $[];
-
-
-/**
- * Flag indicates that bios_id_missing in disk
- * true if missing false if at least one disk has bios_id
- */
-
-global boolean bois_id_missing = true;
-
/**
* device to save loader stage 1 to
* NOTE: this variable is being phased out. The boot_* keys in the globals map
@@ -152,23 +106,6 @@
/* These global variables and functions are needed in included files */
/**
- * string sepresenting device name of /boot partition
- * same as RootPartitionDevice if no separate /boot partition
- */
-global string BootPartitionDevice = "";
-
-
-/**
- * string representing device name of / partition
- */
-global string RootPartitionDevice = "";
-
-/**
- * string representing device name of extended partition
- */
-global string ExtendedPartitionDevice = "";
-
-/**
* Parameters of currently used bootloader
*/
global map<string, any> current_bootloader_attribs = $[];
@@ -195,11 +132,6 @@
/**
- * list of installed floppy devices
- */
-global list<string> floppy_devices = nil;
-
-/**
* Option types for different bootloaders
*/
global map<string,map<string,string> > opt_types = $[];
@@ -476,7 +408,7 @@
if (title == "memtest86") {
if (MemtestPresent ()) {
ret["image"] = "/boot/memtest.bin";
- ret["__devs"] = [BootCommon::BootPartitionDevice];
+ ret["__devs"] = [BootStorage::BootPartitionDevice];
return ret;
}
else {
@@ -603,11 +535,11 @@
"image" : kernel_fn,
"initrd" : initrd_fn,
// try to use label or udev id for device name... FATE #302219
- "root" : BootStorage::Dev2MountByDev(RootPartitionDevice),
+ "root" : BootStorage::Dev2MountByDev(BootStorage::RootPartitionDevice),
"append" : (title == "failsafe")
? BootArch::FailsafeKernelParams ()
: BootArch::DefaultKernelParams (resume),
- "__devs" : [BootPartitionDevice, RootPartitionDevice],
+ "__devs" : [BootStorage::BootPartitionDevice, BootStorage::RootPartitionDevice],
]);
if (BootArch::VgaAvailable () && Kernel::GetVgaType () != "")
{
@@ -645,7 +577,7 @@
map exp = $[
"global": remapGlobals(globals),
"sections" : remapSections(sections),
- "device_map" : remapDeviceMap(device_mapping),
+ "device_map" : BootStorage::remapDeviceMap(BootStorage::device_mapping),
];
if ( ! ( loader_type == "grub" ) ) {
exp["repl_mbr"] = repl_mbr;
@@ -671,7 +603,7 @@
repl_mbr = settings["repl_mbr"]:false;
activate = settings["activate"]:false;
}
- device_mapping = settings["device_map"]:$[];
+ BootStorage::device_mapping = settings["device_map"]:$[];
return true;
}
@@ -694,7 +626,7 @@
sections = GetSections ();
globals = GetGlobal ();
isTrustedGrub ();
- device_mapping = GetDeviceMap ();
+ BootStorage::device_mapping = GetDeviceMap ();
read_default_section_name = "";
foreach (map<string,any> s, sections, {
if (s["original_name"]:"" == "linux"
@@ -705,7 +637,7 @@
});
// convert device names in device map to the kernel device names
- device_mapping = mapmap (string k , string v, device_mapping, {
+ BootStorage::device_mapping = mapmap (string k , string v, BootStorage::device_mapping, {
// if we update from version 9 (SLES9), first convert old-style persistent
// device names to new-style persistent device names ("p1" -> "-part1")
// NOTE: this is idempotent; but other device name translation
@@ -764,7 +696,8 @@
was_proposed = false;
if (init)
{
- ProposeDeviceMap ();
+ if (getLoaderType (false) == "grub")
+ BootStorage::ProposeDeviceMap ();
}
}
@@ -819,9 +752,9 @@
// convert device names in device map to the device names indicated by
// "mountby"
- y2milestone ("device map before mapping %1", device_mapping);
+ y2milestone ("device map before mapping %1", BootStorage::device_mapping);
map<string,string> my_device_mapping =
- mapmap (string k , string v, device_mapping, {
+ mapmap (string k , string v, BootStorage::device_mapping, {
return $[BootStorage::Dev2MountByDev(k) : v];
});
y2milestone ("device map after mapping %1", my_device_mapping);
@@ -832,7 +765,7 @@
// bnc #436899
ConvertXENinDomU ();
- ret = ret && DefineMultipath(multipath_mapping);
+ ret = ret && DefineMultipath(BootStorage::multipath_mapping);
ret = ret && SetDeviceMap (my_device_mapping);
ret = ret && SetSections (sections);
ret = ret && SetGlobal (my_globals);
@@ -866,7 +799,7 @@
if (target_name == "mbr_md")
{
list<string> mbrs = maplist (string d, integer id,
- Md2Partitions (BootPartitionDevice),
+ Md2Partitions (BootStorage::BootPartitionDevice),
{
map p_dev = Storage::GetDiskPartition (d);
return p_dev["disk"]:"";
Modified: trunk/bootloader/src/modules/BootELILO.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootELILO…
==============================================================================
--- trunk/bootloader/src/modules/BootELILO.ycp (original)
+++ trunk/bootloader/src/modules/BootELILO.ycp Thu Apr 23 14:56:26 2009
@@ -31,6 +31,7 @@
import "BootArch";
import "BootCommon";
+import "BootStorage";
import "Installation";
import "Kernel";
import "Mode";
@@ -321,7 +322,7 @@
create_efi_entry = false;
elilo_conf_filename = getEliloConfFilename ();
BootCommon::DetectDisks ();
- BootCommon::del_parts = BootCommon::getPartitionList (`deleted);
+ BootCommon::del_parts = BootStorage::getPartitionList (`deleted, "elilo");
if (BootCommon::sections == nil || size (BootCommon::sections) == 0)
{
Modified: trunk/bootloader/src/modules/BootGRUB.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.…
==============================================================================
--- trunk/bootloader/src/modules/BootGRUB.ycp (original)
+++ trunk/bootloader/src/modules/BootGRUB.ycp Thu Apr 23 14:56:26 2009
@@ -144,7 +144,7 @@
y2milestone ("Other linux parts: %1", other_l);
list<string> destroyed_partitions
- = BootCommon::getPartitionList (`destroyed);
+ = BootStorage::getPartitionList (`destroyed, "grub");
string tmpdir = (string)SCR::Read (.target.tmpdir) + "/bldetect/";
@@ -491,8 +491,8 @@
grub_DetectDisks ();
boolean ret = BootCommon::Read (false, avoid_reading_device_map);
// refresh device map if not read
- if (BootCommon::device_mapping == nil
- || size (BootCommon::device_mapping) == 0)
+ if (BootStorage::device_mapping == nil
+ || size (BootStorage::device_mapping) == 0)
{
BootCommon::ProposeDeviceMap ();
}
@@ -648,11 +648,11 @@
list<string> locations = [];
if (BootCommon::globals["boot_boot"]:"" == "true")
- locations = add(locations, BootCommon::BootPartitionDevice + " (\"/boot\")");
+ locations = add(locations, BootStorage::BootPartitionDevice + " (\"/boot\")");
if (BootCommon::globals["boot_extended"]:"" == "true")
- locations = add(locations, BootCommon::ExtendedPartitionDevice + " (extended)");
+ locations = add(locations, BootStorage::ExtendedPartitionDevice + " (extended)");
if (BootCommon::globals["boot_root"]:"" == "true")
- locations = add(locations, BootCommon::RootPartitionDevice + " (\"/\")");
+ locations = add(locations, BootStorage::RootPartitionDevice + " (\"/\")");
if (BootCommon::globals["boot_mbr"]:"" == "true")
locations = add(locations, BootCommon::mbrDisk + " (MBR)");
if (haskey (BootCommon::globals, "boot_custom"))
@@ -703,7 +703,7 @@
// SetDiskInfo(), and device names in other config files can be translated
// to Unix device names (#328448, this hits sections that are not
// (re-)created by yast-Bootloader or later by perl-Bootloader anyway).
- BootCommon::SetDeviceMap (BootCommon::device_mapping);
+ BootCommon::SetDeviceMap (BootStorage::device_mapping);
Read (true, true);
BootCommon::UpdateSections (true, CreateLinuxSection);
Modified: trunk/bootloader/src/modules/BootLILO.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootLILO.…
==============================================================================
--- trunk/bootloader/src/modules/BootLILO.ycp (original)
+++ trunk/bootloader/src/modules/BootLILO.ycp Thu Apr 23 14:56:26 2009
@@ -25,6 +25,7 @@
import "Arch";
import "BootCommon";
+import "BootStorage";
import "Kernel";
import "Mode";
import "Pkg";
@@ -210,7 +211,7 @@
// SetDiskInfo(), and device names in other config files can be translated
// to Unix device names (#328448, this hits sections that are not
// (re-)created by yast-Bootloader or later by perl-Bootloader anyway).
- BootCommon::SetDeviceMap (BootCommon::device_mapping);
+ BootCommon::SetDeviceMap (BootStorage::device_mapping);
Read (true, true);
BootCommon::UpdateSections (true, BootCommon::CreateLinuxSection);
@@ -274,15 +275,15 @@
list data = mp["/boot"]:(mp["/"]:[]);
string bpd = data[0]:"";
// ???? FIXME ???? how about LVM/MD ????
- if (bpd == BootCommon::BootPartitionDevice
- && getDeviceOfRaid (BootCommon::BootPartitionDevice)
- != BootCommon::BootPartitionDevice
- && contains (BootCommon::getPartitionList(`boot),
- BootCommon::BootPartitionDevice))
+ if (bpd == BootStorage::BootPartitionDevice
+ && getDeviceOfRaid (BootStorage::BootPartitionDevice)
+ != BootStorage::BootPartitionDevice
+ && contains (BootStorage::getPartitionList(`boot, "lilo"),
+ BootStorage::BootPartitionDevice))
{
y2milestone ("Creating backup copy to bootsector");
SCR::Execute (.target.bash, sformat ("/sbin/lilo -b %1",
- BootCommon::BootPartitionDevice));
+ BootStorage::BootPartitionDevice));
}
}
Modified: trunk/bootloader/src/modules/BootPOWERLILO.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootPOWER…
==============================================================================
--- trunk/bootloader/src/modules/BootPOWERLILO.ycp (original)
+++ trunk/bootloader/src/modules/BootPOWERLILO.ycp Thu Apr 23 14:56:26 2009
@@ -193,7 +193,7 @@
}
else {
root_disks = [
- Storage::GetDiskPartition(BootCommon::RootPartitionDevice)["disk"]:""
+ Storage::GetDiskPartition(BootStorage::RootPartitionDevice)["disk"]:""
];
}
@@ -417,7 +417,7 @@
map<string,any> CreateImageSection (string title) {
map<string,any> ret = BootCommon::CreateLinuxSection(title);
//Do not use translated names, as we are happy if it work with kernel device
- ret["root"] = BootCommon::RootPartitionDevice;
+ ret["root"] = BootStorage::RootPartitionDevice;
// bnc #217443
ret["optional"] = "true";
//do not use translated name FIXME this should be filtered out
@@ -445,7 +445,7 @@
// does this device contain the root partition?
boolean hasrootdev = ( find (map p, partitions, ``(
(! p["delete"]:false)
- && p["device"]:"" == BootCommon::RootPartitionDevice
+ && p["device"]:"" == BootStorage::RootPartitionDevice
&& !contains( [`lvm, `evms, `sw_raid], p["type"]:`primary )
)) != nil );
@@ -496,7 +496,7 @@
&& selected_boot_partition == "")
{
y2milestone ("Selected pmac boot partition %1 on device with root partition %2",
- partitions[0, "device"]:"", BootCommon::RootPartitionDevice);
+ partitions[0, "device"]:"", BootStorage::RootPartitionDevice);
selected_boot_partition = partitions[0, "device"]:"";
}
@@ -526,7 +526,7 @@
global void LocationProposal () {
BootCommon::DetectDisks ();
// del_parts is used by FixSections() in lilolike.ycp (imported by BootCommon.ycp)
- BootCommon::del_parts = BootCommon::getPartitionList (`deleted);
+ BootCommon::del_parts = BootStorage::getPartitionList (`deleted, "ppc");
if (BootCommon::DisksChanged ()) {
y2milestone ("Reconfiguring locations");
@@ -541,16 +541,16 @@
switch (getBoardType()) {
case ("chrp"):
- BootCommon::BootPartitionDevice = prep_boot_partition;
+ BootStorage::BootPartitionDevice = prep_boot_partition;
break;
case ("prep"):
- BootCommon::BootPartitionDevice = prep_boot_partition;
+ BootStorage::BootPartitionDevice = prep_boot_partition;
break;
case ("iseries"):
- BootCommon::BootPartitionDevice = prep_boot_partition;
+ BootStorage::BootPartitionDevice = prep_boot_partition;
break;
case ("pmac") :
- BootCommon::BootPartitionDevice = GoodPmacBootPartition();
+ BootStorage::BootPartitionDevice = GoodPmacBootPartition();
break;
default:
y2error("Unknown ppc architecture");
@@ -571,7 +571,7 @@
// file. This may apply better to the boot_* variables in BootGRUB.ycp
// though.
// FIXME: what about loader_location (aka selected_location internally)?
- BootCommon::loader_device = BootCommon::BootPartitionDevice;
+ BootCommon::loader_device = BootStorage::BootPartitionDevice;
BootCommon::activate = true;
y2milestone("Boot partition is %1", BootCommon::loader_device);
}
@@ -602,21 +602,21 @@
map<string, string> boot_map = $[];
- y2milestone("RootPartDevice is %1",BootCommon::RootPartitionDevice);
+ y2milestone("RootPartDevice is %1",BootStorage::RootPartitionDevice);
switch(getBoardType()){
case ("chrp") :
boot_map = $[
- "boot_chrp_custom" : BootCommon::BootPartitionDevice,
+ "boot_chrp_custom" : BootStorage::BootPartitionDevice,
];
break;
case ("prep") :
boot_map = $[
- "boot_prep_custom" : BootCommon::BootPartitionDevice,
+ "boot_prep_custom" : BootStorage::BootPartitionDevice,
];
break;
case ("pmac") :
boot_map = $[
- "boot_pmac_custom" : BootCommon::BootPartitionDevice,
+ "boot_pmac_custom" : BootStorage::BootPartitionDevice,
];
break;
case ("iseries") :
@@ -629,9 +629,9 @@
// If we have an empty BootPartitionDevice on iseries, this means:
// do not boot from BootPartitionDevice but from some other place.
// Do not pass down to perl-Bootloader, lilo fails on an empty "boot =" line.
- if (BootCommon::BootPartitionDevice != nil &&
- BootCommon::BootPartitionDevice != "") {
- boot_map["boot_iseries_custom"] = BootCommon::BootPartitionDevice;
+ if (BootStorage::BootPartitionDevice != nil &&
+ BootStorage::BootPartitionDevice != "") {
+ boot_map["boot_iseries_custom"] = BootStorage::BootPartitionDevice;
}
break;
default:
@@ -702,25 +702,25 @@
string arch = getBoardType ();
switch(arch) {
case ("prep"):
- BootCommon::globals["boot_prep_custom"] = BootCommon::BootPartitionDevice;
+ BootCommon::globals["boot_prep_custom"] = BootStorage::BootPartitionDevice;
break;
case ("pmac"):
- BootCommon::globals["boot_pmac_custom"] = BootCommon::BootPartitionDevice;
+ BootCommon::globals["boot_pmac_custom"] = BootStorage::BootPartitionDevice;
break;
case ("iseries"):
BootCommon::globals["boot_slot"] = "B";
BootCommon::globals["boot_file"] = "/tmp/suse_linux_image";
- if (BootCommon::BootPartitionDevice != nil &&
- BootCommon::BootPartitionDevice != "")
+ if (BootStorage::BootPartitionDevice != nil &&
+ BootStorage::BootPartitionDevice != "")
{
- BootCommon::globals["boot_iseries_custom"] = BootCommon::BootPartitionDevice;
+ BootCommon::globals["boot_iseries_custom"] = BootStorage::BootPartitionDevice;
}
break;
default:
- BootCommon::globals["boot_chrp_custom"] = BootCommon::BootPartitionDevice;
+ BootCommon::globals["boot_chrp_custom"] = BootStorage::BootPartitionDevice;
break;
}
Modified: trunk/bootloader/src/modules/BootStorage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootStora…
==============================================================================
--- trunk/bootloader/src/modules/BootStorage.ycp (original)
+++ trunk/bootloader/src/modules/BootStorage.ycp Thu Apr 23 14:56:26 2009
@@ -25,22 +25,27 @@
textdomain "bootloader";
import "Storage";
+import "StorageDevices";
import "Arch";
+import "Mode";
/**
* Saved change time from target map - only for MapAllPartitions()
*/
-
global integer disk_change_time_InitBootloader = nil;
-
/**
* Saved change time from target map - only for MapAllPartitions()
*/
global integer disk_change_time_MapAllPartitions = nil;
+/**
+ * Saved change time from target map - only for checkCallingDiskInfo()
+ */
+
+global integer disk_change_time_checkCallingDiskInfo = nil;
/**
* bnc #468922 - problem with longtime running the parsing a huge number of disks
@@ -64,6 +69,72 @@
global map<string, string> all_devices = $[];
+/**
+ * Storage locked
+ */
+boolean storage_initialized = false;
+
+
+/**
+ * device mapping between real devices and multipath
+ */
+global map<string,string> multipath_mapping = $[];
+
+
+/**
+ * mountpoints for perl-Bootloader
+ */
+
+global map<string,any> mountpoints = $[];
+
+
+/**
+ * list of all partitions for perl-Bootloader
+ */
+
+global list<list> partinfo = [];
+
+/**
+ * information about MD arrays for perl-Bootloader
+ */
+global map<string,list<string> > md_info = $[];
+
+
+/**
+ * Flag indicates that bios_id_missing in disk
+ * true if missing false if at least one disk has bios_id
+ */
+global boolean bois_id_missing = true;
+
+/**
+ * device mapping between Linux and firmware
+ */
+global map<string,string> device_mapping = $[];
+
+
+
+/**
+ * string sepresenting device name of /boot partition
+ * same as RootPartitionDevice if no separate /boot partition
+ */
+global string BootPartitionDevice = "";
+
+
+/**
+ * string representing device name of / partition
+ */
+global string RootPartitionDevice = "";
+
+/**
+ * string representing device name of extended partition
+ */
+global string ExtendedPartitionDevice = "";
+
+/**
+ * list of installed floppy devices
+ */
+global list<string> floppy_devices = nil;
+
/** FATE #302219 - Use and choose persistent device names for disk devices
* Function prepare maps with mapping disks and partitions by uuid, id, path
* and label.
@@ -345,6 +416,650 @@
}
+/** bnc #447591, 438243, 448110 multipath wrong device map
+ * Function maps real devices to multipath e.g.
+ * "/dev/sda/" : "/dev/mapper/SATA_ST3120813AS_3LS0CD7M"
+ *
+ * @return map <string, string> mapping real disk to multipath
+ */
+
+// FIXME grub only
+
+map <string, string> mapRealDevicesToMultipath()
+{
+ map <string, string> ret = $[];
+ map<string, map> tm = (map<string,map>)Storage::GetTargetMap ();
+ integer num_of_real_disk = 0;
+ foreach (string disk, map disk_info, tm,
+ {
+ if (disk_info["type"]:nil == `CT_DMMULTIPATH)
+ {
+ list <string> devices = (list <string>) disk_info["devices"]:[];
+ if (size(devices) > 0)
+ {
+ foreach(string d, devices,
+ {
+ ret[d]=disk;
+ });
+
+ }
+ }
+
+ if (disk_info["type"]:nil == `CT_DISK)
+ num_of_real_disk = num_of_real_disk +1;
+ if (disk_info["bios_id"]:nil != nil)
+ bois_id_missing = false;
+ });
+ if (num_of_real_disk == 1)
+ bois_id_missing = false;
+ return ret;
+}
+
+
+
+
+/**
+ * Check if function was called or storage change
+ * partitionig of disk. It is usefull fo using cached data
+ * about disk. Data is send to perl-Bootloader and it includes
+ * info about partitions, multi path and md-raid
+ *
+ * @return false if it is posible use cached data
+ */
+
+boolean checkCallingDiskInfo ()
+{
+ boolean ret = false;
+
+ // fix for problem with unintialized storage library in AutoYaST mode
+ // bnc #464090
+ if (Mode::config() && (!storage_initialized))
+ {
+ storage_initialized = true;
+ y2milestone("Init storage library in yast2-bootloader");
+ Storage::InitLibstorage(true);
+ }
+ if ((disk_change_time_checkCallingDiskInfo != Storage::GetTargetChangeTime())
+ || (size(partinfo) < 1))
+ {
+ // save last change time from storage
+ disk_change_time_checkCallingDiskInfo = Storage::GetTargetChangeTime();
+ y2milestone("disk was changed by storage or partinfo is empty: %1", size(partinfo));
+ y2milestone("generate partinfo, md_info, mountpoints and multipath_mapping");
+ ret = true;
+ } else {
+ ret = false;
+ y2milestone("Skip genarating partinfo, md_info, mountpoints and multipath_mapping");
+ }
+
+ return ret;
+}
+
+/**
+ * Function init data for perl-Bootloader about disk
+ * It means fullfil md_info, multipath_mapping, partinfo
+ * and mountpoints
+ */
+
+global void InitDiskInfo()
+{
+
+ if (checkCallingDiskInfo())
+ {
+ // delete variables for perl-Bootloader
+ md_info = $[];
+ multipath_mapping = $[];
+ partinfo = [];
+ mountpoints = $[];
+
+ map<string,map> tm = (map<string,map>)Storage::GetTargetMap ();
+
+ multipath_mapping = mapRealDevicesToMultipath();
+ mountpoints = mapmap (string k, list v,
+ (map<string,list>)Storage::GetMountPoints (),
+ {
+ // detect all raid1 md devices and mark them in md_info
+ any device = v[0]:nil;
+ if (v[3]:"" == "raid1")
+ md_info[(string)device]=[];
+ return $[ k : device ];
+ });
+ mountpoints = filter (string k, any v, mountpoints, {
+ string tmpdir = (string)SCR::Read (.target.tmpdir);
+ integer tmp_sz = size (tmpdir);
+ return is (v, string) && substring (k, 0, tmp_sz) != tmpdir;
+ });
+
+ y2milestone ("Detected mountpoints: %1", mountpoints);
+
+ list<list<list> > pi = maplist (string disk, map info, tm,
+ {
+ if (info["type"]:`CT_UNKNOWN==`CT_LVM)
+ return [];
+ if (info["type"]:`CT_UNKNOWN==`CT_EVMS)
+ return [];
+ list partitions = info["partitions"]:[];
+ list<list> parts = maplist (map p, (list<map>)partitions, {
+ string raid = "";
+ if( p["used_by_type"]:`UB_NONE==`UB_MD )
+ raid = p["used_by_device"]:"";
+ string device = p["device"]:"";
+ // We only pass along RAID1 devices as all other causes
+ // severe breakage in the bootloader stack
+ if (raid != "") {
+ if (haskey (md_info, raid)) {
+ list<string> members = md_info[raid]:[];
+ members = add (members, device);
+ md_info[raid] = members;
+ }
+ }
+ any nr = p["nr"]:nil;
+ if (nr == nil)
+ nr = 0;
+ string nr_str = sformat ("%1", nr);
+
+
+ return [ device, disk, nr_str, tostring(p["fsid"]:0),
+ p["fstype"]:"unknown", tostring(p["type"]:nil),
+ tostring(p["region", 0]:0), tostring(p["region", 1]:0)
+ ];
+ });
+ return parts;
+ });
+ partinfo = flatten (pi);
+ partinfo = filter (list p, partinfo, {return p != nil && p != [];});
+ list<list> partinfo_mountby = [];
+ // adding moundby (by-id) via user preference
+ foreach(list partition, partinfo, {
+ list tmp =[];
+ string mount_by = BootStorage::Dev2MountByDev(tostring(partition[0]:""));
+ if (mount_by != tostring(partition[0]:""))
+ {
+ tmp = add(partition, mount_by);
+ } else {
+ tmp = partition;
+ }
+ partinfo_mountby = add(partinfo_mountby, tmp);
+ });
+ // y2milestone("added mountby: %1", partinfo_mountby);
+
+ partinfo = partinfo_mountby;
+
+ }
+
+}
+
+
+/*** helper functions for ProposeDeviceMap: ***/
+/**
+ * Returns true if any device from list devices is in device_mapping
+ * marked as hd0.
+ */
+boolean isHd0(list<string> devices)
+{
+ boolean ret = false;
+
+ foreach (string value, devices,
+ {
+ if (device_mapping[value]:"" == "hd0"){
+ ret = true;
+ }
+ });
+
+ return ret;
+}
+
+/**
+ * Returns first key from mapping associated with value.
+ * Example:
+ * map = $[ "a" : "1",
+ * "b" : "2",
+ * "c" : "3",
+ * "d" : "2"];
+ * getDeviceFromMapping("1", map) -> "a"
+ * getDeviceFromMapping("2", map) -> "b"
+ */
+string getKey(string value, map<string, string> mapping)
+{
+ string ret = "";
+
+ foreach (string key, string val, mapping,
+ {
+ if (value == val){
+ ret = key;
+ return;
+ }
+ });
+
+ return ret;
+}
+
+/**
+ * This function changes order of devices in device_mapping.
+ * All devices listed in bad_devices are maped to "hdN" are moved to the end
+ * (with changed number N). And second step is putting device with boot partition
+ * on top (i.e. device_mapping[dev_with_boot] = "hd0").
+ *
+ * Example:
+ * device_mapping = $[ "/dev/sda" : "hd0",
+ * "/dev/sdb" : "hd1",
+ * "/dev/sdc" : "hd2",
+ * "/dev/sdd" : "hd3",
+ * "/dev/sde" : "hd4" ];
+ * bad_devices = [ "/dev/sda", "/dev/sdc" ];
+ *
+ * changeOrderInDeviceMapping(bad_devices);
+ * // after call, device_mapping is:
+ * device_mapping -> $[ "/dev/sda" : "hd3",
+ * "/dev/sdb" : "hd0",
+ * "/dev/sdc" : "hd4",
+ * "/dev/sdd" : "hd1",
+ * "/dev/sde" : "hd2" ];
+ */
+void changeOrderInDeviceMapping(list<string> bad_devices)
+{
+ integer cur_id = 0;
+ list keys = [];
+ string value = "";
+ string tmp = "";
+ string tmp2 = "";
+
+ // get keys from device_mapping, it's not possible to use foreach over keys and values
+ // of device_mapping directly, because during the loop device_mapping is changing.
+ foreach (string key, string value, device_mapping, { keys = add(keys, key); });
+
+ // put bad_devices at bottom
+ foreach (string key, (list<string>)keys,
+ {
+ value = device_mapping[key]:"";
+
+ // if device is mapped on hdX and this device is _not_ in bad_devices
+ if (substring(value, 0, 2) == "hd"
+ && !contains(bad_devices, key)){
+ // get device name of mapped on "hd"+cur_id
+ tmp = getKey("hd" + tostring(cur_id), device_mapping);
+
+ // swap tmp and key devices (swap their mapping)
+ device_mapping[tmp] = value;
+ device_mapping[key] = "hd" + tostring(cur_id);
+
+ cur_id = cur_id + 1;
+ }
+ });
+
+}
+/*** helper functions END ***/
+
+/**
+ * Generate device map proposal, store it in internal variables.
+ *
+ * FATE #302075:
+ * When user is installing from USB media or any non IDE disk or bios simply
+ * set any non IDE disk as first and user is not installing on this removable
+ * (non IDE) disk, the order of disks proposed by bios must be changed because
+ * of future remove of USB disk.
+ * This function must find right place for bootloader (which is most probably
+ * boot sector of boot partition (where /boot dir is located)) and change the
+ * order of disks in device map.
+ * This method is only heuristic because order of disks after remove of usb
+ * disk can't be determined by any method.
+ *
+ * Algorithm for solving problem with usb disk propsed by bios as hd0:
+ * if usbDiskDevice == hd0 && BootDevice != usbDiskDevice:
+ * change order of disks in device_mappings to have BootDevice as hd0
+ */
+// FIXME: remove that function from here, as it is grub only
+// NOTE: there is a local copy in routines/grub/misc.ycp now
+global void ProposeDeviceMap () {
+ list<string> usb_disks = []; // contains those usb removable disks
+
+ device_mapping = $[];
+ multipath_mapping = $[];
+
+ map<string,map> targetMap = $[];
+ if (Mode::config ())
+ y2milestone ("Skipping device map proposing in Config mode");
+ else
+ targetMap = (map<string,map>)Storage::GetTargetMap();
+
+ // filter out members of BIOS RAIDs and multipath devices
+ targetMap = filter (string k, map v, targetMap, {
+ return v["used_by_type"]:nil != `UB_DMRAID && v["used_by_type"]:nil != `UB_DMMULTIPATH;
+ });
+ // filter out non-disk devices
+ targetMap = filter (string k, map v, targetMap, {
+ return v["type"]:`CT_UNKNOWN==`CT_DMRAID || v["type"]:`CT_UNKNOWN==`CT_DISK
+ || v["type"]:`CT_UNKNOWN==`CT_DMMULTIPATH;
+ });
+
+ y2milestone ("Target map: %1", targetMap);
+
+ // add devices with known bios_id
+ // collect BIOS IDs which are used
+ map ids = $[];
+ foreach (string target_dev, map target, targetMap, {
+ string bios_id = target["bios_id"]:"";
+ if (bios_id != "")
+ {
+ integer index = tointeger (bios_id) - tointeger ("0x80");
+ string grub_dev = sformat ("hd%1", index);
+ // FATE #303548 - doesn't add disk with same bios_id with different name (multipath machine)
+ if (! ids[index]:false)
+ {
+ device_mapping[target_dev] = grub_dev;
+ ids[index] = true;
+ }
+ }
+ });
+ // and guess other devices
+ // don't use already used BIOS IDs
+ foreach (string target_dev, map target, targetMap, {
+ string bios_id = target["bios_id"]:"";
+ if (bios_id == "")
+ {
+ integer index = 0;
+ while (ids[index]:false)
+ index = index + 1;
+ string grub_dev = sformat ("hd%1", index);
+ device_mapping[target_dev] = grub_dev;
+ ids[index] = true;
+ }
+ });
+
+ // Fill usb_disks list with usb removable devices.
+ //
+ // It's not easy to determine how to identify removable usb devices. Now
+ // it tests if driver of device is usb-storage. If you find better
+ // algorithm how to find removable usb devices, put it here into foreach
+ // to apply this algorithm on all devices.
+ foreach (string target_dev, map target, targetMap,
+ {
+ string driver = target["driver"]:"";
+ if (driver == "usb-storage"){
+ usb_disks = add(usb_disks, target_dev);
+ }
+ });
+ y2milestone("Found usb discs: %1", usb_disks);
+
+ // change order in device_mapping if usb disk is hd0
+ // (FATE #302075)
+ if (isHd0(usb_disks) && BootPartitionDevice != getKey("hd0", device_mapping)){
+ y2milestone ("Detected device mapping: %1", device_mapping);
+ y2milestone("Changing order in device mapping needed...");
+ changeOrderInDeviceMapping(usb_disks);
+ }
+
+ if (size(device_mapping) == 1)
+ bois_id_missing = false;
+ if (StorageDevices::FloppyPresent())
+ device_mapping[StorageDevices::FloppyDevice()] = "fd0";
+
+ y2milestone ("Detected device mapping: %1", device_mapping);
+
+ multipath_mapping = mapRealDevicesToMultipath();
+
+ y2milestone ("Detected multipath mapping: %1", multipath_mapping);
+
+}
+
+/**
+ * Get the order of disks according to BIOS mapping
+ * @return a list of all disks in the order BIOS sees them
+ */
+global list<string> DisksOrder () {
+ if (device_mapping == nil || size (device_mapping) == 0)
+ {
+ ProposeDeviceMap ();
+ }
+ map<string,string> devmap_rev = mapmap (string k, string v, device_mapping,
+ {
+ return $[ v : k ];
+ });
+ devmap_rev = filter (string k, string v, devmap_rev, {
+ return substring (k, 0, 2) == "hd";
+ });
+ list<string> order = maplist (string k, string v, devmap_rev, {
+ return v;
+ });
+ return order;
+}
+
+
+/**
+ * Function remap device map to device name (/dev/sda)
+ * or to label (ufo_disk)
+ * @param map<string,string> device map
+ * @return map<string,string> new device map
+ */
+
+global map<string,string> remapDeviceMap(map<string,string> device_map)
+{
+ symbol by_mount = nil;
+ if (Arch::ppc())
+ by_mount = `id;
+ else
+ by_mount = Storage::GetDefaultMountBy();
+
+ //by_mount = `id;
+ if (by_mount == `label)
+ return device_map;
+
+ map<string,string> ret = $[];
+ // convert device names in device map to the device names by device or label
+ ret = mapmap (string k , string v, device_mapping,
+ {
+ return $[BootStorage::MountByDev2Dev(k) : v];
+ });
+
+ return ret;
+}
+
+/**
+ * Get the list of installed floppy drives
+ * @return a list of floppy devices
+ */
+global list<string> getFloppyDevices ()
+{
+ if (floppy_devices == nil)
+ {
+ list<map> floppies = (list<map>) SCR::Read (.probe.floppy);
+ floppies = filter (map f, floppies,
+ ``(f["model"]:"Floppy Disk" == "Floppy Disk"));
+ floppy_devices = maplist (map f, floppies,
+ ``(f["dev_name"]:""));
+ floppy_devices = filter (string f, floppy_devices, ``(f != ""));
+ }
+ return floppy_devices;
+}
+
+/**
+ * Returns list of partitions with "mount by" hints. Goes through the list
+ * of partitions passed as a parameter and creates a list of partitions with
+ * hints according to the current partitioning requested from
+ * yast2-storage. To be used in a combobox or menu.
+ *
+ * @param parts_to_get list<string> partitions to list
+ * @return a list of strings containing a partition name and a hint (if applicable)
+ */
+global define list<string> getHintedPartitionList(list<string> parts_to_get)
+{
+ y2milestone ("getHintedPartitionList: %1", parts_to_get);
+ map<string,map> devices = (map<string,map>)Storage::GetTargetMap();
+
+ // make a map: "/dev/hda1" -> info_map_for_this_partition
+ map<string,map> partitions = $[];
+ foreach (string k, map v, devices, ``{
+ foreach (map p, (list<map>)(v["partitions"]:[]), ``{
+ partitions[p["device"]:""] = p;
+ });
+ });
+ y2milestone ("getHintedPartitionList: partitions %1", partitions);
+
+ symbol mountby = `device;
+ list<string> ret = maplist (string dev, parts_to_get, ``{
+ mountby = (symbol) partitions[dev, "mountby"]:nil;
+ if ( mountby == `uuid )
+ {
+ return sformat ("%1 (mount by UUID: %2)", dev,
+ partitions[dev, "uuid"]:nil != nil ?
+ partitions[dev, "uuid"]:"" :
+ "<UUID to be created later during format>");
+ } else if ( mountby == `label )
+ {
+ return sformat ("%1 (mount by LABEL: %2)", dev, partitions[dev, "label"]:"");
+ } else if ( mountby == `id )
+ {
+ return sformat ("%1 (mount by ID: %2)", dev, partitions[dev, "udev_id", 0]:"");
+ } else if ( mountby == `path )
+ {
+ return sformat ("%1 (mount by PATH: %2)", dev, partitions[dev, "udev_path"]:"");
+ } else if ( mountby == nil || mountby == `device )
+ {
+ return dev;
+ }
+ });
+
+ y2milestone ("getHintedPartitionList: ret %1", ret);
+ return ret;
+}
+
+/**
+ * Returns list of partitions. Requests current partitioning from
+ * yast2-storage and creates list of partition for combobox, menu or other
+ * purpose.
+ * @param type symbol
+ * `boot - for bootloader installation
+ * `root - for kernel root
+ * `boot_other - for bootable partitions of other systems
+ * `all - all partitions
+ * `parts_old - all partitions, except those what will be created
+ * during isntallation
+ * `deleted - all partitions deleted in current proposal
+ * `kept - all partitions that won't be deleted, new created or formatted
+ * `destroyed - all partition which are new, deleted or formatted
+ * @return a list of strings
+ */
+global define list<string> getPartitionList(symbol type, string bl)
+{
+ y2milestone ("getPartitionList: %1", type);
+ map<string,map> devices = (map<string,map>)Storage::GetTargetMap();
+ list<map> partitions = [];
+ foreach (string k, map v, devices, ``{
+ if ((type == `boot) && (bl == "grub"))
+ {
+ // check if device is in device map
+ if (haskey(device_mapping, k) || (haskey(device_mapping, Dev2MountByDev(k))))
+ partitions = (list<map>)merge (partitions, (list<map>)(v["partitions"]:[]));
+ } else {
+ partitions = (list<map>)merge (partitions, (list<map>)(v["partitions"]:[]));
+ }
+ });
+ list<string> floppies = getFloppyDevices ();
+
+ devices = filter (string k, map v, devices,
+ ``(v["type"]:`CT_UNKNOWN != `CT_LVM));
+
+ if (type == `boot || type == `boot_other)
+ {
+ devices = filter (string k, map v, devices, {
+ if ((v["type"]:`CT_UNKNOWN == `CT_DISK) ||
+ (v["type"]:`CT_UNKNOWN == `CT_DMRAID))
+ return true;
+ else
+ return false;
+ });
+ }
+ list<string> all_disks = (list<string>) maplist (string k, map v, devices,
+ {
+ return k;
+ });
+
+
+
+ if (type == `deleted)
+ return maplist (map x, filter (map p, partitions, ``(p["delete"]:false)),
+ ``{return x["device"]:"";
+ });
+ else if (type == `destroyed)
+ {
+ return maplist (map x, filter (map p, partitions, {
+ return p["delete"]:false || p["format"]:false
+ || p["create"]:false;
+ }),
+ {
+ return x["device"]:"";
+ });
+ }
+ partitions = filter (map p, partitions, ``(! p["delete"]:false));
+ // filter out disk which are not in device map
+ if ((bl == "grub") && (type == `boot))
+ all_disks = (list<string>) filter(string k, all_disks, {
+ if (haskey(device_mapping, k) || (haskey(device_mapping, Dev2MountByDev(k))))
+ return true;
+ else
+ return false;
+ });
+ list<string> ret = all_disks;
+ if (type == `boot_other || type == `root || type == `parts_old
+ || type == `kept)
+ ret = [];
+
+ if (type == `boot)
+ {
+ partitions = filter (map p, partitions,
+ ``(p["type"]:`primary == `primary
+ || p["type"]:`primary == `extended
+ || p["type"]:`primary == `logical
+ || p["type"]:`primary == `sw_raid)
+ );
+ // FIXME this checking is performed on 3 places, one function should
+ // be developed for it
+ partitions = filter (map p, partitions, {
+ symbol fs = (symbol)(p["used_fs"]:p["detected_fs"]:nil);
+ if (fs == `xfs)
+ return false;
+ return true;
+ });
+ }
+ else if (type == `root)
+ {
+ partitions = filter (map p, partitions,
+ ``(p["type"]:`primary != `extended));
+ }
+ else if (type == `parts_old)
+ {
+ partitions = filter (map p, partitions, ``(! p["create"]:false));
+ }
+ else if (type == `kept)
+ {
+ partitions = filter (map p, partitions, {
+ return ! (p["create"]:false || p["format"]:false);
+ });
+ }
+ if (type != `all && type != `parts_old && type != `kept)
+ {
+ partitions = filter (map p, partitions,
+ ``(p["fstype"]:"" != "Linux swap"));
+ }
+ if (type == `boot)
+ {
+ partitions = filter (map p, partitions,
+ ``(p["fstype"]:"" == "Linux native"
+ || p["fstype"]:"" == "Extended"
+ || p["fstype"]:"" == "Linux RAID"
+ || p["fstype"]:"" == "MD Raid"
+ || p["fstype"]:"" == "DM RAID"));
+ }
+ list<string>partition_names
+ = maplist (map p, partitions, ``((string)(p["device"]:"")));
+ partition_names = filter (string p, partition_names, ``(p != ""));
+ partition_names = (list<string>)merge (partition_names, floppies);
+ ret = (list<string>)union (ret, partition_names);
+ ret = (list<string>)toset (ret);
+ return (list<string>)ret;
+}
+
+
}
Modified: trunk/bootloader/src/modules/BootSupportCheck.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootSuppo…
==============================================================================
--- trunk/bootloader/src/modules/BootSupportCheck.ycp (original)
+++ trunk/bootloader/src/modules/BootSupportCheck.ycp Thu Apr 23 14:56:26 2009
@@ -24,6 +24,7 @@
import "Arch";
import "Storage";
import "BootCommon";
+import "BootStorage";
/**
* List of problems found during last check
@@ -137,7 +138,7 @@
boolean GptPartitionTable () {
boolean ret = true;
map tm = Storage::GetTargetMap ();
- list<string> devices = [ BootCommon::BootPartitionDevice ];
+ list<string> devices = [ BootStorage::BootPartitionDevice ];
// TODO add more devices
foreach (string dev, devices, {
map p_dev = Storage::GetDiskPartition (dev);
@@ -178,7 +179,7 @@
boot_device = BootCommon::getBootPartition();
- // if (BootCommon::BootPartitionDevice == BootCommon::RootPartitionDevice)
+ // if (BootStorage::BootPartitionDevice == BootStorage::RootPartitionDevice)
// AddNewProblem (_("Doesn't exist separete /boot partition"));
boolean found_boot = false;
@@ -234,7 +235,7 @@
boolean CheckBios_ID()
{
boolean ret = true;
- if (BootCommon::bois_id_missing)
+ if (BootStorage::bois_id_missing)
{
AddNewProblem (_("It was not possible to determine the exact order of disks for device map. The order of disks can be changed in \"Boot Loader Installation Details\""));
ret = false;
Modified: trunk/bootloader/src/modules/Bootloader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloade…
==============================================================================
--- trunk/bootloader/src/modules/Bootloader.ycp (original)
+++ trunk/bootloader/src/modules/Bootloader.ycp Thu Apr 23 14:56:26 2009
@@ -23,6 +23,7 @@
import "Arch";
import "BootCommon";
+ import "BootStorage";
import "Installation";
import "Initrd";
import "Kernel";
@@ -1231,7 +1232,7 @@
*/
global define string getRootDevice () {
ReadOrProposeIfNeeded ();
- return BootCommon::RootPartitionDevice;
+ return BootStorage::RootPartitionDevice;
}
/**
@@ -1240,7 +1241,7 @@
*/
global define void setRootDevice (string device) {
ReadOrProposeIfNeeded ();
- BootCommon::RootPartitionDevice = device;
+ BootStorage::RootPartitionDevice = device;
}
/**
@@ -1249,7 +1250,7 @@
*/
global define string getBootDevice () {
ReadOrProposeIfNeeded ();
- return BootCommon::BootPartitionDevice;
+ return BootStorage::BootPartitionDevice;
}
/**
@@ -1258,7 +1259,7 @@
*/
global define void setBootDevice (string device) {
ReadOrProposeIfNeeded ();
- BootCommon::BootPartitionDevice = device;
+ BootStorage::BootPartitionDevice = device;
}
/**
Modified: trunk/bootloader/src/routines/global_widgets.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/global_w…
==============================================================================
--- trunk/bootloader/src/routines/global_widgets.ycp (original)
+++ trunk/bootloader/src/routines/global_widgets.ycp Thu Apr 23 14:56:26 2009
@@ -115,7 +115,7 @@
{
type = _("Image");
string image = s["image"]:"";
- string root = (BootCommon::getHintedPartitionList ([s["root"]:""]))[0]:"";
+ string root = (BootStorage::getHintedPartitionList ([s["root"]:""]))[0]:"";
boolean elilo = Bootloader::getLoaderType () == "elilo";
info = (image != "" && image != nil) ? sformat ("%1 (%2%3)",
image, elilo ? "" : BootCommon::splitPath (image)[0]:"",
@@ -124,7 +124,7 @@
else if (s["type"]:"" == "xen"){
type = _("Xen");
string image = s["image"]:"";
- string root = (BootCommon::getHintedPartitionList ([s["root"]:""]))[0]:"";
+ string root = (BootStorage::getHintedPartitionList ([s["root"]:""]))[0]:"";
boolean elilo = Bootloader::getLoaderType () == "elilo";
info = (image != "" && image != nil) ? sformat ("%1 (%2%3)",
image, elilo ? "" : BootCommon::splitPath (image)[0]:"",
Modified: trunk/bootloader/src/routines/i386.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/i386.ycp…
==============================================================================
--- trunk/bootloader/src/routines/i386.ycp (original)
+++ trunk/bootloader/src/routines/i386.ycp Thu Apr 23 14:56:26 2009
@@ -148,7 +148,7 @@
if (! was_proposed)
{
DetectDisks ();
- del_parts = getPartitionList (`deleted);
+ del_parts = BootStorage::getPartitionList (`deleted, getLoaderType(false));
// check whether edd is loaded; if not: load it
string lsmod_command = "lsmod | grep edd";
y2milestone ("Running command %1", lsmod_command);
@@ -165,8 +165,9 @@
}
// refresh device map
- if (device_mapping == nil
- || size (device_mapping) == 0)
+ if ((BootStorage::device_mapping == nil
+ || size (BootStorage::device_mapping) == 0)
+ && (getLoaderType(false) == "grub"))
{
ProposeDeviceMap ();
}
Modified: trunk/bootloader/src/routines/lib_iface.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lib_ifac…
==============================================================================
--- trunk/bootloader/src/routines/lib_iface.ycp (original)
+++ trunk/bootloader/src/routines/lib_iface.ycp Thu Apr 23 14:56:26 2009
@@ -33,44 +33,13 @@
*/
string library_initialized = nil;
-/**
- * Storage locked
- */
-
-boolean storage_initialized = false;
/**
* Declarations...
*/
global boolean DefineMultipath(map<string,string> multipath_map);
-boolean checkCallingDiskInfo ()
-{
- boolean ret = false;
-
- // fix for problem with unintialized storage library in AutoYaST mode
- // bnc #464090
- if (Mode::config() && (!storage_initialized))
- {
- storage_initialized = true;
- y2milestone("Init storage library in yast2-bootloader");
- Storage::InitLibstorage(true);
- }
- if ((disk_change_time_checkCallingDiskInfo != Storage::GetTargetChangeTime())
- || (size(partinfo) < 1))
- {
- // save last change time from storage
- disk_change_time_checkCallingDiskInfo = Storage::GetTargetChangeTime();
- y2milestone("disk was changed by storage or partinfo is empty: %1", size(partinfo));
- y2milestone("generate partinfo, md_info, mountpoints and multipath_mapping");
- ret = true;
- } else {
- ret = false;
- y2milestone("Skip genarating partinfo, md_info, mountpoints and multipath_mapping");
- }
- return ret;
-}
/**
@@ -81,104 +50,16 @@
// FIXME: this should be done directly in perl-Bootloader through LibStorage.pm
global void SetDiskInfo () {
- if (checkCallingDiskInfo())
- {
- // delete variables for perl-Bootloader
- md_info = $[];
- multipath_mapping = $[];
- partinfo = [];
- mountpoints = $[];
-
- map<string,map> tm = (map<string,map>)Storage::GetTargetMap ();
-
-
- multipath_mapping = BootCommon::mapRealDevicesToMultipath();
- mountpoints = mapmap (string k, list v,
- (map<string,list>)Storage::GetMountPoints (),
- {
- // detect all raid1 md devices and mark them in md_info
- any device = v[0]:nil;
- if (v[3]:"" == "raid1")
- md_info[(string)device]=[];
- return $[ k : device ];
- });
- mountpoints = filter (string k, any v, mountpoints, {
- string tmpdir = (string)SCR::Read (.target.tmpdir);
- integer tmp_sz = size (tmpdir);
- return is (v, string) && substring (k, 0, tmp_sz) != tmpdir;
- });
-
- y2milestone ("Detected mountpoints: %1", mountpoints);
-
- list<list<list> > pi = maplist (string disk, map info, tm,
- {
- if (info["type"]:`CT_UNKNOWN==`CT_LVM)
- return [];
- if (info["type"]:`CT_UNKNOWN==`CT_EVMS)
- return [];
- list partitions = info["partitions"]:[];
- list<list> parts = maplist (map p, (list<map>)partitions, {
- string raid = "";
- if( p["used_by_type"]:`UB_NONE==`UB_MD )
- raid = p["used_by_device"]:"";
- string device = p["device"]:"";
- // We only pass along RAID1 devices as all other causes
- // severe breakage in the bootloader stack
- if (raid != "") {
- if (haskey (md_info, raid)) {
- list<string> members = md_info[raid]:[];
- members = add (members, device);
- md_info[raid] = members;
- }
- }
- any nr = p["nr"]:nil;
- if (nr == nil)
- nr = 0;
- string nr_str = sformat ("%1", nr);
- /* FIXME: And the other information about the disk ?:
- p["fsid"] = LibStorage::PartitionInfo::swig_id_get(info);
- p["fstype"] = Partitions::FsIdToString( p["fsid"]:0 );
- p["region"] = [ LibStorage::PartitionInfo::swig_cylStart_get(info),
- LibStorage::PartitionInfo::swig_cylSize_get(info) ];
- p["type"] = toSymbol( conv_ptype, t );
- p["boot"] = true;
- */
-
- return [ device, disk, nr_str, tostring(p["fsid"]:0),
- p["fstype"]:"unknown", tostring(p["type"]:nil),
- tostring(p["region", 0]:0), tostring(p["region", 1]:0)
- ];
- });
- return parts;
- });
- partinfo = flatten (pi);
- partinfo = filter (list p, partinfo, {return p != nil && p != [];});
- list<list> partinfo_mountby = [];
- // adding moundby (by-id) via user preference
- foreach(list partition, partinfo, {
- list tmp =[];
- string mount_by = BootStorage::Dev2MountByDev(tostring(partition[0]:""));
- if (mount_by != tostring(partition[0]:""))
- {
- tmp = add(partition, mount_by);
- } else {
- tmp = partition;
- }
- partinfo_mountby = add(partinfo_mountby, tmp);
- });
- // y2milestone("added mountby: %1", partinfo_mountby);
-
- partinfo = partinfo_mountby;
- }
+ BootStorage::InitDiskInfo();
- y2milestone ("Information about partitioning: %1", partinfo);
- y2milestone ("Information about MD arrays: %1", md_info);
- y2milestone ("Mapping real disk to multipath: %1", multipath_mapping);
-
- System::Bootloader_API::setMountPoints ((map<string,string>) mountpoints);
- System::Bootloader_API::setPartitions ((list<list<string> >) partinfo);
- System::Bootloader_API::setMDArrays ((map<string,list<string> >) md_info);
- DefineMultipath(multipath_mapping);
+ y2milestone ("Information about partitioning: %1", BootStorage::partinfo);
+ y2milestone ("Information about MD arrays: %1", BootStorage::md_info);
+ y2milestone ("Mapping real disk to multipath: %1", BootStorage::multipath_mapping);
+
+ System::Bootloader_API::setMountPoints ((map<string,string>) BootStorage::mountpoints);
+ System::Bootloader_API::setPartitions ((list<list<string> >) BootStorage::partinfo);
+ System::Bootloader_API::setMDArrays ((map<string,list<string> >) BootStorage::md_info);
+ DefineMultipath(BootStorage::multipath_mapping);
}
/**
Modified: trunk/bootloader/src/routines/lilolike.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lilolike…
==============================================================================
--- trunk/bootloader/src/routines/lilolike.ycp (original)
+++ trunk/bootloader/src/routines/lilolike.ycp Thu Apr 23 14:56:26 2009
@@ -47,8 +47,8 @@
// don't change configuration if '/' and '/boot' were not changed
// and location is "floppy", "mbr" or "boot"
- if (actual_boot == BootCommon::BootPartitionDevice
- && actual_root == BootCommon::RootPartitionDevice
+ if (actual_boot == BootStorage::BootPartitionDevice
+ && actual_root == BootStorage::RootPartitionDevice
&& selected_location != "custom"
&& selected_location != ""
&& selected_location != nil)
@@ -56,7 +56,7 @@
return false;
}
- list all_partitions = BootCommon::getPartitionList(`boot);
+ list all_partitions = BootStorage::getPartitionList(`boot, getLoaderType(false));
if (!contains(all_partitions, BootCommon::loader_device))
{
@@ -100,10 +100,10 @@
{
string result = "";
string boot_device = "";
- if ((BootCommon::BootPartitionDevice != nil) && (BootCommon::BootPartitionDevice != ""))
- boot_device = BootCommon::BootPartitionDevice;
+ if ((BootStorage::BootPartitionDevice != nil) && (BootStorage::BootPartitionDevice != ""))
+ boot_device = BootStorage::BootPartitionDevice;
else
- boot_device = BootCommon::RootPartitionDevice;
+ boot_device = BootStorage::RootPartitionDevice;
foreach(map p, partitions, {
if (p["device"]:"" == boot_device)
@@ -162,15 +162,15 @@
// - is primary: is_logical -> false
// - is on the first disk (with the MBR): disk_is_mbr -> true
map<string,any> tm = Storage::GetTargetMap ();
- map dp = Storage::GetDiskPartition (BootPartitionDevice);
+ map dp = Storage::GetDiskPartition (BootStorage::BootPartitionDevice);
string disk = dp["disk"]:"";
boolean disk_is_mbr = disk == mbrDisk;
map dm = tm[disk]:$[];
list<map> partitions = dm["partitions"]:[];
boolean is_logical = false;
string extended = nil;
- list<string> needed_devices = [ BootPartitionDevice ];
- map<string,integer> md_info = Md2Partitions (BootPartitionDevice);
+ list<string> needed_devices = [ BootStorage::BootPartitionDevice ];
+ map<string,integer> md_info = Md2Partitions (BootStorage::BootPartitionDevice);
if (md_info != nil && size (md_info) > 0)
{
disk_is_mbr = false;
@@ -208,7 +208,7 @@
if (disk_is_mbr && ! is_logical)
{
selected_location = "boot";
- loader_device = BootPartitionDevice;
+ loader_device = BootStorage::BootPartitionDevice;
activate = true;
activate_changed = true;
// examine_mbr.pl returns
@@ -247,10 +247,10 @@
if (is_logical && extended != nil)
loader_device = extended;
else
- loader_device = BootPartitionDevice;
+ loader_device = BootStorage::BootPartitionDevice;
selected_location = "boot";
}
- if (! contains (getPartitionList (`boot), loader_device))
+ if (! contains (BootStorage::getPartitionList (`boot, getLoaderType(false)), loader_device))
{
selected_location = "mbr"; // default to mbr
loader_device = BootCommon::mbrDisk;
@@ -301,16 +301,16 @@
y2milestone( "mountPoints %1", mp );
y2milestone( "mountdata_boot %1", mountdata_boot );
- BootCommon::RootPartitionDevice = mp["/", 0]:"";
+ BootStorage::RootPartitionDevice = mp["/", 0]:"";
- if (BootCommon::RootPartitionDevice == "")
+ if (BootStorage::RootPartitionDevice == "")
{
y2error ("No mountpoint for / !!");
}
// if /boot changed, re-configure location
- BootCommon::BootPartitionDevice
- = mountdata_boot[0]:BootCommon::RootPartitionDevice;
+ BootStorage::BootPartitionDevice
+ = mountdata_boot[0]:BootStorage::RootPartitionDevice;
if (BootCommon::mbrDisk == "" || BootCommon::mbrDisk == nil)
{
@@ -319,7 +319,7 @@
}
if (loader_device == nil || loader_device == ""
- || ! contains (getPartitionList (`boot), loader_device))
+ || ! contains (BootStorage::getPartitionList (`boot, getLoaderType(false)), loader_device))
ConfigureLocation ();
}
@@ -515,7 +515,7 @@
* Fix section of lilo-like bootloader
*/
global void FixSections (void() create_sections) {
- list<string> parts = getPartitionList(`parts_old);
+ list<string> parts = BootStorage::getPartitionList(`parts_old, getLoaderType(false));
if (partitioning_last_change
!= Storage::GetTargetChangeTime()
&& BootCommon::files_edited)
@@ -999,13 +999,13 @@
* Read device map and store it in internal structures
*/
global void UpdateDeviceMap () {
- device_mapping = mapmap (string unix, string fw, device_mapping, {
+ BootStorage::device_mapping = mapmap (string unix, string fw, BootStorage::device_mapping, {
y2milestone ("Updating device in devmap entry %1 -> %2",
unix, fw);
unix = BootCommon::UpdateDevice (unix);
return $[ unix : fw ];
});
- y2milestone ("Updated device map: %1", device_mapping);
+ y2milestone ("Updated device map: %1", BootStorage::device_mapping);
}
/**
@@ -1107,256 +1107,6 @@
}
-/*** helper functions for ProposeDeviceMap: ***/
-/**
- * Returns true if any device from list devices is in device_mapping
- * marked as hd0.
- */
-boolean isHd0(list<string> devices)
-{
- boolean ret = false;
-
- foreach (string value, devices,
- {
- if (device_mapping[value]:"" == "hd0"){
- ret = true;
- }
- });
-
- return ret;
-}
-
-/**
- * Returns first key from mapping associated with value.
- * Example:
- * map = $[ "a" : "1",
- * "b" : "2",
- * "c" : "3",
- * "d" : "2"];
- * getDeviceFromMapping("1", map) -> "a"
- * getDeviceFromMapping("2", map) -> "b"
- */
-string getKey(string value, map<string, string> mapping)
-{
- string ret = "";
-
- foreach (string key, string val, mapping,
- {
- if (value == val){
- ret = key;
- return;
- }
- });
-
- return ret;
-}
-
-/**
- * This function changes order of devices in device_mapping.
- * All devices listed in bad_devices are maped to "hdN" are moved to the end
- * (with changed number N). And second step is putting device with boot partition
- * on top (i.e. device_mapping[dev_with_boot] = "hd0").
- *
- * Example:
- * device_mapping = $[ "/dev/sda" : "hd0",
- * "/dev/sdb" : "hd1",
- * "/dev/sdc" : "hd2",
- * "/dev/sdd" : "hd3",
- * "/dev/sde" : "hd4" ];
- * bad_devices = [ "/dev/sda", "/dev/sdc" ];
- *
- * changeOrderInDeviceMapping(bad_devices);
- * // after call, device_mapping is:
- * device_mapping -> $[ "/dev/sda" : "hd3",
- * "/dev/sdb" : "hd0",
- * "/dev/sdc" : "hd4",
- * "/dev/sdd" : "hd1",
- * "/dev/sde" : "hd2" ];
- */
-void changeOrderInDeviceMapping(list<string> bad_devices)
-{
- integer cur_id = 0;
- list keys = [];
- string value = "";
- string tmp = "";
- string tmp2 = "";
-
- // get keys from device_mapping, it's not possible to use foreach over keys and values
- // of device_mapping directly, because during the loop device_mapping is changing.
- foreach (string key, string value, device_mapping, { keys = add(keys, key); });
-
- // put bad_devices at bottom
- foreach (string key, (list<string>)keys,
- {
- value = device_mapping[key]:"";
-
- // if device is mapped on hdX and this device is _not_ in bad_devices
- if (substring(value, 0, 2) == "hd"
- && !contains(bad_devices, key)){
- // get device name of mapped on "hd"+cur_id
- tmp = getKey("hd" + tostring(cur_id), device_mapping);
-
- // swap tmp and key devices (swap their mapping)
- device_mapping[tmp] = value;
- device_mapping[key] = "hd" + tostring(cur_id);
-
- cur_id = cur_id + 1;
- }
- });
-
- // put device with boot partition on the top:
- /*
- tmp = (regexptokenize(BootCommon::BootPartitionDevice, "([a-z/]+)[0-9]*"))[0]:"";
- if (haskey(device_mapping, tmp) && device_mapping[tmp]:"" != "hd0"){
- y2debug("Putting device with boot partition (%1) on the top.", tmp);
-
- tmp2 = getKey("hd0", device_mapping);
- device_mapping[tmp2] = device_mapping[tmp]:"";
- device_mapping[tmp] = "hd0";
- }*/
-}
-/*** helper functions END ***/
-
-/**
- * Generate device map proposal, store it in internal variables.
- *
- * FATE #302075:
- * When user is installing from USB media or any non IDE disk or bios simply
- * set any non IDE disk as first and user is not installing on this removable
- * (non IDE) disk, the order of disks proposed by bios must be changed because
- * of future remove of USB disk.
- * This function must find right place for bootloader (which is most probably
- * boot sector of boot partition (where /boot dir is located)) and change the
- * order of disks in device map.
- * This method is only heuristic because order of disks after remove of usb
- * disk can't be determined by any method.
- *
- * Algorithm for solving problem with usb disk propsed by bios as hd0:
- * if usbDiskDevice == hd0 && BootDevice != usbDiskDevice:
- * change order of disks in device_mappings to have BootDevice as hd0
- */
-// FIXME: remove that function from here, as it is grub only
-// NOTE: there is a local copy in routines/grub/misc.ycp now
-global void ProposeDeviceMap () {
- list<string> usb_disks = []; // contains those usb removable disks
-
- device_mapping = $[];
- multipath_mapping = $[];
-
- if (getLoaderType (false) == "grub")
- {
- map<string,map> targetMap = $[];
- if (Mode::config ())
- y2milestone ("Skipping device map proposing in Config mode");
- else
- targetMap = (map<string,map>)Storage::GetTargetMap();
-
- // filter out members of BIOS RAIDs and multipath devices
- targetMap = filter (string k, map v, targetMap, {
- return v["used_by_type"]:nil != `UB_DMRAID && v["used_by_type"]:nil != `UB_DMMULTIPATH;
- });
- // filter out non-disk devices
- targetMap = filter (string k, map v, targetMap, {
- return v["type"]:`CT_UNKNOWN==`CT_DMRAID || v["type"]:`CT_UNKNOWN==`CT_DISK
- || v["type"]:`CT_UNKNOWN==`CT_DMMULTIPATH;
- });
-
- y2milestone ("Target map: %1", targetMap);
-
- // add devices with known bios_id
- // collect BIOS IDs which are used
- map ids = $[];
- foreach (string target_dev, map target, targetMap, {
- string bios_id = target["bios_id"]:"";
- if (bios_id != "")
- {
- integer index = tointeger (bios_id) - tointeger ("0x80");
- string grub_dev = sformat ("hd%1", index);
- // FATE #303548 - doesn't add disk with same bios_id with different name (multipath machine)
- if (! ids[index]:false)
- {
- device_mapping[target_dev] = grub_dev;
- ids[index] = true;
- }
- }
- });
- // and guess other devices
- // don't use already used BIOS IDs
- foreach (string target_dev, map target, targetMap, {
- string bios_id = target["bios_id"]:"";
- if (bios_id == "")
- {
- integer index = 0;
- while (ids[index]:false)
- index = index + 1;
- string grub_dev = sformat ("hd%1", index);
- device_mapping[target_dev] = grub_dev;
- ids[index] = true;
- }
- });
-
- // Fill usb_disks list with usb removable devices.
- //
- // It's not easy to determine how to identify removable usb devices. Now
- // it tests if driver of device is usb-storage. If you find better
- // algorithm how to find removable usb devices, put it here into foreach
- // to apply this algorithm on all devices.
- foreach (string target_dev, map target, targetMap,
- {
- string driver = target["driver"]:"";
- if (driver == "usb-storage"){
- usb_disks = add(usb_disks, target_dev);
- }
- });
- y2milestone("Found usb discs: %1", usb_disks);
-
- // change order in device_mapping if usb disk is hd0
- // (FATE #302075)
- if (isHd0(usb_disks)
- && BootCommon::BootPartitionDevice != getKey("hd0", device_mapping)){
- y2milestone ("Detected device mapping: %1", device_mapping);
- y2milestone("Changing order in device mapping needed...");
- changeOrderInDeviceMapping(usb_disks);
- }
-
- if (size(device_mapping) == 1)
- bois_id_missing = false;
- if (StorageDevices::FloppyPresent())
- device_mapping[StorageDevices::FloppyDevice()] = "fd0";
-
- y2milestone ("Detected device mapping: %1", device_mapping);
-
- multipath_mapping = BootCommon::mapRealDevicesToMultipath();
-
- y2milestone ("Detected multipath mapping: %1", multipath_mapping);
-
- } else {
- y2milestone("Skip creating device map for bootloader: %1", getLoaderType (false));
- }
-}
-
-/**
- * Get the order of disks according to BIOS mapping
- * @return a list of all disks in the order BIOS sees them
- */
-global list<string> DisksOrder () {
- if (device_mapping == nil || size (device_mapping) == 0)
- {
- ProposeDeviceMap ();
- }
- map<string,string> devmap_rev = mapmap (string k, string v,
- BootCommon::device_mapping,
- {
- return $[ v : k ];
- });
- devmap_rev = filter (string k, string v, devmap_rev, {
- return substring (k, 0, 2) == "hd";
- });
- list<string> order = maplist (string k, string v, devmap_rev, {
- return v;
- });
- return order;
-}
/**
* Get the summary of disks order for the proposal
Modified: trunk/bootloader/src/routines/misc.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/misc.ycp…
==============================================================================
--- trunk/bootloader/src/routines/misc.ycp (original)
+++ trunk/bootloader/src/routines/misc.ycp Thu Apr 23 14:56:26 2009
@@ -131,53 +131,6 @@
Misc::boot_msg = msg;
}
- /**
- * Get the list of installed floppy drives
- * @return a list of floppy devices
- */
- global list<string> getFloppyDevices () ``{
- if (floppy_devices == nil)
- {
- list<map> floppies = (list<map>) SCR::Read (.probe.floppy);
- floppies = filter (map f, floppies,
- ``(f["model"]:"Floppy Disk" == "Floppy Disk"));
- floppy_devices = maplist (map f, floppies,
- ``(f["dev_name"]:""));
- floppy_devices = filter (string f, floppy_devices, ``(f != ""));
- }
- return floppy_devices;
- }
-
-
-
-/**
- * Function remap device map to device name (/dev/sda)
- * or to label (ufo_disk)
- * @param map<string,string> device map
- * @return map<string,string> new device map
- */
-
-global map<string,string> remapDeviceMap(map<string,string> device_map)
-{
- symbol by_mount = nil;
- if (Arch::ppc())
- by_mount = `id;
- else
- by_mount = Storage::GetDefaultMountBy();
-
- //by_mount = `id;
- if (by_mount == `label)
- return device_map;
-
- map<string,string> ret = $[];
- // convert device names in device map to the device names by device or label
- ret = mapmap (string k , string v, device_mapping,
- {
- return $[BootStorage::MountByDev2Dev(k) : v];
- });
-
- return ret;
-}
/**
* Function remap globals settings "boot_custom" device name (/dev/sda)
@@ -324,192 +277,6 @@
/**
- * Returns list of partitions with "mount by" hints. Goes through the list
- * of partitions passed as a parameter and creates a list of partitions with
- * hints according to the current partitioning requested from
- * yast2-storage. To be used in a combobox or menu.
- *
- * @param parts_to_get list<string> partitions to list
- * @return a list of strings containing a partition name and a hint (if applicable)
- */
- global define list<string> getHintedPartitionList(list<string> parts_to_get) ``{
- y2milestone ("getHintedPartitionList: %1", parts_to_get);
- map<string,map> devices = (map<string,map>)Storage::GetTargetMap();
-
- // make a map: "/dev/hda1" -> info_map_for_this_partition
- map<string,map> partitions = $[];
- foreach (string k, map v, devices, ``{
- foreach (map p, (list<map>)(v["partitions"]:[]), ``{
- partitions[p["device"]:""] = p;
- });
- });
- y2milestone ("getHintedPartitionList: partitions %1", partitions);
-
- symbol mountby = `device;
- list<string> ret = maplist (string dev, parts_to_get, ``{
- mountby = (symbol) partitions[dev, "mountby"]:nil;
- if ( mountby == `uuid )
- {
- return sformat ("%1 (mount by UUID: %2)", dev,
- partitions[dev, "uuid"]:nil != nil ?
- partitions[dev, "uuid"]:"" :
- "<UUID to be created later during format>");
- } else if ( mountby == `label )
- {
- return sformat ("%1 (mount by LABEL: %2)", dev, partitions[dev, "label"]:"");
- } else if ( mountby == `id )
- {
- return sformat ("%1 (mount by ID: %2)", dev, partitions[dev, "udev_id", 0]:"");
- } else if ( mountby == `path )
- {
- return sformat ("%1 (mount by PATH: %2)", dev, partitions[dev, "udev_path"]:"");
- } else if ( mountby == nil || mountby == `device )
- {
- return dev;
- }
- });
-
- y2milestone ("getHintedPartitionList: ret %1", ret);
- return ret;
- }
-
- /**
- * Returns list of partitions. Requests current partitioning from
- * yast2-storage and creates list of partition for combobox, menu or other
- * purpose.
- * @param type symbol
- * `boot - for bootloader installation
- * `root - for kernel root
- * `boot_other - for bootable partitions of other systems
- * `all - all partitions
- * `parts_old - all partitions, except those what will be created
- * during isntallation
- * `deleted - all partitions deleted in current proposal
- * `kept - all partitions that won't be deleted, new created or formatted
- * `destroyed - all partition which are new, deleted or formatted
- * @return a list of strings
- */
- global define list<string> getPartitionList(symbol type) ``{
- y2milestone ("getPartitionList: %1", type);
- string bl = getLoaderType(false);
- map<string,map> devices = (map<string,map>)Storage::GetTargetMap();
- list<map> partitions = [];
- foreach (string k, map v, devices, ``{
- if ((type == `boot) && (bl == "grub"))
- {
- // check if device is in device map
- if (haskey(device_mapping, k) || (haskey(device_mapping, BootStorage::Dev2MountByDev(k))))
- partitions = (list<map>)merge (partitions, (list<map>)(v["partitions"]:[]));
- } else {
- partitions = (list<map>)merge (partitions, (list<map>)(v["partitions"]:[]));
- }
- });
- list<string> floppies = getFloppyDevices ();
-
- devices = filter (string k, map v, devices,
- ``(v["type"]:`CT_UNKNOWN != `CT_LVM));
-
- if (type == `boot || type == `boot_other)
- {
- devices = filter (string k, map v, devices, {
- if ((v["type"]:`CT_UNKNOWN == `CT_DISK) ||
- (v["type"]:`CT_UNKNOWN == `CT_DMRAID))
- return true;
- else
- return false;
- });
- }
- list<string> all_disks = (list<string>) maplist (string k, map v, devices,
- {
- return k;
- });
-
-
-
- if (type == `deleted)
- return maplist (map x, filter (map p, partitions, ``(p["delete"]:false)),
- ``{return x["device"]:"";
- });
- else if (type == `destroyed)
- {
- return maplist (map x, filter (map p, partitions, {
- return p["delete"]:false || p["format"]:false
- || p["create"]:false;
- }),
- {
- return x["device"]:"";
- });
- }
- partitions = filter (map p, partitions, ``(! p["delete"]:false));
- // filter out disk which are not in device map
- if ((bl == "grub") && (type == `boot))
- all_disks = (list<string>) filter(string k, all_disks, {
- if (haskey(device_mapping, k) || (haskey(device_mapping, BootStorage::Dev2MountByDev(k))))
- return true;
- else
- return false;
- });
- list<string> ret = all_disks;
- if (type == `boot_other || type == `root || type == `parts_old
- || type == `kept)
- ret = [];
-
- if (type == `boot)
- {
- partitions = filter (map p, partitions,
- ``(p["type"]:`primary == `primary
- || p["type"]:`primary == `extended
- || p["type"]:`primary == `logical
- || p["type"]:`primary == `sw_raid)
- );
- // FIXME this checking is performed on 3 places, one function should
- // be developed for it
- partitions = filter (map p, partitions, {
- symbol fs = (symbol)(p["used_fs"]:p["detected_fs"]:nil);
- if (fs == `xfs)
- return false;
- return true;
- });
- }
- else if (type == `root)
- {
- partitions = filter (map p, partitions,
- ``(p["type"]:`primary != `extended));
- }
- else if (type == `parts_old)
- {
- partitions = filter (map p, partitions, ``(! p["create"]:false));
- }
- else if (type == `kept)
- {
- partitions = filter (map p, partitions, {
- return ! (p["create"]:false || p["format"]:false);
- });
- }
- if (type != `all && type != `parts_old && type != `kept)
- {
- partitions = filter (map p, partitions,
- ``(p["fstype"]:"" != "Linux swap"));
- }
- if (type == `boot)
- {
- partitions = filter (map p, partitions,
- ``(p["fstype"]:"" == "Linux native"
- || p["fstype"]:"" == "Extended"
- || p["fstype"]:"" == "Linux RAID"
- || p["fstype"]:"" == "MD Raid"
- || p["fstype"]:"" == "DM RAID"));
- }
- list<string>partition_names
- = maplist (map p, partitions, ``((string)(p["device"]:"")));
- partition_names = filter (string p, partition_names, ``(p != ""));
- partition_names = (list<string>)merge (partition_names, floppies);
- ret = (list<string>)union (ret, partition_names);
- ret = (list<string>)toset (ret);
- return (list<string>)ret;
- }
-
- /**
* returns true if char is blank (newline, tab or space)
* @param s single char string
* @return boolean blank/non blank
@@ -580,9 +347,9 @@
if (BootCommon::selected_location == "mbr")
return BootCommon::mbrDisk;
if (BootCommon::selected_location == "boot")
- return BootCommon::BootPartitionDevice;
+ return BootStorage::BootPartitionDevice;
if (BootCommon::selected_location == "root")
- return BootCommon::RootPartitionDevice;
+ return BootStorage::RootPartitionDevice;
if (BootCommon::selected_location == "floppy")
return StorageDevices::FloppyDevice();
if (BootCommon::selected_location == "mbr_md")
@@ -600,17 +367,17 @@
global define list<string> GetBootloaderDevices () ``{
list<string> ret = [];
if (BootCommon::globals["boot_boot"]:"false" == "true") {
- ret = add(ret, BootCommon::BootPartitionDevice);
+ ret = add(ret, BootStorage::BootPartitionDevice);
}
if (BootCommon::globals["boot_root"]:"false" == "true") {
- ret = add(ret, BootCommon::RootPartitionDevice);
+ ret = add(ret, BootStorage::RootPartitionDevice);
}
if (BootCommon::globals["boot_mbr"]:"false" == "true") {
ret = add(ret, BootCommon::mbrDisk);
}
if ( haskey(BootCommon::globals, "boot_extended") &&
BootCommon::globals["boot_extended"]:"false" == "true" ) {
- ret = add(ret, BootCommon::ExtendedPartitionDevice);
+ ret = add(ret, BootStorage::ExtendedPartitionDevice);
}
// FIXME: floppy support is probably obsolete
if ( haskey(BootCommon::globals, "boot_floppy") &&
@@ -660,7 +427,7 @@
ret = false;
else if (loader_device == StorageDevices::FloppyDevice())
ret = true;
- else if (contains (getFloppyDevices (), loader_device))
+ else if (contains (BootStorage::getFloppyDevices (), loader_device))
ret = true;
y2milestone ("Installing to floppy: %1", ret);
return ret;
@@ -899,7 +666,7 @@
map<string,integer> md = $[];
if (BootCommon::loader_device == "mbr_md")
{
- md = Md2Partitions (BootCommon::BootPartitionDevice);
+ md = Md2Partitions (BootStorage::BootPartitionDevice);
}
else
{
@@ -912,7 +679,7 @@
}
list<map<string,any> > ret = maplist (string partition, partitions, {
return getPartitionToActivate (
- BootCommon::BootPartitionDevice,
+ BootStorage::BootPartitionDevice,
partition);
});
return toset (ret);
@@ -928,7 +695,7 @@
map<string,integer> md = $[];
if (BootCommon::loader_device == "mbr_md")
{
- md = Md2Partitions (BootCommon::BootPartitionDevice);
+ md = Md2Partitions (BootStorage::BootPartitionDevice);
}
else
{
@@ -936,7 +703,7 @@
}
list<string> mbrs = maplist (string d, integer b, md, {
d = getPartitionToActivate (
- BootCommon::BootPartitionDevice, d
+ BootStorage::BootPartitionDevice, d
)["mbr"]:mbrDisk;
return d;
});
@@ -1369,8 +1136,8 @@
{
DetectDisks ();
y2milestone ("Boot partition device: %1",
- BootCommon::BootPartitionDevice);
- map dev = Storage::GetDiskPartition( BootCommon::BootPartitionDevice);
+ BootStorage::BootPartitionDevice);
+ map dev = Storage::GetDiskPartition( BootStorage::BootPartitionDevice);
y2milestone ("Disk info: %1", dev);
// MD, but not mirroring is OK
// FIXME: type detection by name deprecated
@@ -1381,7 +1148,7 @@
list<map> parts = md["partitions"]:[];
map info = $[];
foreach (map p, parts, {
- if (p["device"]:"" == BootPartitionDevice)
+ if (p["device"]:"" == BootStorage::BootPartitionDevice)
info = p;
});
if (tolower (info["raid_type"]:"") != "raid1")
@@ -1706,10 +1473,10 @@
global string getBootPartition()
{
string boot_device = "";
- if (BootCommon::BootPartitionDevice != "")
- boot_device = BootCommon::BootPartitionDevice;
- else if (BootCommon::RootPartitionDevice != "")
- boot_device = BootCommon::RootPartitionDevice;
+ if (BootStorage::BootPartitionDevice != "")
+ boot_device = BootStorage::BootPartitionDevice;
+ else if (BootStorage::RootPartitionDevice != "")
+ boot_device = BootStorage::RootPartitionDevice;
return boot_device;
}
@@ -1906,44 +1673,7 @@
}
}
-/** bnc #447591, 438243, 448110 multipath wrong device map
- * Function maps real devices to multipath e.g.
- * "/dev/sda/" : "/dev/mapper/SATA_ST3120813AS_3LS0CD7M"
- *
- * @return map <string, string> mapping real disk to multipath
- */
-
-// FIXME grub only
-map <string, string> mapRealDevicesToMultipath()
-{
- map <string, string> ret = $[];
- map<string, map> tm = (map<string,map>)Storage::GetTargetMap ();
- integer num_of_real_disk = 0;
- foreach (string disk, map disk_info, tm,
- {
- if (disk_info["type"]:nil == `CT_DMMULTIPATH)
- {
- list <string> devices = (list <string>) disk_info["devices"]:[];
- if (size(devices) > 0)
- {
- foreach(string d, devices,
- {
- ret[d]=disk;
- });
-
- }
- }
-
- if (disk_info["type"]:nil == `CT_DISK)
- num_of_real_disk = num_of_real_disk +1;
- if (disk_info["bios_id"]:nil != nil)
- bois_id_missing = false;
- });
- if (num_of_real_disk == 1)
- bois_id_missing = false;
- return ret;
-}
/** bnc #450153 - support for installation kernel from add-on
* fucntion call client from add-on and update proposal for
Modified: trunk/bootloader/src/routines/section_widgets.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/section_…
==============================================================================
--- trunk/bootloader/src/routines/section_widgets.ycp (original)
+++ trunk/bootloader/src/routines/section_widgets.ycp Thu Apr 23 14:56:26 2009
@@ -29,6 +29,7 @@
import "Storage";
import "StorageDevices";
import "Bootloader";
+import "BootStorage";
import "Popup";
import "FileUtils";
@@ -303,14 +304,14 @@
*/
void RootDeviceInit (string widget) {
y2milestone ("RootDeviceInit: %1", widget);
- list<string> available = BootCommon::getPartitionList (`root);
+ list<string> available = BootStorage::getPartitionList (`root, Bootloader::getLoaderType());
// if we mount any of these devices by id, label etc., we add a hint to
// that effect to the item
y2milestone ("RootDeviceInit: getHintedPartitionList for %1", available);
- available = BootCommon::getHintedPartitionList (available);
+ available = BootStorage::getHintedPartitionList (available);
UI::ChangeWidget (`id (widget), `Items, available);
UI::ChangeWidget (`id (widget), `Value,
- (BootCommon::getHintedPartitionList ([BootCommon::current_section[widget]:""]))[0]:"");
+ (BootStorage::getHintedPartitionList ([BootCommon::current_section[widget]:""]))[0]:"");
}
/**
@@ -336,10 +337,10 @@
string current
= (splitstring( (string)UI::QueryWidget (`id (widget), `Value), " "))[0]:"";
// check against the list of existing partitions
- list<string> available = BootCommon::getPartitionList (`root);
+ list<string> available = BootStorage::getPartitionList (`root, Bootloader::getLoaderType());
if (contains(available, current))
UI::ChangeWidget (`id (widget), `Value,
- (BootCommon::getHintedPartitionList ([current]))[0]:"");
+ (BootStorage::getHintedPartitionList ([current]))[0]:"");
return nil;
}
@@ -372,7 +373,7 @@
* @param widget any id of the widget
*/
void ChainloaderInit (string widget) {
- list<string> available = BootCommon::getPartitionList (`boot_other);
+ list<string> available = BootStorage::getPartitionList (`boot_other, Bootloader::getLoaderType());
UI::ChangeWidget (`id (widget), `Items, available);
SectionOptionInit (widget);
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56932 - /trunk/storage/storage/src/include/ep-hd.ycp
by kmachalkova@svn.opensuse.org 23 Apr '09
by kmachalkova@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: kmachalkova
Date: Thu Apr 23 12:59:35 2009
New Revision: 56932
URL: http://svn.opensuse.org/viewcvs/yast?rev=56932&view=rev
Log:
Function buttons for HDs (finally they do something
useful)
Modified:
trunk/storage/storage/src/include/ep-hd.ycp
Modified: trunk/storage/storage/src/include/ep-hd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-h…
==============================================================================
--- trunk/storage/storage/src/include/ep-hd.ycp (original)
+++ trunk/storage/storage/src/include/ep-hd.ycp Thu Apr 23 12:59:35 2009
@@ -8,6 +8,7 @@
textdomain "storage";
import "Arch";
+ import "TreePanel";
import "Region";
import "Mode";
import "Stage";
@@ -68,6 +69,42 @@
);
}
+ void HandleHdButtons( string device, map event )
+ {
+ map dev = Storage::GetDiskPartition( device );
+ string disk = (string) dev["disk"]:nil;
+ // FIXME: is this necessary & sufficient condition?
+ boolean is_disk = (dev["nr"]:"" == "");
+
+ switch (Event::IsWidgetActivated(event))
+ {
+ case `add:
+ EpCreatePartition( disk );
+ break;
+ case `edit:
+ if ( is_disk )
+ TreePanel::SwitchToNew( disk );
+ else
+ EpEditPartition( device );
+ break;
+
+ case `resize:
+ if ( is_disk )
+ Popup::Error(_("Hard disks, BIOS RAIDs and multipath
+devices cannot be resized."));
+ else
+ EpResizePartition ( device );
+ break;
+
+ case `delete:
+ if ( is_disk )
+ EpDeleteDisk( device );
+ else
+ EpDeletePartition ( device, UI::WidgetExists(`id(`table)) ? `table : `overview );
+ break;
+ }
+ }
+
void CreateHdMainPanel(any user_data)
{
symbol Predicate(map disk, map partition)
@@ -113,10 +150,13 @@
void HandleHdMainPanel(any user_data, map event)
{
+ string device = (string) UI::QueryWidget(`id(`table), `CurrentItem);
+
+ HandleHdButtons( device, event );
+
switch (Event::IsWidgetContextMenuActivated(event))
{
case `table:
- string device = (string) UI::QueryWidget(`id(`table), `CurrentItem);
EpContextMenuDevice(device);
break;
}
@@ -272,24 +312,7 @@
string disk_device = (string) user_data;
string part_device = (string) UI::QueryWidget(`id(`table), `CurrentItem);
- switch (Event::IsWidgetActivated(event))
- {
- case `add:
- EpCreatePartition(disk_device);
- break;
-
- case `edit:
- EpEditPartition(part_device);
- break;
-
- case `resize:
- EpResizePartition(part_device);
- break;
-
- case `delete:
- EpDeletePartition(part_device, `table);
- break;
- }
+ HandleHdButtons( part_device, event );
switch (Event::IsMenu(event))
{
@@ -427,21 +450,7 @@
{
string part_device = (string) user_data;
- switch (Event::IsWidgetActivated(event))
- {
- case `edit:
- EpEditPartition(part_device);
- break;
-
- case `resize:
- EpResizePartition(part_device);
- break;
-
- case `delete:
- EpDeletePartition(part_device, `overview);
- break;
- }
-
+ HandleHdButtons( part_device, event);
UI::SetFocus(`id(`text));
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56931 - /trunk/storage/libstorage/src/Storage.cc
by aschnell@svn.opensuse.org 23 Apr '09
by aschnell@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: aschnell
Date: Thu Apr 23 12:32:38 2009
New Revision: 56931
URL: http://svn.opensuse.org/viewcvs/yast?rev=56931&view=rev
Log:
- added check
Modified:
trunk/storage/libstorage/src/Storage.cc
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.c…
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Thu Apr 23 12:32:38 2009
@@ -5368,6 +5368,10 @@
used, win, efi, ret))
{
}
+ else if (vol->getUsedByType() != UB_NONE)
+ {
+ ret = false;
+ }
else
{
bool needUmount = false;
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
23 Apr '09
Author: jsuchome
Date: Thu Apr 23 11:32:13 2009
New Revision: 56930
URL: http://svn.opensuse.org/viewcvs/yast?rev=56930&view=rev
Log:
Created tag stable-2_18_5 for country
Added:
tags/stable-2_18_5/country/
- copied from r56929, trunk/country/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56929 - in /trunk/country: VERSION language/src/language.ycp package/yast2-country.changes timezone/src/dialogs.ycp
by jsuchome@svn.opensuse.org 23 Apr '09
by jsuchome@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: jsuchome
Date: Thu Apr 23 11:32:06 2009
New Revision: 56929
URL: http://svn.opensuse.org/viewcvs/yast?rev=56929&view=rev
Log:
- before NTP sync, save the current time zone (bnc#467318)
- before updating boot menu, switch the UI language (bnc#446982)
- 2.18.5
Modified:
trunk/country/VERSION
trunk/country/language/src/language.ycp
trunk/country/package/yast2-country.changes
trunk/country/timezone/src/dialogs.ycp
Modified: trunk/country/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/VERSION?rev=56929&r1=569…
==============================================================================
--- trunk/country/VERSION (original)
+++ trunk/country/VERSION Thu Apr 23 11:32:06 2009
@@ -1 +1 @@
-2.18.4
+2.18.5
Modified: trunk/country/language/src/language.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/language/src/language.yc…
==============================================================================
--- trunk/country/language/src/language.ycp (original)
+++ trunk/country/language/src/language.ycp Thu Apr 23 11:32:06 2009
@@ -120,6 +120,10 @@
Progress::NextStage ();
+ // switch the UI to new language (after packages installation), so
+ // the texts in GfxMenu can be translated (bnc#446982)
+ Language::WfmSetLanguage ();
+
GfxMenu::Update();
if (Keyboard::Modified ())
@@ -147,7 +151,7 @@
Wizard::CreateDialog();
- // set the language accoring to Language.ycp initialization
+ // set the language according to Language.ycp initialization
Language::WfmSetLanguage ();
Wizard::OpenOKDialog();
Modified: trunk/country/package/yast2-country.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/package/yast2-country.ch…
==============================================================================
--- trunk/country/package/yast2-country.changes (original)
+++ trunk/country/package/yast2-country.changes Thu Apr 23 11:32:06 2009
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Thu Apr 23 08:46:45 CEST 2009 - jsuchome(a)suse.cz
+
+- before NTP sync, save the current time zone (bnc#467318)
+- before updating boot menu, switch the UI language (bnc#446982)
+- 2.18.5
+
+-------------------------------------------------------------------
Thu Apr 16 10:53:38 CEST 2009 - jsuchome(a)suse.cz
- adapted testsuite for date call change (bnc#445670)
Modified: trunk/country/timezone/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/src/dialogs.ycp…
==============================================================================
--- trunk/country/timezone/src/dialogs.ycp (original)
+++ trunk/country/timezone/src/dialogs.ycp Thu Apr 23 11:32:06 2009
@@ -124,7 +124,7 @@
// check current time and show it in the time widgets
void show_current_time () {
- map val = Timezone::GetDateTimeMap();
+ map val = Timezone::GetDateTimeMap ();
hour = val["hour"]:"";
minute = val["minute"]:"";
second = val["second"]:"";
@@ -288,10 +288,17 @@
if (ret == `accept && ntp_rb)
{
+ // before the sync, save the time zone (bnc#467318)
+ Timezone::Set (Timezone::timezone, Stage::initial () && !Mode::live_installation ());
// true: go on, exit; false: loop on
boolean ntp_handled = (boolean) ntp_call ("ui_try_save", $[]);
if (!ntp_handled)
ret = `retry; // loop on
+ else
+ {
+ // after sync, show real time in the widget
+ Timezone::diff = 0;
+ }
}
if (ret == `accept && !ntp_rb)
{
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56928 - in /trunk/storage/libstorage/src: Storage.cc Storage.h StorageTmpl.h Volume.cc
by aschnell@svn.opensuse.org 23 Apr '09
by aschnell@svn.opensuse.org 23 Apr '09
23 Apr '09
Author: aschnell
Date: Thu Apr 23 11:27:48 2009
New Revision: 56928
URL: http://svn.opensuse.org/viewcvs/yast?rev=56928&view=rev
Log:
- some cleanup
Modified:
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/Storage.h
trunk/storage/libstorage/src/StorageTmpl.h
trunk/storage/libstorage/src/Volume.cc
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.c…
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Thu Apr 23 11:27:48 2009
@@ -2437,7 +2437,7 @@
if( ignoreFs )
vol->setIgnoreFs();
ret = cont->resizeVolume( &(*vol), newSizeMb*1024 );
- eraseFreeInfo( vol->device() );
+ eraseCachedFreeInfo(vol->device());
y2mil( "vol:" << *vol );
}
else
@@ -5352,10 +5352,10 @@
bool
-Storage::getFreeInfo( const string& device, unsigned long long& resize_free,
- unsigned long long& df_free,
- unsigned long long& used, bool& win, bool& efi,
- bool use_cache )
+Storage::getFreeInfo(const string& device, unsigned long long& resize_free,
+ unsigned long long& df_free,
+ unsigned long long& used, bool& win, bool& efi,
+ bool use_cache)
{
bool ret = false;
assertInit();
@@ -5364,8 +5364,8 @@
VolIterator vol;
if( findVolume( device, vol ) )
{
- if( use_cache && getFreeInf( vol->device(), df_free, resize_free,
- used, win, efi, ret ))
+ if (use_cache && getCachedFreeInfo(vol->device(), df_free, resize_free,
+ used, win, efi, ret))
{
}
else
@@ -5472,8 +5472,7 @@
if( !ret )
vol->crUnsetup();
}
- setFreeInfo( vol->device(), df_free, resize_free, used, win, efi,
- ret );
+ setCachedFreeInfo(vol->device(), df_free, resize_free, used, win, efi, ret);
}
}
if( ret )
@@ -5482,25 +5481,27 @@
return( ret );
}
-void Storage::setFreeInfo( const string& device, unsigned long long df_free,
- unsigned long long resize_free,
+
+void
+Storage::setCachedFreeInfo(const string& device, unsigned long long df_free,
+ unsigned long long resize_free,
unsigned long long used, bool win, bool efi,
- bool resize_ok )
- {
+ bool resize_ok)
+{
y2mil("device:" << device << " df_free:" << df_free << " resize_free:" << resize_free << " used:" << used <<
" win:" << win << " efi:" << efi);
- FreeInfo inf( df_free, resize_free, used, win, efi, resize_ok );
- freeInfo[device] = inf;
- }
+ mapInsertOrReplace(freeInfo, device, FreeInfo(df_free, resize_free, used, win, efi, resize_ok));
+}
+
bool
-Storage::getFreeInf( const string& device, unsigned long long& df_free,
- unsigned long long& resize_free,
- unsigned long long& used, bool& win, bool& efi,
- bool& resize_ok )
- {
- map<string,FreeInfo>::iterator i = freeInfo.find( device );
+Storage::getCachedFreeInfo(const string& device, unsigned long long& df_free,
+ unsigned long long& resize_free,
+ unsigned long long& used, bool& win, bool& efi,
+ bool& resize_ok) const
+{
+ map<string, FreeInfo>::const_iterator i = freeInfo.find(device);
bool ret = i!=freeInfo.end();
if( ret )
{
@@ -5515,16 +5516,18 @@
if( ret )
y2mil("df_free:" << df_free << " resize_free:" << resize_free << " used:" << used <<
" win:" << win << " efi:" << efi << " resize_ok:" << resize_ok);
- return( ret );
- }
+ return ret;
+}
+
void
-Storage::eraseFreeInfo( const string& device )
- {
+Storage::eraseCachedFreeInfo(const string& device)
+{
map<string,FreeInfo>::iterator i = freeInfo.find( device );
if( i!=freeInfo.end() )
freeInfo.erase(i);
- }
+}
+
int
Storage::createBackupState( const string& name )
Modified: trunk/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h…
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Thu Apr 23 11:27:48 2009
@@ -183,6 +183,7 @@
{ return( d.type()==storage::NFSC ); }
static bool isDm( const Container&d )
{ return( d.type()==storage::DM ); }
+
struct FreeInfo
{
unsigned long long resize_free;
@@ -191,7 +192,6 @@
bool win;
bool efi;
bool rok;
- FreeInfo() { resize_free=df_free=used=0; efi=win=rok=false; }
FreeInfo( unsigned long long df,
unsigned long long resize,
unsigned long long usd, bool w=false, bool e=false,
@@ -444,7 +444,7 @@
void getCommitInfos(list<CommitInfo>& infos) const;
const string& getLastAction() const { return lastAction; }
const string& getExtendedErrorMessage() const { return extendedError; }
- void eraseFreeInfo( const string& device );
+ void eraseCachedFreeInfo(const string& device);
static void waitForDevice();
static int waitForDevice(const string& device);
@@ -1694,14 +1694,14 @@
string backupStates() const;
void detectObjects();
void deleteBackups();
- void setFreeInfo( const string& device, unsigned long long df_free,
- unsigned long long resize_free,
- unsigned long long used, bool win, bool efi,
- bool resize_ok );
- bool getFreeInf( const string& device, unsigned long long& df_free,
- unsigned long long& resize_free,
- unsigned long long& used, bool& win, bool& efi,
- bool& resize_ok );
+ void setCachedFreeInfo(const string& device, unsigned long long df_free,
+ unsigned long long resize_free,
+ unsigned long long used, bool win, bool efi,
+ bool resize_ok);
+ bool getCachedFreeInfo(const string& device, unsigned long long& df_free,
+ unsigned long long& resize_free,
+ unsigned long long& used, bool& win, bool& efi,
+ bool& resize_ok) const;
// protected internal member variables
Lock lock;
Modified: trunk/storage/libstorage/src/StorageTmpl.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTm…
==============================================================================
--- trunk/storage/libstorage/src/StorageTmpl.h (original)
+++ trunk/storage/libstorage/src/StorageTmpl.h Thu Apr 23 11:27:48 2009
@@ -213,6 +213,17 @@
}
+ template<typename Map, typename Key, typename Value>
+ typename Map::iterator mapInsertOrReplace(Map& m, const Key& k, const Value& v)
+ {
+ typename Map::iterator pos = m.lower_bound(k);
+ if (pos != m.end() && !typename Map::key_compare()(k, pos->first))
+ pos->second = v;
+ else
+ pos = m.insert(pos, typename Map::value_type(k, v));
+ return pos;
+ }
+
template <class T, unsigned int sz>
inline unsigned int lengthof (T (&)[sz]) { return sz; }
Modified: trunk/storage/libstorage/src/Volume.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc…
==============================================================================
--- trunk/storage/libstorage/src/Volume.cc (original)
+++ trunk/storage/libstorage/src/Volume.cc Thu Apr 23 11:27:48 2009
@@ -2186,7 +2186,7 @@
{
crUnsetup();
}
- cont->getStorage()->eraseFreeInfo(dev);
+ cont->getStorage()->eraseCachedFreeInfo(dev);
cont->getStorage()->removeDmTableTo(*this);
y2mil("ret:" << ret);
return( ret );
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r56927 - /trunk/bootloader/src/modules/BootStorage.ycp
by juhliarik@svn.opensuse.org 22 Apr '09
by juhliarik@svn.opensuse.org 22 Apr '09
22 Apr '09
Author: juhliarik
Date: Wed Apr 22 17:52:36 2009
New Revision: 56927
URL: http://svn.opensuse.org/viewcvs/yast?rev=56927&view=rev
Log:
updated function for converting persistend device names to kernel names
and back
Modified:
trunk/bootloader/src/modules/BootStorage.ycp
Modified: trunk/bootloader/src/modules/BootStorage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootStora…
==============================================================================
--- trunk/bootloader/src/modules/BootStorage.ycp (original)
+++ trunk/bootloader/src/modules/BootStorage.ycp Wed Apr 22 17:52:36 2009
@@ -57,14 +57,10 @@
map<string,map> target_map = $[];
-global map<string,string> uuid_partitions = $[];
-global map<string,string> id_partitions = $[];
-global map<string,string> label_partitions = $[];
-global map<string,string> path_partitions = $[];
-
-global map<string,string> uuid_disks = $[];
-global map<string,string> id_disks = $[];
-global map<string,string> path_disks = $[];
+/**
+ * mapping all devices udev-name to kernel name
+ * importnat for init fucntion of perl-Bootloader
+ */
global map<string, string> all_devices = $[];
@@ -83,21 +79,18 @@
if ((v["uuid"]:nil != "") && (v["uuid"]:nil != nil))
{
dev_by_something = "/dev/disk/by-uuid/"+v["uuid"]:"";
- uuid_disks[dev_by_something]= k;
all_devices[dev_by_something]= k;
}
// map disk by path
if ((v["path"]:nil != "") && (v["path"]:nil != nil))
{
dev_by_something = "/dev/disk/by-path/"+v["path"]:"";
- path_disks[dev_by_something]= k;
all_devices[dev_by_something]= k;
}
// map disk by id
if ((v["udev_id"]:nil != nil) && (v["udev_id", 0]:nil != ""))
{
dev_by_something = "/dev/disk/by-id/"+v["udev_id", 0]:"";
- id_disks[dev_by_something] = k;
all_devices[dev_by_something]= k;
}
// map partitions from disk...
@@ -108,7 +101,6 @@
if ((p["uuid"]:nil != "") && (p["uuid"]:nil != nil))
{
dev_by_something = "/dev/disk/by-uuid/"+p["uuid"]:"";
- uuid_partitions[dev_by_something]= p["device"]:"";
all_devices[dev_by_something]= p["device"]:"";
}
@@ -116,7 +108,6 @@
if ((p["path"]:nil != "") && (p["path"]:nil != nil))
{
dev_by_something = "/dev/disk/by-path/"+p["path"]:"";
- path_partitions[dev_by_something]= p["device"]:"";
all_devices[dev_by_something]= p["device"]:"";
}
@@ -124,7 +115,6 @@
if ((p["label"]:nil != "") && (p["label"]:nil != nil))
{
dev_by_something = "/dev/disk/by-label/"+p["label"]:"";
- label_partitions[dev_by_something]= p["device"]:"";
all_devices[dev_by_something]= p["device"]:"";
}
@@ -132,21 +122,14 @@
if ((p["udev_id"]:nil != nil) && (p["udev_id", 0]:nil != ""))
{
dev_by_something = "/dev/disk/by-id/"+p["udev_id", 0]:"";
- id_partitions[dev_by_something] = p["device"]:"";
all_devices[dev_by_something]= p["device"]:"";
}
}); // end of foreach (map p, (list<map>)(v["partitions"]:[]),
}); // end of foreach (string k, map v, devices,
- y2milestone("disks mapping by-id: %1", id_disks);
- y2milestone("disks mapping by-uuid: %1", uuid_disks);
- y2milestone("disks mapping by-path: %1", path_disks);
-
- y2milestone("partitions mapping by-id: %1", id_partitions);
- y2milestone("partitions mapping by-uuid: %1", uuid_partitions);
- y2milestone("partitions mapping by-path: %1", path_partitions);
- y2milestone("partitions mapping by-label: %1", label_partitions);
+ y2debug("device name mapping to kernel names: %1", all_devices);
+
}
@@ -172,50 +155,8 @@
string ret = dev;
// check if it is device name by id
- if (search(dev, "/dev/disk/by-id/") != nil)
- {
- if (haskey(id_partitions, dev))
- ret = id_partitions[dev]:"";
-
- if (haskey(id_disks, dev))
- ret = id_disks[dev]:"";
- y2milestone("Device %1 was converted to: %2", dev, ret);
- return ret;
- }
-
- // check if it is device name by uuid
- if (search(dev, "/dev/disk/by-uuid/") != nil)
- {
- if (haskey(uuid_partitions, dev))
- ret = uuid_partitions[dev]:"";
-
- if (haskey(uuid_disks, dev))
- ret = uuid_disks[dev]:"";
- y2milestone("Device %1 was converted to: %2", dev, ret);
- return ret;
- }
-
- // check if it is device name by path
- if (search(dev, "/dev/disk/by-path/") != nil)
- {
- if (haskey(path_partitions, dev))
- ret = path_partitions[dev]:"";
-
- if (haskey(path_disks, dev))
- ret = path_disks[dev]:"";
- y2milestone("Device %1 was converted to: %2", dev, ret);
- return ret;
- }
-
- // check if it is device name by label
- // only partition are supported
- if (search(dev, "/dev/disk/by-label/") != nil)
- {
- if (haskey(label_partitions, dev))
- ret = label_partitions[dev]:"";
- y2milestone("Device %1 was converted to: %2", dev, ret);
- return ret;
- }
+ if (haskey(all_devices, dev))
+ ret = all_devices[dev]:"";
y2milestone("Device %1 was converted to: %2", dev, ret);
return ret;
@@ -295,23 +236,33 @@
{
y2milestone ("Dev2MountByDev: %1", dev);
- // (`id,`uuid,`path,`device,`label)
- symbol by_mount = nil;
- if (Arch::ppc())
- by_mount = `id;
- else
- by_mount = Storage::GetDefaultMountBy();
-
- //by_mount = `id;
- y2milestone("Default mount by is %1", by_mount);
-
// add all_partitions to partitions
if (MapAllPartitions())
y2milestone("Init all_partitions was done");
map<string,map> partitions = all_partitions;
map<string,map> devices = target_map;
-
+
+ // (`id,`uuid,`path,`device,`label)
+ symbol by_mount = nil;
+
+ // bnc#458018 accept different mount-by for partition
+ // created by user
+ if (!Arch::ppc())
+ {
+ by_mount = Storage::GetDefaultMountBy();
+ if (haskey(partitions, dev))
+ {
+ symbol partition_mount_by = (symbol) partitions[dev, "mountby"]:nil;
+ if ((partition_mount_by != nil))
+ by_mount = partition_mount_by;
+ }
+
+ } else {
+ by_mount = `id;
+ }
+
+ y2milestone("Mount-by: %1", by_mount);
string ret = dev;
switch(by_mount)
{
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0