support vagrant/libvirt 19/47819/6
authorGuo Ruijing <ruijing.guo@intel.com>
Sun, 26 Nov 2017 20:02:37 +0000 (15:02 -0500)
committerGuo Ruijing <ruijing.guo@intel.com>
Wed, 29 Nov 2017 19:28:08 +0000 (14:28 -0500)
1. add cleanup for libvirt
2. use libvirt for deployments
3. use yk0/ubuntu-xenial box
4. update sleep time to reduce log size

Change-Id: Ie1f0acc6a496180c4d73ade5f724434400fef1f7
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
14 files changed:
ci/deploy.sh
src/vagrant/cleanup.sh [moved from ci/cleanup.sh with 65% similarity]
src/vagrant/kubeadm_basic/Vagrantfile
src/vagrant/kubeadm_basic/deploy.sh
src/vagrant/kubeadm_basic/examples/nginx-app.sh
src/vagrant/kubeadm_multus/Vagrantfile
src/vagrant/kubeadm_multus/deploy.sh
src/vagrant/kubeadm_multus/examples/multus.sh
src/vagrant/kubeadm_ovsdpdk/Vagrantfile
src/vagrant/kubeadm_ovsdpdk/deploy.sh
src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh
src/vagrant/kubeadm_virtlet/Vagrantfile
src/vagrant/kubeadm_virtlet/deploy.sh
src/vagrant/kubeadm_virtlet/examples/virtlet.sh

index 26da62e..7d71ff3 100755 (executable)
@@ -17,7 +17,6 @@
 
 set -ex
 
-./cleanup.sh
 ../src/vagrant/kubeadm_basic/deploy.sh
 ../src/vagrant/kubeadm_multus/deploy.sh
 ../src/vagrant/kubeadm_virtlet/deploy.sh
similarity index 65%
rename from ci/cleanup.sh
rename to src/vagrant/cleanup.sh
index afe4ac0..a7d129c 100755 (executable)
@@ -21,3 +21,9 @@ VBoxManage list vms | cut -f2 -d'"' | xargs -I {} VBoxManage controlvm {} powero
 VBoxManage list vms | cut -f2 -d'"' | xargs -I {} VBoxManage unregistervm {} --delete
 VBoxManage list hostonlyifs | grep "^Name:.*vboxnet" |\
     sed "s/^Name:.*vboxnet/vboxnet/" | xargs -I {} VBoxManage hostonlyif remove {}
+sudo virsh list --name | xargs -I {} sudo virsh destroy {}
+sudo virsh list --all --name | xargs -I {} sudo virsh undefine {}
+sudo virsh net-list --name | xargs -I {} sudo virsh net-destroy --network {}
+sudo virsh net-list --name | xargs -I {} sudo virsh undefine {}
+sudo brctl show | awk 'NF>1 && NR>1 {print $1}' | xargs -I {} sudo bash -c "ifconfig {} down; brctl delbr {}"
+sudo virsh vol-list default | awk 'NF>1 && NR>1 {print $1}' | xargs -I {} sudo virsh vol-delete {} default
index 063e802..abb71c4 100644 (file)
@@ -3,20 +3,15 @@ $num_workers=2
 Vagrant.require_version ">= 1.8.6"
 Vagrant.configure("2") do |config|
 
-  config.vm.box = "opnfv/container4nfv"
-  config.vm.box_version = "0"
+  config.vm.box = "yk0/ubuntu-xenial"
+  config.vm.provider :libvirt do |libvirt|
+    libvirt.memory = 4096
+    libvirt.cpus = 4
+  end
+  
   config.vm.synced_folder "../..", "/src"
   config.vm.provision "shell", path: "host_setup.sh", privileged: false
 
-  config.vm.provider :virtualbox do |vb|
-    vb.customize ["modifyvm", :id, "--memory", 4096]
-    vb.customize ["modifyvm", :id, "--cpus", 4]
-    vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
-    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"]
-  end
-
   config.vm.define "master" do |config|
     config.vm.hostname = "master"
     config.vm.provision "shell", path: "master_setup.sh", privileged: false
index 4e12e91..89c4f40 100755 (executable)
@@ -4,6 +4,6 @@ set -ex
 DIR="$(dirname `readlink -f $0`)"
 
 cd $DIR
+../cleanup.sh
 vagrant up
-vagrant ssh master -c "/vagrant/examples/nginx-app.sh" || (vagrant destroy -f; exit 1)
-vagrant destroy -f
+vagrant ssh master -c "/vagrant/examples/nginx-app.sh"
index 07b9c22..ada4306 100755 (executable)
@@ -1,4 +1,21 @@
-#!/usr/bin/env bash
+#!/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 -ex
 
 kubectl create -f /vagrant/examples/nginx-app.yaml
 kubectl get nodes
@@ -10,10 +27,11 @@ r="0"
 while [ $r -ne "2" ]
 do
    r=$(kubectl get pods | grep Running | wc -l)
-   sleep 20
+   sleep 60
 done
 
 svcip=$(kubectl get services nginx  -o json | grep clusterIP | cut -f4 -d'"')
+sleep 10
 wget http://$svcip
 kubectl delete rc --all
 kubectl delete services --all
index bda421f..2007519 100644 (file)
@@ -3,17 +3,13 @@ $num_workers=2
 Vagrant.require_version ">= 1.8.6"
 Vagrant.configure("2") do |config|
 
-  config.vm.box = "opnfv/container4nfv"
-  config.vm.box_version = "0"
-  config.vm.synced_folder "../..", "/src"
-  config.vm.provision "shell", path: "host_setup.sh", privileged: false
-  config.vm.provider :virtualbox do |vb|
-    vb.customize ["modifyvm", :id, "--memory", 4096]
-    vb.customize ["modifyvm", :id, "--cpus", 4]
-    vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
-    vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"]
+  config.vm.box = "yk0/ubuntu-xenial"
+  config.vm.provider :libvirt do |libvirt|
+    libvirt.memory = 4096
+    libvirt.cpus = 4
   end
-
+  config.vm.synced_folder "../..", "/src"
   config.vm.provision "shell", path: "host_setup.sh", privileged: false
 
   config.vm.define "master" do |config|
index a0e7843..9c9e51e 100755 (executable)
@@ -4,7 +4,6 @@ set -ex
 DIR="$(dirname `readlink -f $0`)"
 
 cd $DIR
-vagrant destroy -f
+../cleanup.sh
 vagrant up
-vagrant ssh master -c "/vagrant/examples/multus.sh" || (vagrant destroy -f; exit 1)
-vagrant destroy -f
+vagrant ssh master -c "/vagrant/examples/multus.sh"
index 92e95ab..d7b39a0 100755 (executable)
@@ -20,7 +20,7 @@ set -ex
 while true
 do
     kubectl get pods -n kube-system | grep kube-cnimultus-ds | grep -v Run | wc -l | grep "^0$" && break
-    sleep 20
+    sleep 60
 done
 
 kubectl delete rc --all
@@ -28,8 +28,8 @@ kubectl apply -f /vagrant/examples/busybox.yaml
 r="0"
 while [ $r -ne "2" ]
 do
-   sleep 10
    r=$(kubectl get pods | grep Running | wc -l)
+   sleep 60
 done
 
 kubectl get pods --all-namespaces
index 2d69109..5d51e5a 100644 (file)
@@ -3,18 +3,14 @@ $num_workers=2
 Vagrant.require_version ">= 1.8.6"
 Vagrant.configure("2") do |config|
 
-  config.vm.box = "opnfv/container4nfv"
-  config.vm.box_version = "0"
+  config.vm.box = "yk0/ubuntu-xenial"
+  config.vm.provider :libvirt do |libvirt|
+    libvirt.memory = 4096
+    libvirt.cpus = 4
+  end
+
   config.vm.synced_folder "../..", "/src"
   config.vm.provision "shell", path: "host_setup.sh", privileged: false
-  config.vm.provider :virtualbox do |vb|
-    vb.customize ["modifyvm", :id, "--memory", 4096]
-    vb.customize ["modifyvm", :id, "--cpus", 4]
-    vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
-    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"]
-  end
 
   config.vm.define "master" do |config|
     config.vm.hostname = "master"
index 2cf96b9..2a32d28 100755 (executable)
@@ -4,8 +4,7 @@ set -ex
 DIR="$(dirname `readlink -f $0`)"
 
 cd $DIR
-vagrant destroy -f
+../cleanup.sh
 rm -rf container-ipam-state
 vagrant up
-vagrant ssh master -c "/vagrant/examples/virtio-user.sh" || (vagrant destroy -f; exit 1)
-vagrant destroy -f
+vagrant ssh master -c "/vagrant/examples/virtio-user.sh"
index 0cd9d0e..c208300 100755 (executable)
@@ -23,7 +23,7 @@ r="0"
 while [ $r -ne "6" ]
 do
    r=$(kubectl get pods --all-namespaces | grep ovsdpdk | grep Run | wc -l)
-   sleep 20
+   sleep 60
 done
 
 kubectl delete rc --all
@@ -32,8 +32,8 @@ r="0"
 while [ $r -ne "2" ]
 do
    r=$(kubectl get pods | grep Running | wc -l)
-   sleep 20
+   sleep 60
 done
 kubectl get pods --all-namespaces
-sleep 20
-ping -c4 10.244.0.103 || ping -c4 10.244.0.104
+sleep 60
+kubectl get pods -o wide | awk 'NF>1 && NR>1 {print $1}' | xargs -I {} kubectl exec -i {} vppctl ping 10.244.0.10
index 1cc8e58..83c66d4 100644 (file)
@@ -3,16 +3,13 @@ $num_workers=2
 Vagrant.require_version ">= 1.8.6"
 Vagrant.configure("2") do |config|
 
-  config.vm.box = "opnfv/container4nfv"
-  config.vm.box_version = "0"
-  config.vm.provision "shell", path: "host_setup.sh", privileged: false
-  config.vm.provider :virtualbox do |vb|
-    vb.customize ["modifyvm", :id, "--memory", 4096]
-    vb.customize ["modifyvm", :id, "--cpus", 4]
-    vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
-    vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"]
+  config.vm.box = "yk0/ubuntu-xenial"
+  config.vm.provider :libvirt do |libvirt|
+    libvirt.memory = 4096
+    libvirt.cpus = 4
   end
 
+  config.vm.synced_folder "../..", "/src"
   config.vm.provision "shell", path: "host_setup.sh", privileged: false
 
   config.vm.define "master" do |config|
index 758abb5..c2540a8 100755 (executable)
@@ -4,7 +4,6 @@ set -ex
 DIR="$(dirname `readlink -f $0`)"
 
 cd $DIR
-vagrant destroy -f
+../cleanup.sh
 vagrant up
-vagrant ssh master -c "/vagrant/examples/virtlet.sh" || (vagrant destroy -f; exit 1)
-vagrant destroy -f
+vagrant ssh master -c "/vagrant/examples/virtlet.sh"
index 70bb606..cac1882 100755 (executable)
@@ -14,7 +14,7 @@ r="0"
 while [ $r -ne "1" ]
 do
    r=$(kubectl get pods | grep Running | wc -l)
-   sleep 20
+   sleep 60
 done
 sleep 60
 kubectl get pods -o json | grep podIP | cut -f4 -d'"' | xargs ping -c 4