Increase VM defaults, restart VM on new workspace, make rebuild writable

This commit is contained in:
Joshua Bell 2026-01-26 08:52:13 -06:00
parent 9aa72fade7
commit e766c8466d
7 changed files with 35 additions and 364 deletions

View file

@ -79,7 +79,11 @@ build_base_image() {
# Copy the qcow2 to base image location
log_info "Copying image to: $QVM_BASE_IMAGE"
# Remove existing image first (may be read-only from Nix store copy)
rm -f "$QVM_BASE_IMAGE"
cp -L "$qcow2_path" "$QVM_BASE_IMAGE"
# Ensure the new image is writable for future rebuilds
chmod 644 "$QVM_BASE_IMAGE"
# Remove the result symlink
rm -f "$build_result"

View file

@ -183,7 +183,29 @@ main() {
newly_added=1
fi
# Ensure VM is running
# If this is a newly registered workspace, restart VM to mount it
if [[ "$newly_added" -eq 1 ]] && is_vm_running; then
log_info "New workspace registered. Restarting VM to mount it..."
# Path to qvm-stop and qvm-start scripts
local script_dir="${QVM_LIB_DIR}/../bin"
local qvm_stop="$script_dir/qvm-stop"
local qvm_start="$script_dir/qvm-start"
# Stop the VM
if ! "$qvm_stop"; then
die "Failed to stop VM"
fi
# Start the VM with new workspace mount
if ! "$qvm_start"; then
die "Failed to start VM"
fi
log_info "VM restarted with new workspace mounted"
fi
# Ensure VM is running (if it wasn't running before)
if ! is_vm_running; then
log_info "VM not running, starting..."

View file

@ -153,8 +153,8 @@ main() {
log_info "Using SSH port: $ssh_port"
# Get memory and CPU settings from environment or use defaults
local memory="${QVM_MEMORY:-8G}"
local cpus="${QVM_CPUS:-4}"
local memory="${QVM_MEMORY:-40G}"
local cpus="${QVM_CPUS:-30}"
log_info "VM resources: ${memory} memory, ${cpus} CPUs"
# Build QEMU command