Re: VM migration upon shutdown in centos 7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Please keed the list CCed]

On 01/10/2018 04:43 PM, Raman Gupta wrote:
>> Does this command alone succeed?
> Yes. I have used this command to migrate VMs successfully, without even
> knowing that spelling has changed.
> 
> 
>> I don't know enough about systemd but maybe it's not waiting for virsh to
> finish?
> Yes I also think virsh or libvirtd or related service does not wait
> before /root/vm_migrate.sh
> is called and hence live migration fails.
> If I replace Live Migration with a simple ping to peer node in the
> vPreShutdownHook.service,  then ping goes thru successfully thus indicating
> network service was UP at that time.
> 
>> Can you try to get any logs to see what is going on actually?
> Jan  8 15:30:58 desktop4 systemd: Stopping Session c1 of user gdm.
> Jan  8 15:30:58 desktop4 gdm: Freeing conversation 'gdm-launch-environment'
> with active job
> Jan  8 15:30:58 desktop4 systemd: Stopped target Sound Card.
> Jan  8 15:30:58 desktop4 systemd: Stopping Sound Card.
> Jan  8 15:30:58 desktop4 systemd: Stopping LVM2 PV scan on device 8:3...
> Jan  8 15:30:58 desktop4 systemd: Removed slice system-getty.slice.
> Jan  8 15:30:58 desktop4 systemd: Stopping system-getty.slice.
> Jan  8 15:30:58 desktop4 systemd: Stopping Authorization Manager...
> Jan  8 15:30:58 desktop4 systemd: Stopping Virtual Machine and Container
> Registration Service...
> Jan  8 15:30:58 desktop4 systemd: Stopping GlusterFS brick processes
> (stopping only)...
> Jan  8 15:30:58 desktop4 systemd: Removed slice
> system-selinux\x2dpolicy\x2dmigrate\x2dlocal\x2dchanges.slice.
> Jan  8 15:30:58 desktop4 systemd: Stopping
> system-selinux\x2dpolicy\x2dmigrate\x2dlocal\x2dchanges.slice.
> Jan  8 15:30:58 desktop4 systemd: Stopping Availability of block devices...
> Jan  8 15:30:58 desktop4 systemd: Stopping Virtual Machine
> qemu-1-GsmController.
> Jan  8 15:30:58 desktop4 alsactl[837]: alsactl daemon stopped
> Jan  8 15:30:58 desktop4 systemd: Stopping Session 1 of user root.
> Jan  8 15:30:58 desktop4 systemd: Stopping Manage Sound Card State (restore
> and store)...

I don't see your service being called. Anyway, look at
libvirt-guests.service file. Looks like the following lines cause
systemd to wait for a command to finish:

[Service]
EnvironmentFile=-/etc/sysconfig/libvirt-guests
# Hack just call traditional service until we factor
# out the code
ExecStart=@libexecdir@/libvirt-guests.sh start
ExecStop=@libexecdir@/libvirt-guests.sh stop
Type=oneshot
RemainAfterExit=yes
StandardOutput=journal+console
TimeoutStopSec=0

> 
> 
> 
> On Wed, Jan 10, 2018 at 8:46 PM, Michal Privoznik <mprivozn@xxxxxxxxxx>
> wrote:
> 
>> On 01/05/2018 12:00 PM, Raman Gupta wrote:
>>> 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
>>
>> Does this command alone succeed?
>> BTW: unless really needed --live will only make the migration take longer.
>>
>> I don't know enough about systemd but maybe it's not waiting for virsh
>> to finish? Can you try to get any logs to see what is going on actually?
>>
>> Michal
>>
> 

Michal

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users



[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux