Hello community, here is the log from the commit of package yast2-s390 for openSUSE:Factory checked in at 2018-03-22 12:08:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-s390 (Old) and /work/SRC/openSUSE:Factory/.yast2-s390.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-s390" Thu Mar 22 12:08:17 2018 rev:5 rq:589850 version:4.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-s390/yast2-s390.changes 2018-02-06 16:49:42.662504910 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-s390.new/yast2-s390.changes 2018-03-22 12:12:16.678273538 +0100 @@ -1,0 +2,8 @@ +Tue Mar 20 15:12:15 UTC 2018 - [email protected] + +- Improve error reporting and logging when underlying scripts + failed for DASD (bsc#1070265) +- Allow to format ECKD DASD disk only (bsc#1070265) +- 4.0.3 + +------------------------------------------------------------------- Old: ---- yast2-s390-4.0.2.tar.bz2 New: ---- yast2-s390-4.0.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-s390.spec ++++++ --- /var/tmp/diff_new_pack.s9YTIk/_old 2018-03-22 12:12:17.514243576 +0100 +++ /var/tmp/diff_new_pack.s9YTIk/_new 2018-03-22 12:12:17.522243290 +0100 @@ -17,7 +17,7 @@ Name: yast2-s390 -Version: 4.0.2 +Version: 4.0.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-s390-4.0.2.tar.bz2 -> yast2-s390-4.0.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/.rubocop.yml new/yast2-s390-4.0.3/.rubocop.yml --- old/yast2-s390-4.0.2/.rubocop.yml 2018-02-05 14:37:50.000000000 +0100 +++ new/yast2-s390-4.0.3/.rubocop.yml 2018-03-21 16:50:17.000000000 +0100 @@ -13,7 +13,7 @@ # Offense count: 6 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 640 + Max: 650 # Offense count: 30 Metrics/CyclomaticComplexity: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/package/yast2-s390.changes new/yast2-s390-4.0.3/package/yast2-s390.changes --- old/yast2-s390-4.0.2/package/yast2-s390.changes 2018-02-05 14:37:50.000000000 +0100 +++ new/yast2-s390-4.0.3/package/yast2-s390.changes 2018-03-21 16:50:17.000000000 +0100 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Tue Mar 20 15:12:15 UTC 2018 - [email protected] + +- Improve error reporting and logging when underlying scripts + failed for DASD (bsc#1070265) +- Allow to format ECKD DASD disk only (bsc#1070265) +- 4.0.3 + +------------------------------------------------------------------- Mon Feb 05 14:31:42 CET 2018 - [email protected] - added supplements for yast2-storage-ng (bsc#1070423) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/package/yast2-s390.spec new/yast2-s390-4.0.3/package/yast2-s390.spec --- old/yast2-s390-4.0.2/package/yast2-s390.spec 2018-02-05 14:37:50.000000000 +0100 +++ new/yast2-s390-4.0.3/package/yast2-s390.spec 2018-03-21 16:50:17.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-s390 -Version: 4.0.2 +Version: 4.0.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/src/include/s390/dasd/dialogs.rb new/yast2-s390-4.0.3/src/include/s390/dasd/dialogs.rb --- old/yast2-s390-4.0.2/src/include/s390/dasd/dialogs.rb 2018-02-05 14:37:50.000000000 +0100 +++ new/yast2-s390-4.0.3/src/include/s390/dasd/dialogs.rb 2018-03-21 16:50:17.000000000 +0100 @@ -306,18 +306,26 @@ [id, "resource", "io", 0, "mode"], "ro" ) + channel = Ops.get_string(DASDController.devices, [id, "channel"], "") if !active # error report, %1 is device identification problem = Builtins.sformat( _("Disk %1 is not active."), - Ops.get_string(DASDController.devices, [id, "channel"], "") + channel ) elsif access != "rw" # error report, %1 is device identification problem = Builtins.sformat( _("Disk %1 is not accessible for writing."), - Ops.get_string(DASDController.devices, [id, "channel"], "") + channel ) + elsif !DASDController.can_be_formatted?(DASDController.devices[id]) + problem = + # TRANSLATORS %s is device idetification + format( + _("Disk %s cannot be formatted. Only ECKD disks can be formatted."), + channel + ) end end if !Builtins.isempty(problem) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/src/modules/DASDController.rb new/yast2-s390-4.0.3/src/modules/DASDController.rb --- old/yast2-s390-4.0.2/src/modules/DASDController.rb 2018-02-05 14:37:50.000000000 +0100 +++ new/yast2-s390-4.0.3/src/modules/DASDController.rb 2018-03-21 16:50:17.000000000 +0100 @@ -29,6 +29,7 @@ # Representation of the configuration of controller. # Input and output routines. require "yast" +require "shellwords" module Yast class DASDControllerClass < Module @@ -116,6 +117,19 @@ true end + # Returns if device can be formatted + # + # @param [Hash] device one of the #devices values + # @return [Boolean] + def can_be_formatted?(device) + device_name = device["dev_name"] || GetDeviceName(device["channel"]) + command = "/sbin/dasdview --extended #{device_name.shellescape}" + res = SCR.Execute(path(".target.bash_output"), command) + Builtins.y2milestone("Command %1 result in %2", command, res) + # allow to format only ECKD bsc#1070265 + !res["stdout"].lines.grep(/^type\s.*ECKD/).empty? + end + # Write all controller settings # @return true on success def Write @@ -136,11 +150,22 @@ format = true to_reactivate << device end + device_name = device["dev_name"] || GetDeviceName(channel) if format - to_format << (device["dev_name"] || GetDeviceName(channel)) - # unformtted disk, manual (not AutoYaST) + if can_be_formatted?(device) + to_format << device_name + else + Report.Error( + # TRANSLATORS %s is device name + format( + _("Cannot format device '%s'. Only ECKD disks can be formatted."), + device_name + ) + ) + end + # unformatted disk, manual (not AutoYaST) elsif act_ret == 8 - unformatted_devices << (device["dev_name"] || GetDeviceName(channel)) + unformatted_devices << device_name end end @@ -373,7 +398,7 @@ scr_out = Convert.to_map( SCR.Execute( path(".target.bash_output"), - Builtins.sformat("dasdview --extended '%1' | grep formatted", device) + Builtins.sformat("/sbin/dasdview --extended '%1' | grep formatted", device) ) ) formatted = false @@ -434,9 +459,9 @@ # Report error occured during device activation # @param [String] channel string channel of the device - # @param [Fixnum] ret integer exit code of the operation + # @param [Hash] ret output of bash_output agent run def ReportActivationError(channel, ret) - case ret + case ret["exit"] when 0 when 1 @@ -511,9 +536,11 @@ Report.Error( Builtins.sformat( # error report, %1 is device identification, %2 is integer code - _("%1: Unknown error %2."), + _("%1: Unknown error %2.\nstderr:%3\nstdout:%4"), channel, - ret + ret["exit"], + ret["stderr"], + ret["stdout"] ) ) end @@ -533,17 +560,18 @@ diag ? 1 : 0 ) Builtins.y2milestone("Running command \"%1\"", command) - ret = Convert.to_integer(SCR.Execute(path(".target.bash"), command)) + ret = SCR.Execute(path(".target.bash_output"), command) Builtins.y2milestone( - "Command \"%1\" returned with exit code %2", + "Command \"%1\" returned %2", command, ret ) - if ret == 8 + case ret["exit"] + when 8 # unformatted disk is now handled now outside this function # however, don't issue any error - elsif ret == 7 + when 7 # when return code is 7, set DASD offline # https://bugzilla.novell.com/show_bug.cgi?id=561876#c9 DeactivateDisk(channel, diag) @@ -553,7 +581,7 @@ @disk_configured = true - ret + ret["exit"] end # Deactivate disk @@ -567,7 +595,7 @@ diag ? 1 : 0 ) Builtins.y2milestone("Running command \"%1\"", command) - ret = Convert.to_integer(SCR.Execute(path(".target.bash"), command)) + ret = SCR.Execute(path(".target.bash_output"), command) Builtins.y2milestone( "Command \"%1\" returned with exit code %2", command, @@ -648,8 +676,9 @@ # error report, %1 is exit code of the command (integer) Report.Error( Builtins.sformat( - _("Disks formatting failed. Exit code: %1."), - iret2 + _("Disks formatting failed. Exit code: %1.\nError output:%2"), + iret2, + stderr_from_proccess ) ) return @@ -742,9 +771,10 @@ UI.CloseDialog iret = Convert.to_integer(SCR.Read(path(".process.status"), process_id)) if iret != 0 - # error report, %1 is exit code of the command (integer) + # error report, %1 is exit code of the command (integer), %2 output of command Report.Error( - Builtins.sformat(_("Disks formatting failed. Exit code: %1."), iret) + Builtins.sformat(_("Disks formatting failed. Exit code: %1.\nError output: %2"), + iret, stderr_from_proccess) ) end @@ -811,6 +841,19 @@ publish function: :Summary, type: "list <string> ()" publish function: :AutoPackages, type: "map ()" publish function: :IsAvailable, type: "boolean ()" + + private + + def stderr_from_proccess + stderr = "" + loop do + line = SCR.Read(path(".process.read_line_stderr")) + break unless line + stderr << line + end + + stderr + end end DASDController = DASDControllerClass.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/test/dasd_controller_test.rb new/yast2-s390-4.0.3/test/dasd_controller_test.rb --- old/yast2-s390-4.0.2/test/dasd_controller_test.rb 2018-02-05 14:37:50.000000000 +0100 +++ new/yast2-s390-4.0.3/test/dasd_controller_test.rb 2018-03-21 16:50:17.000000000 +0100 @@ -5,6 +5,8 @@ Yast.import "DASDController" describe "Yast::DASDController" do + subject { Yast::DASDController } + describe "#IsAvailable" do it "returns true if .probe.disk contains DASDs" do expect(Yast::SCR).to receive(:Read).with(Yast.path(".probe.disk")).once @@ -14,10 +16,15 @@ end describe "#Write" do - it "writes the dasd settings to the target (formating disks)" do - # bnc 928388 - data = { "devices" => [{ "channel" => "0.0.0100", "diag" => false, - "format" => true }], "format_unformatted" => true } + let(:data) do + { "devices" => [{ "channel" => "0.0.0100", "diag" => false, + "format" => true }], "format_unformatted" => true } + end + + before do + allow(Yast::SCR).to receive(:Execute).with(path(".target.bash_output"), + /\/sbin\/dasdview/) + .and_return("exitstatus" => 0, "stdout" => load_file("dasdview_eckd.txt"), "stderr" => "") allow(Yast::Mode).to receive(:normal).and_return(false) allow(Yast::Mode).to receive(:installation).and_return(true) @@ -25,12 +32,111 @@ # speed up the test a bit allow(Yast::Builtins).to receive(:sleep) allow(Yast::DASDController).to receive(:ActivateDisk).and_return(0) - expect(Yast::DASDController).to receive(:GetDeviceName).and_return("/dev/dasda") - expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".process.start_shell"), + allow(Yast::DASDController).to receive(:GetDeviceName).and_return("/dev/dasda") + end + + it "writes the dasd settings to the target (formating disks)" do + # bnc 928388 + expect(Yast::SCR).to receive(:Execute).with(path(".process.start_shell"), "/sbin/dasdfmt -Y -P 1 -b 4096 -y -r 10 -m 10 -f '/dev/dasda'") expect(Yast::DASDController.Import(data)).to eq(true) expect(Yast::DASDController.Write).to eq(true) end + + it "does not format disk for FBA disk" do + allow(Yast::SCR).to receive(:Execute).with(path(".target.bash_output"), + /\/sbin\/dasdview/) + .and_return("exitstatus" => 0, "stdout" => load_file("dasdview_fba.txt"), "stderr" => "") + + expect(Yast::SCR).to_not receive(:Execute).with(path(".process.start_shell"), + /dasdfmt.*\/dev\/dasda/) + + expect(Yast::DASDController.Import(data)).to eq(true) + expect(Yast::DASDController.Write).to eq(true) + end + end + + describe "#ProbeDisks" do + let(:disks) { [disk] } + + let(:disk) do + { + "device" => "DASD", + "sysfs_bus_id" => "0.0.0150", + "resource" => { + "io" => [] + } + } + end + + before do + allow(Yast::SCR).to receive(:Read).with(path(".probe.disk")).and_return(disks) + end + + context "there is non-dasd disk" do + let(:disk) do + { + "device" => "ZFCP", + "sysfs_bus_id" => "0.0.0150", + "resource" => { + "io" => [] + } + } + end + + it "is not added to devices" do + subject.ProbeDisks + + expect(subject.devices).to be_empty + end + end + + context "there is not activated dasd disk" do + let(:disk) do + { + "device" => "DASD", + "sysfs_bus_id" => "0.0.0150", + "resource" => { + "io" => [] + } + } + end + + it "is added to devices with channel entry" do + subject.ProbeDisks + + expect(subject.devices.size).to eq 1 + expect(subject.devices.values.first["channel"]).to eq "0.0.0150" + end + end + + context "there is activated dasd disk" do + let(:disk) do + { + "device" => "DASD", + "dev_name" => "/dev/dasda", + "sysfs_bus_id" => "0.0.0150", + "resource" => { + "io" => ["active" => true] + } + } + end + + before do + allow(Yast::FileUtils).to receive(:Exists).and_return(false) + end + + it "is added to devices with formatted info" do + allow(Yast::SCR).to receive(:Execute).with(path(".target.bash_output"), + /\/sbin\/dasdview/) + .and_return("exitstatus" => 0, "stdout" => load_file("dasdview_unformatted.txt"), "stderr" => "") + + subject.ProbeDisks + + expect(subject.devices.size).to eq 1 + expect(subject.devices.values.first["formatted"]).to eq false + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/test/data/dasdview_eckd.txt new/yast2-s390-4.0.3/test/data/dasdview_eckd.txt --- old/yast2-s390-4.0.2/test/data/dasdview_eckd.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-s390-4.0.3/test/data/dasdview_eckd.txt 2018-03-21 16:50:17.000000000 +0100 @@ -0,0 +1,52 @@ + +--- general DASD information -------------------------------------------------- +device node : /dev/dasdg +busid : 0.0.0200 +type : ECKD +device type : hex 3390 dec 13200 + +--- DASD geometry ------------------------------------------------------------- +number of cylinders : hex 826e dec 33390 +tracks per cylinder : hex f dec 15 +blocks per track : hex c dec 12 +blocksize : hex 1000 dec 4096 + +--- extended DASD information ------------------------------------------------- +real device number : hex 0 dec 0 +subchannel identifier : hex c dec 12 +CU type (SenseID) : hex 3990 dec 14736 +CU model (SenseID) : hex e9 dec 233 +device type (SenseID) : hex 3390 dec 13200 +device model (SenseID) : hex c dec 12 +open count : hex 1 dec 1 +req_queue_len : hex 0 dec 0 +chanq_len : hex 0 dec 0 +status : hex 5 dec 5 +label_block : hex 2 dec 2 +FBA_layout : hex 0 dec 0 +characteristics_size : hex 40 dec 64 +confdata_size : hex 100 dec 256 +format : hex 2 dec 2 CDL formatted +features : hex 0 dec 0 default + +characteristics : 3990e933 900c5e8c 1ff72032 826e000f + e000e5a2 05940222 13090674 00000000 + 00000000 00000000 32321502 dfee0001 + 0677080f 007f4800 1f3c0000 0000826e + +configuration_data : dc010100 f0f0f2f1 f0f7f9f0 f0c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f1025a + 40000004 00000000 00000000 0000826d + 00000000 00000000 00000000 00000000 + d4020000 f0f0f2f1 f0f7f9f3 f1c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f10200 + d0000000 f0f0f2f1 f0f7f9f3 f1c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f00200 + f0000001 f0f0f2f1 f0f7f9f0 f0c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f10200 + 00000000 00000000 00000000 00000000 + 00000000 00000000 00000000 00000000 + 00000000 00000000 00000000 00000000 + 00000000 00000000 00000000 00000000 + 80000203 2d001e00 0002003e 0000020b + 000cc05a 6ca327e7 02030000 0000a000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/test/data/dasdview_fba.txt new/yast2-s390-4.0.3/test/data/dasdview_fba.txt --- old/yast2-s390-4.0.2/test/data/dasdview_fba.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-s390-4.0.3/test/data/dasdview_fba.txt 2018-03-21 16:50:17.000000000 +0100 @@ -0,0 +1,34 @@ + +--- general DASD information -------------------------------------------------- +device node : /dev/dasdh +busid : 0.0.ffff +type : FBA +device type : hex 9336 dec 37686 + +--- DASD geometry ------------------------------------------------------------- +number of cylinders : hex 309 dec 777 +tracks per cylinder : hex 10 dec 16 +blocks per track : hex 80 dec 128 +blocksize : hex 200 dec 512 + +--- extended DASD information ------------------------------------------------- +real device number : hex 0 dec 0 +subchannel identifier : hex 1b dec 27 +CU type (SenseID) : hex 6310 dec 25360 +CU model (SenseID) : hex 80 dec 128 +device type (SenseID) : hex 9336 dec 37686 +device model (SenseID) : hex 10 dec 16 +open count : hex 1 dec 1 +req_queue_len : hex 0 dec 0 +chanq_len : hex 0 dec 0 +status : hex 5 dec 5 +label_block : hex 1 dec 1 +FBA_layout : hex 1 dec 1 +characteristics_size : hex 20 dec 32 +confdata_size : hex 0 dec 0 +format : hex 1 dec 1 LDL formatted +features : hex 0 dec 0 default + +characteristics : 30082111 02000000 006f0000 03090003 + 0d400000 00000000 00000000 00000000 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/test/data/dasdview_unformatted.txt new/yast2-s390-4.0.3/test/data/dasdview_unformatted.txt --- old/yast2-s390-4.0.2/test/data/dasdview_unformatted.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-s390-4.0.3/test/data/dasdview_unformatted.txt 2018-03-21 16:50:17.000000000 +0100 @@ -0,0 +1,52 @@ + +--- general DASD information -------------------------------------------------- +device node : /dev/dasde +busid : 0.0.0150 +type : ECKD +device type : hex 3390 dec 13200 + +--- DASD geometry ------------------------------------------------------------- +number of cylinders : hex 826e dec 33390 +tracks per cylinder : hex f dec 15 +blocks per track : hex 0 dec 0 +blocksize : hex 1000 dec 4096 + +--- extended DASD information ------------------------------------------------- +real device number : hex 0 dec 0 +subchannel identifier : hex b dec 11 +CU type (SenseID) : hex 3990 dec 14736 +CU model (SenseID) : hex e9 dec 233 +device type (SenseID) : hex 3390 dec 13200 +device model (SenseID) : hex c dec 12 +open count : hex 1 dec 1 +req_queue_len : hex 0 dec 0 +chanq_len : hex 0 dec 0 +status : hex 3 dec 3 +label_block : hex 2 dec 2 +FBA_layout : hex 0 dec 0 +characteristics_size : hex 40 dec 64 +confdata_size : hex 100 dec 256 +format : hex 0 dec 0 NOT formatted +features : hex 0 dec 0 default + +characteristics : 3990e933 900c5e8c 1ff72032 826e000f + e000e5a2 05940222 13090674 00000000 + 00000000 00000000 32321502 dfee0001 + 0677080f 007f4800 1f3c0000 0000826e + +configuration_data : dc010100 f0f0f2f1 f0f7f9f0 f0c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f1000f + 40000004 00000000 00000000 0000826d + 00000000 00000000 00000000 00000000 + d4020000 f0f0f2f1 f0f7f9f3 f1c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f10000 + d0000000 f0f0f2f1 f0f7f9f3 f1c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f00000 + f0000001 f0f0f2f1 f0f7f9f0 f0c9c2d4 + f7f5f0f0 f0f0f0f0 f0d3f2f3 f7f10000 + 00000000 00000000 00000000 00000000 + 00000000 00000000 00000000 00000000 + 00000000 00000000 00000000 00000000 + 00000000 00000000 00000000 00000000 + 80000203 2d001e00 0001003f 0000020b + 000cc00f b635d510 02030000 0000a000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.2/test/test_helper.rb new/yast2-s390-4.0.3/test/test_helper.rb --- old/yast2-s390-4.0.2/test/test_helper.rb 2018-02-05 14:37:50.000000000 +0100 +++ new/yast2-s390-4.0.3/test/test_helper.rb 2018-03-21 16:50:17.000000000 +0100 @@ -43,6 +43,10 @@ end def load_data(name) + YAML.load(load_file(name)) +end + +def load_file(name) path = File.join(File.dirname(__FILE__), "data", name) - YAML.load(File.read(path)) + File.read(path) end
