diff --git a/docker/local-emulator/qemu/build-image.sh b/docker/local-emulator/qemu/build-image.sh index feca447fa..302403bf0 100755 --- a/docker/local-emulator/qemu/build-image.sh +++ b/docker/local-emulator/qemu/build-image.sh @@ -91,7 +91,7 @@ qemu_cmd_prefix_for_arch() { if [ "$HOST_ARCH" = "arm64" ]; then case "$HOST_OS" in darwin) accel="hvf" ;; - linux) [ -e /dev/kvm ] && accel="kvm" ;; + linux) [ -w /dev/kvm ] && accel="kvm" ;; esac fi local firmware @@ -104,7 +104,7 @@ qemu_cmd_prefix_for_arch() { if [ "$HOST_ARCH" = "amd64" ]; then case "$HOST_OS" in darwin) accel="hvf" ;; - linux) [ -e /dev/kvm ] && accel="kvm" ;; + linux) [ -w /dev/kvm ] && accel="kvm" ;; esac else cpu="qemu64" diff --git a/docker/local-emulator/qemu/run-emulator.sh b/docker/local-emulator/qemu/run-emulator.sh index 58902363c..24461976b 100755 --- a/docker/local-emulator/qemu/run-emulator.sh +++ b/docker/local-emulator/qemu/run-emulator.sh @@ -38,7 +38,7 @@ select_accelerator() { fi ;; linux) - if [ -e /dev/kvm ]; then + if [ -w /dev/kvm ]; then accel="kvm" fi ;; @@ -327,6 +327,8 @@ cmd_reset() { log "Emulator state reset. Next start will be a fresh boot." } +STATUS_FAILED=0 + print_service_status() { local name="$1" local port="$2" @@ -337,15 +339,18 @@ print_service_status() { echo -e " ${GREEN}●${NC} $name (:$port)" else echo -e " ${RED}●${NC} $name (:$port)" + STATUS_FAILED=1 fi } cmd_status() { + STATUS_FAILED=0 echo "VM:" if is_running; then echo -e " ${GREEN}●${NC} emulator" else echo -e " ${RED}●${NC} emulator" + STATUS_FAILED=1 fi echo "" echo "Services:" @@ -357,6 +362,7 @@ cmd_status() { print_service_status "MinIO" "${PORT_PREFIX}21" http /minio/health/live print_service_status "QStash" "${PORT_PREFIX}25" http / 401 print_service_status "ClickHouse" "${PORT_PREFIX}36" http /ping + exit "$STATUS_FAILED" } cmd_bench() {