<div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>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. </div><div>If someone has some idea please help me to migrate VM upon shutdown.<br></div><div><br></div><div><br></div><div>######## vPreShutdownHook.service ###############</div><div><br></div><div><div>[Unit]</div><div>Description=vPreShutdownHook</div><div>Requires=network.target</div><div>Requires=libvirtd.service</div><div>Requires=dbus.service</div><div>Requires=glusterd.service</div><div>Requires=glusterfsd.service</div><div>DefaultDependencies=no</div><div>Before=shutdown.target reboot.target</div><div><br></div><div>[Service]</div><div>Type=oneshot</div><div>RemainAfterExit=true</div><div>ExecStart=/bin/true</div><div>ExecStop=/root/vm_migrate.sh</div><div><br></div><div>[Install]</div><div>WantedBy=multi-user.target</div></div><div><br></div><div><br></div><div>########## Command to migrate ############</div><div>/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<br></div><div><br></div><div><br></div><div>Thanks,</div><div><br></div></div>