Skip to content

Commit

Permalink
F #6303: Support for VIRTIO_BLK_QUEUES in disk attach
Browse files Browse the repository at this point in the history
Add support for VIRTIO_BLK_QUEUES when attaching a disk. "auto" keyword
can be used and set as default.
  • Loading branch information
rsmontero committed Sep 4, 2023
1 parent f5de296 commit 2eb07ee
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/mad/sh/scripts_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,9 @@ function get_source_xml {
# * SOURCE_ARGS: ex. protocol='rbd'
# * SOURCE_HOST
# * AUTH: auth xml for libvirt
# * VIRTIO_SCSI_QUEUES
#
# This function was originaly in attach_disk action
# This function was originally in attach_disk action
function get_disk_information {
FILTER="$1"
Expand All @@ -930,6 +931,7 @@ function get_disk_information {
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($CMD /VMM_DRIVER_ACTION_DATA/VM/ID \
/VMM_DRIVER_ACTION_DATA/VM/TEMPLATE/VCPU \
$DISK_XPATH/DRIVER \
$DISK_XPATH/TYPE \
$DISK_XPATH/READONLY \
Expand Down Expand Up @@ -973,9 +975,11 @@ function get_disk_information {
$DISK_XPATH/WRITE_IOPS_SEC_MAX \
$DISK_XPATH/WRITE_IOPS_SEC_MAX_LENGTH \
$DISK_XPATH/SIZE_IOPS_SEC \
$DISK_XPATH/VIRTIO_BLK_QUEUES \
$DISK_XPATH/IOTHREAD )
VMID="${XPATH_ELEMENTS[j++]}"
VCPU="${XPATH_ELEMENTS[j++]:-1}"
DRIVER="${XPATH_ELEMENTS[j++]:-$DEFAULT_TYPE}"
TYPE="${XPATH_ELEMENTS[j++]}"
READONLY="${XPATH_ELEMENTS[j++]}"
Expand Down Expand Up @@ -1019,6 +1023,7 @@ function get_disk_information {
WRITE_IOPS_SEC_MAX="${XPATH_ELEMENTS[j++]}"
WRITE_IOPS_SEC_MAX_LENGTH="${XPATH_ELEMENTS[j++]}"
SIZE_IOPS_SEC="${XPATH_ELEMENTS[j++]}"
VIRTIO_BLK_QUEUES="${XPATH_ELEMENTS[j++]}"
IOTHREAD="${XPATH_ELEMENTS[j++]}"
TYPE=$(echo "$TYPE"|tr A-Z a-z)
Expand Down
8 changes: 4 additions & 4 deletions src/vmm_mad/exec/vmm_exec_kvm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
# - ARCH
# - MACHINE
# - SD_DISK_BUS
# * vCPU
# * VCPU
# * MEMORY_SLOTS: number of memory slots for hotplug memory
# * gRAPHICS:
# * GRAPHICS:
# - TYPE
# - LISTEN
# - PASSWD
# - KEYMAP
# - RANDOM_PASSWD
# * featURES:
# * FEATURES:
# - ACPI
# - PAE
# - APIC
Expand All @@ -31,7 +31,7 @@
# - IOTHREADS
# - VIRTIO_SCSI_QUEUES
# - VIRTIO_BLK_QUEUES
# * cpu_MODEL:
# * CPU_MODEL:
# - MODEL
# * DISK:
# - DRIVER
Expand Down
6 changes: 6 additions & 0 deletions src/vmm_mad/remotes/kvm/attach_disk
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ WRITE_IOPS_SEC=${WRITE_IOPS_SEC:-${DEFAULT_ATTACH_WRITE_IOPS_SEC}}
WRITE_IOPS_SEC_MAX_LENGTH=${WRITE_IOPS_SEC_MAX_LENGTH:-${DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX_LENGTH}}
WRITE_IOPS_SEC_MAX=${WRITE_IOPS_SEC_MAX:-${DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX}}
SIZE_IOPS_SEC=${SIZE_IOPS_SEC:-${DEFAULT_ATTACH_SIZE_IOPS_SEC}}
VIRTIO_BLK_QUEUES=${VIRTIO_BLK_QUEUES:-${DEFAULT_VIRTIO_BLK_QUEUES}}

if [ "${VIRTIO_BLK_QUEUES}" = "auto" ]; then
VIRTIO_BLK_QUEUES="$VCPU"
fi

# disk XML
XML=''
Expand All @@ -88,6 +93,7 @@ XML+="<driver name='qemu' type='$(xml_esc "${DRIVER}")'"
[ -n "${DISK_IO}" ] && XML+=" io='$(xml_esc "${DISK_IO}")'"
[ -n "${DISCARD}" ] && XML+=" discard='$(xml_esc "${DISCARD}")'"
[ -n "${IOTHREAD}" ] && XML+=" iothread='$(xml_esc "${IOTHREAD}")'"
[ -n "${VIRTIO_BLK_QUEUES}" ] && XML+=" queues='$(xml_esc "${VIRTIO_BLK_QUEUES}")'"
XML+="/>"

XML+="<source ${TYPE_SOURCE}='$(xml_esc "${SOURCE}")' ${SOURCE_ARGS}>"
Expand Down
3 changes: 3 additions & 0 deletions src/vmm_mad/remotes/kvm/kvmrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ DEFAULT_ATTACH_DISCARD=unmap
# The default DISK I/O policy for new attached disks.
#DEFAULT_ATTACH_IO=

# The default number of queues for virtio-blk driver.
#DEFAULT_ATTACH_VIRTIO_BLK_QUEUES=

# These parameters set the default DISK I/O throttling attributes
# for the new attached disk in case they aren't set.
#DEFAULT_ATTACH_TOTAL_BYTES_SEC=
Expand Down

0 comments on commit 2eb07ee

Please sign in to comment.