[Linux-cluster] resource script vm.sh strange declare directive

Lon Hohberger lhh at redhat.com
Thu Sep 9 18:06:22 UTC 2010


On Tue, 2010-08-24 at 17:57 +0200, brem belguebli wrote:
> Hi,
> 
> After not being able to live migrate cluster resource vm's from one
> node to the other using clusvcadm, I've put some debug in vm.sh and it
> allowed me to see a strange variable assignement that I do not
> understand and that prevents live migration to occur.
> 
> Rhel 5.5 /usr/share/cluster/vm.sh at line  790
> virsh_migrate()
>               declare $target=$1 <-- strange
> 
> Rhel 5.4 in /usr/share/cluster/vm.sh at line 631
> virsh_migrate()
>               declare $target=$1 <-- Same declaration
> 
> For information, when removing the $ before target, live migration
> works like a charm.

It should work either way.  That variable assignment doesn't actually
matter because of the way bash works.  The higher up function which
calls virsh_migrate function declares $target (correctly) and passes it
in as $1 to virsh_migrate.

Because $target's scope is actually global (declare does not create a
'local' variable; it creates a global one; the 'local' keyword creates a
'local' variable), the fact that there is a syntax error should not
matter in this case.

So, you'll get a weird error if you run this from the console but it
should not affect migration.

-- Lon




More information about the Linux-cluster mailing list