summaryrefslogtreecommitdiffstats
path: root/xci/scripts/vm
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2017-10-10 08:45:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-10-10 08:45:03 +0000
commitfdd43517bdedbab52fcaa523f4cafe0aeac91d84 (patch)
tree1e0fbbe7f8a77f0b5715d05e7f1622e18cea0e81 /xci/scripts/vm
parent2c7f7d08e42a26f046fd8d745ccbf7caefd56547 (diff)
parent19f594e3a1427536555149efb0c8922518468dc1 (diff)
Merge "xci: scripts: start-new-vm.sh: Do not run multiple package manager processes"
Diffstat (limited to 'xci/scripts/vm')
-rwxr-xr-xxci/scripts/vm/start-new-vm.sh36
1 files changed, 29 insertions, 7 deletions
diff --git a/xci/scripts/vm/start-new-vm.sh b/xci/scripts/vm/start-new-vm.sh
index 96ce17e1..9b5cdd8e 100755
--- a/xci/scripts/vm/start-new-vm.sh
+++ b/xci/scripts/vm/start-new-vm.sh
@@ -45,6 +45,22 @@ usage() {
"""
}
+wait_for_pkg_mgr() {
+ local pkg_mgr=$1
+ local _retries=30
+ while [[ $_retries -gt 0 ]]; do
+ if pgrep -a $pkg_mgr &> /dev/null; then
+ echo "There is another $pkg_mgr process running... ($_retries retries left)"
+ sleep 30
+ (( _retries = _retries - 1 ))
+ else
+ return 0
+ fi
+ done
+ echo "$pkg_mgr still running... Maybe stuck?"
+ exit 1
+}
+
update_clean_vm_files() {
local opnfv_url="http://artifacts.opnfv.org/releng/xci/images"
local vm_cache=${XCI_CACHE_DIR}/clean_vm/images
@@ -112,13 +128,19 @@ if ! sudo -n "true"; then
exit 1
fi
case ${ID,,} in
- *suse) sudo zypper -q -n in virt-manager qemu-kvm qemu-tools libvirt-daemon docker libvirt-client libvirt-daemon-driver-qemu iptables ebtables dnsmasq
- ;;
- centos) sudo yum install -q -y epel-release
- sudo yum install -q -y in virt-manager qemu-kvm qemu-kvm-tools qemu-img libvirt-daemon-kvm docker iptables ebtables dnsmasq
- ;;
- ubuntu) sudo apt-get install -y -q=3 virt-manager qemu-kvm libvirt-bin qemu-utils docker.io docker iptables ebtables dnsmasq
- ;;
+ *suse)
+ wait_for_pkg_mgr zypper
+ sudo zypper -q -n in virt-manager qemu-kvm qemu-tools libvirt-daemon docker libvirt-client libvirt-daemon-driver-qemu iptables ebtables dnsmasq
+ ;;
+ centos)
+ wait_for_pkg_mgr yum
+ sudo yum install -q -y epel-release
+ sudo yum install -q -y in virt-manager qemu-kvm qemu-kvm-tools qemu-img libvirt-daemon-kvm docker iptables ebtables dnsmasq
+ ;;
+ ubuntu)
+ wait_for_pkg_mgr apt-get
+ sudo apt-get install -y -q=3 virt-manager qemu-kvm libvirt-bin qemu-utils docker.io docker iptables ebtables dnsmasq
+ ;;
esac
echo "Ensuring libvirt and docker services are running..."