add cleanup for container4nfv 39/46839/1
authorGuo Ruijing <ruijing.guo@intel.com>
Tue, 7 Nov 2017 23:23:39 +0000 (15:23 -0800)
committerGuo Ruijing <ruijing.guo@intel.com>
Tue, 7 Nov 2017 23:30:06 +0000 (15:30 -0800)
1. move interface cleanup to cleanup.sh
2. can destroy vms after jenkins abort

Change-Id: I627070ace6fa5cded507964091c40784ce4a19f9
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
ci/cleanup.sh [new file with mode: 0755]
ci/deploy.sh
src/vagrant/kubeadm_basic/Vagrantfile
src/vagrant/kubeadm_multus/Vagrantfile
src/vagrant/kubeadm_ovsdpdk/Vagrantfile
src/vagrant/kubeadm_virtlet/Vagrantfile

diff --git a/ci/cleanup.sh b/ci/cleanup.sh
new file mode 100755 (executable)
index 0000000..ee5c428
--- /dev/null
@@ -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 {}
index 0384948..2b335e4 100755 (executable)
@@ -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
index 3b20f3a..7325ac0 100644 (file)
@@ -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|
index acc1852..998edb2 100644 (file)
@@ -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
index 3dba56b..dfce7f3 100644 (file)
@@ -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|
index acc1852..998edb2 100644 (file)
@@ -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