|
|
@ -142,6 +142,7 @@ function check_cpu_flag() { |
|
|
|
function vm_boot() { |
|
|
|
function vm_boot() { |
|
|
|
local BALLOON="-device virtio-balloon" |
|
|
|
local BALLOON="-device virtio-balloon" |
|
|
|
local CPU="" |
|
|
|
local CPU="" |
|
|
|
|
|
|
|
local DISK_USED="" |
|
|
|
local GUEST_CPU_CORES="" |
|
|
|
local GUEST_CPU_CORES="" |
|
|
|
local GUEST_CPU_LOGICAL_CORES="" |
|
|
|
local GUEST_CPU_LOGICAL_CORES="" |
|
|
|
local GUEST_CPU_THREADS="" |
|
|
|
local GUEST_CPU_THREADS="" |
|
|
@ -384,28 +385,37 @@ function vm_boot() { |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
echo " Just created, booting from ${iso}${img}" |
|
|
|
echo " Just created, booting from ${iso}${img}" |
|
|
|
|
|
|
|
DISK_USED="no" |
|
|
|
elif [ -e "${disk_img}" ]; then |
|
|
|
elif [ -e "${disk_img}" ]; then |
|
|
|
# Check there isn't already a process attached to the disk image. |
|
|
|
# Check there isn't already a process attached to the disk image. |
|
|
|
if ! ${QEMU_IMG} info "${disk_img}" >/dev/null; then |
|
|
|
if ! ${QEMU_IMG} info "${disk_img}" >/dev/null; then |
|
|
|
echo " Failed to get \"write\" lock. Is another process using the disk?" |
|
|
|
echo " Failed to get \"write\" lock. Is another process using the disk?" |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
else |
|
|
|
else |
|
|
|
DISK_CURR_SIZE=$(stat -c%s "${disk_img}") |
|
|
|
# Only check disk image size if preallocation is off |
|
|
|
if [ "${DISK_CURR_SIZE}" -le "${DISK_MIN_SIZE}" ]; then |
|
|
|
if [ "${preallocation}" == "off" ]; then |
|
|
|
echo " Looks unused, booting from ${iso}${img}" |
|
|
|
DISK_CURR_SIZE=$(stat -c%s "${disk_img}") |
|
|
|
if [ -z "${iso}" ] && [ -z "${img}" ]; then |
|
|
|
if [ "${DISK_CURR_SIZE}" -le "${DISK_MIN_SIZE}" ]; then |
|
|
|
echo "ERROR! You haven't specified a .iso or .img image to boot from." |
|
|
|
echo " Looks unused, booting from ${iso}${img}" |
|
|
|
exit 1 |
|
|
|
if [ -z "${iso}" ] && [ -z "${img}" ]; then |
|
|
|
|
|
|
|
echo "ERROR! You haven't specified a .iso or .img image to boot from." |
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
DISK_USED="yes" |
|
|
|
fi |
|
|
|
fi |
|
|
|
else |
|
|
|
else |
|
|
|
# If there is a disk image, assume there is an install and do not boot |
|
|
|
DISK_USED="yes" |
|
|
|
# from installation media. |
|
|
|
|
|
|
|
iso="" |
|
|
|
|
|
|
|
img="" |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${DISK_USED}" == "yes" ]; then |
|
|
|
|
|
|
|
# If there is a disk image that appears to be used do not boot from installation media. |
|
|
|
|
|
|
|
iso="" |
|
|
|
|
|
|
|
img="" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Has the status quo been requested? |
|
|
|
# Has the status quo been requested? |
|
|
|
if [ "${STATUS_QUO}" == "-snapshot" ]; then |
|
|
|
if [ "${STATUS_QUO}" == "-snapshot" ]; then |
|
|
|
if [ -z "${img}" ] && [ -z "${iso}" ]; then |
|
|
|
if [ -z "${img}" ] && [ -z "${iso}" ]; then |
|
|
@ -776,7 +786,7 @@ img="" |
|
|
|
iso="" |
|
|
|
iso="" |
|
|
|
macos_release="" |
|
|
|
macos_release="" |
|
|
|
port_forwards=() |
|
|
|
port_forwards=() |
|
|
|
preallocation="metadata" |
|
|
|
preallocation="off" |
|
|
|
ram="" |
|
|
|
ram="" |
|
|
|
tpm="off" |
|
|
|
tpm="off" |
|
|
|
usb_devices=() |
|
|
|
usb_devices=() |
|
|
|