Re: Which method to call to get list of all virtual machine in system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sandeep,

Am Sun, 24 Mar 2013 12:36:08 +0530
schrieb sandeep krishnamurthy <sandeep.krishna98@xxxxxxxxx>:

> *Which python module, method, will be helpful to get list of all
> virtual machine in the system and also what is the type of return
> value(is it list of strings(names)). *
i'am using the Python module libvirt (version 1.0.1) and can use this:

-----
# use you connection string here
connection = libvirt.open('qemu:///system')
vmlist = connection.listAllDomains()
for vm in vmlist:
    print vm.name()
-----
The return value of listAllDomains() is a list of virDomain objects.

You can also use connection.listDomainsID() to get a DomainID
(integer) list of running domains.

To get a list of all not runnig domains you can use 
connection.listDefinedDomains(). The return value is a list of strings
with the names of the defined domains.

Best wishes,
Matthias 

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux