VOL-331 VOL-327 Fixes to the installer to address the two Jiras listed
in addition to some typos and the early installation of Python to ensure
that ansible can run.

Change-Id: Ie97c93dc8ea9caaf9ad20c6eed5bdb1078799fbd
diff --git a/install/BootstrapInstaller.sh b/install/BootstrapInstaller.sh
index 5aba0cc..0532613 100644
--- a/install/BootstrapInstaller.sh
+++ b/install/BootstrapInstaller.sh
@@ -28,6 +28,19 @@
 echo -e "${lBlue}Defining the  ${lCyan}$iVmName${lBlue} virtual machine${NC}"
 cat vmTemplate.xml | sed -e "s/{{ VMName }}/$iVmName/g" | sed -e "s/{{ VMNetwork }}/$iVmNetwork/g" > tmp.xml
 
+# Check that the default storage pool exists and create it if it doesn't
+poolCheck=`virsh pool-list --all | grep default`
+if [ -z "$poolCheck" ]; then
+	virsh pool-define-as --name default --type dir --target /var/lib/libvirt/images/
+	virsh pool-autostart default
+	virsh pool-start default
+else
+	poolCheck=`virsh pool-list | grep default`
+	if [ -z "$poolCheck" ]; then
+		virsh pool-start default
+	fi
+fi
+
 # Copy the vm image to the default storage pool
 echo -e "${lBlue}Creating the storage for the ${lCyan}$iVmName${lBlue} virtual machine${NC}"
 # Copy the vm image to the installer directory
diff --git a/install/CreateInstaller.sh b/install/CreateInstaller.sh
index 14244f4..3f055ec 100755
--- a/install/CreateInstaller.sh
+++ b/install/CreateInstaller.sh
@@ -276,10 +276,18 @@
 	cat containers.cfg >> ansible/group_vars/all
 fi
 
+
 # Install python which is required for ansible
-echo -e "${lBlue}Installing python${NC}"
+echo -e "${lBlue}Installing ${lCyan}Python${NC}"
 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key.pem vinstall@$ipAddr sudo apt-get update 
-ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key.pem vinstall@$ipAddr sudo apt-get -y install python 
+ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key.pem vinstall@$ipAddr sudo apt-get -y install python
+
+# Move all the python deb files to their own directory so they can be installed first
+echo -e "${lBlue}Caching ${lCyan}Python${lBlue} install${NC}"
+ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key.pem vinstall@$ipAddr mkdir python-deb
+ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key.pem vinstall@$ipAddr "sudo mv /var/cache/apt/archives/*.deb /home/vinstall/python-deb"
+ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key.pem vinstall@$ipAddr "sudo chown -R vinstall.vinstall /home/vinstall/python-deb"
+
 
 # Make sure the VM is up-to-date
 echo -e "${lBlue}Ensure that the VM is up-to-date${NC}"
diff --git a/install/Vagrantfile b/install/Vagrantfile
index 65c3ce2..54b6f12 100644
--- a/install/Vagrantfile
+++ b/install/Vagrantfile
@@ -15,7 +15,6 @@
       d.ssh.forward_agent = true
       d.vm.box = settings["box_source"]
       d.vm.hostname = "#{settings['server_name']}#{i}"
-      d.vm.provision :shell, inline: "apt-get -y install python"
       d.vm.provider "libvirt" do |v|
         v.memory = 6144
 	v.cpus = 2
diff --git a/install/ansible/roles/voltha/tasks/main.yml b/install/ansible/roles/voltha/tasks/main.yml
index 5633b76..b7ee587 100644
--- a/install/ansible/roles/voltha/tasks/main.yml
+++ b/install/ansible/roles/voltha/tasks/main.yml
@@ -133,10 +133,10 @@
   when: target == "installer"
   tags: [voltha]
 
-- name: TEMPORARY RULE TO INSTALL ZOOKEEPER
-  command: docker pull zookeeper
-  when: target == "installer"
-  tags: [voltha]
+#- name: TEMPORARY RULE TO INSTALL ZOOKEEPER
+#  command: docker pull zookeeper
+#  when: target == "installer"
+#  tags: [voltha]
 
 - name: Docker images are re-tagged to registry for push
   command: docker tag {{ item }} {{ docker_push_registry }}/{{ item }}
diff --git a/install/installer.sh b/install/installer.sh
index ae2310c..c0d2a55 100755
--- a/install/installer.sh
+++ b/install/installer.sh
@@ -118,6 +118,17 @@
 echo -e "${lBlue}Propagating ssh keys${NC}"
 cp -r .keys ansible/roles/cluster-host/files
 
+# Install python on all the 3 servers since python is required for
+for i in $hosts
+do
+	echo -e "${lBlue}Installing ${lCyan}Python-minimal${lBlue}${NC}"
+	scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i .keys/$i -r python-deb voltha@$i:.
+	ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i .keys/$i  voltha@$i sudo dpkg -i -R /home/voltha/python-deb
+	ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i .keys/$i  voltha@$i rm -fr python-deb
+
+done
+
+
 # Running ansible
 echo -e "${lBlue}Running ansible${NC}"
 cp ansible/ansible.cfg .ansible.cfg
diff --git a/install/vmTemplate.xml b/install/vmTemplate.xml
index d60ba56..0c2d521 100644
--- a/install/vmTemplate.xml
+++ b/install/vmTemplate.xml
@@ -11,8 +11,8 @@
     <acpi/>
     <apic/>
   </features>
-  <cpu mode='custom' match='exact'>
-    <model fallback='allow'>Haswell-noTSX</model>
+  <cpu mode='host-model'>
+    <model fallback='allow'/>
   </cpu>
   <clock offset='utc'>
     <timer name='rtc' tickpolicy='catchup'/>