List all domains

libvirt_list_defined_domains
libvirt_list_storagepools
Libvirt Functions
PHP Manual

# libvirt_list_domains

(php-libvirt 0.1)

libvirt_list_domains — List all domains

### Description

array libvirt_list_domains ( resource `$connection` )

This function returns array of domain resources for all domains defined and/or running on the hypervisor.

### Parameters

`connection`

  Connection resource of hypervisor.

### Return Values

Array of domain resources for all domains. `FALSE` on failure

### Examples

Example #1 libvirt_list_domains() example

List all domains and get their names

`<?php
$conn=libvirt_connect($uri,true);
$domains=libvirt_list_domains($conn);
foreach ($domains as $dom)
{
echo ("Name:\t".libvirt_domain_get_name($dom)."<br/>");
}
?>`

The above example will output something similar to:

    Name:   test1
    Name:   node5
    Name:   ovirt-appliance
    Name:   node3
    Name:   node4

### See Also

- libvirt_list_active_domains() - Get active domains
- libvirt_list_defined_domains() - Get inactive domains

libvirt_list_defined_domains
libvirt_list_storagepools
Libvirt Functions
PHP Manual