Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

if my VM's are not created using virt-manager or are created using any other tool, then virsh system list command does not give them in the list of running VM's however they are running perfectly on my KVM server. Is there a way to list these VM's in my system list anyhow?

I have VM's managed by GKVM, AQEMU, libvirt etc. also some of the user start their VM's using the qemu command as follows:

kvm "image name" -m "memory". this starts the VM and allow them to work perfectly. but I am not able to list all these VM's using the virsh system list command.

adding the output of ps command:

# ps -ef |grep kvm
avahi      980     1  0 Nov02 ?        00:00:00 avahi-daemon: running [ubuntukvm.local]
root      1117     2  0 Nov02 ?        00:00:00 [kvm-irqfd-clean]
1000      1849     1  0 Nov02 ?        00:00:00 /usr/lib/gvfs//gvfs-fuse-daemon -f /home/ubuntu-kvm/.gvfs
1000     14364     1  0 Nov05 ?        00:00:42 gnome-terminal --login --geometry=80x24+10+10 -t ubuntukvm:4 (ubuntu-kvm) Desktop
115      23786     1  0 15:14 ?        00:00:08 /usr/bin/kvm -S -M pc-1.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name **Ubuntu-guest-vm01** -uuid ed5a33c1-76fd-b67e-ff1b-f53a60681ec7 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/Ubuntu-guest-vm01.monitor,server,nowait -monchardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -drive file=/dev/lvm_disk/Ubuntu-guest-vm01,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=18,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:fa:4a:bd,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:2 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
root     23787     2  0 15:14 ?        00:00:00 [kvm-pit-wq]
root     31140 29549  0 17:05 pts/0    00:00:00 sudo kvm winxp-guest-vm00.qcow2 -m 1024
root     31141 31140 54 17:05 pts/0    00:00:05 **kvm winxp-guest-vm00.qcow2 -m 1024**
root     31142     2  0 17:05 ?        00:00:00 [kvm-pit-wq]
1000     31157 23873  0 17:05 pts/9    00:00:00 grep --color=auto kvm

here my vm name ubuntu-guest-vm01 is started by virtmanager, and vm named winxp-guest-vm00 is started by kvm command however both were created using the virtmanager. so my issue is if my user start this vm using the kvm or qemu command i do not get the argument list in ps also so not able to collect all the required details

share|improve this question

1 Answer 1

Just list the processes, that's all KVM is after all ps -ef |grep kvm should do the trick, and you can parse the command line for details if you need to

share|improve this answer
    
hi dyasny, i already tried using ps but it does not give me the details about my vm such as image path and it also does not give any info regarding the config file for the VM. Now when i list the VM i have only the name of VM and nothing else is available in case of vm created or started by not using virtmanager. –  Dr. Death Nov 6 '12 at 10:00
    
In my case i am listing the VM's running from a remote machine which can detect any machine in network. so I need to list down the VM's running on network in order to perform any operation on that particular VM. Now when I start create vm using virtmanager, virsh can list it, but if any of the vm is created using any other tool I can only get the name of the vm from ps command. it does not give the path of the image file and config file as it gives in case of virtmanager. –  Dr. Death Nov 6 '12 at 10:07
    
if you use the command I provided you will see the entire command line for the VM start, that has to include the disk image path and every other detail you can think of –  dyasny Nov 6 '12 at 11:08
    
you can start a VM by just writing kvm <imagename> -m <memory> and it will run. ps -ef can show this as just the last process run. Now, If i say that i had created a vm using virtmanager. now i start this vm using kvm command and do not start it using the virtmanager, then in that case you do not get the arguments that have been passed by virtmanager (when you run it using virtmanager). –  Dr. Death Nov 6 '12 at 11:33
    
i added the ps output in my query but unable to crealy format it. please refer it as botht eh machine are created using virtmanager and used same type of argument at time of creation but the difference is how they are stared. first one is stared using virtmanager and later is using kvm command. please suggest how to proceed. –  Dr. Death Nov 6 '12 at 11:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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