Add ability to store disk and config-drive not under default libvirt dir

Change-Id: I0987e021e0016ec2eab84d4a2c250f364d9d88c8
Related-Prod: PROD-29539
diff --git a/predefine-vm/define-slave-vm.sh b/predefine-vm/define-slave-vm.sh
index dc23cd4..1fc494d 100755
--- a/predefine-vm/define-slave-vm.sh
+++ b/predefine-vm/define-slave-vm.sh
@@ -100,9 +100,11 @@
 fi
 python ./create_config_drive.py ${isoArgs}
 qemu-img resize ${SLAVE_VM_SOURCE_DISK} 80G
-#### Make sure that both files are saved to system path which is available for libvirt-qemu:kvm
-export SLAVE_VM_SOURCE_DISK=$(place_file_under_libvirt ${SLAVE_VM_SOURCE_DISK})
-export SLAVE_VM_CONFIG_DISK=$(place_file_under_libvirt ${aioHostname}.${clusterDomain}-config.iso)
+if [ -z "${NON_DEFAULT_LIBVIRT_DIR}" ]; then
+  #### Make sure that both files are saved to system path which is available for libvirt-qemu:kvm
+  export SLAVE_VM_SOURCE_DISK=$(place_file_under_libvirt ${SLAVE_VM_SOURCE_DISK})
+  export SLAVE_VM_CONFIG_DISK=$(place_file_under_libvirt ${aioHostname}.${clusterDomain}-config.iso)
+fi
 export CREATE_NETWORKS=${CREATE_NETWORKS:-true}
 popd
 
diff --git a/predefine-vm/define-vm.sh b/predefine-vm/define-vm.sh
index 11bff46..a438dbf 100755
--- a/predefine-vm/define-vm.sh
+++ b/predefine-vm/define-vm.sh
@@ -24,11 +24,12 @@
 
 check_packages
 
-#### Make sure that both files are saved to system path which is available for libvirt-qemu:kvm
-export VM_SOURCE_DISK=$(place_file_under_libvirt ${VM_SOURCE_DISK})
-export VM_CONFIG_DISK=$(place_file_under_libvirt ${VM_CONFIG_DISK})
+if [ -z "${NON_DEFAULT_LIBVIRT_DIR}" ]; then
+  #### Make sure that both files are saved to system path which is available for libvirt-qemu:kvm
+  export VM_SOURCE_DISK=$(place_file_under_libvirt ${VM_SOURCE_DISK})
+  export VM_CONFIG_DISK=$(place_file_under_libvirt ${VM_CONFIG_DISK})
+fi
 export CREATE_NETWORKS=${CREATE_NETWORKS:-true}
-
 render_config "${VM_NAME}" "${VM_MEM_KB}" "${VM_CPUS}" "${VM_SOURCE_DISK}" "${VM_CONFIG_DISK}" "${CREATE_NETWORKS}"
 
 virsh define $(pwd)/${VM_NAME}-vm.xml