Hello community,

here is the log from the commit of package yast2-kdump for openSUSE:Factory 
checked in at 2016-01-08 15:39:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-kdump (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-kdump.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-kdump"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-kdump/yast2-kdump.changes  2015-11-08 
11:25:22.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-kdump.new/yast2-kdump.changes     
2016-01-08 15:39:11.000000000 +0100
@@ -1,0 +2,7 @@
+Tue Jan  5 11:18:25 UTC 2016 - an...@suse.com
+
+- Alert the user when trying to configure a Xen DomU system, which
+  does not support kdump (bsc#952253)
+- 3.1.35
+
+-------------------------------------------------------------------

Old:
----
  yast2-kdump-3.1.34.tar.bz2

New:
----
  yast2-kdump-3.1.35.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-kdump.spec ++++++
--- /var/tmp/diff_new_pack.ES5A4B/_old  2016-01-08 15:39:12.000000000 +0100
+++ /var/tmp/diff_new_pack.ES5A4B/_new  2016-01-08 15:39:12.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-kdump
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-kdump
-Version:        3.1.34
+Version:        3.1.35
 Release:        0
 Summary:        Configuration of kdump
 License:        GPL-2.0

++++++ yast2-kdump-3.1.34.tar.bz2 -> yast2-kdump-3.1.35.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/package/yast2-kdump.changes 
new/yast2-kdump-3.1.35/package/yast2-kdump.changes
--- old/yast2-kdump-3.1.34/package/yast2-kdump.changes  2015-11-04 
15:14:23.000000000 +0100
+++ new/yast2-kdump-3.1.35/package/yast2-kdump.changes  2016-01-05 
17:29:44.000000000 +0100
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Tue Jan  5 11:18:25 UTC 2016 - an...@suse.com
+
+- Alert the user when trying to configure a Xen DomU system, which
+  does not support kdump (bsc#952253)
+- 3.1.35
+
+-------------------------------------------------------------------
 Tue Nov  3 09:44:53 UTC 2015 - an...@suse.com
 
 - manage the value of the fadump kernel param (bsc#951212)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/package/yast2-kdump.spec 
new/yast2-kdump-3.1.35/package/yast2-kdump.spec
--- old/yast2-kdump-3.1.34/package/yast2-kdump.spec     2015-11-04 
15:14:23.000000000 +0100
+++ new/yast2-kdump-3.1.35/package/yast2-kdump.spec     2016-01-05 
17:29:44.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-kdump
-Version:        3.1.34
+Version:        3.1.35
 Release:        0
 Summary:        Configuration of kdump
 License:        GPL-2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/src/clients/kdump.rb 
new/yast2-kdump-3.1.35/src/clients/kdump.rb
--- old/yast2-kdump-3.1.34/src/clients/kdump.rb 2015-11-04 15:14:23.000000000 
+0100
+++ new/yast2-kdump-3.1.35/src/clients/kdump.rb 2016-01-05 17:29:44.000000000 
+0100
@@ -358,7 +358,7 @@
         }
       }
 
-      if Kdump.fadump_supported?
+      if Kdump.system.supports_fadump?
         @cmdline_description["actions"]["fadump"] = {
           "handler" => fun_ref(method(:cmd_handle_fadump), "boolean (map)"),
           # TRANSLATORS: CommandLine help
@@ -725,7 +725,7 @@
 
       CommandLine.Print("")
 
-      if Kdump.fadump_supported?
+      if Kdump.system.supports_fadump?
         show_fadump_status
         CommandLine.Print("")
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/src/include/kdump/complex.rb 
new/yast2-kdump-3.1.35/src/include/kdump/complex.rb
--- old/yast2-kdump-3.1.34/src/include/kdump/complex.rb 2015-11-04 
15:14:23.000000000 +0100
+++ new/yast2-kdump-3.1.35/src/include/kdump/complex.rb 2016-01-05 
17:29:44.000000000 +0100
@@ -83,6 +83,9 @@
       Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", ""))
       # Kdump::AbortFunction = PollAbort;
       return :abort if !Confirm.MustBeRoot
+      if !Kdump.system.supports_kdump? && !unsupported_kdump_confirmation
+        return :abort
+      end
       InstallPackages() or return :abort
 
       ret = Kdump.Read
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/src/include/kdump/dialogs.rb 
new/yast2-kdump-3.1.35/src/include/kdump/dialogs.rb
--- old/yast2-kdump-3.1.34/src/include/kdump/dialogs.rb 2015-11-04 
15:14:23.000000000 +0100
+++ new/yast2-kdump-3.1.35/src/include/kdump/dialogs.rb 2016-01-05 
17:29:44.000000000 +0100
@@ -415,7 +415,7 @@
           "widget_names"    => [
             "DisBackButton",
             "EnableDisalbeKdump",
-            (Kdump.fadump_supported? ? "FADump":""),
+            (Kdump.system.supports_fadump? ? "FADump":""),
             "KdumpMemory"
           ]
         },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/src/include/kdump/uifunctions.rb 
new/yast2-kdump-3.1.35/src/include/kdump/uifunctions.rb
--- old/yast2-kdump-3.1.34/src/include/kdump/uifunctions.rb     2015-11-04 
15:14:23.000000000 +0100
+++ new/yast2-kdump-3.1.35/src/include/kdump/uifunctions.rb     2016-01-05 
17:29:44.000000000 +0100
@@ -1476,7 +1476,7 @@
 
     # Initializes FADump settings in UI
     def InitFADump(key)
-      if Kdump.fadump_supported? && UI.WidgetExists(Id("FADump"))
+      if Kdump.system.supports_fadump? && UI.WidgetExists(Id("FADump"))
         UI.ReplaceWidget(
           Id("FADump"),
           VBox(
@@ -1844,5 +1844,15 @@
       Popup.Message(key)
       true
     end
+
+    def unsupported_kdump_confirmation
+      text = _(
+        "Kdump is not supported on this system.\n" \
+        "If you continue now, the module may not function properly.\n" \
+        "For example, some settings will not be correctly read\n" \
+        "and the resulting configuration will probably be useless.\n"
+      )
+      Popup.ContinueCancelHeadline(_("Kdump not supported"), text)
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/src/lib/kdump/kdump_calibrator.rb 
new/yast2-kdump-3.1.35/src/lib/kdump/kdump_calibrator.rb
--- old/yast2-kdump-3.1.34/src/lib/kdump/kdump_calibrator.rb    2015-11-04 
15:14:23.000000000 +0100
+++ new/yast2-kdump-3.1.35/src/lib/kdump/kdump_calibrator.rb    2016-01-05 
17:29:44.000000000 +0100
@@ -1,3 +1,6 @@
+require "yast"
+require "kdump/kdump_system"
+
 module Yast
   # This class tries to calibrate Kdump minimum, maximum and recommended values
   #
@@ -8,7 +11,6 @@
 
     LOW_MEM = 896
     MIN_LOW_DEFAULT = 72
-    MiB_SIZE = 1048576
 
     KDUMPTOOL_CMD = "kdumptool %s calibrate"
     KDUMPTOOL_ARG = "--configfile '%s'"
@@ -61,7 +63,7 @@
     # @return [Fixnum] Memory size (in MiB)
     def max_low
       run_kdumptool unless @kdumptool_executed
-      @max_low ||= propose_high_memory? ? [LOW_MEM, total_memory].min : 
total_memory
+      @max_low ||= system.supports_high_mem? ? [LOW_MEM, total_memory].min : 
total_memory
     end
 
     # Determines what's the recommended quantity of high memory
@@ -88,7 +90,7 @@
     def max_high
       run_kdumptool unless @kdumptool_executed
       @max_high ||=
-        if propose_high_memory?
+        if system.supports_high_mem?
           (total_memory - LOW_MEM) > 0 ? total_memory - LOW_MEM : 0
         else
           0
@@ -100,14 +102,9 @@
     # @return [Fixnum] Memory size (in MiB)
     def total_memory
       run_kdumptool unless @kdumptool_executed
-      return @total_memory if @total_memory
-
-      # Calculating the total memory in a system with kdump enabled is tricky.
       # As a best effort if kdumptool is not available, let's use the physical
       # memory reported by the kernel.
-      probe = SCR.Read(Yast::Path.new(".probe.memory"))
-      resource = probe.first["resource"]
-      @total_memory = resource["phys_mem"][0]["range"] / MiB_SIZE
+      @total_memory ||= system.reported_memory
     end
 
     # Builds a hash containing memory limits
@@ -121,6 +118,10 @@
 
   private
 
+    def system
+      @system ||= KdumpSystem.new
+    end
+
     # Set up memory values relying on kdumptool
     #
     # @see parse
@@ -167,14 +168,5 @@
       end
       KDUMPTOOL_CMD % args
     end
-
-    # Checks whether the machine is expected to support high memory
-    #
-    # This method is only used in case the call to kdumptool failed
-    #
-    # @return [Boolean] true if a positive value for max_high is expected
-    def propose_high_memory?
-      Arch.x86_64
-    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/src/lib/kdump/kdump_system.rb 
new/yast2-kdump-3.1.35/src/lib/kdump/kdump_system.rb
--- old/yast2-kdump-3.1.34/src/lib/kdump/kdump_system.rb        1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-kdump-3.1.35/src/lib/kdump/kdump_system.rb        2016-01-05 
17:29:44.000000000 +0100
@@ -0,0 +1,52 @@
+require "yast"
+
+module Yast
+  Yast.import "Arch"
+
+  class KdumpSystem
+    MiB_SIZE = 1_048_576
+
+    # Checks whether Firmware-Assisted Dump is supported by the system
+    #
+    # @return [Boolean] true if FADump is supported, false otherwise
+    def supports_fadump?
+      Arch.ppc64
+    end
+
+    # Checks whether the usage of high memory is supported in the crashkernel
+    # bootloader param
+    #
+    # @return [Boolean] true if 'high' is supported, false otherwise
+    def supports_high_mem?
+      Arch.x86_64
+    end
+
+    # Check whether the system supports kdump
+    #
+    # See bsc#952253. Kdump cannot work in DomU
+    #
+    # @return [Boolean] true if kdump is supported, false otherwise
+    def supports_kdump?
+      !Arch.is_xenU
+    end
+
+    # Physical memory (in MiB) reported by the kernel.
+    #
+    # Calculating the total memory in a system with kdump enabled is tricky,
+    # since the amount reported by the kernel by the normal methods will be
+    # lower than the real total memory. Thus, use this method only if you don't
+    # have a more precise method (like calling kdumptool) available
+    def reported_memory
+      return @reported_memory if @reported_memory
+
+      probe = SCR.Read(Path.new(".probe.memory"))
+      # SCR.Read should never return nil, but better safe than sorry
+      if probe
+        resource = probe.first["resource"]
+        @reported_memory = resource["phys_mem"][0]["range"] / MiB_SIZE
+      else
+        @reported_memory = 0
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/src/modules/Kdump.rb 
new/yast2-kdump-3.1.35/src/modules/Kdump.rb
--- old/yast2-kdump-3.1.34/src/modules/Kdump.rb 2015-11-04 15:14:23.000000000 
+0100
+++ new/yast2-kdump-3.1.35/src/modules/Kdump.rb 2016-01-05 17:29:44.000000000 
+0100
@@ -29,6 +29,7 @@
 # Representation of the configuration of kdump.
 # Input and output routines.
 require "yast"
+require "kdump/kdump_system"
 require "kdump/kdump_calibrator"
 
 module Yast
@@ -316,6 +317,11 @@
       true
     end
 
+    # Returns the KdumpSystem instance
+    def system
+     @system ||= Yast::KdumpSystem.new
+    end
+
     def write_temporary_config_file
       SCR.RegisterAgent(TEMPORARY_CONFIG_PATH,
                         term(:ag_ini,
@@ -961,21 +967,13 @@
       true
     end
 
-    # Returns whether FADump (Firmware assisted dump) is supported
-    # by the current system
-    #
-    # @return [Boolean] is supported
-    def fadump_supported?
-      Arch.ppc64
-    end
-
     # Sets whether to use FADump (Firmware assisted dump)
     #
     # @param [Boolean] new state
     # @return [Boolean] whether successfully set
     def use_fadump(new_value)
       # Trying to use fadump on unsupported hardware
-      if !fadump_supported? && new_value
+      if !system.supports_fadump? && new_value
         Builtins.y2milestone("FADump is not supported on this hardware")
         Report.Error(_("Cannot use Firmware-assisted dump.\nIt is not 
supported on this hardware."))
         return false
@@ -1141,7 +1139,7 @@
     end
 
     def write_fadump_boot_param
-      if fadump_supported?
+      if system.supports_fadump?
         # If fdump is selected and we want to enable kdump
         if using_fadump? && @add_crashkernel_param
             value = "on"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/test/fadump_test.rb 
new/yast2-kdump-3.1.35/test/fadump_test.rb
--- old/yast2-kdump-3.1.34/test/fadump_test.rb  2015-11-04 15:14:23.000000000 
+0100
+++ new/yast2-kdump-3.1.35/test/fadump_test.rb  2016-01-05 17:29:44.000000000 
+0100
@@ -3,44 +3,40 @@
 require_relative "./test_helper"
 
 Yast.import "Kdump"
-Yast.import "Arch"
 
-describe "#fadump_supported?" do
-  it "returns that fadump is supported on ppc64 architecture" do
-    expect(Yast::Arch).to receive(:ppc64).and_return(true)
-    expect(Yast::Kdump.fadump_supported?).to eq(true)
+describe "#use_fadump" do
+  before do
+    allow(Yast::Kdump.system).to 
receive(:supports_fadump?).and_return(supported)
   end
 
-  it "return that fadump is not supported on other architectures" do
-    expect(Yast::Arch).to receive(:ppc64).and_return(false)
-    expect(Yast::Kdump.fadump_supported?).to eq(false)
-  end
-end
+  context "if fadump is supported on this architecture" do
+    let(:supported) { true }
 
-describe "#use_fadump" do
-  it "returns true if fadump is supported on this architecture" do
-    expect(Yast::Kdump).to receive(:fadump_supported?).twice.and_return(true)
-    expect(Yast::Kdump.use_fadump(true)).to eq(true)
-    expect(Yast::Kdump.use_fadump(false)).to eq(true)
-  end
+    it "returns true when enabling fadump" do
+      expect(Yast::Kdump.use_fadump(true)).to eq(true)
+    end
 
-  it "returns false if it's not supported on this architecture" do
-    expect(Yast::Kdump).to receive(:fadump_supported?).and_return(false)
-    expect(Yast::Kdump.use_fadump(true)).to eq(false)
+    it "returns true when disabling fadump" do
+      expect(Yast::Kdump.use_fadump(false)).to eq(true)
+    end
   end
 
-  it "returns true if disabling fadump" do
-    expect(Yast::Kdump).to receive(:fadump_supported?).and_return(true)
-    expect(Yast::Kdump.use_fadump(false)).to eq(true)
+  context "if fadump is not supported on this architecture" do
+    let(:supported) { false }
+
+    it "returns false when enabling fadump" do
+      expect(Yast::Kdump.use_fadump(true)).to eq(false)
+    end
 
-    expect(Yast::Kdump).to receive(:fadump_supported?).and_return(false)
-    expect(Yast::Kdump.use_fadump(false)).to eq(true)
+    it "returns true when disabling fadump" do
+      expect(Yast::Kdump.use_fadump(false)).to eq(true)
+    end
   end
 end
 
 describe "#using_fadump?" do
  it "returns that fadump is in use if previously set" do
-   expect(Yast::Kdump).to receive(:fadump_supported?).twice.and_return(true)
+   allow(Yast::Kdump.system).to receive(:supports_fadump?).and_return(true)
 
    Yast::Kdump.use_fadump(true)
    expect(Yast::Kdump.using_fadump?).to eq(true)
@@ -58,9 +54,9 @@
   end
 
   it "returns true if use_fadump changed" do
+    allow(Yast::Kdump.system).to receive(:supports_fadump?).and_return(true)
     Yast::Kdump.ReadKdumpSettings
 
-    expect(Yast::Kdump).to receive(:fadump_supported?).and_return(true)
     original_value = Yast::Kdump.using_fadump?
     Yast::Kdump.use_fadump(!original_value)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/test/kdump_test.rb 
new/yast2-kdump-3.1.35/test/kdump_test.rb
--- old/yast2-kdump-3.1.34/test/kdump_test.rb   2015-11-04 15:14:23.000000000 
+0100
+++ new/yast2-kdump-3.1.35/test/kdump_test.rb   2016-01-05 17:29:44.000000000 
+0100
@@ -368,7 +368,7 @@
     before do
       Yast::Mode.SetMode(mode)
       # FIXME: current tests do not cover fadump (ppc64 specific)
-      allow(Yast::Arch).to receive(:ppc64).and_return false
+      allow(Yast::Kdump.system).to receive(:supports_fadump?).and_return false
     end
 
     context "during autoinstallation" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-kdump-3.1.34/test/lib/kdump_system_test.rb 
new/yast2-kdump-3.1.35/test/lib/kdump_system_test.rb
--- old/yast2-kdump-3.1.34/test/lib/kdump_system_test.rb        1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-kdump-3.1.35/test/lib/kdump_system_test.rb        2016-01-05 
17:29:44.000000000 +0100
@@ -0,0 +1,52 @@
+#!/usr/bin/env rspec
+
+require_relative "../test_helper"
+require_relative "../../src/lib/kdump/kdump_system"
+
+Yast.import "Arch"
+
+describe Yast::KdumpSystem do
+  describe "#reported_memory" do
+    it "returns the size in MiB" do
+      allow(Yast::SCR).to receive(:Read).with(path(".probe.memory"))
+        .and_return ["resource"=>{"mem"=>[{"active"=>true, 
"length"=>12_465_651_712, "start"=>0}],
+                                  "phys_mem"=>[{"range"=>12_884_901_888}]}]
+
+      expect(subject.reported_memory).to eq 12_288
+    end
+  end
+
+  describe "#supports_fadump?" do
+    it "returns true on ppc64 architecture" do
+      allow(Yast::Arch).to receive(:ppc64).and_return(true)
+      expect(subject.supports_fadump?).to eq true
+    end
+
+    it "returns false on other architectures" do
+      allow(Yast::Arch).to receive(:ppc64).and_return(false)
+      expect(subject.supports_fadump?).to eq false
+    end
+  end
+
+  describe "#supports_kdump?" do
+    before do
+      allow(Yast::Arch).to receive(:is_xenU).and_return xenU
+    end
+
+    context "in a Xen DomU" do
+      let(:xenU) { true }
+
+      it "returns false" do
+        expect(subject.supports_kdump?).to eq false
+      end
+    end
+
+    context "in a system not being a Xen DomU" do
+      let(:xenU) { false }
+
+      it "returns true" do
+        expect(subject.supports_kdump?).to eq true
+      end
+    end
+  end
+end


Reply via email to