Libvirt Functions
PHP Manual

libvirt_storagevolume_create_xml

(php-libvirt 0.4)

libvirt_storagevolume_create_xmlCreate a new storage volume based on XML input

Description

array libvirt_storagevolume_create_xml ( resource $storagepool resource , string $xml )

This function returns string containing volume information in XML format

Parameters

storagepool resource

Connection resource of the storagepool

xml

XML information to base the new volume on

Return Values

Volume resource of the newly created volume. FALSE on failure

Examples

Example #1 libvirt_storagevolume_create_xmlc() example

Create a new volume in a storagepool

<?php

    $conn
=libvirt_connect($uri,true);
    
$pool=libvirt_storagepools_lookup_by_name($conn,'default');

    
$xml "<volume>
            <name>volume2</name>
              <key>b10fa7e2-5e48-4c97-a7a0-42ca197d400c</key>
              <capacity unit='M'>100</capacity>
        </volume>"
;

    
$volumeNew=libvirt_storagevolume_create_xml($pool,$xml);

    
var_dump($volumeNew);
?>

The above example will output something similar to:

resource(3) of type (Libvirt volume)

See Also


Libvirt Functions
PHP Manual