cockpit-project / cockpit-machines

Cockpit UI for virtual machines
GNU Lesser General Public License v2.1
276 stars 72 forks source link

log applicable 'virt-install' command #1736

Open martinpitt opened 1 month ago

martinpitt commented 1 month ago

Discussed in https://github.com/cockpit-project/cockpit/discussions/20793

Originally posted by **paul-hammant** July 20, 2024 Page: Create VM Cockpit would be even better if each UI-creation of a VM logged the equivalent `virt-install` command used. This would serve as education for users, such that they could transition to scripted creation of VMs. There logs are created for "`New machine qemu-NUMBER-NAME`" but none of the command used. I realize that cockpit does not shell out to `virt-install` specifically, but the equivalent command with arg would be great. Same would be true for podman containers :)
martinpitt commented 1 month ago

@paul-hammant : Cockpit-machines actually does call out to virt-install: https://github.com/cockpit-project/cockpit-machines/blob/main/src/scripts/install_machine.py.

With window.debugging = "machines" you can get the install_machine.py command line, but not directly the virt-install command line. That also wouldn't be quite sufficient, as there is some extra XML preparation that needs to be done. But let's leave this open as an enhancement proposal.

paul-hammant commented 1 month ago

Thanks. I type window.debugging = "machines" into Inspector->Console for the page that has the "Create new virtual machine" overlay up in it? Or that's something I do in qemu.conf that the Python script you link to uses?

martinpitt commented 4 days ago

@paul-hammant (Sorry, missed your reply); yes, that goes into the browser inspector. But as I said, this isn't quite sufficient, as it doesn't show the virt-install invocation. This is a hard problem, as there just is no single virt-install command which would reproduce the VM -- it needs the additional XML preparation/modification logic.

paul-hammant commented 4 days ago

No worries about having more valuable things to do, sir.

I think Proxmox is in the same place - some of the more advanced network stuff has to be done in other config files however simple pct-create is at the outset.

Circling back to KVM ecosystem, I played with Zig and AI for making some of the config in an article - https://paulhammant.com/2024/04/12/playing-with-zig - and of course that is too buggy to use real work and ended up being more about Zig.