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 1 year 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:-}"
[ -n "${disks}" ] || disks=("ssd" "hdd")
bridgeName="${bridgeName:-br0}"
doDryRun=${doDryRun:-false}
isoImagePath="${isoImagePath:-}"

export DIALOGOUT=$(mktemp --tmpdir=/tmp addvm.XXX)
# TODO: How to replace _ with a space??
@@ -198,6 +199,8 @@ fi

virtHome=""
[ "$volhomeDisk" != "none" ] && virtHome="--disk path=/dev/drbd/by-disk/${volhomeDisk}/${vmName}_home,bus=virtio,io=threads,cache=none,format=raw"
bootMode="--pxe"
[ -f "$isoImagePath" ] && bootMode="--cdrom=$isoImagePath"

dryRun virt-install --connect=qemu:///system \
--name=${vmName} \
@@ -205,11 +208,11 @@ dryRun virt-install --connect=qemu:///system \
--memory=${memory} \
--disk path=/dev/drbd/by-disk/${volrootDisk}/${vmName}_root,bus=virtio,io=threads,cache=none,format=raw \
$virtHome \
$bootMode \
--network=bridge:${bridgeName},model=virtio \
--noautoconsole --graphics vnc,listen=127.0.0.1,keymap=fr \
--rng /dev/random \
--os-variant=none \
--pxe
--os-variant=none

if [ -x /usr/share/scripts/evomaintenance.sh ]; then
($doDryRun) || echo "Install VM ${vmName} (add-vm.sh)" | /usr/share/scripts/evomaintenance.sh

Loading…
Cancel
Save