From 0632591996893fe136a1f2fe44d9b9f404f41f3e Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Thu, 1 Nov 2018 13:30:58 +0100 Subject: Initial commit --- .../etc/systemd/system/cluster-muromachi.target | 6 +++++ localfs/etc/systemd/system/freshclam.service | 15 +++++++++++ localfs/etc/systemd/system/kvm-arch.service | 12 +++++++++ localfs/etc/systemd/system/kvm-clustervm@.service | 31 ++++++++++++++++++++++ localfs/etc/systemd/system/kvm-debian.service | 12 +++++++++ localfs/etc/systemd/system/kvm-firewall.service | 21 +++++++++++++++ localfs/etc/systemd/system/kvm-guestmount.service | 13 +++++++++ localfs/etc/systemd/system/kvm-infravm@.service | 23 ++++++++++++++++ localfs/etc/systemd/system/kvm-jango105.service | 12 +++++++++ localfs/etc/systemd/system/kvm-opensuse.service | 12 +++++++++ 10 files changed, 157 insertions(+) create mode 100644 localfs/etc/systemd/system/cluster-muromachi.target create mode 100644 localfs/etc/systemd/system/freshclam.service create mode 100644 localfs/etc/systemd/system/kvm-arch.service create mode 100644 localfs/etc/systemd/system/kvm-clustervm@.service create mode 100644 localfs/etc/systemd/system/kvm-debian.service create mode 100644 localfs/etc/systemd/system/kvm-firewall.service create mode 100644 localfs/etc/systemd/system/kvm-guestmount.service create mode 100644 localfs/etc/systemd/system/kvm-infravm@.service create mode 100644 localfs/etc/systemd/system/kvm-jango105.service create mode 100644 localfs/etc/systemd/system/kvm-opensuse.service (limited to 'localfs/etc/systemd/system') diff --git a/localfs/etc/systemd/system/cluster-muromachi.target b/localfs/etc/systemd/system/cluster-muromachi.target new file mode 100644 index 0000000..ec63edc --- /dev/null +++ b/localfs/etc/systemd/system/cluster-muromachi.target @@ -0,0 +1,6 @@ +[Unit] +Description=Cluster "muromachi_cl" +BindsTo=kvm-clustervm@centoscl0.service kvm-clustervm@centoscl1.service kvm-clustervm@centoscl2.service + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/freshclam.service b/localfs/etc/systemd/system/freshclam.service new file mode 100644 index 0000000..a14de83 --- /dev/null +++ b/localfs/etc/systemd/system/freshclam.service @@ -0,0 +1,15 @@ +[Unit] +Description=ClamAV database updater (freshclam) +Wants=network.target +Requires=network.target +After=network.target + +[Service] +Type=forking +ExecStart=/usr/local/sbin/freshclamd start +ExecStop=/usr/local/sbin/freshclamd stop +TimeoutStartSec=10s +TimeoutStopSec=30s + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/kvm-arch.service b/localfs/etc/systemd/system/kvm-arch.service new file mode 100644 index 0000000..597548f --- /dev/null +++ b/localfs/etc/systemd/system/kvm-arch.service @@ -0,0 +1,12 @@ +[Unit] +Description=virtual machine triskel05 (Arch) +Requires=libvirtd.service libvirt-guests.service lvm2-lvmetad.service + +[Service] +Type=oneshot +ExecStart=/bin/virsh start arch +ExecStop=/bin/virsh shutdown arch +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/kvm-clustervm@.service b/localfs/etc/systemd/system/kvm-clustervm@.service new file mode 100644 index 0000000..f21cbcd --- /dev/null +++ b/localfs/etc/systemd/system/kvm-clustervm@.service @@ -0,0 +1,31 @@ +# 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=VM %i (with cluster inside) +Wants=kvm-infravm@iscsi.service +After=kvm-infravm@iscsi.service +Wants=lvm2-monitor.service +Requires=libvirtd.service +Requires=kvm-firewall.service +Requires=kvm-network@sosaria05.service +Requires=kvm-network@san-cluster.service +After=kvm-firewall.service +After=libvirtd.service +After=lvm2-monitor.service +After=kvm-network@sosaria05.service +After=kvm-network@san-cluster.service +PartOf=cluster-muromachi.target + +[Service] +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=60s + +[Install] +WantedBy=cluster-muromachi.target diff --git a/localfs/etc/systemd/system/kvm-debian.service b/localfs/etc/systemd/system/kvm-debian.service new file mode 100644 index 0000000..1347a0b --- /dev/null +++ b/localfs/etc/systemd/system/kvm-debian.service @@ -0,0 +1,12 @@ +[Unit] +Description=virtual machine balinorgel05 (Debian stable) +Requires=libvirtd.service libvirt-guests.service lvm2-lvmetad.service + +[Service] +Type=oneshot +ExecStart=/bin/virsh start debian +ExecStop=/bin/virsh shutdown debian +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/kvm-firewall.service b/localfs/etc/systemd/system/kvm-firewall.service new file mode 100644 index 0000000..b68ede5 --- /dev/null +++ b/localfs/etc/systemd/system/kvm-firewall.service @@ -0,0 +1,21 @@ +[Unit] +Description=virtual machine cthulhu05 (Debian Firewall) +Wants=lvm2-monitor.service +Requires=libvirtd.service +Requires=kvm-network@sosaria05.service +Requires=kvm-network@san-cluster.service +After=libvirtd.service +After=lvm2-monitor.service +After=kvm-network@sosaria05.service +After=kvm-network@san-cluster.service + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/kvmhelper -q vm-start firewall +ExecStop=/usr/local/bin/kvmhelper -q vm-stop firewall +RemainAfterExit=yes +TimeoutStartSec=10s +TimeoutStopSec=60s + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/kvm-guestmount.service b/localfs/etc/systemd/system/kvm-guestmount.service new file mode 100644 index 0000000..fab979f --- /dev/null +++ b/localfs/etc/systemd/system/kvm-guestmount.service @@ -0,0 +1,13 @@ +[Unit] +Description=Mount KVM domains' boot partitions for direct boots +Requires=libvirtd.service lvm2-lvmetad.service + +[Service] +Type=oneshot +RemainAfterExit=yes +# Test phase, only using arch. Will do a script later on when the amount is > 1 +ExecStart=/usr/bin/guestmount -r -o allow_other -o ro -m /dev/sda2:/:acl,user_xattr -a /dev/libvirt/arch-boot /var/lib/libvirt/boot/arch +ExecStop=/usr/bin/guestunmount /var/lib/libvirt/boot/arch + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/kvm-infravm@.service b/localfs/etc/systemd/system/kvm-infravm@.service new file mode 100644 index 0000000..29f8321 --- /dev/null +++ b/localfs/etc/systemd/system/kvm-infravm@.service @@ -0,0 +1,23 @@ +[Unit] +Description=Infrastructural VM %i +Wants=lvm2-monitor.service +Requires=libvirtd.service +Requires=kvm-firewall.service +Requires=kvm-network@sosaria05.service +Requires=kvm-network@san-cluster.service +After=kvm-firewall.service +After=libvirtd.service +After=lvm2-monitor.service +After=kvm-network@sosaria05.service +After=kvm-network@san-cluster.service + +[Service] +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=60s + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/kvm-jango105.service b/localfs/etc/systemd/system/kvm-jango105.service new file mode 100644 index 0000000..416c1af --- /dev/null +++ b/localfs/etc/systemd/system/kvm-jango105.service @@ -0,0 +1,12 @@ +[Unit] +Description=virtual machine jango105 (Windows 10) +Requires=libvirtd.service libvirt-guests.service lvm2-lvmetad.service + +[Service] +Type=oneshot +ExecStart=/bin/virsh start jango105 +ExecStop=/bin/virsh shutdown jango105 +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/localfs/etc/systemd/system/kvm-opensuse.service b/localfs/etc/systemd/system/kvm-opensuse.service new file mode 100644 index 0000000..217dbbe --- /dev/null +++ b/localfs/etc/systemd/system/kvm-opensuse.service @@ -0,0 +1,12 @@ +[Unit] +Description=virtual machine loukaniko05 (OpenSUSE Leap) +Requires=libvirtd.service libvirt-guests.service lvm2-lvmetad.service + +[Service] +Type=oneshot +ExecStart=/bin/virsh start opensuse +ExecStop=/bin/virsh shutdown opensuse +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3