From 1d9ccc542d0b6d6dd8db085cfb5269a603d90b94 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 24 Oct 2018 16:30:15 -0300 Subject: Change backing_file behavior --- kvmx | 16 ++++++---------- kvmx-status | 2 +- kvmxfile | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/kvmx b/kvmx index a1d2012..102391d 100755 --- a/kvmx +++ b/kvmx @@ -365,15 +365,10 @@ function kvmx_up { exit 1 fi - if [ ! -z "$backing_file" ]; then - if [ -e "$backing_file" ]; then - echo "Creating image $image as an overlay of $backing_file..." - backing_file_format="`qemu-img info $backing_file | grep "^file format: " | cut -d : -f 2 | sed -e 's/ //g'` " - qemu-img create -o backing_file=$backing_file,backing_fmt=$backing_file_format -f $format $image - else - echo "Backing file not found: $backing_file" - exit 1 - fi + if [ ! -z "$backing_file" ] && [ "$backing_file" == "1" ]; then + echo "Creating image $image as an overlay of $baseimage..." + baseimage_format="`qemu-img info $baseimage | grep "^file format: " | cut -d : -f 2 | sed -e 's/ //g'` " + qemu-img create -o backing_file=$baseimage,backing_fmt=$baseimage_format -f $format $image else echo "Copying base image $baseimage to $image..." if which rsync &> /dev/null; then @@ -446,7 +441,8 @@ function kvmx_up { fi if [ -z "$net" ] || [ "$net" == "user" ]; then - net_opts="user,hostfwd=tcp:127.0.0.1:$SSH-:22,hostfwd=udp:127.0.0.1:$XDMCP_PORT-:177$hostfwd -net nic,model=$nic_model" + #net_opts="user,hostfwd=tcp:127.0.0.1:$SSH-:22,hostfwd=udp:127.0.0.1:$XDMCP_PORT-:177$hostfwd -net nic,model=$nic_model" + net_opts="user,hostfwd=tcp:127.0.0.1:$SSH-:22$hostfwd -net nic,model=$nic_model" elif [ "$net" == "tap" ]; then # Thanks kvm-manager tap="${VM}0" diff --git a/kvmx-status b/kvmx-status index 6a90997..1d5868b 100755 --- a/kvmx-status +++ b/kvmx-status @@ -28,7 +28,7 @@ $DIRNAME/kvmx-supervise status ## Get instances #instances="`kvmx list`" # -## Kill old instances +## Check instance status #for vm in $instances; do # kvmx status $vm #done diff --git a/kvmxfile b/kvmxfile index 5f09daf..77250be 100644 --- a/kvmxfile +++ b/kvmxfile @@ -119,9 +119,9 @@ xrandr="0" # Where the guest image is stored #image="$HOME/.local/share/kvmx/$VM/box.img" -# Backing file for overlay images +# Use basebox image as a backing file for overlay images # See https://wiki.archlinux.org/index.php/QEMU#Overlay_storage_images -#backing_file="$HOME/.local/share/kvmx/$basebox/box.img" +#backing_file="1" # Where datafiles are stored: just set this if you know what you're doing #datadir="$HOME/.local/share/kvmx/$VM" -- cgit v1.2.3