PHP API Reference guide

Functions

Total number of functions: 141. Functions supported are:

libvirt_get_last_error()
libvirt_connect($url, $readonly, $credentials)
libvirt_node_get_info($conn)
libvirt_node_get_cpu_stats($conn, $cpunr)
libvirt_node_get_cpu_stats_for_each_cpu($conn, $time)
libvirt_node_get_mem_stats($conn)
libvirt_connect_get_machine_types($conn)
libvirt_connect_get_information($conn)
libvirt_connect_get_uri($conn)
libvirt_connect_get_hostname($conn)
libvirt_image_create($conn, $name, $size, $format)
libvirt_image_remove($conn, $image)
libvirt_connect_get_hypervisor($conn)
libvirt_connect_is_encrypted($conn)
libvirt_connect_is_secure($conn)
libvirt_connect_get_maxvcpus($conn)
libvirt_connect_get_sysinfo($conn)
libvirt_domain_get_counts($conn)
libvirt_domain_is_persistent($res)
libvirt_domain_get_autostart($res)
libvirt_domain_set_autostart($res, $flags)
libvirt_domain_get_metadata($res, $type, $uri, $flags)
libvirt_domain_set_metadata($res, $type, $metadata, $key, $uri, $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_screenshot_api($res, $screenID)
libvirt_domain_get_screenshot($res, $server, $scancode)
libvirt_domain_get_screen_dimensions($res, $server)
libvirt_domain_send_keys($res, $server, $scancode)
libvirt_domain_send_pointer_event($res, $server, $pos_x, $pos_y, $clicked, $release)
libvirt_domain_get_uuid($res)
libvirt_domain_get_id($res)
libvirt_domain_get_next_dev_ids($res)
libvirt_connect_get_capabilities($conn, $xpath)
libvirt_connect_get_emulator($conn, $arch)
libvirt_connect_get_nic_models($conn, $arch)
libvirt_connect_get_soundhw_models($conn, $arch, $flags)
libvirt_domain_new($conn, $name, $arch, $memMB, $maxmemMB, $vcpus, $iso_image, $disks, $networks, $flags)
libvirt_domain_new_get_vnc($one)
libvirt_domain_get_xml_desc($res, $xpath)
libvirt_domain_get_disk_devices($res)
libvirt_domain_get_interface_devices($res)
libvirt_domain_change_vcpus($res, $numCpus, $flags)
libvirt_domain_change_memory($res, $allocMem, $allocMax)
libvirt_domain_change_boot_devices($res, $first, $second)
libvirt_domain_disk_add($res, $img, $dev, $typ, $driver, $flags)
libvirt_domain_disk_remove($res, $dev, $flags)
libvirt_domain_nic_add($res, $mac, $network, $model, $flags)
libvirt_domain_nic_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_managedsave($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_to_uri2($res, $dconnuri, $miguri, $dxml, $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_storagevolume_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_storagepool_build($res)
libvirt_storagepool_delete($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, $xpath)
libvirt_nodedev_get_information($res)
libvirt_network_define_xml($res, $xml)
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_has_feature($name)
libvirt_get_iso_images($path)
libvirt_print_binding_resources()
libvirt_logfile_set($filename, $maxsize)

libvirt_get_last_error

libvirt_get_last_error()

[Since version 0.4.1(-1)]

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

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_node_get_cpu_stats

libvirt_node_get_cpu_stats($conn, $cpunr)

[Since version 0.4.6]

Function is used to get the CPU stats per nodes.

conn [resource]: resource for connection
@cpunr [int]: CPU number to get information about, defaults to VIR_NODE_CPU_STATS_ALL_CPUS to get information about all CPUs
Returns: array of node CPU statistics including time (in seconds since UNIX epoch), cpu number and total number of CPUs on node or FALSE for error

libvirt_node_get_cpu_stats_for_each_cpu

libvirt_node_get_cpu_stats_for_each_cpu($conn, $time)

[Since version 0.4.6]

Function is used to get the CPU stats for each CPU on the host node.

conn [resource]: resource for connection
@time [int]: time in seconds to get the information about, without aggregation for further processing
Returns: array of node CPU statistics for each CPU including time (in seconds since UNIX epoch), cpu number and total number of CPUs on node or FALSE for error

libvirt_node_get_mem_stats

libvirt_node_get_mem_stats($conn)

[Since version 0.4.6]

Function is used to get the memory stats per node.

conn [resource]: resource for connection
Returns: array of node memory statistics including time (in seconds since UNIX epoch) or FALSE for error

libvirt_connect_get_machine_types

libvirt_connect_get_machine_types($conn)

[Since version 0.4.9]

Function is used to get machine types supported by hypervisor on the conneciton.

conn [resource]: resource for connection
Returns: array of machine types for the connection incl. maxCpus if appropriate

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_image_create

libvirt_image_create($conn, $name, $size, $format)

[Since version 0.4.2]

Function is used to create the image of desired name, size and format. The image will be created in the image path (libvirt.image_path INI variable). Works only o.

@conn [resource]: libvirt connection resource
@name [string]: name of the image file that will be created in the libvirt.image_path directory
@size [int]: size of the image in MiBs
@format [string]: format of the image, may be raw, qcow or qcow2
Returns: hostname of the host node or FALSE for error

libvirt_image_remove

libvirt_image_remove($conn, $image)

[Since version 0.4.2]

Function is used to create the image of desired name, size and format. The image will be created in the image path (libvirt.image_path INI variable). Works only on local systems!.

conn [resource]: libvirt connection resource
@image [string]: name of the image file that should be deleted
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_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_is_persistent

libvirt_domain_is_persistent($res)

[Since version 0.4.9]

Function to get information whether domain is persistent or not.

res [resource]: libvirt domain resource
Returns: TRUE for persistent, FALSE for not persistent, -1 on error

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_get_metadata

libvirt_domain_get_metadata($res, $type, $uri, $flags)

[Since version 0.4.9]

Function retrieve appropriate domain element given by @type..

res [resource]: libvirt domain resource
@type [int]: virDomainMetadataType type of description
@uri [string]: XML namespace identifier
@flags [int]: bitwise-OR of virDomainModificationImpact
Returns: metadata string, NULL on error or FALSE on API not supported

libvirt_domain_set_metadata

libvirt_domain_set_metadata($res, $type, $metadata, $key, $uri, $flags)

[Since version 0.4.9]

Function sets the appropriate domain element given by @type to the value of @description. No new lines are permitted..

res [resource]: libvirt domain resource
@type [int]: virDomainMetadataType type of description
@metadata [string]: new metadata text
@key [string]: XML namespace key or empty string (alias of NULL)
@uri [string]: XML namespace identifier or empty string (alias of NULL)
@flags [int]: bitwise-OR of virDomainModificationImpact
Returns: -1 on error, 0 on success

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_lookup_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_lookup_by_*()
Returns: domain UUID string

libvirt_domain_get_screenshot_api

libvirt_domain_get_screenshot_api($res, $screenID)

[Since version 0.4.5]

Function is trying to get domain screenshot using libvirt virGetDomainScreenshot() API if available..

res [resource]: libvirt domain resource, e.g. from libvirt_domain_get_by_*()
@screenID [int]: monitor ID from where to take screenshot
Returns: array of filename and mime type as type is hypervisor specific, caller is responsible for temporary file deletion

libvirt_domain_get_screenshot

libvirt_domain_get_screenshot($res, $server, $scancode)

[Since version 0.4.2]

Function uses gvnccapture (if available) to get the screenshot of the running domain.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
@server [string]: server string for the host machine
@scancode [int]: integer value of the scancode to be send to refresh screen
Returns: PNG image binary data

libvirt_domain_get_screen_dimensions

libvirt_domain_get_screen_dimensions($res, $server)

[Since version 0.4.3]

Function get screen dimensions of the VNC window.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
@server [string]: server string of the host machine
Returns: array of height and width on success, FALSE otherwise

libvirt_domain_send_keys

libvirt_domain_send_keys($res, $server, $scancode)

[Since version 0.4.2]

Function sends keys to the domain's VNC window.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
@server [string]: server string of the host machine
@scancode [int]: integer scancode to be sent to VNC window
Returns: TRUE on success, FALSE otherwise

libvirt_domain_send_pointer_event

libvirt_domain_send_pointer_event($res, $server, $pos_x, $pos_y, $clicked, $release)

[Since version 0.4.2]

Function sends keys to the domain's VNC window.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
@server [string]: server string of the host machine
@pos_x [int]: position on x-axis
@pos_y [int]: position on y-axis
@clicked [int]: mask of clicked buttons (0 for none, bit 1 for button #1, bit 8 for button #8)
@release [int]: boolean value (0 or 1) whether to release the buttons automatically once pressed
Returns: TRUE on success, FALSE otherwise

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_lookup_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 only.

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

libvirt_domain_get_next_dev_ids

libvirt_domain_get_next_dev_ids($res)

[Since version 0.4.2]

This functions can be used to get the next free slot if you intend to add a new device identified by slot to the domain, e.g. NIC device.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
Returns: next free slot number for the domain

libvirt_connect_get_capabilities

libvirt_connect_get_capabilities($conn, $xpath)

[Since version 0.4.1(-2)]

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

conn [resource]: resource for connection
@xpath [string]: optional xPath query to be applied on the result
Returns: capabilities XML from the connection or FALSE for error

libvirt_connect_get_emulator

libvirt_connect_get_emulator($conn, $arch)

[Since version 0.4.5]

Function is used to get the emulator for requested connection/architecture.

conn [resource]: libvirt connection resource
@arch [string]: optional architecture string, can be NULL to get default
Returns: path to the emulator

libvirt_connect_get_nic_models

libvirt_connect_get_nic_models($conn, $arch)

[Since version 0.4.9]

Function is used to get NIC models for requested connection/architecture.

conn [resource]: libvirt connection resource
@arch [string]: optional architecture string, can be NULL to get default
Returns: array of models

libvirt_connect_get_soundhw_models

libvirt_connect_get_soundhw_models($conn, $arch, $flags)

[Since version 0.4.9]

Function is used to get sound hardware models for requested connection/architecture.

conn [resource]: libvirt connection resource
@arch [string]: optional architecture string, can be NULL to get default
@flags [int]: flags for getting sound hardware. Can be either 0 or VIR_CONNECT_SOUNDHW_GET_NAMES
Returns: array of models

libvirt_domain_new

libvirt_domain_new($conn, $name, $arch, $memMB, $maxmemMB, $vcpus, $iso_image, $disks, $networks, $flags)

[Since version 0.4.5]

Function is used to install a new virtual machine to the machine.

conn [resource]: libvirt connection resource
@name [string]: name of the new domain
@arch [string]: optional architecture string, can be NULL to get default (or false)
@memMB [int]: number of megabytes of RAM to be allocated for domain
@maxmemMB [int]: maximum number of megabytes of RAM to be allocated for domain
@vcpus [int]: number of VCPUs to be allocated to domain
@iso_image [string]: installation ISO image for domain
@disks [array]: array of disk devices for domain, consist of keys as 'path' (storage location), 'driver' (image type, e.g. 'raw' or 'qcow2'), 'bus' (e.g. 'ide', 'scsi'), 'dev' (device to be presented to the guest - e.g. 'hda'), 'size' (with 'M' or 'G' suffixes, like '10G' for 10 gigabytes image etc.) and 'flags' (VIR_DOMAIN_DISK_FILE or VIR_DOMAIN_DISK_BLOCK, optionally VIR_DOMAIN_DISK_ACCESS_ALL to allow access to the disk for all users on the host system)
@networks [array]: array of network devices for domain, consists of keys as 'mac' (for MAC address), 'network' (for network name) and optional 'model' for model of NIC device
@flags [int]: bit array of flags
Returns: a new domain resource

libvirt_domain_new_get_vnc

libvirt_domain_new_get_vnc($one)

[Since version 0.4.5]

Function is used to get the VNC server location for the newly created domain (newly started installation).

one: one
Returns: a VNC server for a newly created domain resource (if any)

libvirt_domain_get_xml_desc

libvirt_domain_get_xml_desc($res, $xpath)

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

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

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_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_get_disk_devices

libvirt_domain_get_disk_devices($res)

[Since version 0.4.4]

Function is used to get disk devices for the domain.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
Returns: list of domain disk devices

libvirt_domain_get_interface_devices

libvirt_domain_get_interface_devices($res)

[Since version 0.4.4]

Function is used to get network interface devices for the domain.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
Returns: list of domain interface devices

libvirt_domain_change_vcpus

libvirt_domain_change_vcpus($res, $numCpus, $flags)

[Since version 0.4.2]

Function is used to change the VCPU count for the domain.

res [resource]: libvirt domain resource
@numCpus [int]: number of VCPUs to be set for the guest
@flags [int]: flags for virDomainSetVcpusFlags (available at http://libvirt.org/html/libvirt-libvirt.html#virDomainVcpuFlags )
Returns: true on success, false on error

libvirt_domain_change_memory

libvirt_domain_change_memory($res, $allocMem, $allocMax)

[Since version 0.4.2]

Function is used to change the domain memory allocation.

res [resource]: libvirt domain resource
@allocMem [int]: number of MiBs to be set as immediate memory value
@allocMax [int]: number of MiBs to be set as the maximum allocation
Returns: new domain resource

libvirt_domain_change_boot_devices

libvirt_domain_change_boot_devices($res, $first, $second)

[Since version 0.4.2]

Function is used to change the domain boot devices.

res [resource]: libvirt domain resource
@first [string]: first boot device to be set
@second [string]: second boot device to be set
Returns: new domain resource

libvirt_domain_disk_add

libvirt_domain_disk_add($res, $img, $dev, $typ, $driver, $flags)

[Since version 0.4.2]

Function is used to add the disk to the virtual machine using set of API functions to make it as simple as possible for the user.

res [resource]: libvirt domain resource
@img [string]: string for the image file on the host system
@dev [string]: string for the device to be presented to the guest (e.g. hda)
@typ [string]: bus type for the device in the guest, usually 'ide' or 'scsi'
driver [string]: driver type to be specified, like 'raw' or 'qcow2'
@flags [int]: flags for getting the XML description
Returns: new domain resource

libvirt_domain_disk_remove

libvirt_domain_disk_remove($res, $dev, $flags)

[Since version 0.4.2]

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_nic_add

libvirt_domain_nic_add($res, $mac, $network, $model, $flags)

[Since version 0.4.2]

Function is used to add the NIC card to the virtual machine using set of API functions to make it as simple as possible for the user.

res [resource]: libvirt domain resource
@mac [string]: MAC string interpretation to be used for the NIC device
@network [string]: network name where to connect this NIC
@model [string]: string of the NIC model
@flags [int]: flags for getting the XML description
Returns: new domain resource

libvirt_domain_nic_remove

libvirt_domain_nic_remove($res, $dev, $flags)

[Since version 0.4.2]

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

res [resource]: libvirt domain resource
@dev [string]: string representation of the IP address to be removed (e.g. 54:52:00:xx:yy:zz)
@flags [int]: optional 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_lookup_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_lookup_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_lookup_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_lookup_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_lookup_by_*()
Returns: TRUE for success, FALSE on error

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_lookup_by_*()
Returns: TRUE for success, FALSE on error

libvirt_domain_managedsave

libvirt_domain_managedsave($res)

[Since version 0.4.1(-1)]

Function is used to managed save the domain (domain was unloaded from memory and it state saved to disk) identified by it's resource.

res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
Returns: TRUE for success, FALSE on error

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_lookup_by_*()
Returns: TRUE for success, FALSE on error

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_lookup_by_*()
Returns: TRUE for success, FALSE on error

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_lookup_by_*()
Returns: TRUE for success, FALSE on error

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_lookup_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_lookup_by_*()
Returns: domain memory stats array (same fields as virDomainMemoryStats, please see libvirt documentation)

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_lookup_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: TRUE for success, FALSE on error

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_lookup_by_*()
@path [string]: device path to get statistics about
Returns: domain block stats array, fields are rd_req, rd_bytes, wr_req, wr_bytes and errs

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_lookup_by_*()
@mac [string]: mac address of the network device
Returns: domain network info array of MAC address, network name and type of NIC card

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_lookup_by_*()
@dev [string]: device to get block information about
Returns: domain block device information array of device, file or partition, capacity, allocation and physical size

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_lookup_by_*()
@xpath [string]: xPath expression to parse against the domain
Returns: result of the expression in an array

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_lookup_by_*()
@path [string]: path to interface device
Returns: interface stats array of {tx|rx}_{bytes|packets|errs|drop} fields

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_lookup_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_lookup_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: TRUE for success, FALSE on error

libvirt_domain_migrate_to_uri2

libvirt_domain_migrate_to_uri2($res, $dconnuri, $miguri, $dxml, $flags, $dname, $bandwidth)

[Since version 0.4.6(-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_lookup_by_*()
@dconnuri [string]: URI for target libvirtd
@miguri [string]: URI for invoking the migration
@dxml [string]: XML config for launching guest on target
@flags [int]: migration flags
@dname [string]: domain name to rename domain to on destination side
@bandwidth [int]: migration bandwidth in Mbps
Returns: TRUE for success, FALSE on error

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_lookup_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: libvirt domain resource for migrated domain

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_lookup_by_*()
Returns: job information array of type, time, data, mem and file fields

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

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

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

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(-1)]

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 in an array using default keys (indexes)

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 of state, capacity, allocation and available space

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(-2)]

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(-2)]

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 array of type, allocation and capacity

libvirt_storagevolume_get_xml_desc

libvirt_storagevolume_get_xml_desc($res, $xpath)

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

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(-2)]

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_storagevolume_delete

libvirt_storagevolume_delete($res, $flags)

[Since version 0.4.2]

Function 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.2]

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: storagepool 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: TRUE for autostart enabled, FALSE for autostart disabled, FALSE with last_error set for error

libvirt_storagepool_build

libvirt_storagepool_build($res)

[Since version 0.4.2]

Function is used to Build the underlying storage pool, e.g. create the destination directory for NFS.

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

libvirt_storagepool_delete

libvirt_storagepool_delete($res)

[Since version 0.4.6]

Function is used to Delete the underlying storage pool, e.g. remove the destination directory for NFS.

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

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, $xpath)

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

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

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

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_define_xml

libvirt_network_define_xml($res, $xml)

[Since version 0.4.2]

Function is used to define a new virtual network based on the XML description.

res [resource]: libvirt connection resource
@xml [string]: XML string definition of network to be defined
Returns: libvirt network resource of newly defined network

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)]

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 [long]: major version number to check for
@minor [long]: minor version number to check for
@micro [long]: micro (also release) version number to check for
@type [long]: 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

libvirt_has_feature

libvirt_has_feature($name)

[Since version 0.4.1(-3)]

Function to check for feature existence for working libvirt instance.

@name [string]: feature name
Returns: TRUE if feature is supported, FALSE otherwise

libvirt_get_iso_images

libvirt_get_iso_images($path)

[Since version 0.4.1(-3)]

Function to get the ISO images on path and return them in the array.

@path [string]: string of path where to look for the ISO images
Returns: ISO image array on success, FALSE otherwise

libvirt_print_binding_resources

libvirt_print_binding_resources()

[Since version 0.4.2]

Function to print the binding resources, although the resource information are printed, they are returned in the return_value.

Returns: bindings resource information

libvirt_logfile_set

libvirt_logfile_set($filename, $maxsize)

[Since version 0.4.2]

Function to set the log file for the libvirt module instance.

@filename [string]: log filename or NULL to disable logging
@maxsize [long]: optional maximum log file size argument in KiB, default value can be found in PHPInfo() output
Returns: TRUE if log file has been successfully set, FALSE otherwise