diff options
author | Brenton Leanhardt <bleanhar@redhat.com> | 2008-07-17 13:48:40 -0400 |
---|---|---|
committer | Brenton Leanhardt <bleanhar@redhat.com> | 2008-07-17 17:57:53 -0400 |
commit | 142478c941841b34b20448e1e9bccd193aea1d45 (patch) | |
tree | fc519939e05ab2669bf1213e2f4dd876c86dff5a | |
parent | 7eba082b3e877d2cfd9e9085c83d51961ec5d518 (diff) | |
download | tools-142478c941841b34b20448e1e9bccd193aea1d45.tar.gz tools-142478c941841b34b20448e1e9bccd193aea1d45.tar.xz tools-142478c941841b34b20448e1e9bccd193aea1d45.zip |
The autostarter now supports kvm
-rw-r--r-- | genome-autostarter/Makefile | 9 | ||||
-rw-r--r-- | genome-autostarter/genome-autostarter | 3 | ||||
-rw-r--r-- | genome-autostarter/genome-autostarter.sh | 12 | ||||
-rw-r--r-- | genome-autostarter/genome-autostarter.spec | 15 | ||||
-rw-r--r-- | genome-autostarter/repo/genome-autostarter | 2 |
5 files changed, 26 insertions, 15 deletions
diff --git a/genome-autostarter/Makefile b/genome-autostarter/Makefile index 9b335f5..75b5795 100644 --- a/genome-autostarter/Makefile +++ b/genome-autostarter/Makefile @@ -10,7 +10,6 @@ CVS = cvs RPMBUILD = rpmbuild INSTALL = /usr/bin/install INSTALL_DIR = $(INSTALL) --verbose -d -m 755 -ARCHIVE = $(NAME)-bin.tar.gz RPM_TOPDIR = /tmp/$(NAME)-$(VERSION)-$(RELEASE)-build _RPM_OPTS = --define "_topdir $(RPM_TOPDIR)" \ @@ -22,15 +21,11 @@ _RPM_OPTS = --define "_topdir $(RPM_TOPDIR)" \ --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' RPM_OPTS = $(strip $(_RPM_OPTS)) -rpm: clean $(RPM_TOPDIR) $(SPECFILE) $(ARCHIVE) +rpm: clean $(RPM_TOPDIR) $(SPECFILE) $(RPMBUILD) --clean $(RPM_OPTS) -bs $(SPECFILE) - rm -f $(ARCHIVE) clean: - @rm -rfv *~ *.rpm $(RPM_TOPDIR) $(ARCHIVE) - -$(ARCHIVE): - cd repo; tar cvzf ../$(ARCHIVE) ./*; cd .. + @rm -rfv *~ *.rpm $(RPM_TOPDIR) $(RPM_TOPDIR): @$(INSTALL_DIR) $@ diff --git a/genome-autostarter/genome-autostarter b/genome-autostarter/genome-autostarter new file mode 100644 index 0000000..e69d3b6 --- /dev/null +++ b/genome-autostarter/genome-autostarter @@ -0,0 +1,3 @@ +# Runs every minute and makes sure all the auto started vms are running +export PATH=$PATH:/usr/bin:/bin +* * * * * root /usr/sbin/genome-autostarter.sh diff --git a/genome-autostarter/genome-autostarter.sh b/genome-autostarter/genome-autostarter.sh new file mode 100644 index 0000000..1555d05 --- /dev/null +++ b/genome-autostarter/genome-autostarter.sh @@ -0,0 +1,12 @@ +#!/bin/bash +uname -a | grep -i xen +if [ $? == 0 ]; then + # We're using Xen + find /etc/xen/auto -name "*" -type l | xargs -n1 basename 2> /dev/null | xargs -n1 virsh start &> /dev/null +else + # We're using kvm + for vm_xml in `find /etc/libvirt/qemu/autostart -name "*" -type l`; do + vm=`basename $vm_xml .xml` # Chop of the extension + virsh start $vm &> /dev/null + done +fi diff --git a/genome-autostarter/genome-autostarter.spec b/genome-autostarter/genome-autostarter.spec index adff002..82c4cfc 100644 --- a/genome-autostarter/genome-autostarter.spec +++ b/genome-autostarter/genome-autostarter.spec @@ -1,12 +1,13 @@ Summary: Genome virtual machine autostarter Name: genome-autostarter -Source: genome-autostarter-bin.tar.gz +Source0: genome-autostarter +Source1: genome-autostarter.sh Version: 1.0.0 -Release: 1%{?dist} +Release: 6%{?dist} BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Group: Applications/System -URL: https://fedorahosting.org/genome +URL: http://genome.et.redhat.com License: GPLv2 %description @@ -14,7 +15,7 @@ Genome virtual machine autostarter %prep -%setup -c +%setup -c -T %build @@ -23,9 +24,10 @@ Genome virtual machine autostarter rm -rf $RPM_BUILD_ROOT # Create the directory structure required to lay down our files -mkdir -p $RPM_BUILD_ROOT/etc/cron.d +mkdir -p $RPM_BUILD_ROOT/etc/cron.d $RPM_BUILD_ROOT/usr/sbin -cp -R . $RPM_BUILD_ROOT/etc/cron.d +install -pm 644 %{SOURCE0} $RPM_BUILD_ROOT/etc/cron.d +install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT/usr/sbin %clean rm -rf $RPM_BUILD_ROOT @@ -33,5 +35,6 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) /etc/cron.d/genome-autostarter +/usr/sbin/genome-autostarter.sh %doc diff --git a/genome-autostarter/repo/genome-autostarter b/genome-autostarter/repo/genome-autostarter deleted file mode 100644 index e5147ce..0000000 --- a/genome-autostarter/repo/genome-autostarter +++ /dev/null @@ -1,2 +0,0 @@ -# Runs every minute and makes sure all the auto started vms are running -* * * * * root find /etc/xen/auto -name "*" -type l | xargs -n1 basename 2> /dev/null | xargs -n1 virsh start &> /dev/null |