# PHP API Reference guide

### Functions

    Total number of functions: 194. Functions supported are:

    	libvirt_get_last_error()

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

    	libvirt_image_remove($conn, $image)

    	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_connect($url, $readonly, $credentials)

    	libvirt_connect_get_uri($conn)

    	libvirt_connect_get_hostname($conn)

    	libvirt_connect_get_hypervisor($conn)

    	libvirt_connect_get_capabilities($conn, $xpath)

    	libvirt_connect_get_domain_capabilities($conn, $emulatorbin, $arch, $machine, $virttype, $flags, $xpath)

    	libvirt_connect_get_emulator($conn, $arch)

    	libvirt_connect_get_nic_models($conn, $arch)

    	libvirt_connect_get_soundhw_models($conn, $arch, $flags)

    	libvirt_connect_get_maxvcpus($conn)

    	libvirt_connect_get_sysinfo($conn)

    	libvirt_connect_get_encrypted($conn)

    	libvirt_connect_get_secure($conn)

    	libvirt_connect_get_information($conn)

    	libvirt_connect_get_machine_types($conn)

    	libvirt_connect_get_all_domain_stats($conn, $stats, $flags)

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

    	libvirt_domain_new_get_vnc()

    	libvirt_domain_get_counts($conn)

    	libvirt_domain_is_persistent($res)

    	libvirt_domain_lookup_by_name($res, $name)

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

    	libvirt_domain_change_boot_devices($res, $first, $second, $flags)

    	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_attach_device($res, $xml, $flags)

    	libvirt_domain_detach_device($res, $xml, $flags)

    	libvirt_domain_get_info($res)

    	libvirt_domain_get_name($res)

    	libvirt_domain_get_uuid($res)

    	libvirt_domain_get_uuid_string($res)

    	libvirt_domain_get_id($res)

    	libvirt_domain_lookup_by_uuid($res, $uuid)

    	libvirt_domain_lookup_by_uuid_string($res, $uuid)

    	libvirt_domain_lookup_by_id($conn, $id)

    	libvirt_domain_create($res)

    	libvirt_domain_destroy($res)

    	libvirt_domain_resume($res)

    	libvirt_domain_core_dump($res, $to)

    	libvirt_domain_shutdown($res)

    	libvirt_domain_suspend($res)

    	libvirt_domain_managedsave($res)

    	libvirt_domain_undefine($res)

    	libvirt_domain_undefine_flags($res, $flags)

    	libvirt_domain_reboot($res, $flags)

    	libvirt_domain_reset($res, $flags)

    	libvirt_domain_define_xml($conn, $xml)

    	libvirt_domain_create_xml($conn, $xml)

    	libvirt_domain_xml_from_native($conn, $format, $config_data)

    	libvirt_domain_xml_to_native($conn, $format, $xml_data)

    	libvirt_domain_set_max_memory($res, $memory)

    	libvirt_domain_set_memory($res, $memory)

    	libvirt_domain_set_memory_flags($res, $memory, $flags)

    	libvirt_domain_memory_peek($res, $start, $size, $flags)

    	libvirt_domain_memory_stats($res, $flags)

    	libvirt_domain_block_commit($res, $disk, $base, $top, $bandwidth, $flags)

    	libvirt_domain_block_copy($res, $disk, $destxml, $params, $flags, $*)

    	libvirt_domain_block_pull($res, $disk, $bandwidth, $flags)

    	libvirt_domain_block_rebase($res, $disk, $base, $or, $bandwidth, $flags)

    	libvirt_domain_block_stats($res, $path)

    	libvirt_domain_block_resize($res, $path, $size, $flags)

    	libvirt_domain_block_job_info($dom, $disk, $flags)

    	libvirt_domain_block_job_abort($res, $path, $flags)

    	libvirt_domain_block_job_set_speed($res, $path, $bandwidth, $flags)

    	libvirt_domain_interface_addresses($domain, $source)

    	libvirt_domain_interface_stats($res, $path)

    	libvirt_domain_get_connect($res)

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

    	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_get_job_info($res)

    	libvirt_domain_xml_xpath($res, $xpath, $flags)

    	libvirt_domain_get_block_info($res, $dev)

    	libvirt_domain_get_network_info($res, $mac)

    	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_get_next_dev_ids($res)

    	libvirt_domain_get_screenshot($res, $server, $scancode)

    	libvirt_domain_get_screenshot_api($res, $screenID)

    	libvirt_domain_get_screen_dimensions($res, $server)

    	libvirt_domain_send_keys($res, $server, $scancode)

    	libvirt_domain_send_key_api($res[resource], $codeset, $holdtime, $keycodes, $flags)

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

    	libvirt_domain_update_device($res, $xml, $flags)

    	libvirt_domain_qemu_agent_command($res, $cmd, $timeout, $flags)

    	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_domain_get_cpu_total_stats($res)

    	libvirt_network_define_xml($res, $xml)

    	libvirt_network_get_xml_desc($res, $xpath)

    	libvirt_network_undefine($res)

    	libvirt_network_get($res, $name)

    	libvirt_network_get_bridge($res)

    	libvirt_network_get_active($res)

    	libvirt_network_set_active($res, $flags)

    	libvirt_network_get_information($res)

    	libvirt_network_get_uuid_string($res)

    	libvirt_network_get_uuid($res)

    	libvirt_network_get_name($res)

    	libvirt_network_get_autostart($res)

    	libvirt_network_set_autostart($res, $flags)

    	libvirt_list_all_networks($res, $flags)

    	libvirt_list_networks($res, $flags)

    	libvirt_network_get_dhcp_leases($res, $mac, $flags)

    	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_node_get_free_memory($conn)

    	libvirt_nodedev_get($res, $name)

    	libvirt_nodedev_capabilities($res)

    	libvirt_nodedev_get_xml_desc($res, $xpath)

    	libvirt_nodedev_get_information($res)

    	libvirt_list_nodedevs($res, $cap)

    	libvirt_nwfilter_define_xml($res, $xml)

    	libvirt_nwfilter_undefine($res)

    	libvirt_nwfilter_get_xml_desc($res, $xpath)

    	libvirt_nwfilter_get_uuid_string($res)

    	libvirt_nwfilter_get_uuid($res)

    	libvirt_nwfilter_get_name($res)

    	libvirt_nwfilter_lookup_by_name($res, $name)

    	libvirt_nwfilter_lookup_by_uuid_string($res, $uuid)

    	libvirt_nwfilter_lookup_by_uuid($res, $uuid)

    	libvirt_list_all_nwfilters($res)

    	libvirt_list_nwfilters($res)

    	libvirt_domain_has_current_snapshot($res, $flags)

    	libvirt_domain_snapshot_lookup_by_name($res, $name, $flags)

    	libvirt_domain_snapshot_create($res, $flags)

    	libvirt_domain_snapshot_create_xml($res, $xml, $flags)

    	libvirt_domain_snapshot_current($res, $flags)

    	libvirt_domain_snapshot_get_xml($res, $flags)

    	libvirt_domain_snapshot_revert($res, $flags)

    	libvirt_domain_snapshot_delete($res, $flags)

    	libvirt_list_domain_snapshots($res, $flags)

    	libvirt_storagepool_lookup_by_name($res, $name)

    	libvirt_storagepool_lookup_by_volume($res)

    	libvirt_storagepool_list_volumes($res)

    	libvirt_storagepool_get_info($res)

    	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_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, $flags)

    	libvirt_storagevolume_create_xml($res, $xml, $flags)

    	libvirt_storagevolume_create_xml_from($pool, $xml, $original_volume)

    	libvirt_storagevolume_delete($res, $flags)

    	libvirt_storagevolume_download($res, $stream, $offset, $length, $flags)

    	libvirt_storagevolume_upload($res, $stream, $offset, $length, $flags)

    	libvirt_storagevolume_resize($res, $capacity, $flags)

    	libvirt_list_storagepools($res)

    	libvirt_list_active_storagepools($res)

    	libvirt_list_inactive_storagepools($res)

    	libvirt_stream_create($res)

    	libvirt_stream_close($res)

    	libvirt_stream_abort($res)

    	libvirt_stream_finish($res)

    	libvirt_stream_recv($res, $data, $len)

    	libvirt_stream_send($res, $data, $length)

### `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_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_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

### `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, can be NULL
`@readonly [bool]`: | flag whether to use read-only connection or not
`@credentials [array]`: | array of connection credentials
`Returns`: | : libvirt connection resource

### `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_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_domain_capabilities`

    libvirt_connect_get_domain_capabilities($conn, $emulatorbin, $arch, $machine, $virttype, $flags, $xpath)

[Since version 0.5.8]

Function is used to get the domain capabilities information.

`@conn [resource]`: | resource for connection
`@emulatorbin [string]`: | optional path to emulator
`@arch [string]`: | optional domain architecture
`@machine [string]`: | optional machine type
`@virttype [string]`: | optional virtualization type
`@flags [int]` : | extra flags; not used yet, so callers should always pass 0
`@xpath [string]`: | optional xPath query to be applied on the result
`Returns`: | : domain 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_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_connect_get_encrypted`

    libvirt_connect_get_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_get_secure`

    libvirt_connect_get_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_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_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 connection.

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

### `libvirt_connect_get_all_domain_stats`

    libvirt_connect_get_all_domain_stats($conn, $stats, $flags)

[Since version 0.5.1(-1)]

Query statistics for all domains on a given connection.

`@conn [resource]`: | resource for connection
`@stats [int]`: | the statistic groups from VIR_DOMAIN_STATS_*
`@flags [int]`: | the filter flags from VIR_CONNECT_GET_ALL_DOMAINS_STATS_*
`Returns`: | : assoc array with statistics or false on error

### `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()

[Since version 0.4.5]

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

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

### `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_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_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 https://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, $flags)

[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
`@flags [int]`: | flags
`Returns`: | : new domain resource

### `libvirt_domain_change_boot_devices`

    libvirt_domain_change_boot_devices($res, $first, $second, $flags)

[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
`@flags [int]`: | flags
`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_attach_device`

    libvirt_domain_attach_device($res, $xml, $flags)

[Since version 0.5.3]

Function is used to attach a virtual device to a domain..

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@xml [string]`: | XML description of one device.
`@flags [int]`: | optional flags to control how the device is attached. Defaults to VIR_DOMAIN_AFFECT_LIVE
`Returns`: | : TRUE for success, FALSE on error.

### `libvirt_domain_detach_device`

    libvirt_domain_detach_device($res, $xml, $flags)

[Since version 0.5.3]

Function is used to detach a virtual device from a domain..

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@xml [string]`: | XML description of one device.
`@flags [int]`: | optional flags to control how the device is attached. Defaults to VIR_DOMAIN_AFFECT_LIVE
`Returns`: | : TRUE for success, FALSE on error.

### `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_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`

    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_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_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_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_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, $to)

[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_*()
`@to [string]`: | to
`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_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_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_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_undefine_flags`

    libvirt_domain_undefine_flags($res, $flags)

[Since version 0.5.6]

Function is used to undefine(with flags) the domain identified by it's resource.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@flags [int]`: | optional flags, bitwise-OR of VIR_DOMAIN_UNDEFINE_*
`Returns`: | : TRUE for success, FALSE on error

### `libvirt_domain_reboot`

    libvirt_domain_reboot($res, $flags)

[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_*()
`@flags [int]`: | optional flags
`Returns`: | : TRUE for success, FALSE on error

### `libvirt_domain_reset`

    libvirt_domain_reset($res, $flags)

[Since version 0.5.5]

Function is used to reset the domain identified by its resource.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@flags [int]`: | optional flags
`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_xml_from_native`

    libvirt_domain_xml_from_native($conn, $format, $config_data)

[Since version 0.5.3]

Function is used to convert native configuration data to libvirt domain XML.

`@conn [resource]`: | libvirt connection resource
`@format [string]`: | configuration format converting from
`@config_data [string]`: | content of the native config file
`Returns`: | : libvirt domain XML, FALSE on error

### `libvirt_domain_xml_to_native`

    libvirt_domain_xml_to_native($conn, $format, $xml_data)

[Since version 0.5.3]

Function is used to convert libvirt domain XML to native configuration.

`@conn [resource]`: | libvirt connection resource
`@format [string]`: | configuration format converting to
`@xml_data [string]`: | content of the libvirt domain xml file
`Returns`: | : contents of the native data file, FALSE on error

### `libvirt_domain_set_max_memory`

    libvirt_domain_set_max_memory($res, $memory)

[Since version 0.5.1]

Function to set max memory for domain.

`@res [resource]`: | libvirt domain resource
`@memory [int]`: | memory size in 1024 bytes (Kb)
`Returns`: | : TRUE for success, FALSE for failure

### `libvirt_domain_set_memory`

    libvirt_domain_set_memory($res, $memory)

[Since version 0.5.1]

Function to set memory for domain.

`@res [resource]`: | libvirt domain resource
`@memory [int]`: | memory size in 1024 bytes (Kb)
`Returns`: | : TRUE for success, FALSE for failure

### `libvirt_domain_set_memory_flags`

    libvirt_domain_set_memory_flags($res, $memory, $flags)

[Since version 0.5.1]

Function to set max memory for domain.

`@res [resource]`: | libvirt domain resource
`@memory [int]`: | memory size in 1024 bytes (Kb)
`@flags [int]`: | bitwise-OR VIR_DOMAIN_MEM_* flags
`Returns`: | : TRUE for success, FALSE for failure

### `libvirt_domain_memory_peek`

    libvirt_domain_memory_peek($res, $start, $size, $flags)

[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_*()
`@start [int]`: | start
`@size [int]`: | size
`@flags [int]`: | optional flags
`Returns`: | : domain memory peek

### `libvirt_domain_memory_stats`

    libvirt_domain_memory_stats($res, $flags)

[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_*()
`@flags [int]`: | optional flags
`Returns`: | : domain memory stats array (same fields as virDomainMemoryStats, please see libvirt documentation)

### `libvirt_domain_block_commit`

    libvirt_domain_block_commit($res, $disk, $base, $top, $bandwidth, $flags)

[Since version 0.5.2(-1)]

Function is used to commit block job.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@disk [string]`: | path to the block device, or device shorthand
`@base [string]`: | path to backing file to merge into, or device shorthand, or NULL for default
`@top [string]`: | path to file within backing chain that contains data to be merged, or device shorthand, or NULL to merge all possible data
`@bandwidth [int]`: | (optional) specify bandwidth limit; flags determine the unit
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_COMMIT_*
`Returns`: | : true on success fail on error

### `libvirt_domain_block_copy`

    libvirt_domain_block_copy($res, $disk, $destxml, $params, $flags, $*)

[Since version 0.5.8]

Function is used to commit block job.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@disk [string]`: | path to the block device, or device shorthand
`@destxml [string]`: | XML description of the copy destination
`@params`: | Associative array of block copy parameter objects, or NULL
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_COPY_*
`*`: | *
`Returns`: | : true on success fail on error

### `libvirt_domain_block_pull`

    libvirt_domain_block_pull($res, $disk, $bandwidth, $flags)

[Since version 0.5.8]

Function is used to populate a disk image with data from its backing image..

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@disk [string]`: | path to the block device, or device shorthand
`@bandwidth [int]`: | (optional) specify bandwidth limit; flags determine the unit
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_PULL_*
`Returns`: | : true on success fail on error

### `libvirt_domain_block_rebase`

    libvirt_domain_block_rebase($res, $disk, $base, $or, $bandwidth, $flags)

[Since version 0.5.8]

Populate a disk image with data from its backing image.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@disk [string]`: | path to the block device, or device shorthand
`@base [string]`: | path to backing file to keep, or device shorthand,
`or`: | or
`@bandwidth [int]`: | (optional) specify bandwidth limit; flags determine the unit
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_REBASE_*
`Returns`: | : true on success fail 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_block_resize`

    libvirt_domain_block_resize($res, $path, $size, $flags)

[Since version 0.5.1(-1)]

Function is used to resize the domain's block device.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@path [string]`: | device path to resize
`@size [int]`: | size of device
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_RESIZE_*
`Returns`: | : true on success fail on error

### `libvirt_domain_block_job_info`

    libvirt_domain_block_job_info($dom, $disk, $flags)

[Since version 0.5.2(-1)]

Function is used to request block job information for the given disk.

`@dom [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@disk [string]`: | path to the block device, or device shorthand
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_COMMIT_*
`Returns`: | : Array with status virDomainGetBlockJobInfo and blockjob information.

### `libvirt_domain_block_job_abort`

    libvirt_domain_block_job_abort($res, $path, $flags)

[Since version 0.5.1(-1)]

Function is used to abort block job.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@path [string]`: | device path to resize
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_JOB_ABORT_*
`Returns`: | : true on success fail on error

### `libvirt_domain_block_job_set_speed`

    libvirt_domain_block_job_set_speed($res, $path, $bandwidth, $flags)

[Since version 0.5.1(-1)]

Function is used to set speed of block job.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@path [string]`: | device path to resize
`@bandwidth [int]`: | bandwidth
`@flags [int]`: | bitwise-OR of VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_*
`Returns`: | : true on success fail on error

### `libvirt_domain_interface_addresses`

    libvirt_domain_interface_addresses($domain, $source)

[Since version 0.5.5]

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

`@domain [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@source [int]`: | one of the VIR_DOMAIN_ADDRESSES_SRC_* flags.
`Returns`: | : interface array of a domain holding information about addresses resembling the virDomainInterface structure, false on error

### `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`

    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_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_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_xml_xpath`

    libvirt_domain_xml_xpath($res, $xpath, $flags)

[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
`@flags [int]`: | optional flags
`Returns`: | : result of the expression in an 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_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_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_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_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_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_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_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_key_api`

    libvirt_domain_send_key_api($res[resource], $codeset, $holdtime, $keycodes, $flags)

[Since version 0.5.3]

Function sends keys to domain via libvirt API.

`@res[resource]`: | libvirt domain resource, e.g. from libvirt_domaing_lookup_by_*()
`@codeset [int]`: | the codeset of keycodes, from virKeycodeSet
`@holdtime [int]`: | the duration (in miliseconds) that the keys will be held
`@keycodes [array]`: | array of keycodes
`@flags [int]`: | extra flags; not used yet so callers should alway pass 0
`Returns`: | : TRUE for success, FALSE for failure

### `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_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_qemu_agent_command`

    libvirt_domain_qemu_agent_command($res, $cmd, $timeout, $flags)

[Since version 0.5.2(-1)]

Function is used to send qemu-ga command.

`@res [resource]`: | libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
`@cmd [string]`: | command
`@timeout`: | @timeout
`@flags [int]`: | unknown
`Returns`: | : String on success and FALSE on error

### `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_domain_get_cpu_total_stats`

    libvirt_domain_get_cpu_total_stats($res)

[Since version (null)]

Function is used to get statistics relating to CPU usage attributable to a single domain.

`@res [resource]`: | libvirt domain resource
`Returns`: | : cpu time statistics 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_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_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_set_active`

    libvirt_network_set_active($res, $flags)

[Since version 0.4.1(-1)]

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

`@res [resource]`: | libvirt network resource
`@flags [int]`: | active
`Returns`: | : TRUE if success, 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_get_uuid_string`

    libvirt_network_get_uuid_string($res)

[Since version 0.5.3]

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

`@res [resource]`: | libvirt network resource
`Returns`: | : network UUID string or FALSE on failure

### `libvirt_network_get_uuid`

    libvirt_network_get_uuid($res)

[Since version 0.5.3]

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

`@res [resource]`: | libvirt network resource
`Returns`: | : network UUID in binary format or FALSE on failure

### `libvirt_network_get_name`

    libvirt_network_get_name($res)

[Since version 0.5.3]

Function is used to get network's name.

`@res [resource]`: | libvirt network resource
`Returns`: | : network name string or FALSE on failure

### `libvirt_network_get_autostart`

    libvirt_network_get_autostart($res)

[Since version 0.5.4]

Function is getting the autostart value for the network.

`@res [resource]`: | libvirt network resource
`Returns`: | : autostart value or -1 on error

### `libvirt_network_set_autostart`

    libvirt_network_set_autostart($res, $flags)

[Since version 0.5.4]

Function is setting the autostart value for the network.

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

### `libvirt_list_all_networks`

    libvirt_list_all_networks($res, $flags)

[Since version 0.5.3]

Function is used to list networks on the connection.

`@res [resource]`: | libvirt connection resource
`@flags [int]`: | optional flags to filter the results for a smaller list of targeted networks (bitwise-OR VIR_CONNECT_LIST_NETWORKS_* constants)
`Returns`: | : libvirt network resources 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_network_get_dhcp_leases`

    libvirt_network_get_dhcp_leases($res, $mac, $flags)

[Since version (null)]

Function is fetching leases info of guests in the specified network.

`@res [resource]`: | libvirt network resource
`@mac [string]`: | Optional ASCII formatted MAC address of an interface
`@flags [int]`: | Extra flags, not used yet, so callers should always pass 0
`Returns`: | : dhcp leases info array on success, FALSE on error

### `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_node_get_free_memory`

    libvirt_node_get_free_memory($conn)

[Since version 0.5.3]

Function is used to get free memory available on the node..

`@conn [resource]`: | resource for connection.
`Returns`: | : The available free memory in bytes as string or FALSE for error.

### `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_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_nwfilter_define_xml`

    libvirt_nwfilter_define_xml($res, $xml)

[Since version 0.5.4]

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

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

### `libvirt_nwfilter_undefine`

    libvirt_nwfilter_undefine($res)

[Since version 0.5.4]

Function is used to undefine already defined nwfilter.

`@res [resource]`: | libvirt nwfilter resource
`Returns`: | : TRUE for success, FALSE on error

### `libvirt_nwfilter_get_xml_desc`

    libvirt_nwfilter_get_xml_desc($res, $xpath)

[Since version 0.5.4]

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

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

### `libvirt_nwfilter_get_uuid_string`

    libvirt_nwfilter_get_uuid_string($res)

[Since version 0.5.4]

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

`@res [resource]`: | libvirt nwfilter resource
`Returns`: | : nwfilter UUID string or FALSE on failure

### `libvirt_nwfilter_get_uuid`

    libvirt_nwfilter_get_uuid($res)

[Since version 0.5.3]

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

`@res [resource]`: | libvirt network resource
`Returns`: | : nwfilter UUID in binary format or FALSE on failure

### `libvirt_nwfilter_get_name`

    libvirt_nwfilter_get_name($res)

[Since version 0.5.4]

Function is used to get nwfilter's name.

`@res [resource]`: | libvirt nwfilter resource
`Returns`: | : nwfilter name string or FALSE on failure

### `libvirt_nwfilter_lookup_by_name`

    libvirt_nwfilter_lookup_by_name($res, $name)

[Since version 0.5.4]

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

`@res [resource]`: | libvirt connection resource
`@name [string]`: | name of the nwfilter to get the resource
`Returns`: | : libvirt nwfilter resource

### `libvirt_nwfilter_lookup_by_uuid_string`

    libvirt_nwfilter_lookup_by_uuid_string($res, $uuid)

[Since version 0.5.4]

Function is used to lookup for nwfilter identified by UUID string.

`@res [resource]`: | libvirt connection resource
`@uuid [string]`: | UUID string to look for nwfilter
`Returns`: | : libvirt nwfilter resource

### `libvirt_nwfilter_lookup_by_uuid`

    libvirt_nwfilter_lookup_by_uuid($res, $uuid)

[Since version 0.5.4]

Function is used to lookup for nwfilter 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 nwfilter resource

### `libvirt_list_all_nwfilters`

    libvirt_list_all_nwfilters($res)

[Since version 0.5.4]

Function is used to list nwfilters on the connection.

`@res [resource]`: | libvirt connection resource
`Returns`: | : libvirt nwfilter resources array for the connection

### `libvirt_list_nwfilters`

    libvirt_list_nwfilters($res)

[Since version 0.5.4]

Function is used to list nwfilters on the connection.

`@res [resource]`: | libvirt connection resource
`Returns`: | : libvirt nwfilter names array for the connection

### `libvirt_domain_has_current_snapshot`

    libvirt_domain_has_current_snapshot($res, $flags)

[Since version 0.4.1(-2)]

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

`@res [resource]`: | libvirt domain resource
`@flags [int]`: | libvirt snapshot flags
`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, $flags)

[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
`@flags [int]`: | libvirt snapshot flags
`Returns`: | : domain snapshot resource

### `libvirt_domain_snapshot_create`

    libvirt_domain_snapshot_create($res, $flags)

[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
`@flags [int]`: | libvirt snapshot flags
`Returns`: | : domain snapshot resource

### `libvirt_domain_snapshot_create_xml`

    libvirt_domain_snapshot_create_xml($res, $xml, $flags)

[Since version 0.5.8]

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

`@res [resource]`: | libvirt domain resource
`@xml [string]`: | XML description of the snapshot.
`@flags [int]`: | libvirt snapshot flags
`Returns`: | : domain snapshot resource

### `libvirt_domain_snapshot_current`

    libvirt_domain_snapshot_current($res, $flags)

[Since version 0.5.6]

Function is used to lookup the current snapshot for given domain.

`@res [resource]`: | libvirt domain resource
`@flags [int]`: | libvirt snapshot flags
`Returns`: | : domain snapshot resource

### `libvirt_domain_snapshot_get_xml`

    libvirt_domain_snapshot_get_xml($res, $flags)

[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
`@flags [int]`: | libvirt snapshot flags
`Returns`: | : XML description string for the snapshot

### `libvirt_domain_snapshot_revert`

    libvirt_domain_snapshot_revert($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]`: | libvirt snapshot flags
`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, $flags)

[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
`@flags [int]`: | libvirt snapshot flags
`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_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 destroy 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_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, $flags)

[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
`@flags [int]`: | optional flags
`Returns`: | : storagevolume XML description or result of xPath expression

### `libvirt_storagevolume_create_xml`

    libvirt_storagevolume_create_xml($res, $xml, $flags)

[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
`@flags [int]`: | virStorageVolCreateXML flags
`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 original 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_storagevolume_download`

    libvirt_storagevolume_download($res, $stream, $offset, $length, $flags)

[Since version 0.5.0]

Function is used to download volume identified by it's resource.

`@res [resource]`: | libvirt storagevolume resource
`@stream [resource]`: | stream to use as output
`@offset [int]`: | position to start reading from
`@length [int]` : | limit on amount of data to download
`@flags [int]`: | optional flags for the storage volume download for virStorageVolDownload()
`Returns`: | : int

### `libvirt_storagevolume_upload`

    libvirt_storagevolume_upload($res, $stream, $offset, $length, $flags)

[Since version 0.5.0]

Function is used to upload volume identified by it's resource.

`@res [resource]`: | libvirt storagevolume resource
`@stream [resource]`: | stream to use as input
`@offset [int]`: | position to start writing to
`@length [int]` : | limit on amount of data to upload
`@flags [int]`: | optional flags for the storage volume upload for virStorageVolUpload()
`Returns`: | : int

### `libvirt_storagevolume_resize`

    libvirt_storagevolume_resize($res, $capacity, $flags)

[Since version 0.5.0]

Function is used to resize volume identified by it's resource.

`@res [resource]`: | libvirt storagevolume resource
`@capacity [int]`: | capacity for the storage volume
`@flags [int]`: | optional flags for the storage volume resize for virStorageVolResize()
`Returns`: | : int

### `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_stream_create`

    libvirt_stream_create($res)

[Since version 0.5.0]

Function is used to create new stream from libvirt conn.

`@res [resource]`: | libvirt connection resource from libvirt_connect()
`Returns`: | : resource libvirt stream resource

### `libvirt_stream_close`

    libvirt_stream_close($res)

[Since version 0.5.0]

Function is used to close stream.

`@res [resource]`: | libvirt stream resource from libvirt_stream_create()
`Returns`: | : int

### `libvirt_stream_abort`

    libvirt_stream_abort($res)

[Since version 0.5.0]

Function is used to abort transfer.

`@res [resource]`: | libvirt stream resource from libvirt_stream_create()
`Returns`: | : int

### `libvirt_stream_finish`

    libvirt_stream_finish($res)

[Since version 0.5.0]

Function is used to finish transfer.

`@res [resource]`: | libvirt stream resource from libvirt_stream_create()
`Returns`: | : int

### `libvirt_stream_recv`

    libvirt_stream_recv($res, $data, $len)

[Since version 0.5.0]

Function is used to recv from stream via libvirt conn.

`@res [resource]`: | libvirt stream resource from libvirt_stream_create()
`@data [string]`: | buffer
`@len [int]`: | amout of data to recieve
`Returns`: | : int

### `libvirt_stream_send`

    libvirt_stream_send($res, $data, $length)

[Since version 0.5.0]

Function is used to send to stream via libvirt conn.

`@res [resource]`: | libvirt stream resource from libvirt_stream_create()
`@data [string]`: | buffer
`@length [int]`: | amout of data to send
`Returns`: | : int