summaryrefslogtreecommitdiff
path: root/others/vm3/compute/start.sh
diff options
context:
space:
mode:
authorYour Name <you@example.com>2024-12-22 19:03:49 +0800
committerYour Name <you@example.com>2024-12-22 19:03:49 +0800
commitf7f159a04671690786de2f84e34046c103521d58 (patch)
tree22b45e904c1aa6800250ec6e998d0022fd018ade /others/vm3/compute/start.sh
parent2916e3eff503473f6bf8b90e0921b0ccd347166f (diff)
vm.shupdate
Diffstat (limited to 'others/vm3/compute/start.sh')
-rwxr-xr-x[-rw-r--r--]others/vm3/compute/start.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/others/vm3/compute/start.sh b/others/vm3/compute/start.sh
index 5a2b3aa..d64dbb1 100644..100755
--- a/others/vm3/compute/start.sh
+++ b/others/vm3/compute/start.sh
@@ -1,4 +1,20 @@
1#!/bin/bash 1#!/bin/bash
2 2
3# starts vm 3# starts vm
4# need to remove seed.iso first if vm have the seed iso 4# remove seed.iso first if vm have the seed iso
5
6vmname=$1
7
8# Get the target device for seed.iso
9target_dev=$(sudo virsh domblklist $vmname | grep 'seed.iso' | awk '{print $1}')
10
11# If seed.iso is found, detach it,
12# --config means it is persistent but do not affect the state now.
13# --config --live means online remove
14# no option means that the changes are not persistent
15#
16if [ ! -z "$target_dev" ]; then
17 sudo virsh detach-disk $vmname $target_dev --config
18fi
19
20sudo virsh start $vmname