summaryrefslogtreecommitdiff
path: root/others/vm3/compute/start.sh
blob: d64dbb1cabf3b121762b0f4ffb9fe8a87f3abcf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

# starts vm
# remove seed.iso first if vm have the seed iso

vmname=$1

# Get the target device for seed.iso
target_dev=$(sudo virsh domblklist $vmname | grep 'seed.iso' | awk '{print $1}')

# If seed.iso is found, detach it, 
# --config means it is persistent but do not affect the state now. 
# --config --live means online remove
# no option means that the changes are not persistent
#
if [ ! -z "$target_dev" ]; then
  sudo virsh detach-disk $vmname $target_dev --config
fi

sudo virsh start $vmname