Libvirt Functions
PHP Manual

libvirt_domain_migrate_to_uri

(php-libvirt 0.4)

libvirt_domain_migrate_to_uriMigrate the domain object from its current host to the destination host defined by URI

Description

bool libvirt_domain_migrate_to_uri ( resource $domain , string $duri , int $flags , string $dname , string $uri , integer $bandwith )

Performs migration of the domain from one host to another. For description of parameters and flags see » original documentation.

Please note that the function returns after the migration is complete. It may take a lot of time to migrate a host. Be sure to configure PHP maximum execution time.

Return Values

TRUE on success and FALSE on failure.

Examples

Example #1 libvirt_domain_migrate_to_uri() example

Live migrate domain (f13_exper) to another node

<?php
    
echo ("Looking up f13_exper domain\n");
    
$dom=@libvirt_domain_lookup_by_name($conn,"f13_exper");
    if (
$dom==false)
    {
       echo (
"Domain not found\n");
       echo (
"Libvirt last error: ".libvirt_get_last_error()."\n");
       exit;
    }
    echo (
"Domain found\n");

    echo (
"Migrating domain to $duri\n");
    
$rv=libvirt_domain_migrate_to_uri($dom,$duri,VIR_MIGRATE_LIVE VIR_MIGRATE_PEER2PEER VIR_MIGRATE_PERSIST_DEST VIR_MIGRATE_UNDEFINE_SOURCE);
    if (
$rv==false)
    {
       echo (
"Failure!");
       echo (
"Libvirt last error: ".libvirt_get_last_error()."\n");
    }
    else
    {
       echo (
"Success\n");
    }

?>

See Also


Libvirt Functions
PHP Manual