apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
1.98k stars 1.09k forks source link

Add API/UI option to send guest command via qemu agent #9577

Open tanganellilore opened 2 weeks ago

tanganellilore commented 2 weeks ago
ISSUE TYPE
COMPONENT NAME
API/UI/Backend
CLOUDSTACK VERSION
4.19
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

Hi team,

I notice that actally, for vm that have qemu agent installed, is not possible through cloudstack send command to the host, like vmware guest agent tool. This is possible with qemu agent and i notiche that freeze for example was implemented with this class: https://github.com/apache/cloudstack/blob/main/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuCommand.java

But is not implemented for all type of command and I don't see any API that cover it ( and also via UI I can't see any "form").

This is something that you are interested to implemet?

STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
weizhouapache commented 2 weeks ago

@tanganellilore you can do it on kvm host by virsh command

tanganellilore commented 2 weeks ago

Hi @weizhouapache ,

yes clear, this is what I'm doing now, call the CS Api, retrieve in wich host is allocated the vm, access to the host and send the virsh command. But have an "orchestrator" that can also send command, without access to the kvm host it will be a good enhancement to me.

I notice that this is already present for snapshot, so I thing can be implemented without big deal, at lease on api level.

weizhouapache commented 2 weeks ago

@tanganellilore @DaanHoogland technically it is simple, (just API, no database/vo changes at all)

However, I wonder if it is necessary. It is easy to do on kvm host. Integration such features with ACS will make ACS unnecessarily bigger, IMHO.

tanganellilore commented 2 weeks ago

Hi @weizhouapache ,

i understood that is simple to do it on KVM host, but only if you can access to KVM host, otherwhise no way to do it.

Let me do a simple use case. User that deploy the vm is not the admin of cloudstack/kvm infrastrutcture and can't access on it, so to run a command after provisioning, without usage of cloudstack or virsh command (he can't access to kvm host), he need to use something different like cloud-init. One more specific use-case is the configuration of vm network, when dhcp is not possibile and we use a L2 shared. It's will be very usefull have a kvm command that set network remotley without access to kvm hosts.

I' m using vmware,a nd with it is very simple send command thorugh vmware with guest agent installed, and I thing that it will be a very usefull features, cosidering that command is already implemented in backend. We need simply allow the usage of it via API and very basic command validation (or also without it).

tanganellilore commented 2 weeks ago

Moreover, we need to considering also that normal user not see in which host the vm is allocated and also the instancename assigned on kvm side