[systemd-devel] Fwd: systemd: wait for shutdown-service to complete

Reindl Harald h.reindl at thelounge.net
Fri Dec 16 04:41:17 PST 2011


there must be some bug in Fedora 15 systemd
"systectl start/stop vmware-default.service" works perfectly

but at shutdown systemd will not wait until it is finished
before the sysv-service "vmware-service" is terminated
what results in hard-powered-off guests and fschecks in most
guests starting the host the next time :-(

[root at rh:~]$ cat /etc/systemd/system/vmware-default.service
[Unit]
Description=VMware-Default-Machines
After=vmware.service
[Service]
Type=oneshot
ExecStart=/bin/su -c "/scripts/vmware/vm-default-start.sh" vmware
ExecStop=/scripts/vmware/vm-suspend-all.sh
RemainAfterExit=yes
TimeoutSec=600
SysVStartPriority=90
[Install]
WantedBy=multi-user.target


[root at rh:~]$ cat /scripts/vmware/vm-suspend-all.sh
#!/bin/bash
if [ -x /usr/bin/vmrun ] ; then
 for i in `pidof vmware-vmx` ; do
  VMX_PATH=`ps -p $i -f | sed -ne '/vmware/s/.* \(\/.*\.vmx\)/\1/p'`
  MY_DATE=$(/bin/date +%d-%m-%Y)
  MY_TIME=$(/bin/date +%H:%M:%S)
  echo "$MY_DATE $MY_TIME  SUSPEND: $VMX_PATH"
  /usr/bin/logger -t vmware "SUSPEND: $VMX_PATH"
  /usr/bin/vmrun suspend `ps -p $i -f | sed -ne '/vmware/s/.* \(\/.*\.vmx\)/\1/p'` 2> /dev/null
  MY_DATE=$(/bin/date +%d-%m-%Y)
  MY_TIME=$(/bin/date +%H:%M:%S)
  echo "$MY_DATE $MY_TIME  SUSPENDED: $VMX_PATH"
  /usr/bin/logger -t vmware "SUSPENDED: $VMX_PATH"
 done
fi


[root at rh:~]$ cat /scripts/vmware/vm-default-start.sh
#!/bin/bash
if [ "$HOSTNAME" == "srv-rhsoft.rhsoft.net" ]; then
 /usr/bin/vmrun -T ws start '/mnt/data/fileserver/vmware/arrakis/arrakis.vmx' nogui
 /usr/bin/vmrun -T ws start '/mnt/data/fileserver/vmware/testserver/config.vmx' nogui
 /usr/bin/vmrun -T ws start '/mnt/data/fileserver/vmware/Buildserver32/config.vmx' nogui
 /usr/bin/vmrun -T ws start '/mnt/data/fileserver/vmware/Buildserver64/config.vmx' nogui
 /usr/bin/vmrun -T ws start '/mnt/data/fileserver/vmware/centos/centos.vmx' nogui
fi
if [ "$HOSTNAME" == "rh.thelounge.net" ]; then
 /usr/bin/vmrun -T ws start '/mnt/data/fileserver/vmware/backup-flow/config.vmx' nogui
fi

-------- Original-Nachricht --------
Betreff: Re: systemd: wait for shutdown-service to complete
Datum: Thu, 15 Dec 2011 11:00:21 +0100
Von: Reindl Harald <h.reindl at thelounge.net>
Antwort an: Community support for Fedora users <users at lists.fedoraproject.org>
Organisation: the lounge interactive design
An: users at lists.fedoraproject.org

Am 15.12.2011 08:49, schrieb T.C. Hollingsworth:
> On Wed, Dec 14, 2011 at 6:48 PM, Reindl Harald <h.reindl at thelounge.net> wrote:
>> it seems that this even does not work with the timeout 100%
>>
>> normally i would expect that this service is stopped before
>> "vmware.service" which is a sysvinit, but after some tests
>> i had still VMs which started the next time with fscheck
>> while doing this manually and after that reboot there is no
>> problem
>>
>> seems like there is some paralleizm at shutdown which is
>> very very bad - stopping "vmware.service" kills all running
>> machines since the included suspend worked only with <= F14
> 
> Services are supposed to be shutdown in the reverse order of their
> Before/After dependencies

that was my idea for this "fake-service"

> so this sounds like a bug in SysV compat to me.  

sounds reasonable


> At any rate, you should be able to work around this by setting in
> [Service] "SysVStartPriority=90" (or any value higher than vmware's
> start priority)

thanks, i will give it a try and feedback ASAP
currently RAID-check is running :-)




-- 

Mit besten Grüßen, Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / software-development / cms-solutions
p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40
icq: 154546673, http://www.thelounge.net/

http://www.thelounge.net/signature.asc.what.htm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20111216/9f7d8f2b/attachment.pgp>


More information about the systemd-devel mailing list