[SOLVED] Starting VM from command line on --target

sdettmer

Member
Sep 13, 2022
63
2
8
fabian115074
Hi,

when I login in Web GUI to any cluster node, I can start a VM on any node. The VM IDs must be unique over all nodes (I think).
I can clone a template to a different node, and this also on command line (qm clone 104 841 --target lab1-n4).
But I cannot start it:

Code:
root@lab1-n1:~# qm start 841
Configuration file 'nodes/lab1-n1/qemu-server/841.conf' does not exist

which is true, the file should be nodes/lab1-n4/qemu-server/841.conf.

There is no --target option on qm start.
Can I use some other parameter? Would it work when I use some ReST API or so?

Background:
I have a few nodes, each should run a few VM appliances of exactly same image/template, 80 in total, who get DHCP IP and connect a central host (Jenkins Swarm Client host). I tested with a VM, cloned it to a template and now like to run 8 instances/clone on 10 different nodes. First, I like to have them just running, later I hope I can improve and create a reasonable number of VMs dynamically. For now I just want to start them. I know I can simply SSH to each host and do it there. But I'm curious to understand it.
Since the WebGUI supports this (it automatically finds the right node and starts VM there), I hope there is a way to automate this as well.

If I used a bad approach and I could use a different one, please tell me!
I read about HA Cluster Manager which has features to even relocate VMs, but I think this is when having n VM image with 1 instance each (in contrary, I have 1 image and need n instances distributed evenly across a number of nodes)
 
qm can only address node's local resources. If you want to use CLI with cluster resources you need to use pvesh
pvesh uses API, so you can direct it to any node in cluster, but you still need to know the node name that owns the resource (VM) in most if not all cases. So your request will be a two-step in most cases.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
  • Like
Reactions: sdettmer
qm can only address node's local resources. If you want to use CLI with cluster resources you need to use pvesh
pvesh uses API, so you can direct it to any node in cluster, but you still need to know the node name that owns the resource (VM) in most if not all cases. So your request will be a two-step in most cases.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
Ahh great! Thanks so much for your quick reply! I knew there must be something!

Thanks to your answer I found that I can:

Code:
root@lab1-n1:~# pvesh create /nodes/lab1-n5/qemu/854/status/start

Great, exactly what I was looking for, thank you!
 
qm can only address node's local resources. If you want to use CLI with cluster resources you need to use pvesh
pvesh uses API, so you can direct it to any node in cluster, but you still need to know the node name that owns the resource (VM) in most if not all cases. So your request will be a two-step in most cases
May I ask how to remove a VM? I looked to https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid} but I did not find how to delete / remove / erase a VM (preferably also deleting its disks).

How can I remove a VM?
 

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!