6

I am using qemu-system-x86_64 to boot virtual machines on kvm running on Ubuntu 12.04 64-bit desktop. I have a few VM's that are currently running. I want to get the list of all VM's booted using qemu-system-x86_64 on this host machine, how do I get this list?

Specifications:

  • qemu-system-x86_64 version 1.0

  • linux 3.2.0-60-generic

P.S.: Just as a side note, I am aware of virsh -c qemu:///system list which would list all VMs booted using virsh. However, this does not seem to give the list of VMs booted using qemu-system-x86_64, it would be great if virsh command could list the VMs booted using qemu-system-x86_64.

1
  • 2
    +1 for the question.. Now me too want to get the answer :) – Saurav Kumar Apr 8 '14 at 8:24
9

Each VM started with qemu-system-x86_64 corresponds to a process on the host machine. This means that a list of qemu-system-x86_64 processes corresponds to the list of VMs that are currently running on the host.

ps -ef | grep qemu-system-x86_64

This will list all the qemu-system-x86_64 processes, their pids and the parameters used to start the VM.

2
  • 1
    +1 for a good method, would appreciate a script that would help distinguish two virtual machines booted using qemu-system-x86_64 (may have the same name). – jobin May 17 '14 at 10:13
  • 1
    If both VMs use the same image and you don't want to distinguish them by pid, you could assign a different MAC address for each VM. This depends off course also on your network settings, if this is an option: -net nic,macaddr=<MACADDR> Off course, this does not solve the problem for already existing VMs. – mas_kur1 May 17 '14 at 10:44
1

Here is a solution for some more advanced nice view (see source below):

This one shows all wemu-systems, not only the x86_64 ones.

Cutton Eye@QEMU:~$ ps -ef | awk -e '/qemu/ && !/awk/' | sed -e 's/[^/]*//' -e 's/ -/\n\t-/g'

/18   00:00:17 qemu-system-x86_64
  -enable-kvm
  -hda MyDrive.img
  -m 1G
  -…

Sean Swehla has created this awesome regex

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.