Hello community, here is the log from the commit of package libstorage-ng for openSUSE:Factory checked in at 2018-07-01 21:24:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Sun Jul 1 21:24:51 2018 rev:26 rq:619192 version:3.3.312 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2018-06-19 11:53:29.884677545 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new/libstorage-ng.changes 2018-07-01 21:24:54.264884951 +0200 @@ -1,0 +2,18 @@ +Tue Jun 26 15:54:45 UTC 2018 - [email protected] + +- merge gh#openSUSE/libstorage-ng#540 +- do not use deprecated header file +- coding style +- 3.3.312 + +-------------------------------------------------------------------- +Wed Jun 20 13:19:36 UTC 2018 - [email protected] + +- merge gh#openSUSE/libstorage-ng#539 +- handle device type attribute of udevadm info output +- removed unused and obsolete file +- do not try to activate LUKS on devices used by multipath (bsc#1089699) +- improved explanation +- 3.3.311 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-3.3.310.tar.xz New: ---- libstorage-ng-3.3.312.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.yS6pT1/_old 2018-07-01 21:24:54.640884462 +0200 +++ /var/tmp/diff_new_pack.yS6pT1/_new 2018-07-01 21:24:54.644884456 +0200 @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 3.3.310 +Version: 3.3.312 Release: 0 Summary: Library for storage management License: GPL-2.0 ++++++ libstorage-ng-3.3.310.tar.xz -> libstorage-ng-3.3.312.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/VERSION new/libstorage-ng-3.3.312/VERSION --- old/libstorage-ng-3.3.310/VERSION 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/VERSION 2018-06-26 17:54:45.000000000 +0200 @@ -1 +1 @@ -3.3.310 +3.3.312 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/Devices/LuksImpl.cc new/libstorage-ng-3.3.312/storage/Devices/LuksImpl.cc --- old/libstorage-ng-3.3.310/storage/Devices/LuksImpl.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/Devices/LuksImpl.cc 2018-06-26 17:54:45.000000000 +0200 @@ -214,12 +214,13 @@ if (!key_value1.second.is_luks) continue; - // major and minor of the device holding the luks - dev_t majorminor = system_info.getCmdUdevadmInfo(key_value1.first).get_majorminor(); + // Check whether the block device has holders (as reported in + // /sys by the kernel). In that case it is either already + // activated (the LUKS is already opened) or it is used by + // something else, e.g. multipath. In any case it must be + // skipped. - const CmdDmsetupTable& dmsetup_table = system_info.getCmdDmsetupTable(); - CmdDmsetupTable::const_iterator it = dmsetup_table.find_using(majorminor); - if (it != dmsetup_table.end()) + if (has_kernel_holders(key_value1.first, system_info)) continue; y2mil("inactive luks name:" << key_value1.first << " uuid:" << diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/Devices/MdImpl.cc new/libstorage-ng-3.3.312/storage/Devices/MdImpl.cc --- old/libstorage-ng-3.3.310/storage/Devices/MdImpl.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/Devices/MdImpl.cc 2018-06-26 17:54:45.000000000 +0200 @@ -22,7 +22,7 @@ #include <ctype.h> -#include <boost/math/common_factor_rt.hpp> +#include <boost/integer/common_factor_rt.hpp> #include "storage/Devices/MdImpl.h" #include "storage/Devices/MdContainerImpl.h" @@ -190,8 +190,8 @@ unsigned long long tmp = 1 * KiB; for (const BlkDevice* blk_device : get_devices()) { - tmp = boost::math::lcm(tmp, (unsigned long long) - blk_device->get_region().get_block_size()); + tmp = boost::integer::lcm(tmp, (unsigned long long) + blk_device->get_region().get_block_size()); } if (!is_multiple_of(chunk_size, tmp)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/Filesystems/VfatImpl.cc new/libstorage-ng-3.3.312/storage/Filesystems/VfatImpl.cc --- old/libstorage-ng-3.3.310/storage/Filesystems/VfatImpl.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/Filesystems/VfatImpl.cc 2018-06-26 17:54:45.000000000 +0200 @@ -111,7 +111,7 @@ const BlkDevice* blk_device = get_blk_device(); const BlkDevice* blk_device_rhs = to_vfat(rhs)->get_impl().get_blk_device(); - string cmd_line = FATRESIZE " " + quote(blk_device->get_name()); + string cmd_line = FATRESIZEBIN " " + quote(blk_device->get_name()); if (resize_mode == ResizeMode::SHRINK) cmd_line += " " + to_string(blk_device_rhs->get_size() / KiB); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/FreeInfo.cc new/libstorage-ng-3.3.312/storage/FreeInfo.cc --- old/libstorage-ng-3.3.310/storage/FreeInfo.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/FreeInfo.cc 2018-06-26 17:54:45.000000000 +0200 @@ -22,7 +22,7 @@ #include <limits> -#include <boost/math/common_factor_rt.hpp> +#include <boost/integer/common_factor_rt.hpp> #include "storage/Utils/HumanString.h" #include "storage/Utils/XmlFile.h" @@ -110,7 +110,7 @@ void ResizeInfo::combine_block_size(unsigned long long extra_block_size) { - block_size = boost::math::lcm(block_size, extra_block_size); + block_size = boost::integer::lcm(block_size, extra_block_size); check(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/SystemInfo/CmdUdevadm.cc new/libstorage-ng-3.3.312/storage/SystemInfo/CmdUdevadm.cc --- old/libstorage-ng-3.3.310/storage/SystemInfo/CmdUdevadm.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/SystemInfo/CmdUdevadm.cc 2018-06-26 17:54:45.000000000 +0200 @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 Novell, Inc. + * Copyright (c) 2018 SUSE LLC * * All Rights Reserved. * @@ -35,8 +36,14 @@ using namespace std; + const vector<string> EnumTraits<CmdUdevadmInfo::DeviceType>::names({ + "unknown", "disk", "partition" + }); + + CmdUdevadmInfo::CmdUdevadmInfo(const string& file) - : file(file), path(), name(), majorminor(0), by_path_links(), by_id_links() + : file(file), path(), name(), majorminor(0), device_type(DeviceType::UNKNOWN), + by_path_links(), by_id_links() { // Without emptying the udev queue 'udevadm info' can display old data // or even complain about unknown devices. Even during probing this @@ -71,6 +78,9 @@ if (boost::starts_with(line, "E: MINOR=")) line.substr(9) >> minor; + if (boost::starts_with(line, "E: DEVTYPE=")) + device_type = toValueWithFallback(line.substr(11), DeviceType::UNKNOWN); + if (boost::starts_with(line, "S: disk/by-path/")) by_path_links.push_back(line.substr(16)); @@ -92,7 +102,8 @@ { s << "file:" << cmdudevadminfo.file << " path:" << cmdudevadminfo.get_path() << " name:" << cmdudevadminfo.get_name() << " majorminor:" - << cmdudevadminfo.get_major() << ":" << cmdudevadminfo.get_minor(); + << cmdudevadminfo.get_major() << ":" << cmdudevadminfo.get_minor() + << " device-type:" << toString(cmdudevadminfo.get_device_type()); if (!cmdudevadminfo.by_path_links.empty()) s << " by-path-links:" << cmdudevadminfo.by_path_links; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/SystemInfo/CmdUdevadm.h new/libstorage-ng-3.3.312/storage/SystemInfo/CmdUdevadm.h --- old/libstorage-ng-3.3.310/storage/SystemInfo/CmdUdevadm.h 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/SystemInfo/CmdUdevadm.h 2018-06-26 17:54:45.000000000 +0200 @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 Novell, Inc. + * Copyright (c) 2018 SUSE LLC * * All Rights Reserved. * @@ -27,6 +28,8 @@ #include <string> #include <vector> +#include "storage/Utils/Enum.h" + namespace storage { @@ -39,6 +42,8 @@ public: + enum class DeviceType { UNKNOWN, DISK, PARTITION }; + CmdUdevadmInfo(const string& file); const string& get_path() const { return path; } @@ -48,6 +53,8 @@ unsigned int get_major() const { return gnu_dev_major(majorminor); } unsigned int get_minor() const { return gnu_dev_minor(majorminor); } + DeviceType get_device_type() const { return device_type; } + const vector<string>& get_by_path_links() const { return by_path_links; } const vector<string>& get_by_id_links() const { return by_id_links; } @@ -64,11 +71,15 @@ dev_t majorminor; + DeviceType device_type; + vector<string> by_path_links; vector<string> by_id_links; }; + template <> struct EnumTraits<CmdUdevadmInfo::DeviceType> { static const vector<string> names; }; + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/Utils/AlignmentImpl.cc new/libstorage-ng-3.3.312/storage/Utils/AlignmentImpl.cc --- old/libstorage-ng-3.3.310/storage/Utils/AlignmentImpl.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/Utils/AlignmentImpl.cc 2018-06-26 17:54:45.000000000 +0200 @@ -20,7 +20,7 @@ */ -#include <boost/math/common_factor_rt.hpp> +#include <boost/integer/common_factor_rt.hpp> #include "storage/Utils/AlignmentImpl.h" #include "storage/Utils/ExceptionImpl.h" @@ -50,7 +50,7 @@ } if (extra_grain > 0) - grain = boost::math::lcm(grain, extra_grain); + grain = boost::integer::lcm(grain, extra_grain); return grain; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/Utils/AppUtil.cc new/libstorage-ng-3.3.312/storage/Utils/AppUtil.cc --- old/libstorage-ng-3.3.310/storage/Utils/AppUtil.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/Utils/AppUtil.cc 2018-06-26 17:54:45.000000000 +0200 @@ -42,7 +42,7 @@ #include "storage/Utils/StorageDefines.h" #include "storage/Utils/AppUtil.h" #include "storage/Utils/StorageTypes.h" -#include "storage/SystemInfo/Arch.h" +#include "storage/SystemInfo/SystemInfo.h" #include "storage/Utils/LoggerImpl.h" @@ -175,6 +175,28 @@ } + bool + has_kernel_holders(const string& name, SystemInfo& system_info) + { + const CmdUdevadmInfo& cmd_udevadm_info = system_info.getCmdUdevadmInfo(name); + + string sysfs_path = cmd_udevadm_info.get_path(); + + if (!system_info.getDir(SYSFS_DIR + sysfs_path + "/holders").empty()) + return true; + + if (cmd_udevadm_info.get_device_type() == CmdUdevadmInfo::DeviceType::PARTITION) + { + sysfs_path = dirname(sysfs_path); + + if (!system_info.getDir(SYSFS_DIR + sysfs_path + "/holders").empty()) + return true; + } + + return false; + } + + string extractNthWord(int Num_iv, const string& Line_Cv, bool GetRest_bi) { string::size_type pos; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/Utils/AppUtil.h new/libstorage-ng-3.3.312/storage/Utils/AppUtil.h --- old/libstorage-ng-3.3.310/storage/Utils/AppUtil.h 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/Utils/AppUtil.h 2018-06-26 17:54:45.000000000 +0200 @@ -45,6 +45,7 @@ using std::regex; class Arch; + class SystemInfo; void createPath(const string& Path_Cv); @@ -72,6 +73,12 @@ StatVfs detect_stat_vfs(const string& path); + /** + * Check if the block device has holders as reported by the kernel in + * /sys. If the block device is a partition the disk is also check for + * holders. + */ + bool has_kernel_holders(const string& name, SystemInfo& system_info); string extractNthWord(int Num_iv, const string& Line_Cv, bool GetRest_bi = false); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/storage/Utils/StorageDefines.h new/libstorage-ng-3.3.312/storage/Utils/StorageDefines.h --- old/libstorage-ng-3.3.310/storage/Utils/StorageDefines.h 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/storage/Utils/StorageDefines.h 2018-06-26 17:54:45.000000000 +0200 @@ -111,7 +111,7 @@ #define XFSGROWFSBIN "/usr/sbin/xfs_growfs" #define REISERFSRESIZEBIN "/sbin/resize_reiserfs" #define EXT2RESIZEBIN "/sbin/resize2fs" -#define FATRESIZE "/usr/sbin/fatresize" +#define FATRESIZEBIN "/usr/sbin/fatresize" #define TUNE2FSBIN "/sbin/tune2fs" #define TUNEREISERFSBIN "/sbin/reiserfstune" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/testsuite/SystemInfo/udevadm-info.cc new/libstorage-ng-3.3.312/testsuite/SystemInfo/udevadm-info.cc --- old/libstorage-ng-3.3.310/testsuite/SystemInfo/udevadm-info.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/testsuite/SystemInfo/udevadm-info.cc 2018-06-26 17:54:45.000000000 +0200 @@ -38,6 +38,94 @@ BOOST_AUTO_TEST_CASE(parse1) { vector<string> input = { + "P: /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda", + "N: sda", + "S: disk/by-id/ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683", + "S: disk/by-id/scsi-0ATA_WDC_WD10EADS-00M_WD-WCAV52321683", + "S: disk/by-id/scsi-1ATA_WDC_WD10EADS-00M2B0_WD-WCAV52321683", + "S: disk/by-id/scsi-350014ee203733bb5", + "S: disk/by-id/scsi-SATA_WDC_WD10EADS-00M_WD-WCAV52321683", + "S: disk/by-id/wwn-0x50014ee203733bb5", + "S: disk/by-path/pci-0000:00:1f.2-ata-1", + "E: DEVLINKS=/dev/disk/by-id/ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683 /dev/disk/by-path/pci-0000:00:1f.2-ata-1 /dev/disk/by-id/wwn-0x50014ee203733bb5 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00M_WD-WCAV52321683 /dev/disk/by-id/scsi-0ATA_WDC_WD10EADS-00M_WD-WCAV52321683 /dev/disk/by-id/scsi-1ATA_WDC_WD10EADS-00M2B0_WD-WCAV52321683 /dev/disk/by-id/scsi-350014ee203733bb5", + "E: DEVNAME=/dev/sda", + "E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda", + "E: DEVTYPE=disk", + "E: DONT_DEL_PART_NODES=1", + "E: ID_ATA=1", + "E: ID_ATA_DOWNLOAD_MICROCODE=1", + "E: ID_ATA_FEATURE_SET_AAM=1", + "E: ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=254", + "E: ID_ATA_FEATURE_SET_AAM_ENABLED=0", + "E: ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=128", + "E: ID_ATA_FEATURE_SET_HPA=1", + "E: ID_ATA_FEATURE_SET_HPA_ENABLED=1", + "E: ID_ATA_FEATURE_SET_PM=1", + "E: ID_ATA_FEATURE_SET_PM_ENABLED=1", + "E: ID_ATA_FEATURE_SET_PUIS=1", + "E: ID_ATA_FEATURE_SET_PUIS_ENABLED=0", + "E: ID_ATA_FEATURE_SET_SECURITY=1", + "E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0", + "E: ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=216", + "E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=216", + "E: ID_ATA_FEATURE_SET_SECURITY_FROZEN=1", + "E: ID_ATA_FEATURE_SET_SMART=1", + "E: ID_ATA_FEATURE_SET_SMART_ENABLED=1", + "E: ID_ATA_SATA=1", + "E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1", + "E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1", + "E: ID_ATA_WRITE_CACHE=1", + "E: ID_ATA_WRITE_CACHE_ENABLED=1", + "E: ID_BUS=ata", + "E: ID_MODEL=WDC_WD10EADS-00M2B0", + "E: ID_MODEL_ENC=WDC\x20WD10EADS-00M2B0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20", + "E: ID_PART_TABLE_TYPE=dos", + "E: ID_PART_TABLE_UUID=000c0a5a", + "E: ID_PATH=pci-0000:00:1f.2-ata-1", + "E: ID_PATH_TAG=pci-0000_00_1f_2-ata-1", + "E: ID_REVISION=01.00A01", + "E: ID_SCSI=1", + "E: ID_SCSI_INQUIRY=1", + "E: ID_SERIAL=WDC_WD10EADS-00M2B0_WD-WCAV52321683", + "E: ID_SERIAL_SHORT=WD-WCAV52321683", + "E: ID_TYPE=disk", + "E: ID_VENDOR=ATA", + "E: ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20", + "E: ID_WWN=0x50014ee203733bb5", + "E: ID_WWN_WITH_EXTENSION=0x50014ee203733bb5", + "E: MAJOR=8", + "E: MINOR=0", + "E: MPATH_SBIN_PATH=/sbin", + "E: SCSI_IDENT_LUN_ATA=WDC_WD10EADS-00M2B0_WD-WCAV52321683", + "E: SCSI_IDENT_LUN_NAA_REG=50014ee203733bb5", + "E: SCSI_IDENT_LUN_T10=ATA_WDC_WD10EADS-00M2B0_WD-WCAV52321683", + "E: SCSI_IDENT_LUN_VENDOR=WD-WCAV52321683", + "E: SCSI_IDENT_SERIAL=WD-WCAV52321683", + "E: SCSI_MODEL=WDC_WD10EADS-00M", + "E: SCSI_MODEL_ENC=WDC\x20WD10EADS-00M", + "E: SCSI_REVISION=0A01", + "E: SCSI_TPGS=0", + "E: SCSI_TYPE=disk", + "E: SCSI_VENDOR=ATA", + "E: SCSI_VENDOR_ENC=ATA\x20\x20\x20\x20\x20", + "E: SUBSYSTEM=block", + "E: TAGS=:systemd:", + "E: USEC_INITIALIZED=30039765", + "E: elevator=cfq", + "" + }; + + vector<string> output = { + "file:/dev/sda path:/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda name:sda majorminor:8:0 device-type:disk by-path-links:<pci-0000:00:1f.2-ata-1> by-id-links:<ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683 scsi-0ATA_WDC_WD10EADS-00M_WD-WCAV52321683 scsi-1ATA_WDC_WD10EADS-00M2B0_WD-WCAV52321683 scsi-350014ee203733bb5 scsi-SATA_WDC_WD10EADS-00M_WD-WCAV52321683 wwn-0x50014ee203733bb5>" + }; + + check("/dev/sda", input, output); +} + + +BOOST_AUTO_TEST_CASE(parse2) +{ + vector<string> input = { "P: /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1", "N: sda1", "S: disk/by-id/ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683-part1", @@ -106,11 +194,11 @@ "E: SUBSYSTEM=block", "E: TAGS=:systemd:", "E: USEC_INITIALIZED=759018", - "", + "" }; vector<string> output = { - "file:/dev/sda1 path:/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1 name:sda1 majorminor:8:1 by-path-links:<pci-0000:00:1f.2-ata-1.0-part1> by-id-links:<ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683-part1 scsi-0ATA_WDC_WD10EADS-00M_WD-WCAV52321683-part1 scsi-1ATA_WDC_WD10EADS-00M2B0_WD-WCAV52321683-part1 scsi-350014ee203733bb5-part1 scsi-SATA_WDC_WD10EADS-00M_WD-WCAV52321683-part1 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683-part1 wwn-0x50014ee203733bb5-part1>" + "file:/dev/sda1 path:/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1 name:sda1 majorminor:8:1 device-type:partition by-path-links:<pci-0000:00:1f.2-ata-1.0-part1> by-id-links:<ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683-part1 scsi-0ATA_WDC_WD10EADS-00M_WD-WCAV52321683-part1 scsi-1ATA_WDC_WD10EADS-00M2B0_WD-WCAV52321683-part1 scsi-350014ee203733bb5-part1 scsi-SATA_WDC_WD10EADS-00M_WD-WCAV52321683-part1 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683-part1 wwn-0x50014ee203733bb5-part1>" }; check("/dev/sda1", input, output); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-3.3.310/testsuite/SystemInfo/udevmap.cc new/libstorage-ng-3.3.312/testsuite/SystemInfo/udevmap.cc --- old/libstorage-ng-3.3.310/testsuite/SystemInfo/udevmap.cc 2018-06-18 15:18:38.000000000 +0200 +++ new/libstorage-ng-3.3.312/testsuite/SystemInfo/udevmap.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,83 +0,0 @@ - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE libstorage - -#include <boost/test/unit_test.hpp> -#include <boost/algorithm/string.hpp> - -#include "storage/SystemInfo/DevAndSys.h" -#include "storage/Utils/Mockup.h" -#include "storage/Utils/StorageDefines.h" -#include "storage/Utils/SystemCmd.h" - - -using namespace std; -using namespace storage; - - -void -check(const string& path, const vector<string>& input, const vector<string>& output) -{ - Mockup::set_mode(Mockup::Mode::PLAYBACK); - Mockup::set_command(LSBIN " -1l --sort=none " + quote(path), input); - - UdevMap udevmap(path); - - ostringstream parsed; - parsed.setf(std::ios::boolalpha); - parsed << udevmap; - - string lhs = parsed.str(); - string rhs = boost::join(output, "\n") + "\n"; - - BOOST_CHECK_EQUAL(lhs, rhs); -} - - -BOOST_AUTO_TEST_CASE(parse1) -{ - vector<string> input = { - "total 0", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 wwn-0x50014ee203733bb5-part2 -> ../../sda2", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683-part2 -> ../../sda2", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683-part2 -> ../../sda2", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 wwn-0x50014ee203733bb5-part1 -> ../../sda1", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683-part1 -> ../../sda1", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683-part1 -> ../../sda1", - "lrwxrwxrwx 1 root root 9 Jan 13 15:10 wwn-0x50014ee203733bb5 -> ../../sda", - "lrwxrwxrwx 1 root root 9 Jan 13 15:10 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683 -> ../../sda", - "lrwxrwxrwx 1 root root 9 Jan 13 15:10 ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683 -> ../../sda" - }; - - vector<string> output = { - "path:/dev/disk/by-id", - "data[sda] -> ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683 wwn-0x50014ee203733bb5", - "data[sda1] -> ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683-part1 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683-part1 wwn-0x50014ee203733bb5-part1", - "data[sda2] -> ata-WDC_WD10EADS-00M2B0_WD-WCAV52321683-part2 scsi-SATA_WDC_WD10EADS-00_WD-WCAV52321683-part2 wwn-0x50014ee203733bb5-part2" - }; - - check("/dev/disk/by-id", input, output); -} - - -BOOST_AUTO_TEST_CASE(parse2) -{ - vector<string> input = { - "total 0", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 pci-0000:00:1f.2-ata-1.0-part2 -> ../../sda2", - "lrwxrwxrwx 1 root root 10 Jan 13 15:10 pci-0000:00:1f.2-ata-1.0-part1 -> ../../sda1", - "lrwxrwxrwx 1 root root 9 Jan 13 15:10 pci-0000:00:1f.2-ata-1.0 -> ../../sda" - }; - - vector<string> output = { - "path:/dev/disk/by-path", - "data[sda] -> pci-0000:00:1f.2-ata-1.0", - "data[sda1] -> pci-0000:00:1f.2-ata-1.0-part1", - "data[sda2] -> pci-0000:00:1f.2-ata-1.0-part2" - }; - - check("/dev/disk/by-path", input, output); -} - - -// TODO tests with strange characters in paths
