Browse Source

report optimal io size for block devices

LVM aligns devices data area to io hints, reported for
block devices. Optimal io size can be big for some devices
(16M, as reported in bug). So nailgun's volume manager
should take it into account while doing partitioning.
So nailgun-agent should send this information to nailgun.

Change-Id: Idd9b778f7f21d4fe9d3fd029038664de41f93447
Partial-Bug: #1546049
Dmitry Guryanov 3 years ago
parent
commit
d1d17f253c
1 changed files with 22 additions and 1 deletions
  1. 22
    1
      agent

+ 22
- 1
agent View File

@@ -481,7 +481,8 @@ class NodeAgent
481 481
               :disk => block[:disk],
482 482
               :extra => block[:extra],
483 483
               :removable => block[:removable],
484
-              :paths => nil
484
+              :paths => nil,
485
+              :opt_io => get_opt_io.fetch(dname, block_size)
485 486
             }
486 487
 
487 488
           elsif @mpath_devices.has_key?(dname)
@@ -733,6 +734,26 @@ class NodeAgent
733 734
     @blocks
734 735
   end
735 736
 
737
+  def get_opt_io
738
+    return @opt_io_res if defined?(@opt_io_res)
739
+
740
+    @opt_io_res = {}
741
+
742
+    # example output:
743
+    # sda    4096      0
744
+    # sdb     512      2048
745
+    output = `lsblk --nodeps --bytes --noheadings --output NAME,MIN-IO,OPT-IO`
746
+    output.split("\n").each do |line|
747
+      name, min_io, opt_io = line.split()
748
+      @opt_io_res[name] = opt_io.to_i != 0 ? opt_io.to_i : min_io.to_i
749
+    end
750
+
751
+    @opt_io_res
752
+  rescue => e
753
+    @logger.error("Error '#{e.message}' in obtaining optimal io size: #{e.backtrace}")
754
+    @opt_io_res ||= {}
755
+  end
756
+
736 757
   def _is_virtualbox
737 758
     @os[:dmi][:system][:product_name] == "VirtualBox" rescue false
738 759
   end

Loading…
Cancel
Save