Hello community, here is the log from the commit of package yast2-installation for openSUSE:Factory checked in at 2020-06-27 23:22:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-installation (Old) and /work/SRC/openSUSE:Factory/.yast2-installation.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-installation" Sat Jun 27 23:22:09 2020 rev:448 rq:817066 version:4.3.7 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-installation/yast2-installation.changes 2020-06-14 18:15:51.454943597 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-installation.new.3060/yast2-installation.changes 2020-06-27 23:22:11.649746113 +0200 @@ -1,0 +2,29 @@ +Thu Jun 25 13:24:45 UTC 2020 - Martin Vidner <mvid...@suse.com> + +- Fix "Cmdline: parameter not set" for virt-install (bsc#1172139) +- 4.3.7 + +------------------------------------------------------------------- +Thu Jun 25 11:07:53 CEST 2020 - aschn...@suse.com + +- copy NVMe hostnqn and hostid from installation system to target + system during installation (bsc#1172853) +- 4.3.6 + +------------------------------------------------------------------- +Wed Jun 24 09:18:28 UTC 2020 - Martin Vidner <mvid...@suse.com> + +- memsample: at install time sample memory consumption each 5s, + enabling CSV and PNG reports (bsc#1172139) +- startup/common/network.sh: remove bashisms to enable + switching inst_setup to dash +- 4.3.5 + +------------------------------------------------------------------- +Tue Jun 23 10:53:54 UTC 2020 - Josef Reidinger <jreidin...@suse.com> + +- Do not export to autoyast profile image deployment unless + requested (bsc#1172552) +- 4.3.4 + +------------------------------------------------------------------- Old: ---- yast2-installation-4.3.3.tar.bz2 New: ---- yast2-installation-4.3.7.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-installation.spec ++++++ --- /var/tmp/diff_new_pack.w7Xs9Q/_old 2020-06-27 23:22:12.329748349 +0200 +++ /var/tmp/diff_new_pack.w7Xs9Q/_new 2020-06-27 23:22:12.329748349 +0200 @@ -17,7 +17,7 @@ Name: yast2-installation -Version: 4.3.3 +Version: 4.3.7 Release: 0 Summary: YaST2 - Installation Parts License: GPL-2.0-only ++++++ yast2-installation-4.3.3.tar.bz2 -> yast2-installation-4.3.7.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/bin/memsample new/yast2-installation-4.3.7/bin/memsample --- old/yast2-installation-4.3.3/bin/memsample 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.3.7/bin/memsample 2020-06-25 16:08:05.000000000 +0200 @@ -0,0 +1,54 @@ +#!/bin/sh +# Collect data about memory usage of all processes +DOCS="https://github.com/yast/yast-installation/blob/master/doc/memsample.md" + +# save memory by switching to a smaller shell +# bash RSS is at least 3 MB per process, dash RSS is around 1 MB +if [ -n "$BASH_VERSION" ] && [ -x /bin/dash ]; then + exec /bin/dash "$0" "$@" +fi + +while [ -n "$1" ]; do + case "$1" in + --archive=*) + ARCHIVE=${1#--archive=} + shift + ;; + --sleep=*) + SLEEP=${1#--sleep=} + shift + esac +done +# default values +: "${ARCHIVE=./memsample.zcat}" +: "${SLEEP=5}" + +echo >&2 "Sampling every $SLEEP s to $ARCHIVE" + +{ + echo "### comment-0000-$(date -Iseconds)" + echo "See $DOCS" +} | gzip -c >> "$ARCHIVE" + +memsample_ps() { + ps -e -H -o pid,tname,vsize:8,drs:8,trs:8,rss:8,size:8,ppid,args +} + +I=0 +while true; do + I=$((I + 1)) + I_TIME=$(printf %04d $I)-$(date -Iseconds) + + { + echo "### df-$I_TIME" + df -k / + + echo "### free-$I_TIME" + free -k + + echo "### ps-$I_TIME" + memsample_ps + } | gzip -c >> "$ARCHIVE" + + sleep "$SLEEP" +done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/bin/memsample-archive-to-csv new/yast2-installation-4.3.7/bin/memsample-archive-to-csv --- old/yast2-installation-4.3.3/bin/memsample-archive-to-csv 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.3.7/bin/memsample-archive-to-csv 2020-06-25 16:08:05.000000000 +0200 @@ -0,0 +1,162 @@ +#!/usr/bin/ruby +# memsample-archive-to-csv +# +# memsample.zcat is a bundle of raw data optimized to minimize +# 1. effort collecting +# 2. space on (RAM)disk +# 3. time/space compressing for (2) +# +# The resulting design is +# - A time series of records in varying line-oriented formats +# - The records are individually gziped, then concatenated +# (thus the .zcat extension) +# - Each record starts with a "### HEADER\n" header where +# HEADER is TAG-COUNTER-ISOTIMESTAMP, eg. df-0001-2020-06-13T22:46:58+02:00 + +require "csv" +require "date" +require "shellwords" + +class ZcatArchive + def initialize(plain_io) + @plain_io = plain_io + end + + def each(&block) + header = nil + data = "" + + loop do + l = @plain_io.eof? ? "" : @plain_io.readline + if l.empty? + raise "No '### ...\\n' header found before data" if header.nil? + block.call(header, data) + break + elsif l =~ /\A### (.*)\n\z/ + block.call(header, data) unless header.nil? + header = Regexp.last_match(1) + data = "" + else + data << l + end + end + end +end + +class MemsampleArchive + def initialize(plain_io) + @plain_io = plain_io + end + + def parse + g = ZcatArchive.new(@plain_io) + g.each do |header, data| + tag, counter_s, dt_s = header.split("-", 3) + counter = counter_s.to_i + # normalize time zone switches + dt = DateTime.parse(dt_s).new_offset(0) + + public_send("handle_#{tag}", counter, dt, data) if respond_to?("handle_#{tag}") + end + end +end + +class MemsampleCsv < MemsampleArchive + def write_csv(csv_io) + @csv = CSV.new(csv_io) + @csv << [ + "disk_total_k", "disk_used_k", "disk_free_k", + "mem_total_k", "mem_used_k", "mem_free_k", + "swap_total_k", "swap_used_k", "swap_free_k", + "rss", "rss_all", + "datetime" + ] + @row = [] + parse + end + + # HACK: assuming "df", "free", "ps" order! + + # "df" and "free" happen to produce similar output + def parse_total_used_free(line) + _label, total_k_s, used_k_s, free_k_s, *_rest = line.split + [total_k_s, used_k_s, free_k_s].map(&:to_i) + end + + def handle_df(_counter, _dt, data) + @row.concat parse_total_used_free(data.lines[1]) + end + + def handle_free(_counter, _dt, data) + # mem, swap + @row.concat parse_total_used_free(data.lines[1]) + @row.concat parse_total_used_free(data.lines[2]) + end + + def direct_children_of(processes, parent) + r = processes.find_all { |p| p[:PPID] == parent[:PID] } + # puts parent[:PID] + "=>" + r.map { |p| p[:PID] }.join(" ") + r + end + + def descendants_of(processes, parent) + result = [parent] + direct_children_of(processes, parent).map do |ch| + ch_descendants = descendants_of(processes, ch) + result.concat(ch_descendants) + end + result + end + + def handle_ps(_counter, dt, data) + processes = data.lines.map { |l| l.chomp.split(" ", 9) } + headings = processes.shift + processes.map! do |cols| + headings.zip(cols).each_with_object({}) do |(key, value), hash| + hash[key.to_sym] = value + end + end + + y = processes.find { |p| p[:COMMAND].include? "y2start" } + if !y + @row << 0 + @row << 0 + else + @row << y[:RSS] + + # array of processes that are y2start or its descendants + yy = descendants_of(processes, y) + sizes = yy.map { |p| p[:RSS].to_i } + @row << sizes.reduce(0, &:+) + end + + @row << dt + @csv << @row + @row = [] + end +end + +# do not execute the script when the file is loaded by some other script +# e.g. by a test, allow testing parts of the code without executing it as a whole +if __FILE__ == $PROGRAM_NAME + if ARGV[0] == "-y" + y2logs_tar = ARGV[1] + csv = ARGV[2] || "memsample.csv" + $stderr.puts "Converting memsample.zcat (in #{y2logs_tar}) to #{csv}" + cmd = "tar xvf #{y2logs_tar.shellescape} -O YaST2/memsample.zcat | zcat" + else + zcat = ARGV[0] || "memsample.zcat" + csv = ARGV[1] || "memsample.csv" + $stderr.puts "Converting #{zcat} to #{csv}" + cmd = "zcat #{zcat.shellescape}" + end + + # BTW, Zlib::GzipReader will not work because it ignores concatenated gz files, + # see also https://github.com/ruby/zlib/pull/13 + IO.popen(cmd) do |plain_io| + File.open(csv, "w") do |csv_io| + m = MemsampleCsv.new(plain_io) + m.write_csv(csv_io) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/bin/memsample-csv-plot new/yast2-installation-4.3.7/bin/memsample-csv-plot --- old/yast2-installation-4.3.3/bin/memsample-csv-plot 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.3.7/bin/memsample-csv-plot 2020-06-25 16:08:05.000000000 +0200 @@ -0,0 +1,31 @@ +#!/bin/sh +# memsample-csv-plot +# Plot the memory usage data collected by memsample +CSV="${1-memsample.csv}" +PNG="${2-memsample.png}" +echo >&2 "Plotting from $CSV to $PNG" +cat <<EOS | gnuplot > "$PNG" +set title "YaST instaler memory usage" +set datafile separator comma +set timefmt "%Y-%m-%dT%H:%M:%S+00:00" +set xdata time +set xtics rotate +set format x "%H:%M" +set terminal png size 800, 600 +set xlabel "wall clock (UTC)" +set ylabel "used [MiB]" +set grid +#set key outside +set rmargin 16 +set key rmargin +# 1 disk_total_k, 2 disk_used_k, 3 disk_free_k, +# 4 mem_total_k, 4 mem_used_k, 6 mem_free_k, +# 7 swap_total_k, 8 swap_used_k, 9 swap_free_k, +# 10 rss, 11 rss_all, 12 datetime +plot "${CSV}" using 12:(\$10/1024) title "y2start RSS" with lines,\ + "" using 12:(\$11/1024) title "y2start+children RSS" with lines,\ + "" using 12:(\$2/1024) title "disk" with lines,\ + "" using 12:(\$5/1024) title "mem" with lines,\ + "" using 12:((\$2+\$5)/1024) title "mem+disk" with lines,\ + "" using 12:(\$8/1024) title "swap" with lines +EOS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/doc/memsample.md new/yast2-installation-4.3.7/doc/memsample.md --- old/yast2-installation-4.3.3/doc/memsample.md 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.3.7/doc/memsample.md 2020-06-25 16:08:05.000000000 +0200 @@ -0,0 +1,80 @@ +# Memsample + +### Problem + +Every now and then we get a report that the installer has crashed by running +out of memory +(latest: [bsc#1172139](https://bugzilla.suse.com/show_bug.cgi?id=1172139)). +So far we have managed to fix the problems. Now it is time for +a proactive approach: tracking the memory consumption across all +installations. + +### TL;DR + +![YaST instaler memory usage, SLED15-SP2 GMC](memsample.png) + +To reproduce this, see Usage below. + +### Approach + +Previously we have inserted logging of memory measurements at critical points +of the main installer process (y2start or y2base). + +**memsample** aims to get a full* picture of the install-time system +(aka *inst-sys*) by +1. taking a sample every few seconds +2. measuring the memory used by all the processes, and the RAM-disk (tmpfs) +3. having low overhead as to allow being always enabled in production + +*: A significant problem with time-sampling memory or disk usage is that we may +miss short timed peaks. To detect those, an in-process alternative is needed. + +### Implementation + +At installation time, samples are taken by running the commands `free`, +`df /`, and `ps ...`. + +Parsing the significant data from the output of these commands is not done +yet. Instead, the output is compressed (with gzip) in a crude archive format. +(This is a prototype-quality approach. With more thought and work we could be +more efficient both with CPU and memory.) + +After the installation has concluded, the archive is post-processed to produce +an easily consumable CSV format. A graph is produced from that CSV with +Gnuplot. + +### Usage + +YaST the installer will start `memsample` automatically. + +The environment variable `MEMSAMPLE` (set on the boot command line) means the +interval in seconds between samples. Zero means no sampling at all. The +default is 5. + +Memsample will log to a compressed file `/var/log/YaST2/memsample.zcat`. After +a successful installation this file will be packaged inside +`/var/log/YaST2/yast-installation-logs.tar.xz` + +1. produce a `memsample.csv`, a CSV version of the collected data with +`memsample-archive-to-csv` +or +`memsample-archive-to-csv -y yast-installation-logs.tar.xz` +2. produce `memsample.png` with +`memsample-csv-plot` + +### Overhead + +Measuring memory takes up more memory. + +Process: +``` +1768 dash + 160 +- dash +3780 | `- ps + 920 `- gzip +---- +6628 KiB total +``` + +Logs: A quick next-next installation of SLES took about 13 minutes, +that was 150 samples totaling 392 KiB of memsample.zcat Binary files old/yast2-installation-4.3.3/doc/memsample.png and new/yast2-installation-4.3.7/doc/memsample.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/package/yast2-installation.changes new/yast2-installation-4.3.7/package/yast2-installation.changes --- old/yast2-installation-4.3.3/package/yast2-installation.changes 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/package/yast2-installation.changes 2020-06-25 16:08:05.000000000 +0200 @@ -1,4 +1,33 @@ ------------------------------------------------------------------- +Thu Jun 25 13:24:45 UTC 2020 - Martin Vidner <mvid...@suse.com> + +- Fix "Cmdline: parameter not set" for virt-install (bsc#1172139) +- 4.3.7 + +------------------------------------------------------------------- +Thu Jun 25 11:07:53 CEST 2020 - aschn...@suse.com + +- copy NVMe hostnqn and hostid from installation system to target + system during installation (bsc#1172853) +- 4.3.6 + +------------------------------------------------------------------- +Wed Jun 24 09:18:28 UTC 2020 - Martin Vidner <mvid...@suse.com> + +- memsample: at install time sample memory consumption each 5s, + enabling CSV and PNG reports (bsc#1172139) +- startup/common/network.sh: remove bashisms to enable + switching inst_setup to dash +- 4.3.5 + +------------------------------------------------------------------- +Tue Jun 23 10:53:54 UTC 2020 - Josef Reidinger <jreidin...@suse.com> + +- Do not export to autoyast profile image deployment unless + requested (bsc#1172552) +- 4.3.4 + +------------------------------------------------------------------- Fri Jun 12 16:09:32 UTC 2020 - David Diaz <dgonza...@suse.com> - Improve the UX of the Previously Used Repositories dialog by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/package/yast2-installation.spec new/yast2-installation-4.3.7/package/yast2-installation.spec --- old/yast2-installation-4.3.3/package/yast2-installation.spec 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/package/yast2-installation.spec 2020-06-25 16:08:05.000000000 +0200 @@ -16,7 +16,7 @@ # Name: yast2-installation -Version: 4.3.3 +Version: 4.3.7 Release: 0 Group: System/YaST License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/src/lib/installation/clients/copy_files_finish.rb new/yast2-installation-4.3.7/src/lib/installation/clients/copy_files_finish.rb --- old/yast2-installation-4.3.3/src/lib/installation/clients/copy_files_finish.rb 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/src/lib/installation/clients/copy_files_finish.rb 2020-06-25 16:08:05.000000000 +0200 @@ -1,6 +1,6 @@ # encoding: utf-8 -# Copyright (c) [2006-2019] SUSE LLC +# Copyright (c) [2006-2020] SUSE LLC # # All Rights Reserved. # @@ -73,6 +73,7 @@ copy_hardware_status copy_vnc copy_multipath + copy_nvme # Copy cio_ignore whitelist (bsc#1095033) copy_active_devices @@ -272,6 +273,29 @@ target_path = File.join(Installation.destdir, config_file) target_dir = File.dirname(target_path) ::FileUtils.mkdir_p(target_dir) unless File.exist?(target_dir) + ::FileUtils.cp(config_file, target_path) + end + end + + NVME_CONFIG_FILES = [ + "/etc/nvme/hostnqn", + "/etc/nvme/hostid" + ].freeze + + private_constant :NVME_CONFIG_FILES + + def copy_nvme + # Only in install, as update should keep its config + return unless Mode.installation + + # Copy NVMe config files (bsc #1172853) + NVME_CONFIG_FILES.each do |config_file| + next unless File.exist?(config_file) + + log.info "Copying NVMe config file: '#{config_file}'" + target_path = File.join(Installation.destdir, config_file) + target_dir = File.dirname(target_path) + ::FileUtils.mkdir_p(target_dir) unless File.exist?(target_dir) ::FileUtils.cp(config_file, target_path) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/src/lib/installation/clients/deploy_image_auto.rb new/yast2-installation-4.3.7/src/lib/installation/clients/deploy_image_auto.rb --- old/yast2-installation-4.3.3/src/lib/installation/clients/deploy_image_auto.rb 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/src/lib/installation/clients/deploy_image_auto.rb 2020-06-25 16:08:05.000000000 +0200 @@ -76,11 +76,6 @@ @ret = true else @ret = false - Installation.image_installation = true - Builtins.y2warning( - "Key image_installation not defined, using image_installation: %1", - Installation.image_installation - ) end # Create a summary # return string @@ -94,11 +89,11 @@ # did configuration changed # return boolean elsif @func == "GetModified" - @ret = true + !!self.class.modified # set configuration as changed # return boolean elsif @func == "SetModified" - @ret = true + self.class.modified = true # Reset configuration # return map or list elsif @func == "Reset" @@ -386,7 +381,11 @@ # Return configuration data # return map or list elsif @func == "Export" - @ret = { "image_installation" => Installation.image_installation } + @ret = if Installation.image_installation + { "image_installation" => true } + else + {} + end # Write the configuration (prepare images, deploy images) elsif @func == "Write" Builtins.y2milestone( @@ -423,5 +422,9 @@ # EOF end + + class << self + attr_accessor :modified + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/startup/First-Stage/F08-logging new/yast2-installation-4.3.7/startup/First-Stage/F08-logging --- old/yast2-installation-4.3.3/startup/First-Stage/F08-logging 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/startup/First-Stage/F08-logging 2020-06-25 16:08:05.000000000 +0200 @@ -51,3 +51,17 @@ log "\tSet YaST2 LOG parameters:" log "\tMaximum log size: $Y2MAXLOGSIZE kB" log "\tMaximum log count: $Y2MAXLOGNUM" + +#============================================= +# 8.3) Start sampling memory usage data +#--------------------------------------------- +log "\tStart sampling memory usage data:" +for WORD in ${Cmdline-}; do + case $WORD in MEMSAMPLE=*) MEMSAMPLE=${WORD#MEMSAMPLE=};; esac +done +if [ "$MEMSAMPLE" = 0 ]; then + log "\tdisabled" +else + memsample --sleep="${MEMSAMPLE-5}" --archive=/var/log/YaST2/memsample.zcat & + log "\tPID: $!" +fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/startup/common/network.sh new/yast2-installation-4.3.7/startup/common/network.sh --- old/yast2-installation-4.3.3/startup/common/network.sh 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/startup/common/network.sh 2020-06-25 16:08:05.000000000 +0200 @@ -1,3 +1,4 @@ +#!/bin/sh #================ # FILE : network.sh #---------------- @@ -16,24 +17,24 @@ #---------------- # #----[ is_iface_up ]-----# -function is_iface_up () { +is_iface_up() { #-------------------------------------------------- # check if given interface is up # --- test -z "$1" && return 1 - case "`LC_ALL=POSIX ip link show $1 2>/dev/null`" in + case "$(LC_ALL=POSIX ip link show "$1" 2>/dev/null)" in *$1*UP*) ;; *) return 1 ;; esac } #----[ found_iface ]-----# -function found_iface () { +found_iface() { #-------------------------------------------------- # search for a queued network interface # - for i in `ip -o link show | cut -f2 -d:`;do - iface=`echo $i | tr -d " "` + for i in $(ip -o link show | cut -f2 -d:); do + iface=$(echo "$i" | tr -d " ") if is_iface_up "$iface" ; then return 0 fi @@ -42,7 +43,7 @@ } -function list_ifaces() +list_ifaces() { # list network interfaces # - all active ones with all IPv4 / IPv6 addresses @@ -50,7 +51,7 @@ ifaces=$(/sbin/ip -oneline address show | grep "inet" | cut --delimiter=' ' --fields=2 | uniq | grep --invert-match "^lo") for i in ${ifaces}; do - ip address show $i | sed --quiet \ + ip address show "$i" | sed --quiet \ --expression="1{s/^[^ ]* \([^:]*\).*/\1:/;h}" \ --expression="/ether/{ s/^.*ether[^ ]* \([^ ]*\).*/\1/; H; g; s/\n/ /; p}" \ --expression="s/^[ ]*inet \([^ ]*\).*/ \1/p" \ @@ -60,7 +61,7 @@ #----[ vnc_message ]-----# -function vnc_message () { +vnc_message() { #-------------------------------------------------- # console message displayed with a VNC installation # --- @@ -74,7 +75,7 @@ } #----[ ssh_message ]-----# -function ssh_message () { +ssh_message () { #-------------------------------------------------- # console message displayed with a SSH installation # --- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/test/copy_files_finish_test.rb new/yast2-installation-4.3.7/test/copy_files_finish_test.rb --- old/yast2-installation-4.3.3/test/copy_files_finish_test.rb 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/test/copy_files_finish_test.rb 2020-06-25 16:08:05.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/env rspec # encoding: utf-8 -# Copyright (c) [2018-2019] SUSE LLC +# Copyright (c) [2018-2020] SUSE LLC # # All Rights Reserved. # @@ -126,6 +126,18 @@ subject.write end + + it "copies NVMe config files in installation only" do + allow(Yast::Mode).to receive(:installation).and_return(true) + allow(::File).to receive(:exist?).with(/^\/etc\/nvme/).and_return(true) + allow(::File).to receive(:exist?).with(/^\/mnt\/etc\/nvme/).and_return(false) + + expect(::FileUtils).to receive(:mkdir_p).with("/mnt/etc/nvme") + expect(::FileUtils).to receive(:cp).with("/etc/nvme/hostnqn", "/mnt/etc/nvme/hostnqn") + expect(::FileUtils).to receive(:cp).with("/etc/nvme/hostid", "/mnt/etc/nvme/hostid") + + subject.write + end it "copies cio_ignore whitelist in installation of s390 only" do allow(Yast::Mode).to receive(:installation).and_return(true) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/test/fixtures/memsample.cat new/yast2-installation-4.3.7/test/fixtures/memsample.cat --- old/yast2-installation-4.3.3/test/fixtures/memsample.cat 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.3.7/test/fixtures/memsample.cat 2020-06-25 16:08:05.000000000 +0200 @@ -0,0 +1,232 @@ +### comment-0000-2020-06-23T09:07:09+00:00 +See https://github.com/yast/yast-installation/blob/master/doc/memsample.md +### df-0001-2020-06-23T09:07:09+00:00 +Filesystem 1K-blocks Used Available Use% Mounted on +tmpfs 993988 271400 722588 28% / +### free-0001-2020-06-23T09:07:09+00:00 + total used free shared buff/cache available +Mem: 993988 112980 236960 353168 644048 384900 +Swap: 0 0 0 +### ps-0001-2020-06-23T09:07:09+00:00 + PID TTY VSZ DRS TRS RSS SIZE PPID COMMAND + 2 ? 0 0 0 0 0 0 [kthreadd] + 3 ? 0 0 0 0 0 2 [rcu_gp] + 4 ? 0 0 0 0 0 2 [rcu_par_gp] + 6 ? 0 0 0 0 0 2 [kworker/0:0H-kblockd] + 7 ? 0 0 0 0 0 2 [kworker/u2:0-events_unbound] + 8 ? 0 0 0 0 0 2 [mm_percpu_wq] + 9 ? 0 0 0 0 0 2 [ksoftirqd/0] + 10 ? 0 0 0 0 0 2 [rcu_sched] + 11 ? 0 0 0 0 0 2 [migration/0] + 12 ? 0 0 0 0 0 2 [idle_inject/0] + 14 ? 0 0 0 0 0 2 [cpuhp/0] + 16 ? 0 0 0 0 0 2 [kdevtmpfs] + 17 ? 0 0 0 0 0 2 [netns] + 18 ? 0 0 0 0 0 2 [rcu_tasks_kthre] + 19 ? 0 0 0 0 0 2 [kauditd] + 20 ? 0 0 0 0 0 2 [khungtaskd] + 21 ? 0 0 0 0 0 2 [oom_reaper] + 22 ? 0 0 0 0 0 2 [writeback] + 23 ? 0 0 0 0 0 2 [kcompactd0] + 24 ? 0 0 0 0 0 2 [ksmd] + 25 ? 0 0 0 0 0 2 [khugepaged] + 27 ? 0 0 0 0 0 2 [kworker/u2:1-events_unbound] + 123 ? 0 0 0 0 0 2 [kintegrityd] + 124 ? 0 0 0 0 0 2 [kblockd] + 125 ? 0 0 0 0 0 2 [blkcg_punt_bio] + 126 ? 0 0 0 0 0 2 [tpm_dev_wq] + 127 ? 0 0 0 0 0 2 [edac-poller] + 128 ? 0 0 0 0 0 2 [devfreq_wq] + 129 ? 0 0 0 0 0 2 [watchdogd] + 131 ? 0 0 0 0 0 2 [kworker/0:2-ata_sff] + 132 ? 0 0 0 0 0 2 [kswapd0] + 133 ? 0 0 0 0 0 2 [kworker/u3:0] + 136 ? 0 0 0 0 0 2 [kthrotld] + 137 ? 0 0 0 0 0 2 [ipv6_addrconf] + 143 ? 0 0 0 0 0 2 [kstrp] + 149 ? 0 0 0 0 0 2 [charger_manager] + 213 ? 0 0 0 0 0 2 [loop0] + 214 ? 0 0 0 0 0 2 [kworker/0:1H-kblockd] + 215 ? 0 0 0 0 0 2 [loop1] + 220 ? 0 0 0 0 0 2 [kaluad] + 223 ? 0 0 0 0 0 2 [kmpath_rdacd] + 250 ? 0 0 0 0 0 2 [ata_sff] + 271 ? 0 0 0 0 0 2 [scsi_eh_0] + 278 ? 0 0 0 0 0 2 [scsi_tmf_0] + 279 ? 0 0 0 0 0 2 [scsi_eh_1] + 286 ? 0 0 0 0 0 2 [scsi_tmf_1] + 301 ? 0 0 0 0 0 2 [ttm_swap] + 377 ? 0 0 0 0 0 2 [rpciod] + 378 ? 0 0 0 0 0 2 [xprtiod] + 684 ? 0 0 0 0 0 2 [nfsiod] + 727 ? 0 0 0 0 0 2 [acpi_thermal_pm] + 1188 ? 0 0 0 0 0 2 [kmpathd] + 1189 ? 0 0 0 0 0 2 [kmpath_handlerd] + 2526 ? 0 0 0 0 0 2 [loop2] + 2528 ? 0 0 0 0 0 2 [loop3] + 2542 ? 0 0 0 0 0 2 [loop4] + 2544 ? 0 0 0 0 0 2 [loop5] + 2558 ? 0 0 0 0 0 2 [loop6] + 2560 ? 0 0 0 0 0 2 [loop7] + 2562 ? 0 0 0 0 0 2 [loop8] + 2564 ? 0 0 0 0 0 2 [loop9] + 3083 ? 0 0 0 0 0 2 [kworker/0:0-ata_sff] + 3474 ? 0 0 0 0 0 2 [kworker/0:1-events] + 1 ? 91656 91327 328 17352 12608 0 /init showopts + 226 ? 35672 35174 497 4376 1608 1 udevd --daemon + 362 ? 12148 12133 14 4068 6016 1 /usr/sbin/haveged -w 1024 -v 0 + 383 ? 41416 41201 214 2892 772 1 /bin/dbus-daemon --system + 385 ? 46420 44385 2034 764 644 1 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -B -f /var/log/wpa_supplicant.log + 388 ? 43808 43793 14 5008 1548 1 /usr/sbin/wickedd --debug mini --log-target stderr:time,pid,ident + 391 ? 43556 43526 29 3696 1280 1 /usr/lib/wicked/bin/wickedd-auto4 --debug mini --log-target stderr:time,pid,ident + 393 ? 43560 43531 28 4708 1284 1 /usr/lib/wicked/bin/wickedd-dhcp4 --debug mini --log-target stderr:time,pid,ident + 395 ? 43560 43531 28 4616 1284 1 /usr/lib/wicked/bin/wickedd-dhcp6 --debug mini --log-target stderr:time,pid,ident + 397 ? 43584 43530 53 4164 1284 1 /usr/sbin/wickedd-nanny --debug mini --log-target stderr:time,pid,ident + 1389 tty9 14996 14033 962 3924 1384 1 sh -l + 2568 tty2 16604 15641 962 4340 1384 1 bash -l + 2569 tty5 16604 15641 962 4384 1384 1 bash -l + 2570 tty6 16604 15641 962 4472 1384 1 bash -l + 2571 ? 91656 91327 328 10076 12608 1 /init showopts + 2572 tty1 8924 8813 110 1788 388 2571 /bin/dash /sbin/inst_setup yast + 4529 tty1 4312 4284 27 884 312 2572 sleep 3 + 2681 ? 337192 336549 642 2784 22800 1 /usr/sbin/rsyslogd + 2688 ? 4572 4546 25 1628 572 1 /sbin/klogd -c 1 + 2691 ? 337952 337806 145 2300 17804 1 /usr/sbin/nscd + 2719 ? 64940 64122 817 3784 940 1 /usr/sbin/sshd + 2748 ? 124148 123330 817 9560 1268 2719 sshd: root@pts/0 + 2752 pts/0 18332 17369 962 6168 3112 2748 -bash + 3527 pts/0 13596 12633 962 2876 456 2752 /bin/bash /sbin/yast.ssh + 3528 pts/0 15680 14717 962 4168 960 3527 /bin/bash /usr/lib/YaST2/startup/YaST2.First-Stage + 4625 pts/0 8924 8813 110 928 388 3528 /bin/dash /usr/bin/memsample --archive=/var/log/YaST2/memsample.zcat + 4640 pts/0 8924 8813 110 160 388 4625 /bin/dash /usr/bin/memsample --archive=/var/log/YaST2/memsample.zcat + 4657 pts/0 34588 34480 107 3720 1220 4640 ps -e -H -o pid,tname,vsize:8,drs:8,trs:8,rss:8,size:8,ppid,args + 4641 pts/0 4552 4477 74 792 504 4625 gzip -c + 4655 pts/0 39536 39532 3 17240 14624 3528 /usr/bin/ruby.ruby2.5 /usr/sbin/SUSEConnect --cleanup +### df-0021-2020-06-23T05:08:52-04:00 +Filesystem 1K-blocks Used Available Use% Mounted on +tmpfs 993988 216440 777548 22% / +### free-0021-2020-06-23T05:08:52-04:00 + total used free shared buff/cache available +Mem: 993988 247556 285220 298216 461212 305740 +Swap: 1334248 0 1334248 +### ps-0021-2020-06-23T05:08:52-04:00 + PID TTY VSZ DRS TRS RSS SIZE PPID COMMAND + 2 ? 0 0 0 0 0 0 [kthreadd] + 3 ? 0 0 0 0 0 2 [rcu_gp] + 4 ? 0 0 0 0 0 2 [rcu_par_gp] + 6 ? 0 0 0 0 0 2 [kworker/0:0H-kblockd] + 7 ? 0 0 0 0 0 2 [kworker/u2:0-events_unbound] + 8 ? 0 0 0 0 0 2 [mm_percpu_wq] + 9 ? 0 0 0 0 0 2 [ksoftirqd/0] + 10 ? 0 0 0 0 0 2 [rcu_sched] + 11 ? 0 0 0 0 0 2 [migration/0] + 12 ? 0 0 0 0 0 2 [idle_inject/0] + 14 ? 0 0 0 0 0 2 [cpuhp/0] + 16 ? 0 0 0 0 0 2 [kdevtmpfs] + 17 ? 0 0 0 0 0 2 [netns] + 18 ? 0 0 0 0 0 2 [rcu_tasks_kthre] + 19 ? 0 0 0 0 0 2 [kauditd] + 20 ? 0 0 0 0 0 2 [khungtaskd] + 21 ? 0 0 0 0 0 2 [oom_reaper] + 22 ? 0 0 0 0 0 2 [writeback] + 23 ? 0 0 0 0 0 2 [kcompactd0] + 24 ? 0 0 0 0 0 2 [ksmd] + 25 ? 0 0 0 0 0 2 [khugepaged] + 27 ? 0 0 0 0 0 2 [kworker/u2:1-btrfs-endio-write] + 123 ? 0 0 0 0 0 2 [kintegrityd] + 124 ? 0 0 0 0 0 2 [kblockd] + 125 ? 0 0 0 0 0 2 [blkcg_punt_bio] + 126 ? 0 0 0 0 0 2 [tpm_dev_wq] + 127 ? 0 0 0 0 0 2 [edac-poller] + 128 ? 0 0 0 0 0 2 [devfreq_wq] + 129 ? 0 0 0 0 0 2 [watchdogd] + 131 ? 0 0 0 0 0 2 [kworker/0:2-ata_sff] + 132 ? 0 0 0 0 0 2 [kswapd0] + 133 ? 0 0 0 0 0 2 [kworker/u3:0-btrfs-worker-high] + 136 ? 0 0 0 0 0 2 [kthrotld] + 137 ? 0 0 0 0 0 2 [ipv6_addrconf] + 143 ? 0 0 0 0 0 2 [kstrp] + 149 ? 0 0 0 0 0 2 [charger_manager] + 214 ? 0 0 0 0 0 2 [kworker/0:1H-kblockd] + 215 ? 0 0 0 0 0 2 [loop1] + 220 ? 0 0 0 0 0 2 [kaluad] + 223 ? 0 0 0 0 0 2 [kmpath_rdacd] + 250 ? 0 0 0 0 0 2 [ata_sff] + 271 ? 0 0 0 0 0 2 [scsi_eh_0] + 278 ? 0 0 0 0 0 2 [scsi_tmf_0] + 279 ? 0 0 0 0 0 2 [scsi_eh_1] + 286 ? 0 0 0 0 0 2 [scsi_tmf_1] + 301 ? 0 0 0 0 0 2 [ttm_swap] + 377 ? 0 0 0 0 0 2 [rpciod] + 378 ? 0 0 0 0 0 2 [xprtiod] + 684 ? 0 0 0 0 0 2 [nfsiod] + 727 ? 0 0 0 0 0 2 [acpi_thermal_pm] + 1188 ? 0 0 0 0 0 2 [kmpathd] + 1189 ? 0 0 0 0 0 2 [kmpath_handlerd] + 2526 ? 0 0 0 0 0 2 [loop2] + 2528 ? 0 0 0 0 0 2 [loop3] + 2544 ? 0 0 0 0 0 2 [loop5] + 2558 ? 0 0 0 0 0 2 [loop6] + 2560 ? 0 0 0 0 0 2 [loop7] + 2562 ? 0 0 0 0 0 2 [loop8] + 2564 ? 0 0 0 0 0 2 [loop9] + 3083 ? 0 0 0 0 0 2 [kworker/0:0-ata_sff] + 3474 ? 0 0 0 0 0 2 [kworker/0:1-events] + 5163 ? 0 0 0 0 0 2 [kworker/u2:2-events_unbound] + 6970 ? 0 0 0 0 0 2 [kworker/u3:1-btrfs-worker-high] + 7266 ? 0 0 0 0 0 2 [btrfs-worker] + 7268 ? 0 0 0 0 0 2 [btrfs-worker-hi] + 7269 ? 0 0 0 0 0 2 [btrfs-delalloc] + 7270 ? 0 0 0 0 0 2 [btrfs-flush_del] + 7271 ? 0 0 0 0 0 2 [btrfs-cache] + 7272 ? 0 0 0 0 0 2 [btrfs-submit] + 7273 ? 0 0 0 0 0 2 [btrfs-fixup] + 7274 ? 0 0 0 0 0 2 [btrfs-endio] + 7275 ? 0 0 0 0 0 2 [btrfs-endio-met] + 7276 ? 0 0 0 0 0 2 [btrfs-endio-met] + 7277 ? 0 0 0 0 0 2 [btrfs-endio-rai] + 7278 ? 0 0 0 0 0 2 [btrfs-endio-rep] + 7279 ? 0 0 0 0 0 2 [btrfs-rmw] + 7280 ? 0 0 0 0 0 2 [btrfs-endio-wri] + 7281 ? 0 0 0 0 0 2 [btrfs-freespace] + 7282 ? 0 0 0 0 0 2 [btrfs-delayed-m] + 7283 ? 0 0 0 0 0 2 [btrfs-readahead] + 7284 ? 0 0 0 0 0 2 [btrfs-qgroup-re] + 7285 ? 0 0 0 0 0 2 [btrfs-cleaner] + 7286 ? 0 0 0 0 0 2 [btrfs-transacti] + 1 ? 91656 91327 328 17352 12608 0 /init showopts + 226 ? 35672 35174 497 4440 1608 1 udevd --daemon + 362 ? 12148 12133 14 4068 6016 1 /usr/sbin/haveged -w 1024 -v 0 + 383 ? 41416 41201 214 2892 772 1 /bin/dbus-daemon --system + 385 ? 46420 44385 2034 764 644 1 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -B -f /var/log/wpa_supplicant.log + 388 ? 43808 43793 14 5008 1548 1 /usr/sbin/wickedd --debug mini --log-target stderr:time,pid,ident + 391 ? 43556 43526 29 3696 1280 1 /usr/lib/wicked/bin/wickedd-auto4 --debug mini --log-target stderr:time,pid,ident + 393 ? 43560 43531 28 4708 1284 1 /usr/lib/wicked/bin/wickedd-dhcp4 --debug mini --log-target stderr:time,pid,ident + 395 ? 43560 43531 28 4616 1284 1 /usr/lib/wicked/bin/wickedd-dhcp6 --debug mini --log-target stderr:time,pid,ident + 397 ? 43584 43530 53 4164 1284 1 /usr/sbin/wickedd-nanny --debug mini --log-target stderr:time,pid,ident + 1389 tty9 14996 14033 962 3924 1384 1 sh -l + 2568 tty2 16604 15641 962 4340 1384 1 bash -l + 2569 tty5 16604 15641 962 4384 1384 1 bash -l + 2570 tty6 16604 15641 962 4472 1384 1 bash -l + 2571 ? 91656 91327 328 10076 12608 1 /init showopts + 2572 tty1 8924 8813 110 1788 388 2571 /bin/dash /sbin/inst_setup yast + 7441 tty1 4312 4284 27 816 312 2572 sleep 3 + 2681 ? 337192 336549 642 2784 22800 1 /usr/sbin/rsyslogd + 2688 ? 4572 4546 25 1628 572 1 /sbin/klogd -c 1 + 2691 ? 403488 403342 145 2300 17936 1 /usr/sbin/nscd + 2719 ? 64940 64122 817 3784 940 1 /usr/sbin/sshd + 2748 ? 124148 123330 817 9560 1268 2719 sshd: root@pts/0 + 2752 pts/0 18332 17369 962 6168 3112 2748 -bash + 3527 pts/0 13596 12633 962 2876 456 2752 /bin/bash /sbin/yast.ssh + 3528 pts/0 15680 14717 962 4168 960 3527 /bin/bash /usr/lib/YaST2/startup/YaST2.First-Stage + 4625 pts/0 8924 8813 110 1656 388 3528 /bin/dash /usr/bin/memsample --archive=/var/log/YaST2/memsample.zcat + 7444 pts/0 8924 8813 110 160 388 4625 /bin/dash /usr/bin/memsample --archive=/var/log/YaST2/memsample.zcat + 7448 pts/0 34588 34480 107 3800 1220 7444 ps -e -H -o pid,tname,vsize:8,drs:8,trs:8,rss:8,size:8,ppid,args + 7445 pts/0 4552 4477 74 920 504 4625 gzip -c + 4670 pts/0 14124 13161 962 4024 984 3528 /bin/bash /usr/lib/YaST2/startup/YaST2.call installation initial + 5143 pts/0 528116 528112 3 179772 149492 4670 /usr/bin/ruby.ruby2.5 --encoding=utf-8 /usr/lib/YaST2/bin/y2start installation --arg initial ncurses + 7435 pts/0 0 0 0 0 0 5143 [systemd-inhibit] <defunct> + 7450 pts/0 45516 45504 11 2280 488 5143 rpm --root /mnt --dbpath /var/lib/rpm -U --percent --noglob --force --nodeps -- /mnt/var/cache/zypp/packages/Basesystem-Module_15.2-0/Module-Basesystem/noarch/boost-license1_66_0-1.66.0-10.1.noarch.rpm + 5301 ? 167624 167244 379 744 17108 1 gpg-agent --homedir /var/tmp/zypp.H3ltOz/zypp-trusted-krbAc7e4 --use-standard-socket --daemon + 5355 ? 167624 167244 379 2680 17108 1 gpg-agent --homedir /var/tmp/zypp.H3ltOz/zypp-general-krCGfLFy --use-standard-socket --daemon + 6013 ? 93892 93512 379 792 8784 1 gpg-agent --homedir /var/tmp/zypp.H3ltOz/PublicKey --use-standard-socket --daemon diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/test/lib/clients/deploy_image_auto_test.rb new/yast2-installation-4.3.7/test/lib/clients/deploy_image_auto_test.rb --- old/yast2-installation-4.3.3/test/lib/clients/deploy_image_auto_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.3.7/test/lib/clients/deploy_image_auto_test.rb 2020-06-25 16:08:05.000000000 +0200 @@ -0,0 +1,36 @@ +#!/usr/bin/env rspec + +require_relative "../../test_helper" +require "installation/clients/deploy_image_auto" + +Yast.import "Installation" + +describe Yast::DeployImageAutoClient do + describe "#main" do + before do + allow(Yast::WFM).to receive(:Args) do |*params| + if params.empty? + args + else + args[params.first] + end + end + end + + context "Export argument passed" do + let(:args) { ["Export"] } + + it "return empty hash if image deployment is disabled" do + allow(Yast::Installation).to receive(:image_installation).and_return(false) + + expect(subject.main).to eq({}) + end + + it "return hash with image_installation if image deployment is enabled" do + allow(Yast::Installation).to receive(:image_installation).and_return(true) + + expect(subject.main).to eq("image_installation" => true) + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/test/memsample_test.rb new/yast2-installation-4.3.7/test/memsample_test.rb --- old/yast2-installation-4.3.3/test/memsample_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-4.3.7/test/memsample_test.rb 2020-06-25 16:08:05.000000000 +0200 @@ -0,0 +1,39 @@ +#! /usr/bin/env rspec + +require_relative "./test_helper" + +# 'require' only works with '.rb' files +memsample_rb = File.expand_path("../bin/memsample-archive-to-csv", __dir__) +load memsample_rb unless defined?(MemsampleCsv) + +require "stringio" + +data_fn = "#{FIXTURES_DIR}/memsample.cat" + +describe MemsampleCsv do + describe "#write_csv" do + it "converts sample data correctly" do + output = StringIO.new + File.open(data_fn, "r") do |input| + m = MemsampleCsv.new(input) + m.write_csv(output) + end + + expected = <<EOS +disk_total_k,disk_used_k,disk_free_k,mem_total_k,mem_used_k,mem_free_k,swap_total_k,swap_used_k,swap_free_k,rss,rss_all,datetime +993988,271400,722588,993988,112980,236960,0,0,0,0,0,2020-06-23T09:07:09+00:00 +993988,216440,777548,993988,247556,285220,1334248,0,1334248,179772,182052,2020-06-23T09:08:52+00:00 +EOS + + expect(output.string).to eq expected + end + + it "reports error when it cannot parse the data" do + input = StringIO.new("nobody expects the Spanish inquisition") + output = StringIO.new + m = MemsampleCsv.new(input) + + expect { m.write_csv(output) }.to raise_error(StandardError) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.3.3/test/test_helper.rb new/yast2-installation-4.3.7/test/test_helper.rb --- old/yast2-installation-4.3.3/test/test_helper.rb 2020-06-12 18:23:27.000000000 +0200 +++ new/yast2-installation-4.3.7/test/test_helper.rb 2020-06-25 16:08:05.000000000 +0200 @@ -28,6 +28,7 @@ stub_module("AddOnProduct") stub_module("AutoinstConfig") stub_module("AutoinstGeneral") +stub_module("AutoinstSoftware") stub_module("Console") stub_module("InstURL") stub_module("Keyboard") @@ -47,7 +48,7 @@ bindir = File.expand_path("../../bin", __FILE__) # For coverage we need to load all ruby files - SimpleCov.track_files("{#{srcdir}/**/*.rb,#{bindir}/*}") + SimpleCov.track_files("{#{srcdir}/**/*.rb,#{bindir}/{yupdate,memsample-archive-to-csv}}") # use coveralls for on-line code coverage reporting at Travis CI if ENV["TRAVIS"]