From d0426c877544f905f20b510fdde3db7525640524 Mon Sep 17 00:00:00 2001 From: Pawel Piatek Date: Mon, 10 Aug 2020 15:48:21 +0200 Subject: [PATCH] script/vagrant: split into functions - spdk local copy of nfs Signed-off-by: Pawel Piatek Change-Id: I613e02a88ce4fbfcb67e913574fe3978ba9cb7b2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3713 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Karol Latecki Reviewed-by: Maciej Wawryk Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- scripts/vagrant/Vagrantfile | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index 51c326ce4..47a7161cf 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -94,6 +94,24 @@ def copy_spdk_artifacts(config, plugins_sync_backend) config.vm.synced_folder "#{vagrantfile_dir}/output", "/home/vagrant/spdk_repo/output", plugins_sync_backend end +def make_spdk_local_copy_of_nfs(config,distro) + user_group = 'vagrant:vagrant' + if distro.include? 'clearlinux' + user_group = 'clear:clear' + end + + spdk_path = '/home/vagrant/spdk_repo/spdk' + spdk_tmp_path = '/tmp/spdk' + $spdk_repo_cmd = <<-SCRIPT + sudo -s + cp -R '#{spdk_path}' '#{spdk_tmp_path}' + umount '#{spdk_path}' && rm -rf '#{spdk_path}' + mv '#{spdk_tmp_path}' '#{spdk_path}' + chown -R #{user_group} '#{spdk_path}' + SCRIPT + + config.vm.provision "shell", inline: $spdk_repo_cmd +end Vagrant.configure(2) do |config| @@ -165,25 +183,7 @@ Vagrant.configure(2) do |config| # on host filesystem. # To make sources usable in the guest VM we need to unmount them and use # local copy. - if distro.include? "freebsd" - $freebsd_spdk_repo = <<-SCRIPT - sudo -s - cp -R /home/vagrant/spdk_repo/spdk /tmp/spdk - umount /home/vagrant/spdk_repo/spdk && rm -rf /home/vagrant/spdk_repo/spdk - mv /tmp/spdk /home/vagrant/spdk_repo/spdk - chown -R vagrant:vagrant /home/vagrant/spdk_repo/spdk - SCRIPT - config.vm.provision "shell", inline: $freebsd_spdk_repo - elsif distro.include? "clearlinux" - $clearlinux_spdk_repo = <<-SCRIPT - sudo -s - cp -R /home/vagrant/spdk_repo/spdk /tmp/spdk - umount /home/vagrant/spdk_repo/spdk && rm -rf /home/vagrant/spdk_repo/spdk - mv /tmp/spdk /home/vagrant/spdk_repo/spdk - chown -R clear:clear /home/vagrant/spdk_repo/spdk - SCRIPT - config.vm.provision "shell", inline: $clearlinux_spdk_repo - end + make_spdk_local_copy_of_nfs(config,distro) if plugins_sync_backend[:type] == :nfs config.ssh.forward_agent = true config.ssh.forward_x11 = true