Can I specify the path to qemu (and other customizations to qm)?

jtongen

New Member
Sep 25, 2020
10
0
1
45
I've been running my VMs directly on qemu in the past, and I'd like to transition to using proxmox to run them. I found the following, which was very helpful, but have some additional questions that I can't find in the proxmox docs:

https://pve.proxmox.com/wiki/Qemu/KVM_Virtual_Machines

That doc heavily mentions 'qm'. I haven't seen that before, so I'm assuming that is part of proxmox. But alot of commands look very familiar, I expect its calling into qemu for alot of that functionalty.

1) I'd like to have qm use my own qemu (I'm making source modifications to qemu and compiling it). Is there a way I can tell qm which qemu to run (by specifying the full system path to qemu)?
2) Where are the qm sources? I've cloned about 6 projects from git.proxmox.com, and haven't been able to track them down
3) Is the webpage a wrapper on top of qm? If I make a change on the linux system to the .conf file I assume that will affect the behavior of the system when controlled from the webpage?
4) Is there some way I can see (and possibly edit) the entire command-line with which qemu is being run?
 
I've been looking into it more, I think I've answered some of the above:

1) I'd like to have qm use my own qemu (I'm making source modifications to qemu and compiling it). Is there a way I can tell qm which qemu to run (by specifying the full system path to qemu)?
It looks like qm is running the qemu from the symlink at /usr/bin/kvm, and I could update that to point at any qemu I wanted. Can you confirm that's accurate? Also, while this'd make it possible, I'd prefer a 'better' way (like adding it to the .conf file, perhaps)
2) Where are the qm sources? I've cloned about 6 projects from git.proxmox.com, and haven't been able to track them down
Found them in pve-manager
3) Is the webpage a wrapper on top of qm? If I make a change on the linux system to the .conf file I assume that will affect the behavior of the system when controlled from the webpage?
4) Is there some way I can see (and possibly edit) the entire command-line with which qemu is being run?
 
1) yes, but you are leaving supported territory if you do so ;)
2) qm is in qemu-server, the actual qemu/kvm part is in pve-qemu
3) yes and no. both almost all of 'qm' and all of the web interface use the REST API. both use the same VM config file(s)
4) qm showcmd VMID --pretty, where VMID is the numeric ID of the VM you want to look at. you can also set 'args' in the config file to add additional arguments to that command line
 
OK, that helps some. But of course, I have new questions now ;). All of these are focused along the "how would I enable proxmox users to select a qemu" theme, if you've got general guidance for that that'd be quite helpful.
1) What is the entity that is exposing the REST API? Looks like probably either pveproxy or pvedaemon, which is calling some of these other perl files (like QemuServer.pm)
2) What is the entity that reads the .conf file and actually runs qemu?
3) If I'm really committed to allowing proxmox users to select a QEMU to run, my rough understanding is I'd have to do the following:
  • Extend the REST API to have an attribute for this
  • Extend the tools (the .js and qm) to be able to configure this new attribute
  • Add an entry to the .conf file to hold the users selection
  • Modify the QEMU executor code to act on the (new) value in the .conf file
Does this look roughly correct?
4) I haven't found much for developer docs that describe the code and the design. Does anything like that exist?
 
pveproxy and pvedaemon handle the API together - pveproxy is the public service, depending on which API call you make it gets proxied (hence the name) to pvedaemon or to pveproxy on another node. most of the heavy lifting happens in pvedaemon since it's running as root.

for extending the API that does not matter much, as pvedaemon and pveproxy are just two very similar instance of request handling. the API endpoints are defined in a unified fashion (those with 'protected => 1' are pvedaemon's) in the PVE::API2::* modules. the top level entry point is in pve-manager, which imports all the other modules like those from qemu-server. those then usually call into lower level modules like PVE::Storage or PVE::QemuServer. config loading happens ins PVE::AbstractConfig / PVE::QemuConfig / PVE::LXC::Config.

there's a quick style and dev work flow guide at https://pve.proxmox.com/wiki/Developer_Documentation , but no high-level architectural overview.
 
Could you please point me to any example implementations (or tests would be fine) of client-side scripts (that would be run from a system that is not part of the proxmox cluster) that interact only with the REST API?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!