scripts/vagrant: [nvme] Enable CMB buffer on demand
Allow to specify additional argument which will tell Vagrant to enable CMB on given nvme drive. The format of the argument is any string which is then simply converted to plain "true". E.g. ./create_vbox.sh -b "/path_to_nvme_img,nvme,3,true" Change-Id: I7de55e46491318b082bf4e2165260091b44d60f0 Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2725 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
262c35fc9a
commit
5327de1ffa
13
scripts/vagrant/Vagrantfile
vendored
13
scripts/vagrant/Vagrantfile
vendored
@ -128,6 +128,7 @@ Vagrant.configure(2) do |config|
|
||||
emulated_nvme_types=(ENV['NVME_DISKS_TYPE'] || "nvme").split(',')
|
||||
nvme_namespaces=(ENV['NVME_DISKS_NAMESPACES'] || "").split(',')
|
||||
nvme_file=(ENV['NVME_FILE'] || "").split(',')
|
||||
nvme_cmbs=(ENV['NVME_CMB'] || "").split(',')
|
||||
vagrantfile_dir=(ENV['VAGRANTFILE_DIR'] || "none")
|
||||
|
||||
config.ssh.forward_agent = true
|
||||
@ -192,11 +193,15 @@ Vagrant.configure(2) do |config|
|
||||
libvirt.qemuargs :value => "-drive"
|
||||
libvirt.qemuargs :value => "format=raw,file=#{nvme_disk},if=none,id=#{nvme_disk_id}"
|
||||
libvirt.qemuargs :value => "-device"
|
||||
if nvme_namespaces["#{index}".to_i].nil? || nvme_namespaces["#{index}".to_i] == "1"
|
||||
libvirt.qemuargs :value => "nvme,drive=#{nvme_disk_id},serial=1234#{index}"
|
||||
else
|
||||
libvirt.qemuargs :value => "nvme,drive=#{nvme_disk_id},serial=1234#{index},namespaces=#{nvme_namespaces["#{index}".to_i]}"
|
||||
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]}"
|
||||
end
|
||||
if !nvme_cmbs["#{index}".to_i].nil? && nvme_cmbs["#{index}".to_i] == "true"
|
||||
# Fix the size of the buffer to 128M
|
||||
nvme_drive << ",cmb_size_mb=128"
|
||||
end
|
||||
libvirt.qemuargs :value => nvme_drive
|
||||
elsif disk == "ocssd"
|
||||
libvirt.qemuargs :value => "-drive"
|
||||
libvirt.qemuargs :value => "format=raw,file=#{nvme_disk},if=none,id=#{nvme_disk_id}"
|
||||
|
@ -30,7 +30,7 @@ display_help() {
|
||||
echo " If no -b option is specified then this option defaults to emulating single"
|
||||
echo " NVMe with 1 namespace and assumes path: /var/lib/libvirt/images/nvme_disk.img"
|
||||
echo " -b option can be used multiple times for attaching multiple files to the VM"
|
||||
echo " Parameters for -b option: <path>,<type>,<namespaces>."
|
||||
echo " Parameters for -b option: <path>,<type>,<namespaces>,<cmb>"
|
||||
echo " Available types: nvme, ocssd."
|
||||
echo " -c Create all above disk, default 0"
|
||||
echo " -H Use hugepages for allocating VM memory. Only for libvirt provider. Default: false."
|
||||
@ -197,11 +197,14 @@ if [ -z "$NVME_FILE" ]; then
|
||||
else
|
||||
TMP=""
|
||||
for args in $NVME_FILE; do
|
||||
while IFS=, read -r path type namespace; do
|
||||
while IFS=, read -r path type namespace cmb; do
|
||||
TMP+="$path,"
|
||||
if [ -z "$type" ]; then
|
||||
type="nvme"
|
||||
fi
|
||||
if [[ -n $cmb ]]; then
|
||||
NVME_CMB=${NVME_CMB:+$NVME_CMB,}true
|
||||
fi
|
||||
NVME_DISKS_TYPE+="$type,"
|
||||
if [ -z "$namespace" ] && [ -n "$SPDK_QEMU_EMULATOR" ]; then
|
||||
namespace="1"
|
||||
@ -226,6 +229,7 @@ if [ ${VERBOSE} = 1 ]; then
|
||||
echo NVME_DISKS_TYPE=$NVME_DISKS_TYPE
|
||||
echo NVME_AUTO_CREATE=$NVME_AUTO_CREATE
|
||||
echo NVME_DISKS_NAMESPACES=$NVME_DISKS_NAMESPACES
|
||||
echo NVME_CMB=$NVME_CMB
|
||||
echo SPDK_VAGRANT_DISTRO=$SPDK_VAGRANT_DISTRO
|
||||
echo SPDK_VAGRANT_VMCPU=$SPDK_VAGRANT_VMCPU
|
||||
echo SPDK_VAGRANT_VMRAM=$SPDK_VAGRANT_VMRAM
|
||||
@ -243,6 +247,7 @@ export SPDK_DIR
|
||||
export COPY_SPDK_DIR
|
||||
export COPY_SPDK_ARTIFACTS
|
||||
export DEPLOY_TEST_VM
|
||||
export NVME_CMB
|
||||
export NVME_DISKS_TYPE
|
||||
export NVME_DISKS_NAMESPACES
|
||||
export NVME_FILE
|
||||
|
Loading…
Reference in New Issue
Block a user