blob: d84a571cb0e5e2c7693eb5f0f7268c7f88c09009 [file] [log] [blame]
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Google LLC
# Author: Andrew Scull <ascull@google.com>
set -euo pipefail
echo "Available partitions:"
partition_ids=()
for f in /sys/hypervisor/spci/*
do
if [[ $f =~ ^/sys/hypervisor/spci/partition[0-9]+$ ]]
then
id=${f:30}
uuid=$(<$f/uuid)
exec_state=$(<$f/exec_state)
vcpus=$(<$f/vcpus)
echo " $id: $uuid $exec_state with $vcpus vCPUs"
partition_ids+=($id)
fi
done
selected_id=${partition_ids[0]}
echo "Selecting partition $selected_id"
cmd="./kvmtest-spci --partition_id $selected_id"
echo $cmd
$cmd