script/vagrant: split into functions - spdk local copy of nfs

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I613e02a88ce4fbfcb67e913574fe3978ba9cb7b2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3713
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Piatek 2020-08-10 15:48:21 +02:00 committed by Tomasz Zawadzki
parent b5fea1314b
commit d0426c8775

View File

@ -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 config.vm.synced_folder "#{vagrantfile_dir}/output", "/home/vagrant/spdk_repo/output", plugins_sync_backend
end 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| Vagrant.configure(2) do |config|
@ -165,25 +183,7 @@ Vagrant.configure(2) do |config|
# on host filesystem. # on host filesystem.
# To make sources usable in the guest VM we need to unmount them and use # To make sources usable in the guest VM we need to unmount them and use
# local copy. # local copy.
if distro.include? "freebsd" make_spdk_local_copy_of_nfs(config,distro) if plugins_sync_backend[:type] == :nfs
$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
config.ssh.forward_agent = true config.ssh.forward_agent = true
config.ssh.forward_x11 = true config.ssh.forward_x11 = true