[why] when we need reboot a vm, we need get it's pid from hostname, then check job_id is the same as required.
[how] -name guest=$hostname,process=$job_id
if you need reboot the vm: pkill $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