Browse Source

A path to an ISO image can be configured to boot the VM on it.

tags/0.3.0
Jérémy Lecour 9 months ago
parent
commit
4dc0b423b2
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      add-vm

+ 5
- 2
add-vm View File

@@ -36,6 +36,7 @@ disks="${disks:-}"
36 36
 [ -n "${disks}" ] || disks=("ssd" "hdd")
37 37
 bridgeName="${bridgeName:-br0}"
38 38
 doDryRun=${doDryRun:-false}
39
+isoImagePath="${isoImagePath:-}"
39 40
 
40 41
 export DIALOGOUT=$(mktemp --tmpdir=/tmp addvm.XXX)
41 42
 # TODO: How to replace _ with a space??
@@ -198,6 +199,8 @@ fi
198 199
 
199 200
 virtHome=""
200 201
 [ "$volhomeDisk" != "none" ] && virtHome="--disk path=/dev/drbd/by-disk/${volhomeDisk}/${vmName}_home,bus=virtio,io=threads,cache=none,format=raw"
202
+bootMode="--pxe"
203
+[ -f "$isoImagePath" ] && bootMode="--cdrom=$isoImagePath"
201 204
 
202 205
 dryRun virt-install --connect=qemu:///system \
203 206
   --name=${vmName} \
@@ -205,11 +208,11 @@ dryRun virt-install --connect=qemu:///system \
205 208
   --memory=${memory} \
206 209
   --disk path=/dev/drbd/by-disk/${volrootDisk}/${vmName}_root,bus=virtio,io=threads,cache=none,format=raw \
207 210
   $virtHome \
211
+  $bootMode \
208 212
   --network=bridge:${bridgeName},model=virtio \
209 213
   --noautoconsole --graphics vnc,listen=127.0.0.1,keymap=fr \
210 214
   --rng /dev/random \
211
-  --os-variant=none \
212
-  --pxe
215
+  --os-variant=none
213 216
 
214 217
 if [ -x /usr/share/scripts/evomaintenance.sh ]; then
215 218
     ($doDryRun) || echo "Install VM ${vmName} (add-vm.sh)" | /usr/share/scripts/evomaintenance.sh

Loading…
Cancel
Save