(php-libvirt 0.4)
libvirt_domain_migrate_to_uri — Migrate the domain object from its current host to the destination host defined by URI
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.
TRUE on success and FALSE on failure.
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");
}
?>