avocado-vt
avocado-vt copied to clipboard
refactor(qemu_vm): Split VM lifecycle management into more fine-grained
The current "create" method actually consists of qemu command line generation and qemu process creation. There are also "destroy" methods that include stopping the qemu process and cleaning up resources.
However, in th VM life cycle, we should be able to custom the qemu
command line before launch it, right now we use extra_params
but
it's not a good idea, with this patch, we can deprecat it, but insert
some devices/config which managed by qcontainer.DevContainer.
Besides this, after the VM is stopped, we should be able to use the existing resources to restart the qemu process, without VM definition.
ID: 1403
Hello @luckyh @YongxueHong, this is the initial version. I only moved qemu command line generation out from create
, to avoid breaking the previous usage.
Actually, my whole idea is: vm.create(vm.define --> vm.start)
, vm.destory(vm.kill --> vm.undefine)
, this can make the life cycle of the vm more complete. What do you think of this, need I also update it in this patch?
Besides, I also introduced the state machine, but not sure it's what you want. Can you please have a brief look?
Hello @luckyh @YongxueHong, I think this patch is ready, please help to review it, thanks.
Hello @luckyh @YongxueHong, I only added a modification that separates migration related parameters from def start
, as those parameters are not from params, so I have no idea integrate add_incoming
inside def start
. Please have a check, thanks.
With the latest update, the nettype "user" test passed in the CI check, you can check:
-netdev user,id=idXp6FUP,hostfwd=tcp::5285-:22 \
And we can focus on other nettype usage. @luckyh @YongxueHong