xci: scripts: start-new-vm.sh: Improve do_copy() 23/54123/3
authorVictor Morales <victor.morales@intel.com>
Mon, 19 Mar 2018 09:31:23 +0000 (02:31 -0700)
committerMarkos Chandras <mchandras@suse.de>
Thu, 22 Mar 2018 08:19:15 +0000 (08:19 +0000)
The copy function of start-new-vm.sh script only excludes the
image of the current OS which is some cases can contain other
images. This change excludes any image.

Change-Id: I50075cb56e7784d090582fe5d0c11c906773a174
Signed-off-by: Victor Morales <victor.morales@intel.com>
xci/scripts/vm/start-new-vm.sh

index 6e5c819..f266d64 100755 (executable)
@@ -179,6 +179,8 @@ else
        update_clean_vm_files
 fi
 
+declare -r XCI_DEPLOYMENT_IMAGE="deployment_image.qcow2"
+
 # Doesn't matter if we just built an image or got one from artifacts. In both
 # cases there should be a copy in the cache so copy it over.
 sudo rm -f ${BASE_PATH}/${OS}.qcow2
@@ -186,8 +188,8 @@ sudo rm -f ${BASE_PATH}/${OS}.qcow2
 sudo chmod 777 -R $XCI_CACHE_DIR/clean_vm/images/
 sudo chown $uid:$gid -R $XCI_CACHE_DIR/clean_vm/images/
 cp ${XCI_CACHE_DIR}/clean_vm/images/${OS}.qcow2* ${BASE_PATH}/
-cp ${XCI_CACHE_DIR}/clean_vm/images/${OS}.qcow2.sha256.txt ${BASE_PATH}/deployment_image.qcow2.sha256.txt
-cp ${XCI_CACHE_DIR}/clean_vm/images/${OS}.qcow2 ${BASE_PATH}/deployment_image.qcow2
+cp ${XCI_CACHE_DIR}/clean_vm/images/${OS}.qcow2.sha256.txt ${BASE_PATH}/${XCI_DEPLOYMENT_IMAGE}.sha256.txt
+cp ${XCI_CACHE_DIR}/clean_vm/images/${OS}.qcow2 ${BASE_PATH}/${XCI_DEPLOYMENT_IMAGE}
 
 cd ${BASE_PATH}
 declare -r OS_IMAGE_FILE=${OS}.qcow2
@@ -332,11 +334,13 @@ EOF
 
 # Need to copy releng-xci to the vm so we can execute stuff
 do_copy() {
-       rsync -a \
-               --exclude "${VM_NAME}*" \
-               --exclude "${OS}*" \
-               --exclude "build.log" \
-               -e "$vm_ssh" ${BASE_PATH}/ ${VM_NAME}:~/releng-xci/
+    echo "Copying releng-xci host folder to guest vm..."
+    rsync -a \
+        --exclude "${VM_NAME}*" \
+        --include "${XCI_DEPLOYMENT_IMAGE}*" \
+        --exclude "*qcow2*" \
+        --exclude "build.log" \
+        -e "$vm_ssh" ${BASE_PATH}/ ${VM_NAME}:~/releng-xci/
 }
 
 do_copy