Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-iscsi-client for openSUSE:Factory checked in at 2022-05-17 17:23:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-iscsi-client (Old) and /work/SRC/openSUSE:Factory/.yast2-iscsi-client.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-iscsi-client" Tue May 17 17:23:57 2022 rev:138 rq:977556 version:4.5.3 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-iscsi-client/yast2-iscsi-client.changes 2022-04-14 17:25:21.683256090 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-iscsi-client.new.1538/yast2-iscsi-client.changes 2022-05-17 17:24:10.535156962 +0200 @@ -1,0 +2,15 @@ +Mon May 16 10:11:13 UTC 2022 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Fix a crash when opening the main dialog (bsc#1199552). +- 4.5.3 + +------------------------------------------------------------------- +Wed May 11 09:51:04 UTC 2022 - Ancor Gonzalez Sosa <an...@suse.com> + +- Internal cleanup in several parts to turn the auto-converted YCP + code into something closer to common Ruby. +- Enable iscsiuio during installation only if there is any card in + the system using the bnx2i or qedi modules (bsc#1194432). +- 4.5.2 + +------------------------------------------------------------------- Old: ---- yast2-iscsi-client-4.5.1.tar.bz2 New: ---- yast2-iscsi-client-4.5.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-iscsi-client.spec ++++++ --- /var/tmp/diff_new_pack.XJFiob/_old 2022-05-17 17:24:11.135157505 +0200 +++ /var/tmp/diff_new_pack.XJFiob/_new 2022-05-17 17:24:11.139157509 +0200 @@ -17,7 +17,7 @@ Name: yast2-iscsi-client -Version: 4.5.1 +Version: 4.5.3 Release: 0 Summary: YaST2 - iSCSI Client Configuration License: GPL-2.0-only ++++++ yast2-iscsi-client-4.5.1.tar.bz2 -> yast2-iscsi-client-4.5.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/.rubocop.yml new/yast2-iscsi-client-4.5.3/.rubocop.yml --- old/yast2-iscsi-client-4.5.1/.rubocop.yml 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/.rubocop.yml 2022-05-16 17:05:38.000000000 +0200 @@ -1,23 +1,55 @@ -# use the shared Yast defaults inherit_from: - /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml - -AllCops: - # Do not complain about safe navigation operator (&.) - TargetRubyVersion: 2.3 - -# this needs more testing if we can have frozen string literals -Style/FrozenStringLiteralComment: - Enabled: false + - /usr/share/YaST2/data/devtools/data/rubocop-1.24.1_yast_style.yml # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-11-06 09:37:19 +0100 using RuboCop version 0.41.2. +# on 2022-05-16 10:07:13 UTC using RuboCop version 1.24.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. +# Offense count: 3 +# Cop supports --auto-correct. +Layout/ClosingParenthesisIndentation: + Exclude: + - 'src/include/iscsi-client/dialogs.rb' + - 'test/iscsi_client_lib_test.rb' + +# Offense count: 17 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'src/include/iscsi-client/complex.rb' + - 'src/include/iscsi-client/widgets.rb' + - 'src/modules/IscsiClient.rb' + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Exclude: + - 'src/clients/iscsi-client_finish.rb' + - 'src/include/iscsi-client/helps.rb' + - 'src/modules/IscsiClientLib.rb' + - 'test/iscsi_client_lib_test.rb' + +# Offense count: 27 +# Cop supports --auto-correct. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 231 + +# Offense count: 4 +# Cop supports --auto-correct. +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'src/include/iscsi-client/widgets.rb' + - 'src/modules/IscsiClientLib.rb' + # Offense count: 2 # Configuration parameters: AllowSafeAssignment. Lint/AssignmentInCondition: @@ -25,65 +57,141 @@ - 'src/modules/IscsiClientLib.rb' # Offense count: 1 -Lint/LiteralInCondition: +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 1 +Lint/LiteralAsCondition: Exclude: - 'src/modules/IscsiClient.rb' -# Offense count: 26 +# Offense count: 3 +# Cop supports --auto-correct. +Lint/ScriptPermission: + Exclude: + - 'test/iscsi-client_finish_test.rb' + - 'test/iscsi_client_lib_test.rb' + - 'test/iscsi_client_test.rb' + +# Offense count: 19 Lint/UselessAssignment: Exclude: - - 'src/include/iscsi-client/dialogs.rb' - 'src/include/iscsi-client/widgets.rb' - 'src/modules/IscsiClientLib.rb' -# Offense count: 26 +# Offense count: 28 +# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: - Max: 241 + Max: 239 + +# Offense count: 1 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine +Metrics/BlockLength: + Max: 29 # Offense count: 4 +# Configuration parameters: CountBlocks. Metrics/BlockNesting: Max: 5 # Offense count: 1 -# Configuration parameters: CountComments. +# Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 1480 + Max: 1279 # Offense count: 21 +# Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 21 -# Offense count: 38 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes. -# URISchemes: http, https -Metrics/LineLength: - Max: 231 - # Offense count: 32 -# Configuration parameters: CountComments. +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: - Max: 298 + Max: 294 # Offense count: 3 -# Configuration parameters: CountComments. +# Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: - Max: 741 + Max: 738 -# Offense count: 19 +# Offense count: 21 +# Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 23 +# Offense count: 7 +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Exclude: + - 'src/clients/inst_iscsi-client.rb' + - 'src/clients/iscsi-client.rb' + - 'src/clients/iscsi-client_auto.rb' + - 'src/clients/iscsi-client_finish.rb' + - 'src/clients/iscsi-client_proposal.rb' + - 'src/modules/IscsiClient.rb' + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 1 +# Configuration parameters: ForbiddenDelimiters. +# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +Naming/HeredocDelimiterNaming: + Exclude: + - 'test/mocking.rb' + +# Offense count: 100 +# Configuration parameters: EnforcedStyle, IgnoredPatterns. +# SupportedStyles: snake_case, camelCase +Naming/MethodName: + Exclude: + - 'src/include/iscsi-client/complex.rb' + - 'src/include/iscsi-client/dialogs.rb' + - 'src/include/iscsi-client/widgets.rb' + - 'src/include/iscsi-client/wizards.rb' + - 'src/modules/IscsiClient.rb' + - 'src/modules/IscsiClientLib.rb' + # Offense count: 2 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: + Exclude: + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 5 +# Configuration parameters: EnforcedStyle, AllowedIdentifiers. +# SupportedStyles: snake_case, camelCase +Naming/VariableName: + Exclude: + - 'src/include/iscsi-client/helps.rb' + - 'src/modules/IscsiClient.rb' + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 4 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly. +Style/CaseLikeIf: + Exclude: + - 'src/clients/iscsi-client_auto.rb' + - 'src/clients/iscsi-client_finish.rb' + - 'src/clients/iscsi-client_proposal.rb' + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. # SupportedStyles: assign_to_condition, assign_inside_condition Style/ConditionalAssignment: Exclude: - 'src/clients/iscsi-client.rb' - - 'src/modules/IscsiClientLib.rb' - 'src/include/iscsi-client/widgets.rb' + - 'src/modules/IscsiClientLib.rb' # Offense count: 14 +# Configuration parameters: AllowedConstants. Style/Documentation: Exclude: - 'spec/**/*' @@ -101,29 +209,56 @@ - 'src/modules/IscsiClient.rb' - 'src/modules/IscsiClientLib.rb' -# Offense count: 7 -# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts. -Style/FileName: +# Offense count: 13 +# Cop supports --auto-correct. +Style/Encoding: Exclude: - 'src/clients/inst_iscsi-client.rb' - 'src/clients/iscsi-client.rb' - 'src/clients/iscsi-client_auto.rb' - 'src/clients/iscsi-client_finish.rb' - 'src/clients/iscsi-client_proposal.rb' + - 'src/include/iscsi-client/complex.rb' + - 'src/include/iscsi-client/dialogs.rb' + - 'src/include/iscsi-client/helps.rb' + - 'src/include/iscsi-client/widgets.rb' + - 'src/include/iscsi-client/wizards.rb' - 'src/modules/IscsiClient.rb' - 'src/modules/IscsiClientLib.rb' + - 'test/mocking.rb' -# Offense count: 2 +# Offense count: 1 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Exclude: + - 'test/test_helper.rb' + +# Offense count: 18 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 3 # Configuration parameters: MinBodyLength. Style/GuardClause: Exclude: - 'src/include/iscsi-client/widgets.rb' - 'src/modules/IscsiClientLib.rb' -# Offense count: 213 +# Offense count: 3 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. -# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets +# Configuration parameters: AllowedReceivers. +Style/HashEachMethods: + Exclude: + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 161 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never Style/HashSyntax: Exclude: - 'src/include/iscsi-client/dialogs.rb' @@ -133,37 +268,52 @@ - 'src/modules/IscsiClientLib.rb' # Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowIfModifier. Style/IfInsideElse: Exclude: - 'src/include/iscsi-client/widgets.rb' +# Offense count: 4 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'src/include/iscsi-client/dialogs.rb' + - 'src/include/iscsi-client/widgets.rb' + - 'src/modules/IscsiClientLib.rb' + # Offense count: 10 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. +# Configuration parameters: EnforcedStyle. # SupportedStyles: line_count_dependent, lambda, literal Style/Lambda: Exclude: - 'src/include/iscsi-client/wizards.rb' -# Offense count: 99 -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: snake_case, camelCase -Style/MethodName: +# Offense count: 1 +# Cop supports --auto-correct. +Style/MultilineIfModifier: Exclude: - - 'src/include/iscsi-client/complex.rb' - - 'src/include/iscsi-client/dialogs.rb' - - 'src/include/iscsi-client/widgets.rb' - - 'src/include/iscsi-client/wizards.rb' - - 'src/modules/IscsiClient.rb' - - 'src/modules/IscsiClientLib.rb' + - 'src/include/iscsi-client/helps.rb' # Offense count: 1 +# Cop supports --auto-correct. Style/MultilineTernaryOperator: Exclude: - 'src/modules/IscsiClientLib.rb' -# Offense count: 5 +# Offense count: 9 # Cop supports --auto-correct. +Style/NegatedIfElseCondition: + Exclude: + - 'src/include/iscsi-client/widgets.rb' + - 'src/modules/IscsiClient.rb' + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: predicate, comparison Style/NilComparison: Exclude: - 'src/modules/IscsiClient.rb' @@ -178,18 +328,48 @@ - 'src/modules/IscsiClient.rb' - 'src/modules/IscsiClientLib.rb' -# Offense count: 2 +# Offense count: 1 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Exclude: + - 'src/modules/IscsiClientLib.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: Methods. +Style/RedundantArgument: + Exclude: + - 'src/include/iscsi-client/widgets.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantAssignment: + Exclude: + - 'src/include/iscsi-client/dialogs.rb' + +# Offense count: 9 # Cop supports --auto-correct. # Configuration parameters: AllowMultipleReturnValues. Style/RedundantReturn: Exclude: + - 'src/include/iscsi-client/widgets.rb' - 'src/modules/IscsiClientLib.rb' -# Offense count: 5 -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: snake_case, camelCase -Style/VariableName: +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: Exclude: - - 'src/include/iscsi-client/helps.rb' + - 'src/clients/iscsi-client_finish.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'src/clients/iscsi-client.rb' + - 'src/include/iscsi-client/widgets.rb' - 'src/modules/IscsiClient.rb' - 'src/modules/IscsiClientLib.rb' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/package/yast2-iscsi-client.changes new/yast2-iscsi-client-4.5.3/package/yast2-iscsi-client.changes --- old/yast2-iscsi-client-4.5.1/package/yast2-iscsi-client.changes 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/package/yast2-iscsi-client.changes 2022-05-16 17:05:38.000000000 +0200 @@ -1,4 +1,19 @@ ------------------------------------------------------------------- +Mon May 16 10:11:13 UTC 2022 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Fix a crash when opening the main dialog (bsc#1199552). +- 4.5.3 + +------------------------------------------------------------------- +Wed May 11 09:51:04 UTC 2022 - Ancor Gonzalez Sosa <an...@suse.com> + +- Internal cleanup in several parts to turn the auto-converted YCP + code into something closer to common Ruby. +- Enable iscsiuio during installation only if there is any card in + the system using the bnx2i or qedi modules (bsc#1194432). +- 4.5.2 + +------------------------------------------------------------------- Mon Apr 11 12:04:00 UTC 2022 - Stefan Hundhammer <shundham...@suse.com> - Use $PATH, not absolute paths for calling external programs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/package/yast2-iscsi-client.spec new/yast2-iscsi-client-4.5.3/package/yast2-iscsi-client.spec --- old/yast2-iscsi-client-4.5.1/package/yast2-iscsi-client.spec 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/package/yast2-iscsi-client.spec 2022-05-16 17:05:38.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-iscsi-client -Version: 4.5.1 +Version: 4.5.3 Release: 0 Summary: YaST2 - iSCSI Client Configuration License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/src/clients/iscsi-client_finish.rb new/yast2-iscsi-client-4.5.3/src/clients/iscsi-client_finish.rb --- old/yast2-iscsi-client-4.5.1/src/clients/iscsi-client_finish.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/src/clients/iscsi-client_finish.rb 2022-05-16 17:05:38.000000000 +0200 @@ -87,10 +87,7 @@ # enable iscsi and iscsid service Service.Enable("iscsid") Service.Enable("iscsi") - Builtins.y2milestone("enabling iscsiuio socket and service") - socket = Yast2::Systemd::Socket.find("iscsiuio") - socket.enable if socket - Service.Enable("iscsiuio") + enable_iscsiuio end else Builtins.y2error("unknown function: %1", @func) @@ -101,6 +98,24 @@ Builtins.y2milestone("iscsi-client_finish finished") deep_copy(@ret) end + + private + + # Enables the iscsiuio service if needed + def enable_iscsiuio + if !IscsiClientLib.iscsiuio_relevant? + Builtins.y2milestone("iscsiuio is not needed") + return + end + + Builtins.y2milestone("enabling iscsiuio socket and service") + socket = Yast2::Systemd::Socket.find("iscsiuio") + if socket + socket.enable + else + Service.Enable("iscsiuio") + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/src/include/iscsi-client/dialogs.rb new/yast2-iscsi-client-4.5.3/src/include/iscsi-client/dialogs.rb --- old/yast2-iscsi-client-4.5.1/src/include/iscsi-client/dialogs.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/src/include/iscsi-client/dialogs.rb 2022-05-16 17:05:38.000000000 +0200 @@ -410,7 +410,7 @@ Wizard.HideBackButton ret = CWM.Run( w, - abort: fun_ref(method(:ReallyAbort), "boolean ()") + { abort: fun_ref(method(:ReallyAbort), "boolean ()") } ) ret end @@ -448,7 +448,7 @@ ret = CWM.Run( w, - abort: fun_ref(method(:ReallyAbort), "boolean ()") + { abort: fun_ref(method(:ReallyAbort), "boolean ()") } ) deep_copy(ret) end @@ -473,7 +473,7 @@ ) ret = CWM.Run( w, - abort: fun_ref(method(:ReallyAbort), "boolean ()") + { abort: fun_ref(method(:ReallyAbort), "boolean ()") } ) deep_copy(ret) end @@ -515,7 +515,7 @@ ret = CWM.Run( w, - abort: fun_ref(method(:ReallyAbort), "boolean ()") + { abort: fun_ref(method(:ReallyAbort), "boolean ()") } ) deep_copy(ret) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/src/modules/IscsiClient.rb new/yast2-iscsi-client-4.5.3/src/modules/IscsiClient.rb --- old/yast2-iscsi-client-4.5.1/src/modules/IscsiClient.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/src/modules/IscsiClient.rb 2022-05-16 17:05:38.000000000 +0200 @@ -76,17 +76,11 @@ # # @return [Yast2::CompundService] def services - # TODO: Having a combination of services and sockets in a compoud service + # TODO: Having a combination of services and sockets in a compound service # do not smell very well and the user might be very carefull on the # 'after reboot' selection having to choose correctly for enabling the # desired option (bsc#1160606). - @services ||= Yast2::CompoundService.new( - Yast2::SystemService.find("iscsid"), - Yast2::SystemService.find("iscsiuio"), - # It seems that moving it to the end help when iscsid socket is active - # and need to be restarted. (bsc#853300, bsc#1160606) - Yast2::SystemService.find("iscsi") - ) + @services ||= Yast2::CompoundService.new(*system_services) end # Abort function @@ -356,6 +350,18 @@ publish :function => :Summary, :type => "list ()" publish :function => :Overview, :type => "list ()" publish :function => :AutoPackages, :type => "map ()" + + private + + # @see #services + def system_services + list = [Yast2::SystemService.find("iscsid")] + list << Yast2::SystemService.find("iscsiuio") if IscsiClientLib.iscsiuio_relevant? + # It seems that moving it to the end helps when iscsid socket is active + # and need to be restarted. (bsc#853300, bsc#1160606) + list << Yast2::SystemService.find("iscsi") + list + end end IscsiClient = IscsiClientClass.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/src/modules/IscsiClientLib.rb new/yast2-iscsi-client-4.5.3/src/modules/IscsiClientLib.rb --- old/yast2-iscsi-client-4.5.1/src/modules/IscsiClientLib.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/src/modules/IscsiClientLib.rb 2022-05-16 17:05:38.000000000 +0200 @@ -40,6 +40,17 @@ # (bsc#1196086, bsc#1196086) OFFLOAD_SCRIPT = "iscsi_offload".freeze + # Driver modules that depend on the iscsiuio service/socket + # + # @see #iscsiuio_relevant? + # + # The modules match with the ones specified as the fourth element of the relevant entries + # at @offload. + # + # @return [Array<String>] + ISCSIUIO_MODULES = ["bnx2i", "qedi"].freeze + private_constant :ISCSIUIO_MODULES + def main textdomain "iscsi-client" @@ -59,13 +70,6 @@ @iface_file = {} @iface_eth = [] - # status of iscsi.service - @iscsi_service_stat = false - # status of iscsid.socket - @iscsid_socket_stat = false - # status of iscsiuio.socket - @iscsiuio_socket_stat = false - # Content of the main configuration file (/etc/iscsi/iscsid.conf) # # Due to the way YaST ini-agent works, this variable follows the structure @@ -130,6 +134,19 @@ # @offload_valid = nil + # Very likely, these two instance variables should NOT be directly accessed everywhere in + # this class. It would be more sane to rely on accessors with memoization like this: + # + # def iscsid_socket + # @iscsid_socket ||= Yast2::Systemd::Socket.find!("iscsid") + # end + # + # Currently there are several methods that seem to rely on these variables been initialized, + # which only happens during #getServiceStatus. + # + # But having sane accessors and breaking those dependencies between method calls would + # introduce changes in behavior, so it must be done carefully. Maybe some functionality relies + # on the current logic, even if it looks broken by design. @iscsid_socket = nil @iscsiuio_socket = nil end @@ -290,25 +307,40 @@ end # get accessor for service status + # + # NOTE: this is reliable only if {#getServiceStatus} has been called before (since that's + # the only way to initialize @iscsid_socket and @iscsiuio_socket). Not sure if that method + # interdependency is intentional (looks dangerous). def GetStartService status_d = socketEnabled?(@iscsid_socket) status_uio = socketEnabled?(@iscsiuio_socket) status = Service.Enabled("iscsi") log.info "Start at boot enabled for iscsid.socket: #{status_d}, iscsi: #{status}, iscsiuio.socket: #{status_uio}" - return status_d && status && status_uio + log.info "Is iscsiuio relevant? #{iscsiuio_relevant?}" + return status_d && status && !(iscsiuio_relevant? && !status_uio) end # set accessor for service status + # + # NOTE: this can handle the iscsid and iscsiuio sockets only if {#getServiceStatus} has been + # called before. Not sure if that method interdependency is intentional (looks dangerous). def SetStartService(status) - log.info "Set start at boot for iscsid.socket, iscsiuio.socket and iscsi.service to #{status}" + msg = + if iscsiuio_relevant? + "Set start at boot for iscsid.socket, iscsiuio.socket and iscsi.service to #{status}" + else + "Set start at boot for iscsid.socket and iscsi.service to #{status}" + end + log.info msg + if status == true Service.Enable("iscsi") socketEnable(@iscsid_socket) - socketEnable(@iscsiuio_socket) + socketEnable(@iscsiuio_socket) if iscsiuio_relevant? else Service.Disable("iscsi") socketDisable(@iscsid_socket) - socketDisable(@iscsiuio_socket) + socketDisable(@iscsiuio_socket) if iscsiuio_relevant? end nil @@ -919,7 +951,6 @@ # comparing IPv4 and IPv6 return false end - rescue ArgumentError => e Builtins.y2error("Invalid IP address, error: %1", e.to_s) false @@ -1078,12 +1109,15 @@ true end - # FIXME: this method has too much responsibility and it is doing - # "unexpected" things according to its name. Ideally, it only must return - # the service status without changing the status of related services and - # sockets. + # Starts iscsi-related services if they are not running # - # get status of iscsid + # As a side effect, it also takes care of initializing the @iscsid_socket and @iscsiuio_socket + # instance variables that are basic for other methods to work as expected. + # + # FIXME: The name gives a totally wrong impression on the method responsibilities and + # functionality. It seems to suggest it should simply return the status of the services. + # + # @return [Boolean] true in all cases, which looks suspicious def getServiceStatus ret = true if Stage.initial @@ -1096,29 +1130,41 @@ @iscsid_socket = Yast2::Systemd::Socket.find!("iscsid") @iscsiuio_socket = Yast2::Systemd::Socket.find!("iscsiuio") - @iscsi_service_stat = Service.active?("iscsi") - @iscsid_socket_stat = socketActive?(@iscsid_socket) - @iscsiuio_socket_stat = socketActive?(@iscsiuio_socket) + iscsi_service_stat = Service.active?("iscsi") + iscsid_socket_stat = socketActive?(@iscsid_socket) + iscsiuio_socket_stat = socketActive?(@iscsiuio_socket) - log.info "Status of iscsi.service: #{@iscsi_service_stat}, iscsid.socket: #{@iscsid_socket_stat}, iscsiuio.socket: #{@iscsiuio_socket_stat}" + log.info "Status of iscsi.service: #{iscsi_service_stat}, iscsid.socket: #{iscsid_socket_stat}, iscsiuio.socket: #{iscsiuio_socket_stat}" # if not running, start iscsi.service, iscsid.socket and iscsiuio.socket - if !@iscsid_socket_stat + if !iscsid_socket_stat Service.Stop("iscsid") if Service.active?("iscsid") log.error "Cannot start iscsid.socket" if !socketStart(@iscsid_socket) end - if !@iscsiuio_socket_stat + if !iscsiuio_socket_stat Service.Stop("iscsiuio") if Service.active?("iscsiuio") log.error "Cannot start iscsiuio.socket" if !socketStart(@iscsiuio_socket) end - if !@iscsi_service_stat && !Service.Start("iscsi") + if !iscsi_service_stat && !Service.Start("iscsi") log.error "Cannot start iscsi.service" end end ret end - # set startup status of iscsid + # Stops immediately all iscsi-related services and sockets if those services are disabled and + # there are no running sessions. + # + # NOTE: this only works in the installed system, it does nothing during installation. + # + # NOTE: this is reliable only if {#getServiceStatus} has been called before (since that's + # the only way to initialize @iscsid_socket and @iscsiuio_socket). Not sure if that method + # interdependency is intentional (looks dangerous). + # + # FIXME: The name gives a totally wrong impression on the method functionality. This method + # is only useful to stop services, it never starts/enables/disables any service. + # + # @return [Boolean] true in all cases, which looks suspicious def setServiceStatus ret = true # only makes sense in installed system @@ -1376,6 +1422,13 @@ deep_copy(ret) end + # Modules to use for all the cards detected in the system and that support hardware + # offloading, no matter whether those cards are indeed configured + # + # The module to use for each card is determined by the fourth element of the + # corresponding entry at @offload. + # + # @return [Array<String>] def GetOffloadModules GetOffloadItems() if @offload_valid == nil modules = [] @@ -1466,6 +1519,16 @@ command end + # Whether the system contains any offload card that would need the iscsiuio user-space + # I/O driver (see bsc#1194432) + # + # No matter where the card is configured or not + # + # @return [Boolean] + def iscsiuio_relevant? + (ISCSIUIO_MODULES & GetOffloadModules()).any? + end + publish :variable => :sessions, :type => "list <string>" publish :variable => :discovered, :type => "list <string>" publish :variable => :targets, :type => "list <string>" @@ -1563,6 +1626,8 @@ # @param card [Hash] description of a netcard as returned by the probe.netcard agent # @return [Array<String>] names of modules def netcard_modules(card) + return [] unless card.key?("drivers") + card["drivers"].flat_map { |d| d["modules"].map(&:first) } end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/test/fixtures/probe-netcard.yml new/yast2-iscsi-client-4.5.3/test/fixtures/probe-netcard.yml --- old/yast2-iscsi-client-4.5.1/test/fixtures/probe-netcard.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-iscsi-client-4.5.3/test/fixtures/probe-netcard.yml 2022-05-16 17:05:38.000000000 +0200 @@ -0,0 +1,42 @@ +--- +- bus: Virtio + class_id: 2 + dev_name: eth0 + dev_names: + - eth0 + device: Ethernet Card 0 + device_id: 262145 + driver: virtio_net + driver_module: virtio_net + drivers: + - active: true + modprobe: true + modules: + - - virtio_net + - '' + modalias: virtio:d00000001v00001AF4 + model: Virtio Ethernet Card 0 + old_unique_key: Pt7z.uqInxgTlyoD + parent_unique_key: 3hqH.pkM7KXDR457 + resource: + hwaddr: + - addr: 52:54:00:6b:d8:ef + link: + - state: true + phwaddr: + - addr: 52:54:00:6b:d8:ef + sub_class_id: 0 + sysfs_bus_id: virtio0 + sysfs_id: "/devices/pci0000:00/0000:00:03.0/virtio0" + unique_key: vWuh.VIRhsc57kTD + vendor: Virtio + vendor_id: 286740 +- bus: Virtio + class_id: 2 + dev_name: eth1 + dev_names: + - eth1 + device: Ethernet Card 1 + device_id: 262146 + driver: virtio_net + driver_module: virtio_net diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/test/iscsi-client_finish_test.rb new/yast2-iscsi-client-4.5.3/test/iscsi-client_finish_test.rb --- old/yast2-iscsi-client-4.5.1/test/iscsi-client_finish_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-iscsi-client-4.5.3/test/iscsi-client_finish_test.rb 2022-05-16 17:05:38.000000000 +0200 @@ -0,0 +1,87 @@ +#!/usr/bin/env rspec + +require_relative "test_helper" +require_relative "../src/clients/iscsi-client_finish" + +describe Yast::IscsiClientFinishClient do + subject { described_class.new } + + describe "#main when func is 'Write'" do + before do + allow(Yast::WFM).to receive(:Args).with(no_args).and_return(args) + allow(Yast::WFM).to receive(:Args) { |n| n.nil? ? args : args[n] } + + # Mock copying of the open-iscsi database to avoid side effects + allow(Yast::WFM).to receive(:Execute) + + allow(Yast::IscsiClientLib).to receive(:sessions).and_return session + allow(Yast::IscsiClientLib).to receive(:iscsiuio_relevant?).and_return iscsiuio + allow(Yast2::Systemd::Socket).to receive(:find) + allow(Yast2::Systemd::Socket).to receive(:find) + .with("iscsiuio") + .and_return(iscsiuio_socket) + end + + let(:args) { ["Write"] } + let(:session) { false } + let(:iscsiuio) { false } + let(:iscsiuio_socket) { nil } + + context "if there are no active iSCSI sessions" do + let(:session) { [] } + + it "does not enable any service or socket" do + expect(Yast2::Systemd::Socket).to_not receive(:find) + expect(Yast::Service).to_not receive(:Enable) + + result = subject.main + expect(result).to be_nil + end + end + + context "if there is any active iSCSI session" do + let(:session) { ["session0", "session1"] } + + context "and iscsiuio may be relevant in this system" do + let(:iscsiuio) { true } + + context "and there is a systemd unit for the iscsiuio socket" do + let(:iscsiuio_socket) { instance_double(Yast2::Systemd::Socket, enable: true) } + + it "enables iscsi service and the iscsiuio socket but not the iscsiuio service" do + expect(Yast::Service).to receive(:Enable).with("iscsid") + expect(Yast::Service).to receive(:Enable).with("iscsi") + expect(Yast::Service).to_not receive(:Enable).with("iscsiuio") + expect(iscsiuio_socket).to receive(:enable) + + subject.main + end + end + + context "but there is no systemd unit for the iscsiuio socket" do + let(:iscsiuio_socket) { nil } + + it "enables iscsi service and the iscsiuio service" do + expect(Yast::Service).to receive(:Enable).with("iscsid") + expect(Yast::Service).to receive(:Enable).with("iscsi") + expect(Yast::Service).to receive(:Enable).with("iscsiuio") + + subject.main + end + end + end + + context "and iscsiuio is not relevant in this system" do + let(:iscsiuio) { false } + + it "enables iscsi service but not the iscsiuio service" do + expect(Yast::Service).to receive(:Enable).with("iscsid") + expect(Yast::Service).to receive(:Enable).with("iscsi") + expect(Yast2::Systemd::Socket).to_not receive(:find).with("iscsiuio") + + subject.main + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/test/iscsi_client_lib_test.rb new/yast2-iscsi-client-4.5.3/test/iscsi_client_lib_test.rb --- old/yast2-iscsi-client-4.5.1/test/iscsi_client_lib_test.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/test/iscsi_client_lib_test.rb 2022-05-16 17:05:38.000000000 +0200 @@ -9,6 +9,8 @@ before do subject.main + stub_const("Yast::Service", double) + allow(Yast::Service).to receive(:Start).with(anything) end describe "#getServiceStatus" do @@ -555,7 +557,7 @@ "\t\tIface Name: default", "\tPortal: 192.168.10.20:3260,1", "\t\tIface Name: default"] - )). to eq( + )).to eq( [ "[2620:113:80c0:8080:e051:f9ea:73c7:9171]:3260 iqn.2013-10.de.suse:test_file2 default", "10.120.66.182:3260 iqn.2013-10.de.suse:test_file2 default", @@ -620,6 +622,54 @@ end end end + + describe "#iscsiuio_relevant?" do + before do + allow(subject).to receive(:GetOffloadModules).and_return modules + end + + context "there are no cards in the system supporting offloading" do + let(:modules) { [] } + + it "returns false" do + expect(subject.iscsiuio_relevant?).to eq false + end + end + + context "there are cards in the system supporting offloading" do + context "but none of them use the bnx2i or qedi modules" do + let(:modules) { ["fnic", "cxgb3i"] } + + it "returns false" do + expect(subject.iscsiuio_relevant?).to eq false + end + end + + context "and one of them uses de bnx2i module" do + let(:modules) { ["fnic", "cxgb3i", "bnx2i"] } + + it "returns true" do + expect(subject.iscsiuio_relevant?).to eq true + end + end + + context "and one of them uses de qedi module" do + let(:modules) { ["qedi"] } + + it "returns true" do + expect(subject.iscsiuio_relevant?).to eq true + end + end + + context "and there are cards using both bnx2i and qedi modules" do + let(:modules) { ["qedi", "cxgb3i", "bnx2i"] } + + it "returns true" do + expect(subject.iscsiuio_relevant?).to eq true + end + end + end + end describe ".GetOffloadItems" do around(:each) do |example| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/test/iscsi_client_test.rb new/yast2-iscsi-client-4.5.3/test/iscsi_client_test.rb --- old/yast2-iscsi-client-4.5.1/test/iscsi_client_test.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/test/iscsi_client_test.rb 2022-05-16 17:05:38.000000000 +0200 @@ -6,10 +6,21 @@ Yast.import "IscsiClient" describe Yast::IscsiClient do - subject(:iscsi_client) { described_class } + # Due to the tricky way in which YaST modules are implemented, this is needed to reset the + # instance variables of the module on every example. + subject(:iscsi_client) do + klass = Yast::IscsiClientClass.new + klass.main + klass + end before do allow(Yast2::SystemService).to receive(:find).with(anything).and_return(service) + + stub_const("Yast::Service", double) + allow(Yast::Service).to receive(:Start).with(anything) + allow(Yast::Service).to receive(:Stop).with(anything) + allow(Yast::Service).to receive(:Enabled).with(anything).and_return(false) end let(:service) { instance_double(Yast2::SystemService, save: true, is_a?: true) } @@ -18,16 +29,39 @@ let(:commandline) { false } describe "#services" do - it "includes iscsi, iscsid, and iscsiuio" do - expect(Yast2::SystemService).to receive(:find).with("iscsi") - expect(Yast2::SystemService).to receive(:find).with("iscsid") - expect(Yast2::SystemService).to receive(:find).with("iscsiuio") + before do + allow(Yast::IscsiClientLib).to receive(:iscsiuio_relevant?).and_return(iscsiuio) + end + + context "if any card in the system needs iscsiuio" do + let(:iscsiuio) { true } + + it "includes iscsi, iscsid and iscsiuio" do + expect(Yast2::SystemService).to receive(:find).with("iscsi") + expect(Yast2::SystemService).to receive(:find).with("iscsid") + expect(Yast2::SystemService).to receive(:find).with("iscsiuio") + + subject.services + end - subject.services + it "returns a compound service" do + expect(subject.services).to be_a(Yast2::CompoundService) + end end - it "returns a compound service" do - expect(subject.services).to be_a(Yast2::CompoundService) + context "if there are no cards in the system depending on iscsiuio" do + let(:iscsiuio) { false } + + it "includes iscsi and iscsid" do + expect(Yast2::SystemService).to receive(:find).with("iscsi") + expect(Yast2::SystemService).to receive(:find).with("iscsid") + + subject.services + end + + it "returns a compound service" do + expect(subject.services).to be_a(Yast2::CompoundService) + end end end @@ -84,6 +118,8 @@ end describe "#Write" do + let(:netcards) { YAML.load_file(FIXTURES_DIR.join("probe-netcard.yml")) } + before do allow(Yast::Progress).to receive(:New) allow(Yast::Progress).to receive(:NextStage) @@ -92,6 +128,9 @@ allow(Yast::Stage).to receive(:initial).and_return(false) allow(Yast::Mode).to receive(:auto) { auto } allow(Yast::Mode).to receive(:commandline) { commandline } + allow(Yast::SCR).to receive(:Read).and_call_original + allow(Yast::SCR).to receive(:Read).with(Yast::Path.new(".probe.netcard")) + .and_return(netcards) allow(iscsi_client).to receive(:Abort).and_return(false) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/test/mocking.rb new/yast2-iscsi-client-4.5.3/test/mocking.rb --- old/yast2-iscsi-client-4.5.1/test/mocking.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/test/mocking.rb 2022-05-16 17:05:38.000000000 +0200 @@ -80,9 +80,7 @@ if ipaddr result["stdout"] << "#{dev_name}: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500\n" - if !ipaddr.empty? - result["stdout"] << " inet #{ipaddr} netmask 255.255.255.0 broadcast 192.168.0.255\n" - end + result["stdout"] << " inet #{ipaddr} netmask 255.255.255.0 broadcast 192.168.0.255\n" unless ipaddr.empty? result["stdout"] << <<EOF RX packets 927138 bytes 920436197 (877.7 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.5.1/test/test_helper.rb new/yast2-iscsi-client-4.5.3/test/test_helper.rb --- old/yast2-iscsi-client-4.5.1/test/test_helper.rb 2022-04-12 13:34:59.000000000 +0200 +++ new/yast2-iscsi-client-4.5.3/test/test_helper.rb 2022-05-16 17:05:38.000000000 +0200 @@ -4,6 +4,9 @@ require "yast" require "yast/rspec" +require "pathname" + +FIXTURES_DIR = Pathname.new(__FILE__).dirname.join("fixtures") # Ensure the tests runs with english locales ENV["LC_ALL"] = "en_US.UTF-8"