[why] we need reboot a vm based on hostname or job_id. so, add hostname and job_id to vm process information.
[how] -name guest=$hostname,process=$job_id
if you need reboot the vm: pkill -f $job_id
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com --- providers/qemu/kvm.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 66099ee..dd657cb 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -39,6 +39,9 @@ parse_ipxe_script() ;; initrd) file=$(basename "$b") + [ $file == "job.cgz" ] && { + job_id=$(basename $(dirname "$b")) + } wget --timestamping -a ${log_file} --progress=bar:force $b initrds+="$file " ;; @@ -144,6 +147,7 @@ public_option() { kvm=( $qemu + -name guest=$hostname,process=$job_id -kernel $kernel -initrd $initrd -smp $nr_cpu