PHP API Reference guide

Functions

Total number of functions: 104. Functions supported are:

libvirt_get_last_error($one)
libvirt_connect($url, $readonly, $credentials)
libvirt_node_get_info($conn)
libvirt_connect_get_information($conn)
libvirt_connect_get_uri($conn)
libvirt_connect_get_hostname($conn)
libvirt_connect_get_hypervisor($conn)
libvirt_connect_is_encrypted($conn)
libvirt_connect_is_secure($conn)
libvirt_connect_get_maxvcpus($conn)
libvirt_connect_get_capabilities($conn)
libvirt_connect_get_sysinfo($conn)
libvirt_domain_get_counts($conn)
libvirt_domain_get_autostart($res)
libvirt_domain_set_autostart($res, $flags)
libvirt_domain_is_active($res)
libvirt_domain_lookup_by_name($res, $name)
libvirt_domain_lookup_by_uuid($res, $uuid)
libvirt_domain_lookup_by_uuid_string($res, $uuid)
libvirt_domain_lookup_by_id($conn, $id)
libvirt_domain_get_name($res)
libvirt_domain_get_uuid_string($res)
libvirt_domain_get_uuid($res)
libvirt_domain_get_id($res)
libvirt_domain_get_xml_desc($res, $xpath)
libvirt_domain_disk_remove($res, $dev, $flags)
libvirt_domain_get_info($res)
libvirt_domain_create($res)
libvirt_domain_destroy($res)
libvirt_domain_resume($res)
libvirt_domain_core_dump($res)
libvirt_domain_shutdown($res)
libvirt_domain_suspend($res)
libvirt_domain_undefine($res)
libvirt_domain_reboot($res)
libvirt_domain_define_xml($conn, $xml)
libvirt_domain_create_xml($conn, $xml)
libvirt_domain_memory_peek($res)
libvirt_domain_memory_stats($res)
libvirt_domain_update_device($res, $xml, $flags)
libvirt_domain_block_stats($res, $path)
libvirt_domain_get_network_info($res, $mac)
libvirt_domain_get_block_info($res, $dev)
libvirt_domain_xml_xpath($res, $xpath)
libvirt_domain_interface_stats($res, $path)
libvirt_domain_get_connect($res)
libvirt_domain_migrate_to_uri($res, $dest_uri, $flags, $dname, $bandwidth)
libvirt_domain_migrate($res, $dest_conn, $flags, $dname, $bandwidth)
libvirt_domain_get_job_info($res)
libvirt_domain_has_current_snapshot($res)
libvirt_domain_snapshot_lookup_by_name($res, $name)
libvirt_domain_snapshot_create($res)
libvirt_domain_snapshot_get_xml($res)
libvirt_domain_snapshot_revert($res)
libvirt_domain_snapshot_delete($res, $flags)
libvirt_list_domain_snapshots($res)
libvirt_storagepool_lookup_by_name($res, $name)
libvirt_storagepool_lookup_by_volume($res)
libvirt_storagepool_list_volumes($res)
libvirt_storagepool_get_info($res)
libvirt_storagevolume_lookup_by_name($res, $name)
libvirt_storagevolume_lookup_by_path($res, $path)
libvirt_storagevolume_get_name($res)
libvirt_storagevolume_get_path($res)
libvirt_storagevolume_get_info($res)
libvirt_storagevolume_get_xml_desc($res, $xpath)
libvirt_storagevolume_create_xml($res, $xml)
libvirt_storagevolume_create_xml_from($pool, $xml, $original_volume)
libvirt_storagepool_delete($res, $flags)
libvirt_storagepool_get_uuid_string($res)
libvirt_storagepool_get_name($res)
libvirt_storagepool_lookup_by_uuid_string($res, $uuid)
libvirt_storagepool_get_xml_desc($res, $xpath)
libvirt_storagepool_define_xml($res, $xml, $flags)
libvirt_storagepool_undefine($res)
libvirt_storagepool_create($res)
libvirt_storagepool_destroy($res)
libvirt_storagepool_is_active($res)
libvirt_storagepool_get_volume_count($res)
libvirt_storagepool_refresh($res, $flags)
libvirt_storagepool_set_autostart($res, $flags)
libvirt_storagepool_get_autostart($res)
libvirt_list_storagepools($res)
libvirt_list_active_storagepools($res)
libvirt_list_inactive_storagepools($res)
libvirt_list_domains($res)
libvirt_list_domain_resources($res)
libvirt_list_active_domain_ids($res)
libvirt_list_active_domains($res)
libvirt_list_inactive_domains($res)
libvirt_list_networks($res, $flags)
libvirt_list_nodedevs($res, $cap)
libvirt_nodedev_get($res, $name)
libvirt_nodedev_capabilities($res)
libvirt_nodedev_get_xml_desc($res)
libvirt_nodedev_get_information($res)
libvirt_network_undefine($res)
libvirt_network_get($res, $name)
libvirt_network_get_bridge($res)
libvirt_network_get_active($res)
libvirt_network_get_information($res)
libvirt_network_set_active($res)
libvirt_network_get_xml_desc($res, $xpath)
libvirt_version($type)
libvirt_check_version($major, $minor, $micro, $type)

libvirt_get_last_error

libvirt_get_last_error($one)

[Since version 0.4.1(-1)]

This function is used to get the last error coming either from libvirt or the PHP extension itself.

one: one
Returns: last error string

libvirt_connect

libvirt_connect($url, $readonly, $credentials)

[Since version 0.4.1(-1)]

libvirt_connect() is used to connect to the specified libvirt daemon using the specified URL, user can also set the readonly flag and/or set credentials for connection.

url [string]: URI for connection
@readonly [bool]: flag whether to use read-only connection or not
@credentials [array]: array of connection credentials
Returns: libvirt connection resource

libvirt_node_get_info

libvirt_node_get_info($conn)

[Since version 0.4.1(-1)]

Function is used to get the information about host node, mainly total memory installed, total CPUs installed and model information are useful.

conn [resource]: resource for connection
Returns: array of node information or FALSE for error

libvirt_connect_get_information

libvirt_connect_get_information($conn)

[Since version 0.4.1(-2)]

Function is used to get the information about the connection.

conn [resource]: resource for connection
Returns: array of information about the connection

libvirt_connect_get_uri

libvirt_connect_get_uri($conn)

[Since version 0.4.1(-1)]

Function is used to get the connection URI. This is useful to check the hypervisor type of host machine when using "null" uri to libvirt_connect().

conn [resource]: resource for connection
Returns: connection URI string or FALSE for error

libvirt_connect_get_hostname

libvirt_connect_get_hostname($conn)

[Since version 0.4.1(-1)]

Function is used to get the hostname of the guest associated with the connection.

conn [resource]: resource for connection
Returns: hostname of the host node or FALSE for error

libvirt_connect_get_hypervisor

libvirt_connect_get_hypervisor($conn)

[Since version 0.4.1(-2)]

Function is used to get the information about the hypervisor on the connection identified by the connection pointer.

conn [resource]: resource for connection
Returns: array of hypervisor information if available

libvirt_connect_is_encrypted

libvirt_connect_is_encrypted($conn)

[Since version 0.4.1(-2)]

Function is used to get the information whether the connection is encrypted or not.

conn [resource]: resource for connection
Returns: 1 if encrypted, 0 if not encrypted, -1 on error

libvirt_connect_is_secure

libvirt_connect_is_secure($conn)

[Since version 0.4.1(-2)]

Function is used to get the information whether the connection is secure or not.

conn [resource]: resource for connection
Returns: 1 if secure, 0 if not secure, -1 on error

libvirt_connect_get_maxvcpus

libvirt_connect_get_maxvcpus($conn)

[Since version 0.4.1(-2)]

Function is used to get maximum number of VCPUs per VM on the hypervisor connection.

conn [resource]: resource for connection
Returns: number of VCPUs available per VM on the connection or FALSE for error

libvirt_connect_get_capabilities

libvirt_connect_get_capabilities($conn)

[Since version 0.4.1(-2)]

Function is used to get the capabilities information from the connection.

conn [resource]: resource for connection
Returns: capabilities XML from the connection or FALSE for error

libvirt_connect_get_sysinfo

libvirt_connect_get_sysinfo($conn)

[Since version 0.4.1(-2)]

Function is used to get the system information from connection if available.

conn [resource]: resource for connection
Returns: XML description of system information from the connection or FALSE for error

libvirt_domain_get_counts

libvirt_domain_get_counts($conn)

[Since version 0.4.1(-1)]

Function is getting domain counts for all, active and inactive domains.

conn [resource]: libvirt connection resource from libvirt_connect()
Returns: array of total, active and inactive (but defined) domain counts

libvirt_domain_get_autostart

libvirt_domain_get_autostart($res)

[Since version 0.4.1(-1)]

Function is getting the autostart value for the domain.

res [resource]: libvirt domain resource
Returns: autostart value or -1

libvirt_domain_set_autostart

libvirt_domain_set_autostart($res, $flags)

[Since version 0.4.1(-1)]

Function is setting the autostart value for the domain.

res [resource]: libvirt domain resource
@flags [int]: flag to enable/disable autostart
Returns: TRUE on success, FALSE on error

libvirt_domain_is_active

libvirt_domain_is_active($res)

[Since version 0.4.1(-1)]

Function is getting information whether domain identified by resource is active or not.

res [resource]: libvirt domain resource
Returns: virDomainIsActive() result on the domain

libvirt_domain_lookup_by_name

libvirt_domain_lookup_by_name($res, $name)

[Since version 0.4.1(-1)]

Function is used to lookup for domain by it's name.

res [resource]: libvirt connection resource from libvirt_connect()
@name [string]: domain name to look for
Returns: libvirt domain resource

libvirt_domain_lookup_by_uuid

libvirt_domain_lookup_by_uuid($res, $uuid)

[Since version 0.4.1(-1)]

Function is used to lookup for domain by it's UUID in the binary format.

res [resource]: libvirt connection resource from libvirt_connect()
@uuid [string]: binary defined UUID to look for
Returns: libvirt domain resource

libvirt_domain_lookup_by_uuid_string

libvirt_domain_lookup_by_uuid_string($res, $uuid)

[Since version 0.4.1(-1)]

Function is used to get the domain by it's UUID that's accepted in string format.

res [resource]: libvirt connection resource from libvirt_connect()
@uuid [string]: domain UUID [in string format] to look for
Returns: libvirt domain resource

libvirt_domain_lookup_by_id

libvirt_domain_lookup_by_id($conn, $id)

[Since version 0.4.1(-1)]

Function is used to get domain by it's ID, applicable only to running guests.

conn [resource]: libvirt connection resource from libvirt_connect()
@id [string]: domain id to look for
Returns: libvirt domain resource

libvirt_domain_get_name

libvirt_domain_get_name($res)

[Since version 0.4.1(-1)]

Function is used to get domain name from it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: domain name string

libvirt_domain_get_uuid_string

libvirt_domain_get_uuid_string($res)

[Since version 0.4.1(-1)]

Function is used to get the domain's UUID in string format.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: domain UUID string

libvirt_domain_get_uuid

libvirt_domain_get_uuid($res)

[Since version 0.4.1(-1)]

Function is used to get the domain's UUID in binary format.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: domain UUID in binary format

libvirt_domain_get_id

libvirt_domain_get_id($res)

[Since version 0.4.1(-1)]

Function is used to get the domain's ID, applicable to running guests.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: running domain ID or -1 if not running

libvirt_domain_get_xml_desc

libvirt_domain_get_xml_desc($res, $xpath)

[Since version 0.4.1(-1), changed 0.4.1(-4)]

Function is used to get the domain's XML description.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@xpath [string]: optional xPath expression string to get just this entry, can be NULL
Returns: domain XML description string or result of xPath expression

libvirt_domain_disk_remove

libvirt_domain_disk_remove($res, $dev, $flags)

[Since version 0.4.1(-4)]

Function is used to remove the disk from the virtual machine using set of API functions to make it as simple as possible.

res [resource]: libvirt domain resource
@dev [string]: string for the device to be removed from the guest (e.g. 'hdb')
@flags [int]: flags for getting the XML description
Returns: new domain resource

libvirt_domain_get_info

libvirt_domain_get_info($res)

[Since version 0.4.1(-1)]

Function is used to get the domain's information.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: domain information array

libvirt_domain_create

libvirt_domain_create($res)

[Since version 0.4.1(-1)]

Function is used to create the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: result of domain creation (startup)

libvirt_domain_destroy

libvirt_domain_destroy($res)

[Since version 0.4.1(-1)]

Function is used to destroy the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: result of domain destroy

libvirt_domain_resume

libvirt_domain_resume($res)

[Since version 0.4.1(-1)]

Function is used to resume the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: result of domain resume

libvirt_domain_core_dump

libvirt_domain_core_dump($res)

[Since version 0.4.1(-2)]

Function is used to dump core of the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: boolean of core dump command

libvirt_domain_shutdown

libvirt_domain_shutdown($res)

[Since version 0.4.1(-1)]

Function is used to shutdown the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: result of domain shutdown

libvirt_domain_suspend

libvirt_domain_suspend($res)

[Since version 0.4.1(-1)]

Function is used to suspend the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: result of domain suspend

libvirt_domain_undefine

libvirt_domain_undefine($res)

[Since version 0.4.1(-1)]

Function is used to undefine the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: result of domain undefine

libvirt_domain_reboot

libvirt_domain_reboot($res)

[Since version 0.4.1(-1)]

Function is used to reboot the domain identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: result of domain reboot

libvirt_domain_define_xml

libvirt_domain_define_xml($conn, $xml)

[Since version 0.4.1(-1)]

Function is used to define the domain from XML string.

conn [resource]: libvirt connection resource
@xml [string]: XML string to define guest from
Returns: newly defined domain resource

libvirt_domain_create_xml

libvirt_domain_create_xml($conn, $xml)

[Since version 0.4.1(-1)]

Function is used to create the domain identified by it's resource.

conn [resource]: libvirt connection resource
@xml [string]: XML string to create guest from
Returns: newly started/created domain resource

libvirt_domain_memory_peek

libvirt_domain_memory_peek($res)

[Since version 0.4.1(-1)]

Function is used to get the domain's memory peek value.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: domain memory peek

libvirt_domain_memory_stats

libvirt_domain_memory_stats($res)

[Since version 0.4.1(-1)]

Function is used to get the domain's memory stats.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: domain memory stats array

libvirt_domain_update_device

libvirt_domain_update_device($res, $xml, $flags)

[Since version 0.4.1(-1)]

Function is used to update the domain's devices from the XML string.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@xml [string]: XML string for the update
@flags [int]: Flags to update the device (VIR_DOMAIN_DEVICE_MODIFY_CURRENT, VIR_DOMAIN_DEVICE_MODIFY_LIVE, VIR_DOMAIN_DEVICE_MODIFY_CONFIG, VIR_DOMAIN_DEVICE_MODIFY_FORCE)
Returns: 0 on success, -1 on failure

libvirt_domain_block_stats

libvirt_domain_block_stats($res, $path)

[Since version 0.4.1(-1)]

Function is used to get the domain's block stats.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@path [string]: device path to get statistics about
Returns: domain block stats array

libvirt_domain_get_network_info

libvirt_domain_get_network_info($res, $mac)

[Since version 0.4.1(-1)]

Function is used to get the domain's network information.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@mac [string]: mac address of the network device
Returns: domain network info array

libvirt_domain_get_block_info

libvirt_domain_get_block_info($res, $dev)

[Since version 0.4.1(-1)]

Function is used to get the domain's block device information.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@dev [string]: device to get block information about
Returns: domain block device information array

libvirt_domain_xml_xpath

libvirt_domain_xml_xpath($res, $xpath)

[Since version 0.4.1(-1)]

Function is used to get the result of xPath expression that's run against the domain.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@xpath [string]: xPath expression to parse against the domain
Returns: result of the expression

libvirt_domain_interface_stats

libvirt_domain_interface_stats($res, $path)

[Since version 0.4.1(-1)]

Function is used to get the domain's interface stats.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@path [string]: path to interface device
Returns: interface stats array

libvirt_domain_get_connect

libvirt_domain_get_connect($res)

[Since version 0.4.1(-1)]

Function is used to get the domain's connection resource. This function should *not* be used!.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: libvirt connection resource

libvirt_domain_migrate_to_uri

libvirt_domain_migrate_to_uri($res, $dest_uri, $flags, $dname, $bandwidth)

[Since version 0.4.1(-1)]

Function is used migrate domain to another libvirt daemon specified by it's URI.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@dest_uri [string]: destination URI to migrate to
@flags [int]: migration flags
@dname [string]: domain name to rename domain to on destination side
@bandwidth [int]: migration bandwidth in Mbps
Returns: migration result as boolean

libvirt_domain_migrate

libvirt_domain_migrate($res, $dest_conn, $flags, $dname, $bandwidth)

[Since version 0.4.1(-1)]

Function is used migrate domain to another domain.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@dest_conn [string]: destination host connection object
@flags [int]: migration flags
@dname [string]: domain name to rename domain to on destination side
@bandwidth [int]: migration bandwidth in Mbps
Returns: migration result as boolean

libvirt_domain_get_job_info

libvirt_domain_get_job_info($res)

[Since version 0.4.1(-1)]

Function is used get job information for the domain.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
Returns: job information array

libvirt_domain_has_current_snapshot

libvirt_domain_has_current_snapshot($res)

[Since version 0.4.1(-2)]

Function is used to get the information whether domain has the current snapshot.

res [resource]: libvirt domain resource
Returns: TRUE is domain has the current snapshot, otherwise FALSE (you may need to check for error using libvirt_get_last_error())

libvirt_domain_snapshot_lookup_by_name

libvirt_domain_snapshot_lookup_by_name($res, $name)

[Since version 0.4.1(-2)]

This functions is used to lookup for the snapshot by it's name.

res [resource]: libvirt domain resource
@name [string]: name of the snapshot to get the resource
Returns: domain snapshot resource or NULL on error

libvirt_domain_snapshot_create

libvirt_domain_snapshot_create($res)

[Since version 0.4.1(-2)]

This function creates the domain snapshot for the domain identified by it's resource.

res [resource]: libvirt domain resource
Returns: domain snapshot resource or NULL on error

libvirt_domain_snapshot_get_xml

libvirt_domain_snapshot_get_xml($res)

[Since version 0.4.1(-2)]

Function is used to get the XML description of the snapshot identified by it's resource.

res [resource]: libvirt snapshot resource
Returns: XML description string for the snapshot or NULL on error

libvirt_domain_snapshot_revert

libvirt_domain_snapshot_revert($res)

[Since version 0.4.1(-2)]

Function is used to revert the domain state to the state identified by the snapshot.

res [resource]: libvirt snapshot resource
Returns: TRUE on success, FALSE on error

libvirt_domain_snapshot_delete

libvirt_domain_snapshot_delete($res, $flags)

[Since version 0.4.1(-2)]

Function is used to revert the domain state to the state identified by the snapshot.

res [resource]: libvirt snapshot resource
@flags [int]: 0 to delete just snapshot, VIR_SNAPSHOT_DELETE_CHILDREN to delete snapshot children as well
Returns: TRUE on success, FALSE on error

libvirt_list_domain_snapshots

libvirt_list_domain_snapshots($res)

[Since version 0.4.1(-2)]

Function is used to list domain snapshots for the domain specified by it's resource.

res [resource]: libvirt domain resource
Returns: libvirt domain snapshot names array

libvirt_storagepool_lookup_by_name

libvirt_storagepool_lookup_by_name($res, $name)

[Since version 0.4.1(-1)]

Function is used to lookup for storage pool by it's name.

res [resource]: libvirt connection resource
@name [string]: storage pool name
Returns: libvirt storagepool resource

libvirt_storagepool_lookup_by_volume

libvirt_storagepool_lookup_by_volume($res)

[Since version 0.4.1(-4)]

Function is used to lookup for storage pool by a volume.

res [volume]: volume resource of storage pool
Returns: libvirt storagepool resource

libvirt_storagepool_list_volumes

libvirt_storagepool_list_volumes($res)

[Since version 0.4.1(-1)]

Function is used to list volumes in the specified storage pool.

res [resource]: libvirt storagepool resource
Returns: list of storage volume names in the storage pool

libvirt_storagepool_get_info

libvirt_storagepool_get_info($res)

[Since version 0.4.1(-1)]

Function is used to get information about the storage pool.

res [resource]: libvirt storagepool resource
Returns: storage pool information array

libvirt_storagevolume_lookup_by_name

libvirt_storagevolume_lookup_by_name($res, $name)

[Since version 0.4.1(-1)]

Function is used to lookup for storage volume by it's name.

res [resource]: libvirt storagepool resource
@name [string]: name of the storage volume to look for
Returns: libvirt storagevolume resource

libvirt_storagevolume_lookup_by_path

libvirt_storagevolume_lookup_by_path($res, $path)

[Since version 0.4.1(-4)]

Function is used to lookup for storage volume by it's path.

res [resource]: libvirt connection resource
@path [string]: path of the storage volume to look for
Returns: libvirt storagevolume resource

libvirt_storagevolume_get_name

libvirt_storagevolume_get_name($res)

[Since version 0.4.1(-2)]

Function is used to get the storage volume name.

res [resource]: libvirt storagevolume resource
Returns: storagevolume name

libvirt_storagevolume_get_path

libvirt_storagevolume_get_path($res)

[Since version 0.4.1(-4)]

Function is used to get the storage volume path.

res [resource]: libvirt storagevolume resource
Returns: storagevolume path

libvirt_storagevolume_get_info

libvirt_storagevolume_get_info($res)

[Since version 0.4.1(-1)]

Function is used to get the storage volume information.

res [resource]: libvirt storagevolume resource
Returns: storage volume information

libvirt_storagevolume_get_xml_desc

libvirt_storagevolume_get_xml_desc($res, $xpath)

[Since version 0.4.1(-1), changed 0.4.1(-4)]

Function is used to get the storage volume XML description.

res [resource]: libvirt storagevolume resource
@xpath [string]: optional xPath expression string to get just this entry, can be NULL
Returns: storagevolume XML description or result of xPath expression

libvirt_storagevolume_create_xml

libvirt_storagevolume_create_xml($res, $xml)

[Since version 0.4.1(-1)]

Function is used to create the new storage pool and return the handle to new storage pool.

res [resource]: libvirt storagepool resource
@xml [string]: XML string to create the storage volume in the storage pool
Returns: libvirt storagevolume resource

libvirt_storagevolume_create_xml_from

libvirt_storagevolume_create_xml_from($pool, $xml, $original_volume)

[Since version 0.4.1(-4)]

Function is used to clone the new storage volume into pool from the orignial volume.

pool [resource]: libvirt storagepool resource
@xml [string]: XML string to create the storage volume in the storage pool
@original_volume [resource]: libvirt storagevolume resource
Returns: libvirt storagevolume resource

libvirt_storagepool_delete

libvirt_storagepool_delete($res, $flags)

[Since version 0.4.1(-4)]

unction is used to delete to volume identified by it's resource.

res [resource]: libvirt storagevolume resource
@flags [int]: optional flags for the storage volume deletion for virStorageVolDelete()
Returns: TRUE for success, FALSE on error

libvirt_storagepool_get_uuid_string

libvirt_storagepool_get_uuid_string($res)

[Since version 0.4.1(-1)]

Function is used to get storage pool by UUID string.

res [resource]: libvirt storagepool resource
Returns: storagepool UUID string

libvirt_storagepool_get_name

libvirt_storagepool_get_name($res)

[Since version 0.4.1(-1)]

Function is used to get storage pool name from the storage pool resource.

res [resource]: libvirt storagepool resource
Returns: storagepool name string

libvirt_storagepool_lookup_by_uuid_string

libvirt_storagepool_lookup_by_uuid_string($res, $uuid)

[Since version 0.4.1(-1)]

Function is used to lookup for storage pool identified by UUID string.

res [resource]: libvirt connection resource
@uuid [string]: UUID string to look for storagepool
Returns: libvirt storagepool resource

libvirt_storagepool_get_xml_desc

libvirt_storagepool_get_xml_desc($res, $xpath)

[Since version 0.4.1(-1), changed 0.4.1(-4)]

Function is used to get the XML description for the storage pool identified by res.

res [resource]: libvirt storagepool resource
@xpath [string]: optional xPath expression string to get just this entry, can be NULL
Returns: Storage pool XML description string or result of xPath expression

libvirt_storagepool_define_xml

libvirt_storagepool_define_xml($res, $xml, $flags)

[Since version 0.4.1(-1)]

Function is used to define the storage pool from XML string and return it's resource.

res [resource]: libvirt connection resource
@xml [string]: XML string definition of storagepool
@flags [int]: flags to define XML
Returns: libvirt storagepool resource

libvirt_storagepool_undefine

libvirt_storagepool_undefine($res)

[Since version 0.4.1(-1)]

Function is used to undefine the storage pool identified by it's resource.

res [resource]: libvirt storagepool resource
Returns: TRUE if success, FALSE on error

libvirt_storagepool_create

libvirt_storagepool_create($res)

[Since version 0.4.1(-1)]

Function is used to create/start the storage pool.

res [resource]: libvirt storagepool resource
Returns: TRUE if success, FALSE on error

libvirt_storagepool_destroy

libvirt_storagepool_destroy($res)

[Since version 0.4.1(-1)]

Function is used to destory the storage pool.

res [resource]: libvirt storagepool resource
Returns: TRUE if success, FALSE on error

libvirt_storagepool_is_active

libvirt_storagepool_is_active($res)

[Since version 0.4.1(-1)]

Function is used to get information whether storage pool is active or not.

res [resource]: libvirt storagepool resource
Returns: result of virStoragePoolIsActive

libvirt_storagepool_get_volume_count

libvirt_storagepool_get_volume_count($res)

[Since version 0.4.1(-1)]

Function is used to get storage volume count in the storage pool.

res [resource]: libvirt storagepool resource
Returns: number of volumes in the pool

libvirt_storagepool_refresh

libvirt_storagepool_refresh($res, $flags)

[Since version 0.4.1(-1)]

Function is used to refresh the storage pool information.

res [resource]: libvirt storagepool resource
@flags [int]: refresh flags
Returns: TRUE if success, FALSE on error

libvirt_storagepool_set_autostart

libvirt_storagepool_set_autostart($res, $flags)

[Since version 0.4.1(-1)]

Function is used to set autostart of the storage pool.

res [resource]: libvirt storagepool resource
@flags [int]: flags to set autostart
Returns: result on setting storagepool autostart value

libvirt_storagepool_get_autostart

libvirt_storagepool_get_autostart($res)

[Since version 0.4.1(-1)]

Function is used to get autostart of the storage pool.

res [resource]: libvirt storagepool resource
Returns: autostart value for storagepool

libvirt_list_storagepools

libvirt_list_storagepools($res)

[Since version 0.4.1(-1)]

Function is used to list storage pools on the connection.

res [resource]: libvirt connection resource
Returns: libvirt storagepool names array for the connection

libvirt_list_active_storagepools

libvirt_list_active_storagepools($res)

[Since version 0.4.1(-1)]

Function is used to list active storage pools on the connection.

res [resource]: libvirt connection resource
Returns: libvirt storagepool names array for the connection

libvirt_list_inactive_storagepools

libvirt_list_inactive_storagepools($res)

[Since version 0.4.1(-1)]

Function is used to list inactive storage pools on the connection.

res [resource]: libvirt connection resource
Returns: libvirt storagepool names array for the connection

libvirt_list_domains

libvirt_list_domains($res)

[Since version 0.4.1(-1)]

Function is used to list domains on the connection.

res [resource]: libvirt connection resource
Returns: libvirt domain names array for the connection

libvirt_list_domain_resources

libvirt_list_domain_resources($res)

[Since version 0.4.1(-1)]

Function is used to list domain resources on the connection.

res [resource]: libvirt connection resource
Returns: libvirt domain resources array for the connection

libvirt_list_active_domain_ids

libvirt_list_active_domain_ids($res)

[Since version 0.4.1(-1)]

Function is used to list active domain IDs on the connection.

res [resource]: libvirt connection resource
Returns: libvirt active domain ids array for the connection

libvirt_list_active_domains

libvirt_list_active_domains($res)

[Since version 0.4.1(-1)]

Function is used to list active domain names on the connection.

res [resource]: libvirt connection resource
Returns: libvirt active domain names array for the connection

libvirt_list_inactive_domains

libvirt_list_inactive_domains($res)

[Since version 0.4.1(-1)]

Function is used to list inactive domain names on the connection.

res [resource]: libvirt connection resource
Returns: libvirt inactive domain names array for the connection

libvirt_list_networks

libvirt_list_networks($res, $flags)

[Since version 0.4.1(-1)]

Function is used to list networks on the connection.

res [resource]: libvirt connection resource
@flags [int]: flags whether to list active, inactive or all networks (VIR_NETWORKS_{ACTIVE|INACTIVE|ALL} constants)
Returns: libvirt network names array for the connection

libvirt_list_nodedevs

libvirt_list_nodedevs($res, $cap)

[Since version 0.4.1(-1)]

Function is used to list node devices on the connection.

res [resource]: libvirt connection resource
@cap [string]: optional capability string
Returns: libvirt nodedev names array for the connection

libvirt_nodedev_get

libvirt_nodedev_get($res, $name)

[Since version 0.4.1(-1)]

Function is used to get the node device by it's name.

res [resource]: libvirt connection resource
@name [string]: name of the nodedev to get resource
Returns: libvirt nodedev resource

libvirt_nodedev_capabilities

libvirt_nodedev_capabilities($res)

[Since version 0.4.1(-1)]

Function is used to list node devices by capabilities.

res [resource]: libvirt nodedev resource
Returns: nodedev capabilities array

libvirt_nodedev_get_xml_desc

libvirt_nodedev_get_xml_desc($res)

[Since version 0.4.1(-1)]

Function is used to get the node device's XML description.

res [resource]: libvirt nodedev resource
Returns: nodedev XML description

libvirt_nodedev_get_information

libvirt_nodedev_get_information($res)

[Since version 0.4.1(-1)]

Function is used to get the node device's information.

res [resource]: libvirt nodedev resource
Returns: nodedev information array

libvirt_network_undefine

libvirt_network_undefine($res)

[Since version 0.4.2]

Function is used to undefine already defined network.

@res [resource]: libvirt network resource
Returns: TRUE for success, FALSE on error

libvirt_network_get

libvirt_network_get($res, $name)

[Since version 0.4.1(-1)]

Function is used to get the network resource from name.

@res [resource]: libvirt connection resource
@name [string]: network name string
Returns: libvirt network resource

libvirt_network_get_bridge

libvirt_network_get_bridge($res)

[Since version 0.4.1(-1)]

Function is used to get the bridge associated with the network.

res [resource]: libvirt network resource
Returns: bridge name string

libvirt_network_get_active

libvirt_network_get_active($res)

[Since version 0.4.1(-1)]

Function is used to get the activity state of the network.

res [resource]: libvirt network resource
Returns: 1 when active, 0 when inactive, FALSE on error

libvirt_network_get_information

libvirt_network_get_information($res)

[Since version 0.4.1(-1)]

Function is used to get the network information.

res [resource]: libvirt network resource
Returns: network information array

libvirt_network_set_active

libvirt_network_set_active($res)

[Since version 0.4.1(-1)]

Function is used to set the activity state of the network.

res [resource]: libvirt network resource
Returns: TRUE if success, FALSE on error

libvirt_network_get_xml_desc

libvirt_network_get_xml_desc($res, $xpath)

[Since version 0.4.1(-1), changed 0.4.1(-4)]

Function is used to get the XML description for the network.

res [resource]: libvirt network resource
@xpath [string]: optional xPath expression string to get just this entry, can be NULL
Returns: network XML string or result of xPath expression

libvirt_version

libvirt_version($type)

[Since version 0.4.1(-1)]

Function is used to get libvirt, driver and libvirt-php version numbers. Can be used for information purposes, for version checking please use libvirt_check_version() defined below.

type [string]: optional type string to identify driver to look at
Returns: libvirt, type (driver) and connector (libvirt-php) version numbers array

libvirt_check_version

libvirt_check_version($major, $minor, $micro, $type)

[Since version 0.4.1(-1)]

Function is used to check major, minor and micro (also sometimes called release) versions of libvirt-php or libvirt itself. This could useful when you want your application to support only versions of libvirt or libvirt-php higher than some version specified..

major [int]: major version number to check for
@minor [int]: minor version number to check for
@micro [int]: micro (also release) version number to check for
@type [int]: type of checking, VIR_VERSION_BINDING to check against libvirt-php binding or VIR_VERSION_LIBVIRT to check against libvirt version
Returns: TRUE if version is equal or higher than required, FALSE if not, FALSE with error [for libvirt_get_last_error()] on unsupported version type check