test/vhost: allow vm_setup to boot vm from vhost controller
Change-Id: I26814ce3b20eb02c809bb586e11aabbabd35ed0d Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com> Reviewed-on: https://review.gerrithub.io/421746 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
6609b776e4
commit
b77ac822dc
@ -542,6 +542,7 @@ function vm_setup()
|
||||
incoming=*) local vm_incoming="${OPTARG#*=}" ;;
|
||||
migrate-to=*) local vm_migrate_to="${OPTARG#*=}" ;;
|
||||
vhost-num=*) local vhost_dir="$(get_vhost_dir ${OPTARG#*=})" ;;
|
||||
spdk-boot=*) local boot_from="${OPTARG#*=}" ;;
|
||||
*)
|
||||
error "unknown argument $OPTARG"
|
||||
return 1
|
||||
@ -669,6 +670,7 @@ function vm_setup()
|
||||
$shell_restore_x
|
||||
|
||||
local node_num=${!qemu_numa_node_param}
|
||||
local boot_disk_present=false
|
||||
notice "NUMA NODE: $node_num"
|
||||
cmd+="-m $guest_memory --enable-kvm -cpu host -smp $cpu_num -vga std -vnc :$vnc_socket -daemonize ${eol}"
|
||||
cmd+="-object memory-backend-file,id=mem,size=${guest_memory}M,mem-path=/dev/hugepages,share=on,prealloc=yes,host-nodes=$node_num,policy=bind ${eol}"
|
||||
@ -681,8 +683,10 @@ function vm_setup()
|
||||
cmd+="-D $vm_dir/qemu.log ${eol}"
|
||||
cmd+="-net user,hostfwd=tcp::$ssh_socket-:22,hostfwd=tcp::$fio_socket-:8765 ${eol}"
|
||||
cmd+="-net nic ${eol}"
|
||||
cmd+="-drive file=$os,if=none,id=os_disk ${eol}"
|
||||
cmd+="-device ide-hd,drive=os_disk,bootindex=0 ${eol}"
|
||||
if [[ -z "$boot_from" ]]; then
|
||||
cmd+="-drive file=$os,if=none,id=os_disk ${eol}"
|
||||
cmd+="-device ide-hd,drive=os_disk,bootindex=0 ${eol}"
|
||||
fi
|
||||
|
||||
if ( [[ $disks == '' ]] && [[ $disk_type_g == virtio* ]] ); then
|
||||
disks=1
|
||||
@ -729,12 +733,22 @@ function vm_setup()
|
||||
spdk_vhost_scsi)
|
||||
notice "using socket $vhost_dir/naa.$disk.$vm_num"
|
||||
cmd+="-chardev socket,id=char_$disk,path=$vhost_dir/naa.$disk.$vm_num ${eol}"
|
||||
cmd+="-device vhost-user-scsi-pci,id=scsi_$disk,num_queues=$queue_number,chardev=char_$disk ${eol}"
|
||||
cmd+="-device vhost-user-scsi-pci,id=scsi_$disk,num_queues=$queue_number,chardev=char_$disk"
|
||||
if [[ "$disk" == "$boot_from" ]]; then
|
||||
cmd+=",bootindex=0"
|
||||
boot_disk_present=true
|
||||
fi
|
||||
cmd+=" ${eol}"
|
||||
;;
|
||||
spdk_vhost_blk)
|
||||
notice "using socket $vhost_dir/naa.$disk.$vm_num"
|
||||
cmd+="-chardev socket,id=char_$disk,path=$vhost_dir/naa.$disk.$vm_num ${eol}"
|
||||
cmd+="-device vhost-user-blk-pci,num-queues=$queue_number,chardev=char_$disk ${eol}"
|
||||
cmd+="-device vhost-user-blk-pci,num-queues=$queue_number,chardev=char_$disk"
|
||||
if [[ "$disk" == "$boot_from" ]]; then
|
||||
cmd+=",bootindex=0"
|
||||
boot_disk_present=true
|
||||
fi
|
||||
cmd+=" ${eol}"
|
||||
;;
|
||||
kernel_vhost)
|
||||
if [[ -z $disk ]]; then
|
||||
@ -753,6 +767,11 @@ function vm_setup()
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n $boot_from ]] && [[ $boot_disk_present == false ]]; then
|
||||
error "Boot from $boot_from is selected but device is not present"
|
||||
return 1
|
||||
fi
|
||||
|
||||
[[ ! -z $qemu_args ]] && cmd+=" $qemu_args ${eol}"
|
||||
# remove last $eol
|
||||
cmd="${cmd%\\\\\\n }"
|
||||
|
Loading…
Reference in New Issue
Block a user