From e28143db4c0cf9d2c203445eb92b05f98ad828e4 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Mon, 9 Jul 2018 17:36:39 +0200 Subject: Initial commit of kvmhelper and improvement of systemd services --- etc/systemd/system/cluster-muromachi.target | 5 ----- etc/systemd/system/kvm-clustervm@.service | 10 ++++------ etc/systemd/system/kvm-infravm@.service | 15 ++++----------- etc/systemd/system/kvm-network@.service | 8 ++++---- 4 files changed, 12 insertions(+), 26 deletions(-) (limited to 'etc/systemd/system') diff --git a/etc/systemd/system/cluster-muromachi.target b/etc/systemd/system/cluster-muromachi.target index b8570e4..ec63edc 100644 --- a/etc/systemd/system/cluster-muromachi.target +++ b/etc/systemd/system/cluster-muromachi.target @@ -1,8 +1,3 @@ -# Work in progress: -# - Start needs to be more sophisticated in reaction to state of domains -# - Stop should not just do a post-sleep, but instead the post section should -# carry a script polling the state of the machine and hammering it into the -# coffing after a certain timeout [Unit] Description=Cluster "muromachi_cl" BindsTo=kvm-clustervm@centoscl0.service kvm-clustervm@centoscl1.service kvm-clustervm@centoscl2.service diff --git a/etc/systemd/system/kvm-clustervm@.service b/etc/systemd/system/kvm-clustervm@.service index 1d86851..f21cbcd 100644 --- a/etc/systemd/system/kvm-clustervm@.service +++ b/etc/systemd/system/kvm-clustervm@.service @@ -20,14 +20,12 @@ After=kvm-network@san-cluster.service PartOf=cluster-muromachi.target [Service] -Type=forking -ExecStartPre=/bin/sleep 5 -ExecStart=/bin/virsh start %i -ExecStop=/bin/virsh shutdown %i -ExecStopPost=/bin/sleep 15 +Type=oneshot +ExecStart=/usr/local/bin/kvmhelper -q vm-start %i +ExecStop=/usr/local/bin/kvmhelper -q vm-stop %i RemainAfterExit=yes TimeoutStartSec=10s -TimeoutStopSec=40s +TimeoutStopSec=60s [Install] WantedBy=cluster-muromachi.target diff --git a/etc/systemd/system/kvm-infravm@.service b/etc/systemd/system/kvm-infravm@.service index f284f5b..29f8321 100644 --- a/etc/systemd/system/kvm-infravm@.service +++ b/etc/systemd/system/kvm-infravm@.service @@ -1,8 +1,3 @@ -# Work in progress: -# - Start needs to be more sophisticated in reaction to state of domains -# - Stop should not just do a post-sleep, but instead the post section should -# carry a script polling the state of the machine and hammering it into the -# coffing after a certain timeout [Unit] Description=Infrastructural VM %i Wants=lvm2-monitor.service @@ -17,14 +12,12 @@ After=kvm-network@sosaria05.service After=kvm-network@san-cluster.service [Service] -Type=forking -ExecStart=/bin/virsh start %i -#ExecStartPost=/bin/sleep 5 -ExecStop=/bin/virsh shutdown %i -ExecStopPost=/bin/sleep 15 +Type=oneshot +ExecStart=/usr/local/bin/kvmhelper -q vm-start %i +ExecStop=/usr/local/bin/kvmhelper -q vm-stop %i RemainAfterExit=yes TimeoutStartSec=10s -TimeoutStopSec=40s +TimeoutStopSec=60s [Install] WantedBy=multi-user.target diff --git a/etc/systemd/system/kvm-network@.service b/etc/systemd/system/kvm-network@.service index 84862a7..aca4e4b 100644 --- a/etc/systemd/system/kvm-network@.service +++ b/etc/systemd/system/kvm-network@.service @@ -4,12 +4,12 @@ Requires=libvirtd.service After=libvirtd.service [Service] -Type=forking -ExecStart=/bin/virsh net-start %i -ExecStop=/bin/virsh net-destroy %i +Type=oneshot +ExecStart=/usr/local/bin/kvmhelper -q net-start %i +ExecStop=/usr/local/bin/kvmhelper -q net-stop %i RemainAfterExit=yes TimeoutStartSec=10s -TimeoutStopSec=40s +TimeoutStopSec=10s [Install] WantedBy=multi-user.target -- cgit v1.2.3