Hi Claudio
Here is my PHP code
<?php
echo ("Looking up test domain\n");
$con = new Libvirt('qemu+tcp://192.168.168.11/system');
$duri = 'qemu+tcp://192.168.168.14/system';
$dom = $con->get_domain_by_name("ldap");
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_PEER2PEER |
VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE | VIR_MIGRATE_PERSI
ST_DEST | VIR_MIGRATE_UNDEFINE_SOURCE);
if ($rv==false)
{
echo ("Failure!");
echo ("Libvirt last error: ".libvirt_get_last_error()."\n");
}
else
{
echo ("Success\n");
}
Here is the error message when I tried to migrate (powered off) domain
----------------------------------------------------------------------
*Looking up test domain*
*Domain found*
*Migrating domain to qemu+tcp://192.168.168.14/system*
*Failure!Libvirt last error: Requested operation is not valid: domain is
not running*
And here is the error message when I tried (powered on) domain
--------------------------------------------------------------
*Looking up test domain*
*Domain found*
*Migrating domain to qemu+tcp://192.168.168.14/system*
*Failure!Libvirt last error: Unsafe migration: Migration may lead to data
corruption if disks use cache != none*
Here is the php_error_logs
--------------------------
*[17-Oct-2013 05:17:42 America/New_York] PHP Notice: Use of undefined
constant VIR_MIGRATE_UNSAFE - assumed 'VIR_MIGRATE_UNSAFE' in
/home/www/virtspace/inc/mig.php on line 21*
*[17-Oct-2013 05:17:42 America/New_York] PHP Notice: Use of undefined
constant VIR_MIGRATE_OFFLINE - assumed 'VIR_MIGRATE_OFFLINE' in
/home/www/virtspace/inc/mig.php on line 21*
According to above php_notices, both VIR_OFFLINE AND VIR_UNSAFE options are
not available.
*My libvirt version on kvm hosts is (1000002), and php-libvirt version is
(0.4.8)*
Br.
Umar
On Thu, Oct 17, 2013 at 11:14 AM, Claudio Bley <cbley(a)av-test.de> wrote:
[Please, don't top post on technical lists.]
At Thu, 17 Oct 2013 08:40:52 +0500,
Umar Draz wrote:
>
> HI,
>
> I am using KVM
Could you tell us a bit more about your setup and show your code?
Which version of libvirt are you using?
My guess would be that you don't have shared storage and are using
the VIR_MIGRATE_NON_SHARED_DISK flag when migrating, which only works
if the domain is running.
In that case, you could start your domain in the 'paused' state,
migrate and then destroy it.
> On Tue, Oct 15, 2013 at 4:11 PM, Daniel P. Berrange <berrange(a)redhat.com
>wrote:
>
> > On Sun, Oct 13, 2013 at 03:20:31PM +0500, Umar Draz wrote:
> > > Hi All
> > >
> > > I am trying to migrate offline domain on other URI but its not
working
> > >
> > > due to this error
> > >
> > > Failure!Libvirt last error: Requested operation is not valid: domain
is
> > not
> > > running
> > >
> > > I tried to use this option but not working
> > >
> > > VIR_MIGRATE_OFFLINE
> > >
> > > Please anybody help me?
> >
> > You don't mention what hypervisor you're using. IIRC only the QEMU
driver
> > supports the VIR_MIGRATE_OFFLINE flag.
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
--
Umar Draz
Network Architect