]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Change backing_file behavior
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 24 Oct 2018 19:30:15 +0000 (16:30 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 24 Oct 2018 19:30:15 +0000 (16:30 -0300)
kvmx
kvmx-status
kvmxfile

diff --git a/kvmx b/kvmx
index a1d2012d116811a812f79b6a38534bc74b905588..102391d2d4212535f799a6b70dc4e7dfe312ba8f 100755 (executable)
--- 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"
index 6a90997229da44017bb0a9425fb1919c8d8b7d55..1d5868b922f8a4626c64e014759a7ba70012793d 100755 (executable)
@@ -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
index 5f09dafd87e5830e0c69cd2ef2a345d3d9866e30..77250be9333c7caf9086e7058832478e9e8f8603 100644 (file)
--- 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"