CI: Enable the ability to have test VMs with different block sizes

Recently we became aware that some operators might need a larger
block size, but our CI testing doesn't represent any ability to
assert a different block size.

We can now assert a block size override in the scripting which
allows us to create a CI job.

Change-Id: I8470fb5b2827226dc155938a94c3a2cbe98912b5
This commit is contained in:
Julia Kreger 2024-09-05 13:20:23 -07:00
parent c996aafa6d
commit 6f1c603b5b
3 changed files with 10 additions and 2 deletions

View File

@ -91,6 +91,8 @@ def main():
help=('The absolute path of the non-volatile memory ' help=('The absolute path of the non-volatile memory '
'to store the UEFI variables. Should be used ' 'to store the UEFI variables. Should be used '
'only when --uefi-loader is also specified.')) 'only when --uefi-loader is also specified.'))
parser.add_argument('--block-size', default='512',
help='The block size for the block storage.')
args = parser.parse_args() args = parser.parse_args()
env = jinja2.Environment(loader=jinja2.FileSystemLoader(templatedir)) env = jinja2.Environment(loader=jinja2.FileSystemLoader(templatedir))
@ -117,6 +119,7 @@ def main():
'disk_format': args.disk_format, 'disk_format': args.disk_format,
'uefi_loader': args.uefi_loader, 'uefi_loader': args.uefi_loader,
'uefi_nvram': args.uefi_nvram, 'uefi_nvram': args.uefi_nvram,
'block_size': args.block_size,
} }
if args.emulator: if args.emulator:

View File

@ -12,7 +12,7 @@ export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}: '
# Keep track of the DevStack directory # Keep track of the DevStack directory
TOP_DIR=$(cd $(dirname "$0")/.. && pwd) TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
while getopts "n:c:i:m:M:d:a:b:e:E:p:o:f:l:L:N:A:D:v:P:t:" arg; do while getopts "n:c:i:m:M:d:a:b:e:E:p:o:f:l:L:N:A:D:v:P:t:B:" arg; do
case $arg in case $arg in
n) NAME=$OPTARG;; n) NAME=$OPTARG;;
c) CPU=$OPTARG;; c) CPU=$OPTARG;;
@ -37,6 +37,7 @@ while getopts "n:c:i:m:M:d:a:b:e:E:p:o:f:l:L:N:A:D:v:P:t:" arg; do
v) VOLUME_COUNT=$OPTARG;; v) VOLUME_COUNT=$OPTARG;;
P) STORAGE_POOL=$OPTARG;; P) STORAGE_POOL=$OPTARG;;
t) MACHINE_TYPE=$OPTARG;; t) MACHINE_TYPE=$OPTARG;;
B) BLOCK_SIZE=$OPTARG;;
esac esac
done done
@ -77,6 +78,8 @@ if [ ! -z "$UEFI_LOADER" ]; then
fi fi
fi fi
BLOCK_SIZE=${BLOCK_SIZE:-512}
# Create bridge and add VM interface to it. # Create bridge and add VM interface to it.
# Additional interface will be added to this bridge and # Additional interface will be added to this bridge and
# it will be plugged to OVS. # it will be plugged to OVS.
@ -129,7 +132,8 @@ if ! virsh list --all | grep -q $NAME; then
--bootdev network --name $NAME \ --bootdev network --name $NAME \
--arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \ --arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \
--disk-format $DISK_FORMAT $VM_LOGGING --engine $ENGINE $UEFI_OPTS $vm_opts \ --disk-format $DISK_FORMAT $VM_LOGGING --engine $ENGINE $UEFI_OPTS $vm_opts \
--interface-count $INTERFACE_COUNT $MAC_ADDRESS --machine_type $MACHINE_TYPE >&2 --interface-count $INTERFACE_COUNT $MAC_ADDRESS --machine_type $MACHINE_TYPE \
--block-size $BLOCK_SIZE >&2
fi fi
# echo mac in format mac1,ovs-node-0i1;mac2,ovs-node-0i2;...;macN,ovs-node0iN # echo mac in format mac1,ovs-node-0i1;mac2,ovs-node-0i2;...;macN,ovs-node0iN

View File

@ -46,6 +46,7 @@
<driver name='qemu' type='{{ disk_format }}' cache='unsafe'/> <driver name='qemu' type='{{ disk_format }}' cache='unsafe'/>
<source file='{{ imagefile }}'/> <source file='{{ imagefile }}'/>
<target dev='vd{{ letter }}'/> <target dev='vd{{ letter }}'/>
<blockio logical_block_size="{{ block_size }}" physical_block_size="{{ block_size }}" discard_granularity="{{ block_size }}"/>
</disk> </disk>
{% endfor %} {% endfor %}
{% for n in range(1, interface_count+1) %} {% for n in range(1, interface_count+1) %}