From 0b46c777bd8805ecfc2acad001ebe78bf956085d Mon Sep 17 00:00:00 2001 From: Pawel Piatek Date: Mon, 10 Aug 2020 15:29:37 +0200 Subject: [PATCH] script/vagrant: avoid unnecessary strings interpolation Signed-off-by: Pawel Piatek Change-Id: Ie6e306011249fcdaeb96d3dcdf9807f6ec2d9926 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3710 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Karol Latecki --- scripts/vagrant/Vagrantfile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index 61163f7ca..5bea8940c 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -145,8 +145,8 @@ Vagrant.configure(2) do |config| config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--ioapic", "on"] - vb.memory = "#{vmram}" - vb.cpus = "#{vmcpu}" + vb.memory = vmram + vb.cpus = vmcpu nvme_disk=(ENV['NVME_FILE'] || "nvme_disk.img") unless File.exist? (nvme_disk) @@ -180,7 +180,7 @@ Vagrant.configure(2) do |config| end if not vmemulator.empty? - libvirt.emulator_path = "#{vmemulator}" + libvirt.emulator_path = vmemulator libvirt.machine_type = "pc" end @@ -190,10 +190,10 @@ Vagrant.configure(2) do |config| # Loop to create all emulated disks set emulated_nvme_types.each_with_index { |disk, index| if ENV['NVME_FILE'] - nvme_disk_id="#{disk}" + "-#{index}" - nvme_disk="#{nvme_file["#{index}".to_i]}" + nvme_disk_id = disk + "-" + index.to_s + nvme_disk = nvme_file[index] else - nvme_disk="/var/lib/libvirt/images/nvme_disk.img" + nvme_disk = "/var/lib/libvirt/images/nvme_disk.img" end unless File.exist? (nvme_disk) @@ -205,10 +205,10 @@ Vagrant.configure(2) do |config| libvirt.qemuargs :value => "format=raw,file=#{nvme_disk},if=none,id=#{nvme_disk_id}" libvirt.qemuargs :value => "-device" nvme_drive = "nvme,drive=#{nvme_disk_id},serial=1234#{index}" - if !nvme_namespaces["#{index}".to_i].nil? && nvme_namespaces["#{index}".to_i] != 1 - nvme_drive << ",namespaces=#{nvme_namespaces["#{index}".to_i]}" + if !nvme_namespaces[index].nil? && nvme_namespaces[index] != 1 + nvme_drive << ",namespaces=#{nvme_namespaces[index]}" end - if !nvme_cmbs["#{index}".to_i].nil? && nvme_cmbs["#{index}".to_i] == "true" + if !nvme_cmbs[index].nil? && nvme_cmbs[index] == "true" # Fix the size of the buffer to 128M nvme_drive << ",cmb_size_mb=128" end @@ -228,8 +228,8 @@ Vagrant.configure(2) do |config| libvirt.driver = "kvm" libvirt.graphics_type = "vnc" - libvirt.memory = "#{vmram}" - libvirt.cpus = "#{vmcpu}" + libvirt.memory = vmram + libvirt.cpus = vmcpu libvirt.video_type = "cirrus" if ENV['VAGRANT_HUGE_MEM'] == "1" @@ -243,7 +243,7 @@ Vagrant.configure(2) do |config| # rsync the spdk directory if provision hasn't happened yet # Warning: rsync does not work with freebsd boxes, so this step is disabled if ENV['COPY_SPDK_DIR'] == "1" && spdk_dir != "none" - config.vm.synced_folder "#{spdk_dir}", "/home/vagrant/spdk_repo/spdk", files_sync_backend + config.vm.synced_folder spdk_dir, "/home/vagrant/spdk_repo/spdk", files_sync_backend end # rsync artifacts from build