Commit efb72886 authored by Vitaliy Mysak's avatar Vitaliy Mysak Committed by Tomasz Zawadzki
Browse files

scripts/vagrant: add fedora31 to create_vhost_vm script



Adding fedora31 to the list of available choices
in create_vhost_vm script.
This requires some changes in Vagrant_vhost_vm because
fedora is configured differently than ubuntu.

Fedora VMs will very useful for vhost tests because
they run on fedora.

Change-Id: Iad2820a9c3fe2621a368be34d9a72b80ad3f4941
Signed-off-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1677


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 1cab8c9f
Loading
Loading
Loading
Loading
+34 −7
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@ Vagrant.configure(2) do |config|
    # See: https://app.vagrantup.com/bento/boxes/ubuntu-18.04
    config.vm.box = "bento/ubuntu-18.04"
    config.vm.box_version = "201808.24.0"
  when "fedora31"
    # See: https://app.vagrantup.com/generic/boxes/fedora31
    config.vm.box = "generic/fedora31"
    config.vm.box_version = "2.0.6"
  else
    "Invalid argument #{distro}"
    abort("Invalid argument!")
@@ -63,7 +67,20 @@ Vagrant.configure(2) do |config|
  sudo DEBIAN_FRONTEND=noninteractive apt -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
  sudo apt -y install -y fio sg3-utils bc
  SCRIPT
  config.vm.provision "shell", inline: $apt_script

  $dnf_script = <<-SCRIPT
  sudo dnf -y update
  sudo dnf -y install fio sg3_utils bc
  SCRIPT

  $install_script = case distro
    when "ubuntu16" then $apt_script
    when "ubuntu18" then $apt_script
    when "fedora31" then $dnf_script
    else abort("#{distro} distribution is not supported yet")
  end

  config.vm.provision "shell", inline: $install_script

  # Modify GRUB options
  # console=ttyS0 earlyprintk=ttyS0 - reroute output to serial dev, so that QEMU can write output to file
@@ -72,13 +89,23 @@ Vagrant.configure(2) do |config|
  #     Reason for these options is that NIC can have different udev name during provisioning with Vagrant
  #     and then some other name while running SPDK tests which use Qemu without any hypervisor like vbox or libvirt
  #     so no corresponding configuration for this NIC name will be present in /etc.
  config.vm.provision "shell", inline: 'sudo sed -ir s#GRUB_CMDLINE_LINUX=\"\"#GRUB_CMDLINE_LINUX=\"console=ttyS0\ earlyprintk=ttyS0\ scsi_mod.use_blk_mq=1\ net.ifnames=0\ biosdevname=0\"#g /etc/default/grub'
  config.vm.provision "shell", inline: 'sudo update-grub'
  config.vm.provision "shell", inline: 'sudo sed -ir s#GRUB_CMDLINE_LINUX=#GRUB_CMDLINE_LINUX=\"console=ttyS0\ earlyprintk=ttyS0\ scsi_mod.use_blk_mq=1\ net.ifnames=0\ biosdevname=0\"#g /etc/default/grub'
  config.vm.provision "shell", inline: 'sudo sed -ir s#\"\"#\ #g /etc/default/grub'

  update_grub_command = case distro
    when "ubuntu16" then 'sudo update-grub'
    when "ubuntu18" then 'sudo update-grub'
    when "fedora31" then 'sudo grub2-mkconfig -o /boot/grub2/grub.cfg ; sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg'
    else abort("#{distro} distribution is not supported yet")
  end
  config.vm.provision "shell", inline: update_grub_command

  if distro.include? "ubuntu"
    # TODO: Next 2 lines break any future ssh communication via "vagrant ssh"
    # I'd be good to check NIC names in ifconfig and then sed them in /etc/network/interfaces to eht0, eht1, and so on
    config.vm.provision "shell", inline: 'sudo sh -c "echo \"auto eth0\" >> /etc/network/interfaces"'
    config.vm.provision "shell", inline: 'sudo sh -c "echo \"iface eth0 inet dhcp\" >> /etc/network/interfaces"'
  end

  if distro.include? "ubuntu18"
    # This is to avoid annoying "Start job is running for wait for network to be configured" 2 minute timeout
+4 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ display_help() {
	echo
	echo " Usage: ${0##*/} <distro>"
	echo
	echo "  distro = <ubuntu16 | ubuntu18> "
	echo "  distro = <ubuntu16 | ubuntu18 | fedora31> "
	echo
	echo "  --use-ssh-dir=<dir path>    Use existing spdk_vhost_id_rsa keys from specified directory"
	echo "                              for setting up SSH key pair on VM"
@@ -79,6 +79,9 @@ case "${SPDK_VAGRANT_DISTRO}" in
	ubuntu18)
		export SPDK_VAGRANT_DISTRO
		;;
	fedora31)
		export SPDK_VAGRANT_DISTRO
		;;
	*)
		echo "  Invalid argument \"${SPDK_VAGRANT_DISTRO}\""
		echo "  Try: \"$0 -h\"" >&2