[yast-commit] r66986 - in /branches/SuSE-Code-11-SP2-Branch/storage: libstorage/src/ package/ storage/src/include/ storage/src/modules/
Author: aschnell Date: Tue Dec 6 14:13:27 2011 New Revision: 66986 URL: http://svn.opensuse.org/viewcvs/yast?rev=66986&view=rev Log: - add nofail for volumes using iSCSI disks (bnc#734786) Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Device.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-hd-lib.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-lvm-lib.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-raid-dialogs.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/FileSystems.ycp Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Device.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Device.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Device.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Device.h Tue Dec 6 14:13:27 2011 @@ -93,6 +93,8 @@ bool isUsedBy(UsedByType type) const; const list<UsedBy>& getUsedBy() const { return uby; } + virtual list<string> getUsing() const { return list<string>(); } + void logDifference(std::ostream& log, const Device& rhs) const; friend std::ostream& operator<<(std::ostream& s, const Device& d); Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.cc?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.cc Tue Dec 6 14:13:27 2011 @@ -503,6 +503,15 @@ } + list<string> + Dm::getUsing() const + { + list<string> ret; + ret.push_back(cont->device()); + return ret; + } + + void Dm::getInfo( DmInfo& tinfo ) const { Volume::getInfo(info.v); Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Dm.h Tue Dec 6 14:13:27 2011 @@ -85,6 +85,8 @@ static string devToTable( const string& dev ); + virtual list<string> getUsing() const; + bool equalContent(const Dm& rhs) const; void logDifference(std::ostream& log, const Dm& rhs) const; Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.cc?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.cc Tue Dec 6 14:13:27 2011 @@ -528,6 +528,15 @@ } + list<string> + Md::getUsing() const + { + list<string> ret = devs; + ret.insert(ret.end(), spare.begin(), spare.end()); + return ret; + } + + void Md::getInfo( MdInfo& tinfo ) const { Volume::getInfo(info.v); Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Md.h Tue Dec 6 14:13:27 2011 @@ -89,6 +89,8 @@ bool updateEntry(EtcMdadm* mdadm) const; + virtual list<string> getUsing() const; + protected: void computeSize(); Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.cc?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.cc Tue Dec 6 14:13:27 2011 @@ -186,6 +186,16 @@ return txt; } + + list<string> + MdPart::getUsing() const + { + list<string> ret; + ret.push_back(cont->device()); + return ret; + } + + void MdPart::getInfo( MdPartInfo& tinfo ) const { Volume::getInfo(info.v); Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPart.h Tue Dec 6 14:13:27 2011 @@ -69,6 +69,8 @@ virtual string procName() const { return nm; } virtual string sysfsPath() const; + virtual list<string> getUsing() const; + protected: const MdPartCo* co() const; Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.cc?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.cc Tue Dec 6 14:13:27 2011 @@ -1589,6 +1589,15 @@ } + list<string> + MdPartCo::getUsing() const + { + list<string> ret = devs; + ret.insert(ret.end(), spare.begin(), spare.end()); + return ret; + } + + bool MdPartCo::active = false; } Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/MdPartCo.h Tue Dec 6 14:13:27 2011 @@ -117,6 +117,8 @@ Partition* getPartition( unsigned nr, bool del ); + virtual list<string> getUsing() const; + void getInfo( storage::MdPartCoInfo& info ) const; bool equalContent( const Container& rhs ) const; Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.cc?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.cc Tue Dec 6 14:13:27 2011 @@ -571,6 +571,15 @@ } + list<string> + Partition::getUsing() const + { + list<string> ret; + ret.push_back(cont->device()); + return ret; + } + + void Partition::getInfo( PartitionAddInfo& tinfo ) const { Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Partition.h Tue Dec 6 14:13:27 2011 @@ -120,6 +120,8 @@ bool operator> ( const Partition& rhs ) const { return( !(*this<=rhs) ); } + virtual list<string> getUsing() const; + protected: Region reg; Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.cc?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.cc Tue Dec 6 14:13:27 2011 @@ -819,4 +819,18 @@ setChildValue(node, "pe_free", free_pe); } + + list<string> + PeContainer::getUsing() const + { + list<string> ret; + for (list<Pv>::const_iterator it = pv.begin(); it != pv.end(); ++it) + ret.push_back(it->device); + for (list<Pv>::const_iterator it = pv_add.begin(); it != pv_add.end(); ++it) + ret.push_back(it->device); + for (list<Pv>::const_iterator it = pv_remove.begin(); it != pv_remove.end(); ++it) + ret.remove(it->device); + return ret; + } + } Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/PeContainer.h Tue Dec 6 14:13:27 2011 @@ -63,6 +63,8 @@ string getDeviceByNumber( const string& majmin ) const; + virtual list<string> getUsing() const; + protected: struct Pv { Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.cc Tue Dec 6 14:13:27 2011 @@ -1101,6 +1101,56 @@ } +int +Storage::getRecursiveUsedBy(const list<string>& devices, bool itself, list<string>& usedby_devices) +{ + y2mil("devices:" << devices); + assertInit(); + int ret = 0; + usedby_devices.clear(); + for (list<string>::const_iterator it = devices.begin(); it != devices.end(); ++it) + { + ret = getRecursiveUsedByHelper(*it, itself, usedby_devices); + if (ret != 0) + break; + } + + y2mil("ret:" << ret << " usedby_devices:" << usedby_devices); + return ret; +} + + +int +Storage::getRecursiveUsedByHelper(const string& device, bool itself, list<string>& usedby_devices) +{ + int ret = 0; + + const Device* p = findDevice(device, true); + if (p) + { + if (itself && find(usedby_devices.begin(), usedby_devices.end(), + p->device()) == usedby_devices.end()) + usedby_devices.push_back(p->device()); + + list<string> tmp = p->getUsing(); + for (list<string>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) + { + if (find(usedby_devices.begin(), usedby_devices.end(), *it) == usedby_devices.end()) + { + usedby_devices.push_back(*it); + getRecursiveUsedByHelper(*it, itself, usedby_devices); + } + } + } + else + { + ret = STORAGE_DEVICE_NOT_FOUND; + } + + return ret; +} + + void Storage::setZeroNewPartitions(bool val) { y2mil("val:" << val); Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Storage.h Tue Dec 6 14:13:27 2011 @@ -429,6 +429,9 @@ int getRecursiveUsing(const string& device, list<string>& devices); int getRecursiveUsingHelper(const string& device, list<string>& devices); + int getRecursiveUsedBy(const list<string>& device, bool itself, list<string>& usedby_devices); + int getRecursiveUsedByHelper(const string& device, bool itself, list<string>& usedby_devices); + void setZeroNewPartitions( bool val=true ); bool getZeroNewPartitions() const { return zeroNewPartitions; } Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h Tue Dec 6 14:13:27 2011 @@ -1706,6 +1706,18 @@ virtual int getRecursiveUsing(const string& device, list<string>& devices) = 0; /** + * Recursively get all devices used by devices. Containers of volumes are + * also considered as used by the devices. + * + * @param devices list of name of devices, e.g. /dev/sda1 + * @param itself whether the device itself is included in the result + * @param usedby_devices name of devices used by devices, e.g. /dev/sda + * @return zero if all is ok, a negative number to indicate an error + */ + virtual int getRecursiveUsedBy(const list<string>& devices, bool itself, + list<string>& usedby_devices) = 0; + + /** * Set handling of newly created partitions. With this flag * once can make the library overwrite start and end of newly * created partitions with zeroes. This prevents that obsolete Modified: branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes Tue Dec 6 14:13:27 2011 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Tue Dec 06 14:08:41 CET 2011 - aschnell@suse.de + +- add nofail for volumes using iSCSI disks (bnc#734786) + +------------------------------------------------------------------- Wed Nov 23 15:25:59 CET 2011 - aschnell@suse.de - add name in /dev/md/ to alt-names of partitioned RAID Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-hd-lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-hd-lib.ycp?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-hd-lib.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-hd-lib.ycp Tue Dec 6 14:13:27 2011 @@ -220,6 +220,8 @@ "cyl_count" : disk["cyl_count"]:0, "slots" : slots ]; + data["using_devices"] = [ disk_device ]; + if (DlgCreatePartition(data)) { string device = data["device"]:"error"; Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-lvm-lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-lvm-lib.ycp?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-lvm-lib.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-lvm-lib.ycp Tue Dec 6 14:13:27 2011 @@ -207,6 +207,7 @@ data["max_size_k"] = (target_map[device, "pe_free"]:0 * target_map[device, "pesize"]:0) / 1024; data["max_stripes"] = size(MergeDevices((map<string, any>) target_map[device]:$[])); + data["using_devices"] = [ device ]; symbol Commit() { Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-raid-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-raid-dialogs.ycp?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-raid-dialogs.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/ep-raid-dialogs.ycp Tue Dec 6 14:13:27 2011 @@ -188,6 +188,8 @@ integer size_k = 0; Storage::ComputeMdSize(tosymbol(raid_type), devices, size_k); data["size_k"] = size_k; + + data["using_devices"] = devices; } y2milestone("MiniWorkflowStepRaidTypeDevices data:%1 ret:%2", data, widget); Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/FileSystems.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/FileSystems.ycp?rev=66986&r1=66985&r2=66986&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/FileSystems.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/FileSystems.ycp Tue Dec 6 14:13:27 2011 @@ -1342,29 +1342,46 @@ } } - any dp = LibStorage::ContVolInfo::new("LibStorage::ContVolInfo"); string dev = part["device"]:""; - LibStorage::StorageInterface::getContVolInfo(sint, dev, dp); - integer t = LibStorage::ContVolInfo::swig_ctype_get(dp); - if( t == LibStorage::DISK() && part["mount"]:""!="/" ) + + if (part["mount"]:"" != "/") + { + boolean need_nofail = false; + + list<string> devs = part["using_devices"]:[dev]; + y2milestone("DefaultFstabOptions devs:%1", devs); + + list<string> usedby_devices = []; + if (LibStorage::StorageInterface::getRecursiveUsedBy(sint, devs, true, usedby_devices) == 0) { - any infos = LibStorage::DiskInfo::new("LibStorage::DiskInfo"); - string disk = LibStorage::ContVolInfo::swig_cdevice_get(dp); - y2milestone( "DefaultFstabOptions disk:%1", disk ); - integer r = LibStorage::StorageInterface::getDiskInfo(sint, disk, infos); - if( r==0 ) - { - integer t = LibStorage::DiskInfo::swig_transport_get(infos); - list<integer> hotpl = [ LibStorage::USB(), LibStorage::FCOE(), LibStorage::ISCSI() ]; - y2milestone( "DefaultFstabOptions transport:%1 list:%2", t, hotpl ); - if( contains( hotpl, t )) + // USB since those might actually not be present during boot + // iSCSI since the boot scripts need it + list<integer> hotplug_transports = [ LibStorage::USB(), LibStorage::ISCSI() ]; + + foreach (string usedby_device, usedby_devices, { + + any dp = LibStorage::ContVolInfo::new("LibStorage::ContVolInfo"); + if (LibStorage::StorageInterface::getContVolInfo(sint, usedby_device, dp) == 0 && + LibStorage::ContVolInfo::swig_ctype_get(dp) == LibStorage::DISK()) { - if( size(fst_default)>0 ) + string disk = LibStorage::ContVolInfo::swig_cdevice_get(dp); + any infos = LibStorage::DiskInfo::new("LibStorage::DiskInfo"); + if (LibStorage::StorageInterface::getDiskInfo(sint, disk, infos) == 0 && + contains(hotplug_transports, LibStorage::DiskInfo::swig_transport_get(infos))) + { + need_nofail = true; + } + } + }); + + if (need_nofail) + { + if (!isempty(fst_default)) fst_default = fst_default + ","; fst_default = fst_default + "nofail"; - } } } + } if( substring(fst_default,0,1)=="," ) fst_default = substring(fst_default,1); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn2.opensuse.org