From 5f41686bc6a09307e346bbbf980ab45df7ac9ced Mon Sep 17 00:00:00 2001 From: Guo Ruijing Date: Tue, 7 Nov 2017 15:23:39 -0800 Subject: add cleanup for container4nfv 1. move interface cleanup to cleanup.sh 2. can destroy vms after jenkins abort Change-Id: I627070ace6fa5cded507964091c40784ce4a19f9 Signed-off-by: Guo Ruijing --- ci/cleanup.sh | 23 +++++++++++++++++++++++ ci/deploy.sh | 1 + src/vagrant/kubeadm_basic/Vagrantfile | 1 - src/vagrant/kubeadm_multus/Vagrantfile | 1 - src/vagrant/kubeadm_ovsdpdk/Vagrantfile | 1 - src/vagrant/kubeadm_virtlet/Vagrantfile | 1 - 6 files changed, 24 insertions(+), 4 deletions(-) create mode 100755 ci/cleanup.sh diff --git a/ci/cleanup.sh b/ci/cleanup.sh new file mode 100755 index 0000000..ee5c428 --- /dev/null +++ b/ci/cleanup.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -x + +VBoxManage list vms | cut -f2 -d'"' | xargs -I {} VBoxManage unregistervm {} --delete +VBoxManage list vms | cut -f2 -d'"' | xargs -I {} VBoxManage controlvm {} poweroff +VBoxManage list hostonlyifs | grep "^Name:.*vboxnet" |\ + sed "s/^Name:.*vboxnet/vboxnet/" | xargs -I {} VBoxManage hostonlyif remove {} diff --git a/ci/deploy.sh b/ci/deploy.sh index 0384948..2b335e4 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -17,6 +17,7 @@ set -ex +./cleanup.sh ../src/vagrant/kubeadm_ovsdpdk/deploy.sh ../src/vagrant/kubeadm_multus/deploy.sh ../src/vagrant/kubeadm_virtlet/deploy.sh diff --git a/src/vagrant/kubeadm_basic/Vagrantfile b/src/vagrant/kubeadm_basic/Vagrantfile index 3b20f3a..7325ac0 100644 --- a/src/vagrant/kubeadm_basic/Vagrantfile +++ b/src/vagrant/kubeadm_basic/Vagrantfile @@ -14,7 +14,6 @@ Vagrant.configure("2") do |config| vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] - vb.destroy_unused_network_interfaces = true end config.vm.define "master" do |config| diff --git a/src/vagrant/kubeadm_multus/Vagrantfile b/src/vagrant/kubeadm_multus/Vagrantfile index acc1852..998edb2 100644 --- a/src/vagrant/kubeadm_multus/Vagrantfile +++ b/src/vagrant/kubeadm_multus/Vagrantfile @@ -10,7 +10,6 @@ Vagrant.configure("2") do |config| vb.customize ["modifyvm", :id, "--cpus", 4] vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] - vb.destroy_unused_network_interfaces = true end config.vm.provision "shell", path: "host_setup.sh", privileged: false diff --git a/src/vagrant/kubeadm_ovsdpdk/Vagrantfile b/src/vagrant/kubeadm_ovsdpdk/Vagrantfile index 3dba56b..dfce7f3 100644 --- a/src/vagrant/kubeadm_ovsdpdk/Vagrantfile +++ b/src/vagrant/kubeadm_ovsdpdk/Vagrantfile @@ -13,7 +13,6 @@ Vagrant.configure("2") do |config| vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] - vb.destroy_unused_network_interfaces = true end config.vm.define "master" do |config| diff --git a/src/vagrant/kubeadm_virtlet/Vagrantfile b/src/vagrant/kubeadm_virtlet/Vagrantfile index acc1852..998edb2 100644 --- a/src/vagrant/kubeadm_virtlet/Vagrantfile +++ b/src/vagrant/kubeadm_virtlet/Vagrantfile @@ -10,7 +10,6 @@ Vagrant.configure("2") do |config| vb.customize ["modifyvm", :id, "--cpus", 4] vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] - vb.destroy_unused_network_interfaces = true end config.vm.provision "shell", path: "host_setup.sh", privileged: false -- cgit 1.2.3-korg