Hi,

I have CentOS 7,  two node system which allows live VM migration between them. Live migration triggered from virsh is happily happening. I am using GlusterFS for replicating VM disk files.

Now I want to automatically do the live migration at the time of reboot/shutdown/halt of the host node and for this I have written a systemd service unit [vPreShutdownHook.service] and placed the live migration command in a migrate script which is invoked from this service unit. The migrate script is invoked but migration does not happen. 
If someone has some idea please help me to migrate VM upon shutdown.


######## vPreShutdownHook.service ###############

[Unit]
Description=vPreShutdownHook
Requires=network.target
Requires=libvirtd.service
Requires=dbus.service
Requires=glusterd.service
Requires=glusterfsd.service
DefaultDependencies=no
Before=shutdown.target reboot.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/root/vm_migrate.sh

[Install]
WantedBy=multi-user.target


########## Command to migrate ############
/usr/bin/virsh migrate --verbose --p2p --tunneled --live  --compressed --comp-methods "mt"  --comp-mt-level 5 --comp-mt-threads 5 --comp-mt-dthreads 5   MY_VM qemu+ssh://root@$node2/system


Thanks,