summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/start-qemu52
1 files changed, 41 insertions, 11 deletions
diff --git a/libexec/container/start-qemu b/libexec/container/start-qemu
index 491278c..e27df60 100755
--- a/libexec/container/start-qemu
+++ b/libexec/container/start-qemu
@@ -125,12 +125,6 @@ case "${NAME}" in
;;
esac
-if [ ! -e "${MACHINES}/${NAME}.img" ]
-then
- echo "'${NAME}': no such vm" >&2
- exit 1
-fi
-
case "${START}" in
false)
STATE="$(machinectl show ${NAME} 2>&1 | awk -FState= '/^State=/ { print $2 }')"
@@ -228,8 +222,41 @@ then
esac
DIRECTORY="$(awk -Fdirectory= '/^directory=/ { print $2 }' ${CONFIG}/${NAME}.conf || echo ${MACHINES}/${NAMES})"
- DIRECTORY="-drive file=${DIRECTORY}.img,format=raw,if=virtio"
+ DRIVE=""
+ DRIVES="$(awk -Fdrive= '/^drive=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+
+ case "${DRIVES}" in
+ "")
+ ;;
+
+ *)
+ for DRIVE_ITEM in ${DRIVES}
+ do
+ DRIVE="${DRIVE} -drive ${DRIVE_ITEM}"
+ done
+ ;;
+ esac
+
+ MEMORY="-m $(awk -Fmemory= '/^memory=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+
+ SERIAL="-serial $(awk -Fserial= '/^serial=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+ # FIXME empty
+
+ RAW_OPTIONS="$(awk -Fraw-options= '/^raw-options=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+ # FIXME empty
+
+ BIOS_FILE="$(awk -Fbios= '/^bios=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+
+ case "${BIOS_FILE}" in
+ "")
+ BIOS=""
+ ;;
+
+ *)
+ BIOS="-bios ${BIOS_FILE}"
+ ;;
+ esac
DROP_CAPABILITY="$(awk -Fdrop-capability= '/^drop-capability=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
case "${DROP_CAPABILITY}" in
@@ -268,8 +295,9 @@ then
for VETH in ${VETHS}
do
INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')"
+ INTERFACE_ID="$(echo ${VETH} | awk -F: '{ print $2 }')"
- NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} -netdev tap,id=${INTERFACE},ifname=${INTERFACE},script=no,downscript=no -device virtio-net-pci,netdev=${INTERFACE}"
+ NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} -netdev tap,id=${INTERFACE_ID},ifname=${INTERFACE},script=no,downscript=no -device virtio-net-pci,netdev=${INTERFACE_ID}"
if [ "$(echo ${INTERFACE} | wc -c)" -gt 15 ]
then
@@ -400,11 +428,13 @@ case "${START}" in
qemu-system-x86_64 \
-machine accel=kvm:tcg \
- ${DIRECTORY} \
- -m 4G \
+ ${DRIVE} \
+ ${MEMORY} \
-name ${NAME} \
${NETWORK_VETH_EXTRA} \
- -bios /usr/share/qemu/OVMF.fd
+ ${BIOS} \
+ ${SERIAL} \
+ ${RAW_OPTIONS}
case "${VERBOSE}" in
true)